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

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

Ticket #1009 - Corrigindo problemas com a inclusão de javascript.

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                                $GLOBALS['phpgw']->js->validate_file('jscode','connector','expressoAdmin1_2');#diretorio, arquivo.js, aplicacao
32                                $GLOBALS['phpgw']->js->validate_file('jscode','institutional_accounts','expressoAdmin1_2');
33                                $GLOBALS['phpgw']->js->validate_file('modal','modal','expressoAdmin1_2');
34                                $GLOBALS['phpgw']->js->validate_file('jscode','expressoadmin','expressoAdmin1_2');
35                        }
36                }
37
38                function index()
39                {
40                        /* Begin:  Check manager access */
41                        $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
42                        $acl = $this->functions->read_acl($account_lid);
43                        $contexts = $acl['contexts'];
44                        foreach ($acl['contexts_display'] as $index=>$tmp_context) {
45                                $context_display .= '<br>'.$tmp_context;
46                        }
47                       
48                        if (!$this->functions->check_acl($account_lid,'list_institutional_accounts')) {
49                                $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php'));
50                        }
51                        /* End: Check manager access */
52
53                        //unset($GLOBALS['phpgw_info']['flags']['noheader']);
54                        //unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
55                        $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Institutional accounts');
56                        //$GLOBALS['phpgw']->common->phpgw_header();
57
58                        $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
59
60                        $p->set_file(
61                                                Array(
62                                                                'institutional_accounts'                => 'institutional_accounts.tpl',
63                                                                'institutional_accounts_modal'  =>'institutional_accounts_modal.tpl'
64                                                        )
65                                                );
66                        $p->set_block('institutional_accounts','body');
67                       
68                        /* dinamic load lang */
69                        $p->set_var($this->functions->make_dinamic_lang($p, 'body'));
70                        $p->set_var($this->functions->make_dinamic_lang($p, 'institutional_accounts_modal'));
71
72                        $p->set_var( 'url', $this -> url );
73
74                        /* Begin: set modal */
75
76                        $functions = CreateObject('expressoAdmin1_2.functions');
77                       
78                        //$organizations = $functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context']);
79                       
80                        foreach ($contexts as $index=>$context)
81                                $combo_manager_org .= $this->functions->get_organizations($context);
82                        $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context']);
83                       
84                        $p->set_var('manager_organizations', $combo_manager_org);
85                        $p->set_var('all_organizations', $combo_all_orgs);
86                       
87                        $modal_id = 'institutional_accounts_modal';
88                        $p->set_var('modal_id', $modal_id);
89                        $institutional_accounts_modal_tpl = $p->fp('out','institutional_accounts_modal');
90                        /* End: set modal */
91                       
92                        $var = Array(
93                                'th_bg'                                         => $GLOBALS['phpgw_info']['theme']['th_bg'],
94                                'back_url'                                      => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'),
95                                'context_display'                       => $context_display,
96                                'institutional_accounts_modal' => $institutional_accounts_modal_tpl,
97                                'onclick_create_institutional_account' => "modal(\"$modal_id\",\"create\")"
98                        );
99                        $p->set_var($var);
100                        $p->pfp('out','body');
101                        $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>";
102                }
103
104        }
105?>
Note: See TracBrowser for help on using the repository browser.