source: trunk/preferences/index.php @ 6766

Revision 6766, 4.5 KB checked in by jefferson, 12 years ago (diff)

Ticket #2958 - Commit Correcao de inconsitencia nas abas de edicao das preferencias

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * phpGroupWare - preferences                                               *
4        * http://www.phpgroupware.org                                              *
5        * Written by Joseph Engo <jengo@phpgroupware.org>                          *
6        * --------------------------------------------                             *
7        *  This program is free software; you can redistribute it and/or modify it *
8        *  under the terms of the GNU General Public License as published by the   *
9        *  Free Software Foundation; either version 2 of the License, or (at your  *
10        *  option) any later version.                                              *
11        \**************************************************************************/
12        $phpgw_info = array();
13        $GLOBALS['phpgw_info']['flags'] = array(
14                'currentapp' => 'preferences',
15                'disable_Template_class' => True
16        );
17        include('../header.inc.php');
18
19        $pref_tpl = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
20        $templates = Array(
21                'pref' => 'index.tpl'
22        );
23        //Check preferences that influences the hooks
24        $c = CreateObject('phpgwapi.config','expressoMail1_2');
25        $c->read_repository();
26        $current_config = $c->config_data;
27        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['enable_expresso_offline'] = $current_config['enable_expresso_offline'];
28        /*print_r($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']);
29        exit;*/
30       
31        $pref_tpl->set_file($templates);
32
33        $pref_tpl->set_block('pref','list');
34        $pref_tpl->set_block('pref','app_row');
35        $pref_tpl->set_block('pref','app_row_noicon');
36        $pref_tpl->set_block('pref','link_row');
37        $pref_tpl->set_block('pref','spacer_row');
38
39        if ($GLOBALS['phpgw']->acl->check('run',1,'admin'))
40        {
41                // This is where we will keep track of our position.
42                // Developers won't have to pass around a variable then
43                $session_data = $GLOBALS['phpgw']->session->appsession('session_data','preferences');
44
45                if (! is_array($session_data))
46                {
47                        $session_data = array('type' => 'user');
48                        $GLOBALS['phpgw']->session->appsession('session_data','preferences',$session_data);
49                }
50
51                if (! $GLOBALS['HTTP_GET_VARS']['type'])
52                {
53                        $type = $session_data['type'];
54                }
55                else
56                {
57                        $type = $GLOBALS['HTTP_GET_VARS']['type'];
58                        $session_data = array('type' => $type);
59                        $GLOBALS['phpgw']->session->appsession('session_data','preferences',$session_data);
60                }
61
62                $pref_tpl->set_var('tabs',$GLOBALS['phpgw']->common->create_tabs($tabs,$selected));
63        }
64
65        // This func called by the includes to dump a row header
66        function section_start($appname='',$icon='')
67        {
68                global $pref_tpl;
69
70                $pref_tpl->set_var('icon_backcolor',$GLOBALS['phpgw_info']['theme']['row_off']);
71                $pref_tpl->set_var('link_backcolor',$GLOBALS['phpgw_info']['theme']['row_off']);
72                $pref_tpl->set_var('a_name',$appname);
73                $pref_tpl->set_var('app_name',$GLOBALS['phpgw_info']['apps'][$appname]['title']);
74                $pref_tpl->set_var('app_icon',$icon);
75                if ($icon)
76                {
77                        $pref_tpl->parse('rows','app_row',True);
78                }
79                else
80                {
81                        $pref_tpl->parse('rows','app_row_noicon',True);
82                }
83        }
84
85        function section_item($pref_link='',$pref_text='')
86        {
87                global $pref_tpl;
88
89                $pref_tpl->set_var('pref_link',$pref_link);
90
91                if (strtolower($pref_text) == 'grant access' && $GLOBALS['phpgw_info']['server']['deny_user_grants_access'])
92                {
93                        return False;
94                }
95                else
96                {
97                        $pref_tpl->set_var('pref_text',$pref_text);
98                }
99
100                $pref_tpl->parse('rows','link_row',True);
101        }
102
103        function section_end()
104        {
105                global $pref_tpl;
106
107                $pref_tpl->parse('rows','spacer_row',True);
108        }
109
110        function display_section($appname,$file,$file2=False)
111        {
112                if ($file2)
113                {
114                        $file = $file2;
115                }
116                section_start($appname,$GLOBALS['phpgw']->common->image($appname,Array('navbar',$appname)));
117
118                while(list($text,$url) = each($file))
119                {
120                        if (($text == 'Change your Password') && ($GLOBALS['phpgw_info']['server']['use_https'] == 1))
121                        {
122                                $url = 'https://' . $_SERVER['HTTP_HOST'] . $GLOBALS['phpgw_info']['server']['webserver_url'] . '/preferences/changepassword.php';
123                        }
124
125                        if($text == 'Expresso Offline' &&
126                                $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['enable_expresso_offline']!='True')
127                                continue;
128                        if($text == 'Programed Archiving' && 
129                                $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages']!='1')
130                                continue;                       
131                        section_item($url,lang($text));
132                }
133                section_end();
134        }
135
136        $GLOBALS['phpgw']->hooks->process('preferences',array('preferences'));
137        $pref_tpl->pfp('out','list');
138        $GLOBALS['phpgw']->common->phpgw_footer();
139
140?>
141
142
143
Note: See TracBrowser for help on using the repository browser.