source: trunk/expressoAdmin1_2/inc/class.institutional_accounts.inc.php @ 2707

Revision 2707, 4.2 KB checked in by rodsouza, 14 years ago (diff)

Ticket #1058 - Corrigindo problemas no expressoAdmin1_2.

Line 
1<?php
2        /***********************************************************************************\
3        * Expresso Administração                                                                                                                        *
4        * by Joao Alfredo Knopik Junior (joao.alfredo@gmail.com, jakjr@celepar.pr.gov.br)       *
5        * ----------------------------------------------------------------------------------*
6        *  This program is free software; you can redistribute it and/or modify it                      *
7        *  under the terms of the GNU General Public License as published by the                        *
8        *  Free Software Foundation; either version 2 of the License, or (at your                       *
9        *  option) any later version.                                                                                                           *
10        \***********************************************************************************/
11
12        class institutional_accounts
13        {
14                var $public_functions = array
15                (
16                        'index' => True
17                );
18               
19                var $functions;
20
21                function institutional_accounts()
22                {                       
23                        if (function_exists('CreateObject'))
24                        {
25                                $this->functions = CreateObject('expressoAdmin1_2.functions');
26                               
27                                if(!@is_object($GLOBALS['phpgw']->js))
28                                {
29                                        $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
30                                }
31
32                                $GLOBALS['phpgw']->js->validate_file('jscode','globals','expressoAdmin1_2');
33                                $GLOBALS['phpgw']->js->validate_file('jscode','connector','expressoAdmin1_2');
34                                $GLOBALS['phpgw']->js->validate_file('jscode','institutional_accounts','expressoAdmin1_2');
35                                $GLOBALS['phpgw']->js->validate_file('modal','modal','expressoAdmin1_2');
36                                $GLOBALS['phpgw']->js->validate_file('jscode','expressoadmin','expressoAdmin1_2');
37                        }
38                }
39
40                function index()
41                {
42                        /* Begin:  Check manager access */
43                        $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
44                        $acl = $this->functions->read_acl($account_lid);
45                        $contexts = $acl['contexts'];
46                        foreach ($acl['contexts_display'] as $index=>$tmp_context) {
47                                $context_display .= '<br>'.$tmp_context;
48                        }
49                       
50                        if (!$this->functions->check_acl($account_lid,'list_institutional_accounts')) {
51                                $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php'));
52                        }
53                        /* End: Check manager access */
54
55                        //unset($GLOBALS['phpgw_info']['flags']['noheader']);
56                        //unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
57                        $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Institutional accounts');
58                        //$GLOBALS['phpgw']->common->phpgw_header();
59
60                        $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
61
62                        $p->set_file(
63                                                Array(
64                                                                'institutional_accounts'                => 'institutional_accounts.tpl',
65                                                                'institutional_accounts_modal'  =>'institutional_accounts_modal.tpl'
66                                                        )
67                                                );
68                        $p->set_block('institutional_accounts','body');
69                       
70                        /* dinamic load lang */
71                        $p->set_var($this->functions->make_dinamic_lang($p, 'body'));
72                        $p->set_var($this->functions->make_dinamic_lang($p, 'institutional_accounts_modal'));
73
74                        $p->set_var( 'url', $this -> url );
75
76                        /* Begin: set modal */
77
78                        $functions = CreateObject('expressoAdmin1_2.functions');
79                       
80                        //$organizations = $functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context']);
81                       
82                        foreach ($contexts as $index=>$context)
83                                $combo_manager_org .= $this->functions->get_organizations($context);
84                        $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context']);
85                       
86                        $p->set_var('manager_organizations', $combo_manager_org);
87                        $p->set_var('all_organizations', $combo_all_orgs);
88                       
89                        $modal_id = 'institutional_accounts_modal';
90                        $p->set_var('modal_id', $modal_id);
91                        $institutional_accounts_modal_tpl = $p->fp('out','institutional_accounts_modal');
92                        /* End: set modal */
93                       
94                        $var = Array(
95                                'th_bg'                                         => $GLOBALS['phpgw_info']['theme']['th_bg'],
96                                'back_url'                                      => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'),
97                                'context_display'                       => $context_display,
98                                'institutional_accounts_modal' => $institutional_accounts_modal_tpl,
99                                'onclick_create_institutional_account' => "modal(\"$modal_id\",\"create\")"
100                        );
101                        $p->set_var($var);
102                        $p->pfp('out','body');
103                        $GLOBALS['phpgw_info']['flags']['java_script_thirst'] = "<script>var expressoAdmin_url = '{$GLOBALS[ 'phpgw' ] -> link( '/expressoAdmin1_2/' )}';var expressoAdmin_controller = '{$GLOBALS[ 'phpgw' ] -> link( '/expressoAdmin1_2/controller.php' )}?action=';</script>";
104                }
105
106        }
107?>
Note: See TracBrowser for help on using the repository browser.