source: branches/2.2/expressoAdmin1_2/inc/class.uishared_accounts.inc.php @ 1913

Revision 1913, 4.8 KB checked in by valmir.sena, 14 years ago (diff)

Ticket #849 - Criacao de caixas compartilhadas pelo administrador, commit inicial com as principais mudancas

Line 
1<?php
2        /***********************************************************************************\
3        * Expresso Administraᅵᅵo                                                                                                                    *
4        * by Joao Alfredo Knopik Junior (joao.alfredo@gmail.com, jakjr@celepar.pr.gov.br)       *
5        * modified by Valmir Andre de Sena valmirse@gmail.com valmir.sena@ati.pe.gov.br
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
13        define('PHPGW_API_INC','../phpgwapi/inc');
14
15        class uishared_accounts
16        {
17                var $public_functions = array
18                (
19                        'index' => True
20                );
21               
22                var $functions;
23                var $current_config;
24
25                function uishared_accounts()
26                {                       
27                        if (function_exists('CreateObject'))
28                        {
29                                $this->functions = CreateObject('expressoAdmin1_2.functions');
30                               
31                                if(!@is_object($GLOBALS['phpgw']->js))
32                                {
33                                        $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
34                                }
35                                $GLOBALS['phpgw']->js->validate_file('jscode','connector','expressoAdmin1_2');#diretorio, arquivo.js, aplicacao
36                                $GLOBALS['phpgw']->js->validate_file('jscode','shared_accounts','expressoAdmin1_2');
37                                $GLOBALS['phpgw']->js->validate_file('modal','modal','expressoAdmin1_2');
38                                $GLOBALS['phpgw']->js->validate_file('jscode','expressoadmin','expressoAdmin1_2');
39                                $c = CreateObject('phpgwapi.config','expressoAdmin1_2');
40                                $c->read_repository();
41                                $this->current_config = $c->config_data;
42                        }
43                }
44
45                function index()
46                {
47                        /* Begin:  Check manager access */
48                        $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
49                        $acl = $this->functions->read_acl($account_lid);
50                        $contexts = $acl['contexts'];
51                       
52                        foreach ($acl['contexts_display'] as $index=>$tmp_context) {
53                                $context_display .= '<br>'.$tmp_context;
54                        }
55                       
56                        if (!$this->functions->check_acl($account_lid,'list_shared_accounts')) {
57                                $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php'));
58                        }
59                        /* End: Check manager access */
60
61                        unset($GLOBALS['phpgw_info']['flags']['noheader']);
62                        unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
63                        $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('shared accounts');
64                        $GLOBALS['phpgw']->common->phpgw_header();
65
66                        $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
67
68                        $p->set_file(
69                                                Array(
70                                                                'shared_accounts'               => 'shared_accounts.tpl',
71                                                                'shared_accounts_modal' =>'shared_accounts_modal.tpl'
72                                                        )
73                                                );
74                        $p->set_block('shared_accounts','body');
75                       
76                        /* dinamic load lang */                       
77                        $p->set_var($this->functions->make_dinamic_lang($p, 'body'));
78                        $p->set_var($this->functions->make_dinamic_lang($p, 'shared_accounts_modal'));
79
80
81                        /* Begin: set modal */
82
83                        $functions = CreateObject('expressoAdmin1_2.functions');
84                       
85                        //$organizations = $functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context']);
86                       
87                        foreach ($contexts as $index=>$context)
88                                $combo_manager_org .= $this->functions->get_organizations($context);
89                        $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context']);
90                       
91                        $p->set_var('manager_organizations', $combo_manager_org);
92                        $p->set_var('all_organizations', $combo_all_orgs);
93                       
94                        $modal_id = 'shared_accounts_modal';
95                        $p->set_var('modal_id', $modal_id);
96                       
97                        $var = Array(
98                            'mailquota' =>  $this->current_config['expressoAdmin_defaultUserQuota'],
99                            'changequote_disabled' => $this->functions->check_acl($account_lid,'edit_shared_accounts_quote') ? '' : 'readonly',
100                            'disabled_empty_inbox' => $this->functions->check_acl($account_lid,'empty_shared_accounts_inbox') ? '' : 'disabled',
101                            'display_quota_used' => 'none'
102                        );
103                        $p->set_var($var);
104                        $shared_accounts_modal_tpl = $p->fp('out','shared_accounts_modal');
105                        /* End: set modal */
106                       
107                        $var = Array(
108                                'th_bg'                                         => $GLOBALS['phpgw_info']['theme']['th_bg'],
109                                'back_url'                                      => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'),
110                                'context_display'                       => $context_display,
111                                'shared_accounts_modal' => $shared_accounts_modal_tpl,                               
112                                'onclick_create_shared_account' => "modal(\"$modal_id\",\"create\")"
113                        );
114                        $p->set_var($var);
115                        $p->pfp('out','body');
116                }
117        }
118
119
120       
121?>
Note: See TracBrowser for help on using the repository browser.