[2] | 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 uisectors |
---|
| 13 | { |
---|
| 14 | var $public_functions = array |
---|
| 15 | ( |
---|
| 16 | 'list_sectors' => True, |
---|
| 17 | 'add_sector' => True, |
---|
| 18 | 'validate_data_sectors_add' => True, |
---|
[32] | 19 | 'edit_sector' => True, |
---|
| 20 | 'validate_data_sectors_edit' => True, |
---|
[2] | 21 | 'delete_sector' => True, |
---|
[1516] | 22 | 'css' => True, |
---|
| 23 | 'view_cota' => True |
---|
[2] | 24 | ); |
---|
| 25 | |
---|
| 26 | var $bo; |
---|
| 27 | var $nextmatchs; |
---|
| 28 | var $functions; |
---|
| 29 | |
---|
| 30 | function uisectors() |
---|
| 31 | { |
---|
| 32 | $this->bo = CreateObject('expressoAdmin1_2.bosectors'); |
---|
| 33 | $this->so = $this->bo->so; |
---|
| 34 | $this->functions = $this->bo->functions; |
---|
| 35 | $this->nextmatchs = createobject('phpgwapi.nextmatchs'); |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | function list_sectors() |
---|
| 39 | { |
---|
[64] | 40 | $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
| 41 | $acl = $this->functions->read_acl($manager_lid); |
---|
| 42 | $contexts = $acl['contexts']; |
---|
| 43 | foreach ($acl['contexts_display'] as $index=>$tmp_context) |
---|
| 44 | { |
---|
| 45 | $context_display .= '<br>'.$tmp_context; |
---|
| 46 | } |
---|
| 47 | |
---|
[2] | 48 | // Verifica se o administrador tem acesso. |
---|
[64] | 49 | if (!$this->functions->check_acl($manager_lid,'list_sectors')) |
---|
[2] | 50 | { |
---|
| 51 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
| 52 | } |
---|
| 53 | |
---|
[2419] | 54 | //unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
| 55 | //unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
[2] | 56 | |
---|
| 57 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Sectors'); |
---|
[2419] | 58 | //$GLOBALS['phpgw']->common->phpgw_header(); |
---|
[2] | 59 | |
---|
| 60 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 61 | $p->set_file(array('sectors' => 'sectors.tpl')); |
---|
| 62 | $p->set_block('sectors','list','list'); |
---|
| 63 | $p->set_block('sectors','row','row'); |
---|
| 64 | $p->set_block('sectors','row_empty','row_empty'); |
---|
| 65 | |
---|
[1516] | 66 | //$sectors_info = $this->functions->get_sectors_list($contexts); |
---|
| 67 | $sectors_info = $this->functions->get_organizations2($contexts); |
---|
[2] | 68 | |
---|
| 69 | $var = Array( |
---|
| 70 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], |
---|
| 71 | 'back_url' => $GLOBALS['phpgw']->link('/expressoAdmin1_2/index.php'), |
---|
[548] | 72 | 'context_display' => $context_display, |
---|
[1516] | 73 | 'lang_inactives' => lang('list inactives'), |
---|
| 74 | 'lang_ver_cota' => lang('view cota') |
---|
[2] | 75 | ); |
---|
| 76 | $p->set_var($var); |
---|
[414] | 77 | $p->set_var($this->functions->make_dinamic_lang($p, 'list')); |
---|
[2] | 78 | |
---|
| 79 | if (!count($sectors_info)) |
---|
| 80 | { |
---|
| 81 | $p->set_var('message',lang('No matches found')); |
---|
| 82 | $p->parse('rows','row_empty',True); |
---|
| 83 | } |
---|
| 84 | else |
---|
| 85 | { |
---|
[64] | 86 | if ($this->functions->check_acl($manager_lid,'edit_sectors')) |
---|
[2] | 87 | { |
---|
| 88 | $can_edit = True; |
---|
| 89 | } |
---|
| 90 | |
---|
[64] | 91 | if ($this->functions->check_acl($manager_lid,'delete_sectors')) |
---|
[2] | 92 | { |
---|
| 93 | $can_delete = True; |
---|
| 94 | } |
---|
| 95 | |
---|
[46] | 96 | foreach($sectors_info as $context=>$sector) |
---|
[2] | 97 | { |
---|
| 98 | $tr_color = $this->nextmatchs->alternate_row_color($tr_color); |
---|
| 99 | |
---|
| 100 | $var = Array( |
---|
| 101 | 'tr_color' => $tr_color, |
---|
[1516] | 102 | 'sector_name' => $sector['display'], |
---|
| 103 | 'cota_link' => $this->row_action('view','cota',$sector['dn']), |
---|
| 104 | 'add_link' => $this->row_action('add','sector',$sector['dn']) |
---|
[597] | 105 | ); |
---|
[548] | 106 | if(isset($GLOBALS['phpgw_info']['server']['time_to_account_expires'])) |
---|
[1516] | 107 | $var['inactives_link'] = $this->row_action('list_inactive','users',$sector['dn'],'uiaccounts'); |
---|
[548] | 108 | else |
---|
[597] | 109 | $var['inactives_link'] = lang('disabled'); |
---|
[548] | 110 | |
---|
[2] | 111 | $p->set_var($var); |
---|
| 112 | |
---|
[32] | 113 | if ($can_edit) |
---|
| 114 | { |
---|
[1516] | 115 | $p->set_var('edit_link',$this->row_action('edit','sector',$sector['dn'])); |
---|
[32] | 116 | } |
---|
| 117 | else |
---|
| 118 | { |
---|
| 119 | $p->set_var('edit_link',' '); |
---|
| 120 | } |
---|
| 121 | |
---|
[2] | 122 | if ($can_delete) |
---|
| 123 | { |
---|
[1516] | 124 | $p->set_var('delete_link',$this->row_action('delete','sector',$sector['dn'])); |
---|
[2] | 125 | } |
---|
| 126 | else |
---|
| 127 | { |
---|
| 128 | $p->set_var('delete_link',' '); |
---|
| 129 | } |
---|
| 130 | |
---|
| 131 | $p->fp('rows','row',True); |
---|
| 132 | } |
---|
| 133 | } |
---|
| 134 | $var = Array( |
---|
| 135 | 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uisectors.add_sector') |
---|
| 136 | ); |
---|
| 137 | $p->set_var($var); |
---|
[1684] | 138 | $p->set_var('input_add','<input type="submit" value="' . lang('Add Sectors') . '">'); |
---|
[2] | 139 | |
---|
| 140 | $p->parse('rows','row_empty',True); |
---|
| 141 | $p->pfp('out','list'); |
---|
| 142 | } |
---|
| 143 | |
---|
| 144 | |
---|
| 145 | function add_sector($context='') |
---|
| 146 | { |
---|
[64] | 147 | $manager_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
| 148 | $acl = $this->functions->read_acl($manager_lid); |
---|
[1145] | 149 | |
---|
| 150 | $manager_contexts = $acl['contexts']; |
---|
| 151 | $combo_manager_org = ''; |
---|
| 152 | |
---|
[1394] | 153 | if ( array_key_exists( 'context', $_GET ) ) |
---|
| 154 | { |
---|
| 155 | $context = $_GET['context']; |
---|
| 156 | $combo_manager_org = $this->functions->get_organizations( $context, '', true, true, true ); |
---|
| 157 | } |
---|
| 158 | else |
---|
| 159 | { |
---|
| 160 | foreach ($manager_contexts as $index=>$context) |
---|
| 161 | $combo_manager_org .= $this->functions->get_organizations( $context ); |
---|
| 162 | } |
---|
| 163 | |
---|
[2] | 164 | // Verifica se tem acesso a este modulo |
---|
[64] | 165 | if (!$this->functions->check_acl($manager_lid,'create_sectors')) |
---|
[2] | 166 | { |
---|
| 167 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
| 168 | } |
---|
| 169 | |
---|
[2419] | 170 | //unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
| 171 | //unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
[309] | 172 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Create Sector'); |
---|
[2419] | 173 | //$GLOBALS['phpgw']->common->phpgw_header(); |
---|
[2] | 174 | |
---|
| 175 | // Set o template |
---|
| 176 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 177 | $p->set_file(Array('create_sector' => 'sectors_form.tpl')); |
---|
[414] | 178 | $p->set_block('create_sector','list','list'); |
---|
[396] | 179 | |
---|
[2] | 180 | // Seta variaveis utilizadas pelo tpl. |
---|
| 181 | $var = Array( |
---|
[32] | 182 | 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uisectors.validate_data_sectors_add'), |
---|
| 183 | 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uisectors.list_sectors'), |
---|
| 184 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], |
---|
[64] | 185 | 'context' => $context == '' ? $GLOBALS['phpgw_info']['server']['ldap_context'] : $context, |
---|
[32] | 186 | 'sector' => $_POST['sector'], |
---|
[1991] | 187 | 'associated_domain' => $_POST['associated_domain'], |
---|
[1516] | 188 | 'disk_quota' => $_POST['disk_quota'], |
---|
| 189 | 'users_quota' => $_POST['users_quota'], |
---|
[1145] | 190 | 'manager_org' => $combo_manager_org, |
---|
[309] | 191 | 'sector_visible_checked'=> $_POST['sector_visible'] ? 'checked' : '', |
---|
[32] | 192 | 'error_messages' => $_POST['error_messages'] == '' ? '' : "<script type='text/javascript'>alert('".$_POST['error_messages']."')</script>", |
---|
[2] | 193 | ); |
---|
[1516] | 194 | |
---|
| 195 | if($this->functions->db_functions->use_cota_control()) { |
---|
| 196 | $var["open_comment_cotas"] = ""; |
---|
| 197 | $var["close_comment_cotas"] =""; |
---|
| 198 | } |
---|
| 199 | else { |
---|
| 200 | $var["open_comment_cotas"] = "<!--"; |
---|
| 201 | $var["close_comment_cotas"] ="-->"; |
---|
| 202 | } |
---|
| 203 | |
---|
[2] | 204 | $p->set_var($var); |
---|
[414] | 205 | $p->set_var($this->functions->make_dinamic_lang($p, 'list')); |
---|
[2] | 206 | |
---|
| 207 | $p->pfp('out','create_sector'); |
---|
| 208 | } |
---|
| 209 | |
---|
[32] | 210 | function edit_sector() |
---|
| 211 | { |
---|
| 212 | $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
| 213 | $acl = $this->functions->read_acl($account_lid); |
---|
| 214 | $manager_context = $acl[0]['context']; |
---|
| 215 | |
---|
| 216 | $context = $_GET['context']; |
---|
[1145] | 217 | |
---|
| 218 | $combo_manager_org = $this->functions->get_organizations($_GET['context'], '', true, true, true); |
---|
| 219 | $combo_manager_org = substr( $combo_manager_org, 0, ( strpos($combo_manager_org, '</option>') + 9 ) ); |
---|
| 220 | |
---|
[32] | 221 | $a_tmp = explode(",", ldap_dn2ufn($context)); |
---|
| 222 | $sector_name = $a_tmp[0]; |
---|
| 223 | |
---|
| 224 | // Verifica se tem acesso a este modulo |
---|
| 225 | if (!$this->functions->check_acl($account_lid,'edit_sectors')) |
---|
| 226 | { |
---|
| 227 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
| 228 | } |
---|
| 229 | |
---|
[2419] | 230 | //unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
| 231 | //unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
[309] | 232 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Edit Sector'); |
---|
[2419] | 233 | //$GLOBALS['phpgw']->common->phpgw_header(); |
---|
[32] | 234 | |
---|
| 235 | // Set o template |
---|
| 236 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 237 | $p->set_file(Array('edit_sector' => 'sectors_form.tpl')); |
---|
[414] | 238 | $p->set_block('edit_sector','list','list'); |
---|
[32] | 239 | |
---|
| 240 | if (!$_POST) |
---|
| 241 | { |
---|
| 242 | $sector_info = $this->so->get_info($context); |
---|
[1516] | 243 | $sector_disk_quota = $sector_info[0]['diskquota'][0]; |
---|
| 244 | $sector_users_quota = $sector_info[0]['usersquota'][0]; |
---|
[1991] | 245 | $sector_associated_domain = $sector_info[0]['associateddomain'][0]; |
---|
[32] | 246 | $_POST['sector_visible'] = $sector_info[0]['phpgwaccountvisible'][0]; |
---|
| 247 | } |
---|
| 248 | |
---|
| 249 | // Seta variaveis utilizadas pelo tpl. |
---|
| 250 | $var = Array( |
---|
| 251 | 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.bosectors.save_sector'), |
---|
| 252 | 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uisectors.list_sectors'), |
---|
| 253 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], |
---|
| 254 | 'context' => $context == '' ? $manager_context : $context, |
---|
[1145] | 255 | 'sector' => $_POST['sector'] == '' ? $sector_name : $_POST['sector'], |
---|
| 256 | 'manager_org' => $combo_manager_org, |
---|
[309] | 257 | 'sector_visible_checked'=> $_POST['sector_visible'] ? 'checked' : '', |
---|
[1991] | 258 | 'associated_domain' => $_POST['associated_domain'] == '' ? $sector_associated_domain : $_POST['associated_domain'], |
---|
[1516] | 259 | 'disk_quota' => $_POST['disk_quota'] == '' ? $sector_disk_quota : $_POST['disk_quota'], |
---|
| 260 | 'users_quota' => $_POST['users_quota'] == '' ? $sector_users_quota : $_POST['users_quota'], |
---|
[32] | 261 | 'lang_add' => lang('Add'), |
---|
| 262 | 'disable' => 'disabled', |
---|
| 263 | 'error_messages' => $_POST['error_messages'] == '' ? '' : "<script type='text/javascript'>alert('".$_POST['error_messages']."')</script>", |
---|
[1516] | 264 | 'lang_disk_quota' => lang('disk quota'), |
---|
| 265 | 'lang_users_quota' => lang('users quota') |
---|
[32] | 266 | ); |
---|
[1516] | 267 | if($this->functions->db_functions->use_cota_control()) { |
---|
| 268 | $var["open_comment_cotas"] = ""; |
---|
| 269 | $var["close_comment_cotas"] =""; |
---|
| 270 | } |
---|
| 271 | else { |
---|
| 272 | $var["open_comment_cotas"] = "<!--"; |
---|
| 273 | $var["close_comment_cotas"] ="-->"; |
---|
| 274 | } |
---|
[32] | 275 | $p->set_var($var); |
---|
[414] | 276 | $p->set_var($this->functions->make_dinamic_lang($p, 'list')); |
---|
| 277 | |
---|
[32] | 278 | $p->pfp('out','edit_sector'); |
---|
| 279 | } |
---|
| 280 | |
---|
[1516] | 281 | function view_cota() |
---|
| 282 | { |
---|
| 283 | $context = $_GET['context']; |
---|
| 284 | $a_tmp = explode(",", ldap_dn2ufn($context)); |
---|
| 285 | |
---|
| 286 | $sector_name = $a_tmp[0]; |
---|
| 287 | if($this->functions->db_functions->use_cota_control()) { |
---|
| 288 | $sector_info = $this->so->get_info($context); |
---|
| 289 | $sector_disk_cota = $sector_info[0]['diskquota'][0]; |
---|
| 290 | $sector_users_cota = $sector_info[0]['usersquota'][0]; |
---|
| 291 | } |
---|
| 292 | else { |
---|
| 293 | $sector_disk_cota = lang('cotas control disabled'); |
---|
| 294 | $sector_users_cota = lang('cotas control disabled'); |
---|
| 295 | } |
---|
| 296 | |
---|
| 297 | |
---|
[2419] | 298 | //unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
| 299 | //unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
[1516] | 300 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Edit Sector'); |
---|
[2419] | 301 | //$GLOBALS['phpgw']->common->phpgw_header(); |
---|
[1516] | 302 | |
---|
| 303 | // Set o template |
---|
| 304 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 305 | $p->set_file(Array('ver_cota' => 'sectors_cota.tpl')); |
---|
| 306 | |
---|
| 307 | |
---|
| 308 | // Seta variaveis utilizadas pelo tpl. |
---|
| 309 | $var = Array( |
---|
| 310 | 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uisectors.list_sectors'), |
---|
| 311 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], |
---|
| 312 | 'context' => $context, |
---|
| 313 | 'sector' => $sector_name, |
---|
| 314 | 'disk_cota' => $sector_disk_cota, |
---|
| 315 | 'users_cota' => $sector_users_cota, |
---|
| 316 | 'actual_users' => $this->functions->get_num_users($context), |
---|
| 317 | 'actual_disk' => round($this->functions->get_actual_disk_usage($context),2), |
---|
| 318 | |
---|
| 319 | 'lang_back' => lang('Back'), |
---|
| 320 | 'lang_context' => lang('Context'), |
---|
| 321 | 'lang_sector_name' => lang('Sector name'), |
---|
| 322 | 'lang_disk_cota' => lang('disk usage cota'), |
---|
| 323 | 'lang_users_cota' => lang('user number cota'), |
---|
| 324 | 'lang_user_number' => lang('user number'), |
---|
| 325 | 'lang_disk_used' => lang('disk usage'), |
---|
| 326 | 'error_messages' => $_POST['error_messages'] == '' ? '' : "<script type='text/javascript'>alert('".$_POST['error_messages']."')</script>", |
---|
| 327 | ); |
---|
| 328 | $p->set_var($var); |
---|
| 329 | |
---|
| 330 | $p->pfp('out','ver_cota'); |
---|
| 331 | } |
---|
| 332 | |
---|
[2] | 333 | function validate_data_sectors_add() |
---|
| 334 | { |
---|
| 335 | $sector_name = $_POST['sector']; |
---|
[396] | 336 | $context = $_POST['context']; |
---|
[2] | 337 | |
---|
| 338 | // Verifica se o nome do sector nao esta vazio. |
---|
| 339 | if ($sector_name == '') |
---|
| 340 | { |
---|
[309] | 341 | $_POST['error_messages'] = lang('Sector name is empty.'); |
---|
[2] | 342 | ExecMethod('expressoAdmin1_2.uisectors.add_sector'); |
---|
| 343 | return; |
---|
| 344 | } |
---|
| 345 | |
---|
| 346 | // Verifica se o nome do setor existe no contexto atual. |
---|
| 347 | if ($this->so->exist_sector_name($sector_name, $context)) |
---|
| 348 | { |
---|
| 349 | $_POST['error_messages'] = lang('Sector name already exist.'); |
---|
| 350 | ExecMethod('expressoAdmin1_2.uisectors.add_sector'); |
---|
| 351 | return; |
---|
| 352 | } |
---|
| 353 | |
---|
| 354 | ExecMethod('expressoAdmin1_2.bosectors.create_sector'); |
---|
| 355 | } |
---|
[32] | 356 | |
---|
[2] | 357 | function delete_sector() |
---|
| 358 | { |
---|
| 359 | $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid']; |
---|
| 360 | $acl = $this->functions->read_acl($account_lid); |
---|
| 361 | $manager_context = $acl[0]['context']; |
---|
| 362 | |
---|
| 363 | // Verifica se tem acesso a este modulo |
---|
| 364 | if (!$this->functions->check_acl($account_lid,'delete_sectors')) |
---|
| 365 | { |
---|
| 366 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/expressoAdmin1_2/inc/access_denied.php')); |
---|
| 367 | } |
---|
| 368 | |
---|
[2419] | 369 | //unset($GLOBALS['phpgw_info']['flags']['noheader']); |
---|
| 370 | //unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
[309] | 371 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Delete Sectors'); |
---|
[2419] | 372 | //$GLOBALS['phpgw']->common->phpgw_header(); |
---|
[2] | 373 | |
---|
| 374 | // Set o template |
---|
| 375 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 376 | $p->set_file(Array('delete_sector' => 'sectors_delete.tpl')); |
---|
[414] | 377 | $p->set_block('delete_sector','list','list'); |
---|
[2] | 378 | |
---|
| 379 | $tmp_sector_name = $_GET['context']; |
---|
| 380 | $tmp_sector_name = explode(",",$tmp_sector_name); |
---|
| 381 | $tmp_sector_name = $tmp_sector_name[0]; |
---|
| 382 | $tmp_sector_name = explode("=", $tmp_sector_name); |
---|
| 383 | $sector_name = $tmp_sector_name[1]; |
---|
| 384 | |
---|
| 385 | // Get users of sector |
---|
[32] | 386 | $sector_users = $this->so->get_sector_users($_GET['context']); |
---|
[2] | 387 | $sector_groups = $this->so->get_sector_groups($_GET['context']); |
---|
| 388 | $sector_subsectors = $this->so->get_sector_subsectors($_GET['context']); |
---|
| 389 | |
---|
| 390 | $users_list = ''; |
---|
| 391 | foreach ($sector_users as $user) |
---|
| 392 | { |
---|
| 393 | $users_list .= $user['cn'][0] . '<br>'; |
---|
| 394 | } |
---|
| 395 | |
---|
| 396 | $groups_list = ''; |
---|
| 397 | foreach ($sector_groups as $group) |
---|
| 398 | { |
---|
| 399 | $groups_list .= $group['cn'][0] . '<br>'; |
---|
| 400 | } |
---|
| 401 | |
---|
| 402 | $subsectors_list = ''; |
---|
| 403 | foreach ($sector_subsectors as $subsector) |
---|
| 404 | { |
---|
| 405 | if ($subsector['dn'] != $_GET['context']) |
---|
| 406 | $subsectors_list .= $subsector['ou'][0] . '<br>'; |
---|
| 407 | } |
---|
| 408 | |
---|
| 409 | // Seta variaveis utilizadas pelo tpl. |
---|
| 410 | $var = Array( |
---|
| 411 | 'color_bg1' => "#E8F0F0", |
---|
| 412 | 'manager_context' => $manager_context, |
---|
| 413 | 'dn' => $_GET['context'], |
---|
| 414 | 'back_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uisectors.list_sectors'), |
---|
| 415 | 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.bosectors.delete_sector'), |
---|
| 416 | |
---|
| 417 | 'sector_name' => $sector_name, |
---|
| 418 | 'users_list' => $users_list, |
---|
| 419 | 'groups_list' => $groups_list, |
---|
| 420 | 'sectors_list' => $subsectors_list |
---|
| 421 | ); |
---|
| 422 | $p->set_var($var); |
---|
[414] | 423 | $p->set_var($this->functions->make_dinamic_lang($p, 'list')); |
---|
[2] | 424 | $p->pfp('out','delete_sector'); |
---|
| 425 | } |
---|
| 426 | |
---|
[548] | 427 | function row_action($action,$type,$context,$class='uisectors') |
---|
[2] | 428 | { |
---|
| 429 | return '<a href="'.$GLOBALS['phpgw']->link('/index.php',Array( |
---|
[548] | 430 | 'menuaction' => 'expressoAdmin1_2.'.$class.'.'.$action.'_'.$type, |
---|
[2] | 431 | 'context' => $context |
---|
| 432 | )).'"> '.lang($action).' </a>'; |
---|
| 433 | } |
---|
| 434 | |
---|
| 435 | function css() |
---|
| 436 | { |
---|
| 437 | $appCSS = ''; |
---|
| 438 | return $appCSS; |
---|
| 439 | } |
---|
| 440 | |
---|
| 441 | } |
---|
[548] | 442 | ?> |
---|