[317] | 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 | define('PHPGW_API_INC','../phpgwapi/inc'); |
---|
| 13 | |
---|
| 14 | class institutional_accounts |
---|
| 15 | { |
---|
| 16 | var $public_functions = array |
---|
| 17 | ( |
---|
| 18 | 'index' => True |
---|
| 19 | ); |
---|
| 20 | |
---|
| 21 | var $functions; |
---|
| 22 | |
---|
| 23 | function institutional_accounts() |
---|
| 24 | { |
---|
| 25 | if (function_exists('CreateObject')) |
---|
| 26 | { |
---|
| 27 | $this->functions = CreateObject('expressoAdmin1_2.functions'); |
---|
| 28 | |
---|
| 29 | if(!@is_object($GLOBALS['phpgw']->js)) |
---|
| 30 | { |
---|
| 31 | $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript'); |
---|
| 32 | } |
---|
| 33 | $GLOBALS['phpgw']->js->validate_file('jscode','connector','expressoAdmin1_2');#diretorio, arquivo.js, aplicacao |
---|
| 34 | $GLOBALS['phpgw']->js->validate_file('jscode','institutional_accounts','expressoAdmin1_2'); |
---|
| 35 | $GLOBALS['phpgw']->js->validate_file('modal','modal','expressoAdmin1_2'); |
---|
[414] | 36 | $GLOBALS['phpgw']->js->validate_file('jscode','expressoadmin','expressoAdmin1_2'); |
---|
[317] | 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 */ |
---|
[414] | 71 | $p->set_var($this->functions->make_dinamic_lang($p, 'body')); |
---|
| 72 | $p->set_var($this->functions->make_dinamic_lang($p, 'institutional_accounts_modal')); |
---|
[317] | 73 | |
---|
| 74 | |
---|
| 75 | /* Begin: set modal */ |
---|
| 76 | |
---|
| 77 | $functions = CreateObject('expressoAdmin1_2.functions'); |
---|
| 78 | |
---|
| 79 | //$organizations = $functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context']); |
---|
| 80 | |
---|
| 81 | foreach ($contexts as $index=>$context) |
---|
| 82 | $combo_manager_org .= $this->functions->get_organizations($context); |
---|
| 83 | $combo_all_orgs = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context']); |
---|
| 84 | |
---|
| 85 | $p->set_var('manager_organizations', $combo_manager_org); |
---|
| 86 | $p->set_var('all_organizations', $combo_all_orgs); |
---|
| 87 | |
---|
| 88 | $modal_id = 'institutional_accounts_modal'; |
---|
| 89 | $p->set_var('modal_id', $modal_id); |
---|
| 90 | $institutional_accounts_modal_tpl = $p->fp('out','institutional_accounts_modal'); |
---|
| 91 | /* End: set modal */ |
---|
| 92 | |
---|
| 93 | $var = Array( |
---|
| 94 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], |
---|
| 95 | 'back_url' => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'), |
---|
| 96 | 'context_display' => $context_display, |
---|
| 97 | 'institutional_accounts_modal' => $institutional_accounts_modal_tpl, |
---|
| 98 | 'onclick_create_institutional_account' => "modal(\"$modal_id\",\"create\")" |
---|
| 99 | ); |
---|
| 100 | $p->set_var($var); |
---|
| 101 | $p->pfp('out','body'); |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | } |
---|
| 105 | ?> |
---|