[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 uimanagers |
---|
| 13 | { |
---|
| 14 | var $public_functions = array |
---|
| 15 | ( |
---|
| 16 | 'list_managers' => True, |
---|
| 17 | 'add_managers' => True, |
---|
| 18 | 'delete_managers' => True, |
---|
| 19 | 'edit_managers' => True, |
---|
| 20 | 'validate' => True |
---|
| 21 | ); |
---|
| 22 | |
---|
| 23 | var $functions; |
---|
| 24 | var $config; |
---|
| 25 | |
---|
| 26 | function uimanagers() |
---|
| 27 | { |
---|
| 28 | $this->functions = CreateObject('expressoAdmin1_2.functions'); |
---|
| 29 | $c = CreateObject('phpgwapi.config','expressoAdmin1_2'); |
---|
| 30 | $c->read_repository(); |
---|
| 31 | $this->config = $c->config_data; |
---|
[64] | 32 | |
---|
| 33 | if(!@is_object($GLOBALS['phpgw']->js)) |
---|
| 34 | { |
---|
| 35 | $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript'); |
---|
| 36 | } |
---|
| 37 | $GLOBALS['phpgw']->js->validate_file('jscode','connector','expressoAdmin1_2');#diretorio, arquivo.js, aplicacao |
---|
[5133] | 38 | $GLOBALS['phpgw']->js->validate_file('jscode','finder','expressoAdmin1_2'); |
---|
[458] | 39 | $GLOBALS['phpgw']->js->validate_file('jscode','expressoadmin','expressoAdmin1_2'); |
---|
[64] | 40 | $GLOBALS['phpgw']->js->validate_file('jscode','managers','expressoAdmin1_2'); |
---|
[2] | 41 | } |
---|
| 42 | |
---|
| 43 | function row_action($lang,$link,$manager_lid,$context) |
---|
| 44 | { |
---|
| 45 | return '<a href="'.$GLOBALS['phpgw']->link('/index.php',Array( |
---|
| 46 | 'menuaction' => 'expressoAdmin1_2.uimanagers.'.$link, |
---|
| 47 | 'action' => $lang, |
---|
| 48 | 'manager_lid' => $manager_lid, |
---|
| 49 | 'context' => $context |
---|
| 50 | )).'" onmouseover="window.status=\''.lang($lang).' Manager\'; return true;" onmouseout="window.status=\'\';" >'.lang($lang).' </a>'; |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | function list_managers() |
---|
| 54 | { |
---|
| 55 | // Caso nao seja admin, sai. |
---|
[1684] | 56 | if (!$GLOBALS['phpgw']->acl->check('run',1,'admin')) |
---|
[2] | 57 | { |
---|
| 58 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/admin/index.php')); |
---|
| 59 | } |
---|
| 60 | // Imprime o NavBar |
---|
| 61 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
[309] | 62 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('List Managers'); |
---|
[2] | 63 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 64 | |
---|
| 65 | // Seta o template |
---|
| 66 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 67 | $p->set_file(array('managers' => 'managers.tpl')); |
---|
| 68 | $p->set_block('managers','body','body'); |
---|
| 69 | $p->set_block('managers','row','row'); |
---|
| 70 | $p->set_block('managers','row_empty','row_empty'); |
---|
[64] | 71 | $tpl_vars = $p->get_undefined('body'); |
---|
[2] | 72 | |
---|
| 73 | $var = Array( |
---|
| 74 | 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimanagers.add_managers'), |
---|
| 75 | 'tr_color' => '#DDDDDD', |
---|
[64] | 76 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'] |
---|
[2] | 77 | ); |
---|
| 78 | |
---|
[64] | 79 | // Cria dinamicamente os langs |
---|
| 80 | foreach ($tpl_vars as $atribute) |
---|
| 81 | { |
---|
| 82 | $lang = strstr($atribute, 'lang_'); |
---|
| 83 | if($lang !== false) |
---|
| 84 | { |
---|
| 85 | $p->set_var($atribute, $this->make_lang($atribute)); |
---|
| 86 | } |
---|
| 87 | } |
---|
| 88 | |
---|
| 89 | // Le BD para pegar os administradors. |
---|
[6484] | 90 | $query = 'SELECT DISTINCT ON (manager_lid) manager_lid , context FROM phpgw_expressoadmin_acls ORDER by manager_lid '; |
---|
[2] | 91 | $GLOBALS['phpgw']->db->query($query); |
---|
| 92 | while($GLOBALS['phpgw']->db->next_record()) |
---|
| 93 | { |
---|
| 94 | $managers[] = $GLOBALS['phpgw']->db->row(); |
---|
| 95 | } |
---|
| 96 | $ldap_conn = $GLOBALS['phpgw']->common->ldapConnect(); |
---|
| 97 | $justthese = array("cn"); |
---|
| 98 | // Loop para listar os administradores |
---|
| 99 | if (count($managers)) |
---|
| 100 | { |
---|
| 101 | foreach($managers as $array_managers) |
---|
| 102 | { |
---|
[64] | 103 | $managers_context = ""; |
---|
[5593] | 104 | $a_managers_context = preg_split('/%/', $array_managers['context']); |
---|
[64] | 105 | |
---|
| 106 | foreach ($a_managers_context as $context) |
---|
| 107 | { |
---|
| 108 | $managers_context .= "$context<br>"; |
---|
| 109 | } |
---|
| 110 | |
---|
[2] | 111 | $filter="(&(phpgwAccountType=u)(uid=".$array_managers['manager_lid']."))"; |
---|
| 112 | $ldap_search = ldap_search($ldap_conn, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); |
---|
| 113 | $ldap_result = ldap_get_entries($ldap_conn, $ldap_search); |
---|
| 114 | $p->set_var('manager_lid', $array_managers[manager_lid]); |
---|
| 115 | $p->set_var('manager_cn', $ldap_result[0]['cn'][0] == '' ? '<font color=red>NAO ENCONTRADO NO LDAP</font>' : $ldap_result[0]['cn'][0]); |
---|
[64] | 116 | $p->set_var('context', $managers_context); |
---|
[2] | 117 | $p->set_var('link_edit',$this->row_action('edit','edit_managers',$array_managers[manager_lid],$array_managers[context])); |
---|
| 118 | $p->set_var('link_delete',$this->row_action('delete','delete_managers',$array_managers[manager_lid],$array_managers[context])); |
---|
[309] | 119 | $p->set_var('link_copy',"<a href='#' onClick='javascript:copy_manager(\"".$array_managers['manager_lid']."\");'>Copiar</a>"); |
---|
[2] | 120 | $p->fp('rows','row',True); |
---|
| 121 | } |
---|
| 122 | } |
---|
| 123 | $p->set_var($var); |
---|
| 124 | $p->pfp('out','body'); |
---|
| 125 | ldap_close($ldap_conn); |
---|
| 126 | } |
---|
| 127 | |
---|
| 128 | |
---|
| 129 | function add_managers() |
---|
| 130 | { |
---|
| 131 | // Caso nao seja admin, sai. |
---|
[1684] | 132 | if (!$GLOBALS['phpgw']->acl->check('run',1,'admin')) |
---|
[2] | 133 | { |
---|
| 134 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/admin/index.php')); |
---|
| 135 | } |
---|
| 136 | |
---|
| 137 | // Seta o template |
---|
| 138 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 139 | $p->set_file(array('managers' => 'managers_form.tpl')); |
---|
| 140 | $p->set_block('managers','form','form'); |
---|
[64] | 141 | $tpl_vars = $p->get_undefined('form'); |
---|
[2] | 142 | |
---|
| 143 | // Imprime o NavBar |
---|
| 144 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
[309] | 145 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Add Managers'); |
---|
[2] | 146 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 147 | |
---|
[64] | 148 | // Seta variaveis javascript necessárias |
---|
[2] | 149 | $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url']; |
---|
[64] | 150 | $scripts_java = '<script type="text/javascript" src="'.$webserver_url.'/expressoAdmin1_2/js/jscode/expressoadmin.js"></script>'; |
---|
[2] | 151 | |
---|
| 152 | // App, create list of available apps |
---|
[107] | 153 | $applications_list = $this->make_app_list(''); |
---|
[64] | 154 | |
---|
[180] | 155 | /* |
---|
[107] | 156 | if ($_POST['context']) |
---|
| 157 | { |
---|
[5593] | 158 | $contexts = preg_split('/%/', $_POST['context']); |
---|
[107] | 159 | foreach ($contexts as $manager_context) |
---|
| 160 | $input_context_fields .= "<input type='text' size=60 value=$manager_context></input><br>"; |
---|
| 161 | } |
---|
| 162 | else |
---|
[180] | 163 | $input_context_fields = '<input type="text" size=60></input><br>'; |
---|
| 164 | */ |
---|
[64] | 165 | |
---|
[208] | 166 | $options_context = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context'], '', false, true, false); |
---|
[180] | 167 | |
---|
[2] | 168 | // Seta variaveis que estao no TPL |
---|
| 169 | $var = Array( |
---|
| 170 | 'scripts_java' => $scripts_java, |
---|
[180] | 171 | //'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimanagers.validate'), |
---|
| 172 | //'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.bomanagers.add_managers'), |
---|
[2] | 173 | 'display_samba_suport' => $this->config['expressoAdmin_samba_support'] == 'true' ? '' : 'display:none', |
---|
| 174 | 'type' => "add", |
---|
| 175 | 'color_bg1' => "#E8F0F0", |
---|
| 176 | 'color_bg2' => "#D3DCE3", |
---|
| 177 | 'color_font1' => "#DDDDDD", |
---|
| 178 | 'color_font2' => "#EEEEEE", |
---|
[64] | 179 | 'input_context_fields' => $input_context_fields, |
---|
| 180 | 'error_messages' => $_POST['error_messages'] == '' ? '' : '<script language="JavaScript">alert("'.$_POST['error_messages'].'");</script>', |
---|
| 181 | 'manager_lid' => $_POST['manager_lid'], |
---|
| 182 | 'context' => $_POST['context'], |
---|
[180] | 183 | 'app_list' => $applications_list, |
---|
| 184 | 'options_contexts' => $options_context |
---|
[2] | 185 | ); |
---|
| 186 | $p->set_var($var); |
---|
[64] | 187 | |
---|
| 188 | // Cria dinamicamente os langs e seta acls |
---|
| 189 | foreach ($tpl_vars as $atribute) |
---|
| 190 | { |
---|
| 191 | $acl = strstr($atribute, 'acl_'); |
---|
| 192 | $lang = strstr($atribute, 'lang_'); |
---|
| 193 | // Recuperar os valores das ACLS |
---|
| 194 | if ($acl !== false) |
---|
| 195 | { |
---|
| 196 | $p->set_var($atribute, $_POST[$atribute] != '' ? 'checked' : ''); |
---|
| 197 | } |
---|
| 198 | // Setar os langs do tpl. |
---|
| 199 | elseif($lang !== false) |
---|
| 200 | { |
---|
| 201 | $p->set_var($atribute, $this->make_lang($atribute)); |
---|
| 202 | } |
---|
| 203 | } |
---|
| 204 | |
---|
[2] | 205 | echo $p->fp('out','form'); |
---|
| 206 | } |
---|
| 207 | |
---|
| 208 | function delete_managers() |
---|
| 209 | { |
---|
[1684] | 210 | if (!$GLOBALS['phpgw']->acl->check('run',1,'admin')) |
---|
| 211 | { |
---|
| 212 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/admin/index.php')); |
---|
| 213 | } |
---|
[2] | 214 | // Criar uma verificação e jogar a query para o BO. |
---|
| 215 | $context = $_GET['context']; |
---|
| 216 | $manager_lid = $_GET['manager_lid']; |
---|
| 217 | |
---|
[5133] | 218 | $query = "DELETE FROM phpgw_expressoadmin_acls WHERE manager_lid = '".$manager_lid."' AND context = '" . $context ."'"; |
---|
[2] | 219 | $GLOBALS['phpgw']->db->query($query); |
---|
| 220 | |
---|
| 221 | // Remove Gerente da tabela dos apps |
---|
| 222 | $query = "DELETE FROM phpgw_expressoadmin_apps WHERE " |
---|
| 223 | . "manager_lid = '".$manager_lid."' AND " |
---|
| 224 | . "context = '".$context."'"; |
---|
| 225 | $GLOBALS['phpgw']->db->query($query); |
---|
| 226 | |
---|
| 227 | // Remove Gerente na ACL do expressoadmin |
---|
| 228 | $accounts = CreateObject('phpgwapi.accounts'); |
---|
| 229 | $manager_id = $accounts->name2id($_GET['manager_lid']); |
---|
| 230 | $sql = "DELETE FROM phpgw_acl WHERE acl_appname = 'expressoadmin' AND acl_account = '" . $manager_id . "'"; |
---|
| 231 | $GLOBALS['phpgw']->db->query($sql); |
---|
| 232 | |
---|
| 233 | ExecMethod('expressoAdmin1_2.uimanagers.list_managers'); |
---|
| 234 | } |
---|
| 235 | |
---|
| 236 | function edit_managers() |
---|
| 237 | { |
---|
[6517] | 238 | echo "<input type='hidden' name='old_url_context_aux' value='".$_GET['context']."'>"; |
---|
| 239 | |
---|
[2] | 240 | // Caso nao seja admin, sai. |
---|
[1684] | 241 | if (!$GLOBALS['phpgw']->acl->check('run',1,'admin')) |
---|
[2] | 242 | { |
---|
| 243 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/admin/index.php')); |
---|
| 244 | } |
---|
| 245 | |
---|
| 246 | // Verifica se eh a primeira entrada, ai eu tenho o get, senao pego o post. |
---|
| 247 | if ($_GET['manager_lid'] != '') |
---|
| 248 | { |
---|
[64] | 249 | $first_time = true; |
---|
[2] | 250 | $_POST['manager_lid'] = $_GET['manager_lid']; |
---|
| 251 | $_POST['context'] = $_GET['context']; |
---|
[180] | 252 | $hidden_manager_lid = $_GET['manager_lid']; |
---|
[2] | 253 | } |
---|
| 254 | elseif ($_POST['manager_lid'] != '') |
---|
| 255 | { |
---|
[64] | 256 | $first_time = false; |
---|
[180] | 257 | $hidden_manager_lid = $_POST['old_manager_lid']; |
---|
[2] | 258 | } |
---|
| 259 | |
---|
| 260 | if ($first_time) |
---|
| 261 | { |
---|
[5133] | 262 | |
---|
| 263 | $manager_acl = $this->functions->read_acl($_GET['manager_lid']); |
---|
[2] | 264 | //Pesquisa no Banco e pega os valores dos apps. |
---|
[7655] | 265 | $query = "SELECT * FROM phpgw_expressoadmin_apps WHERE manager_lid = '" . addslashes($_GET['manager_lid']) . "' AND context = '" . addslashes($_GET['context']) . "'"; |
---|
[2] | 266 | $GLOBALS['phpgw']->db->query($query); |
---|
| 267 | $i=0; |
---|
| 268 | $manager[0]['apps'] = array(); |
---|
| 269 | while($GLOBALS['phpgw']->db->next_record()) |
---|
| 270 | { |
---|
| 271 | $tmp[$i] = $GLOBALS['phpgw']->db->row(); |
---|
| 272 | $_POST['applications_list'][$tmp[$i]['app']] = 1; |
---|
| 273 | $manager[0]['apps'][$tmp[$i]['app']] = 1; |
---|
[7655] | 274 | ++$i; |
---|
[2] | 275 | } |
---|
| 276 | } |
---|
[7655] | 277 | |
---|
[2] | 278 | // Seta o template |
---|
| 279 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); |
---|
| 280 | $p->set_file(array('managers' => 'managers_form.tpl')); |
---|
| 281 | $p->set_block('managers','form','form'); |
---|
[64] | 282 | $tpl_vars = $p->get_undefined('form'); |
---|
[2] | 283 | |
---|
| 284 | // Imprime o NavBar |
---|
| 285 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']); |
---|
[309] | 286 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['expressoAdmin1_2']['title'].' - '.lang('Edit Managers'); |
---|
[2] | 287 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 288 | |
---|
| 289 | // Seta variaveis javas necessárias |
---|
| 290 | $webserver_url = $GLOBALS['phpgw_info']['server']['webserver_url']; |
---|
[64] | 291 | $scripts_java = '<script type="text/javascript" src="'.$webserver_url.'/expressoAdmin1_2/js/jscode/expressoadmin.js"></script>'; |
---|
[2] | 292 | |
---|
| 293 | // App, create list of available apps |
---|
[64] | 294 | $applications_list = $this->make_app_list($manager[0]['apps']); |
---|
[2] | 295 | |
---|
[5593] | 296 | $a_context = preg_split('/%/', $_POST['context']); |
---|
[64] | 297 | foreach ($a_context as $context) |
---|
[180] | 298 | $input_context_fields .= '<div><input disabled type="text" value="'.$context.'" size=60></input><span onclick="this.parentNode.parentNode.removeChild(this.parentNode);" style="cursor:pointer"> -</span></div>'; |
---|
[208] | 299 | $options_context = $this->functions->get_organizations($GLOBALS['phpgw_info']['server']['ldap_context'], '', false, true, false); |
---|
[2] | 300 | |
---|
| 301 | $var = Array( |
---|
[180] | 302 | 'scripts_java' => $scripts_java, |
---|
| 303 | 'action' => $GLOBALS['phpgw']->link('/index.php','menuaction=expressoAdmin1_2.uimanagers.validate'), |
---|
| 304 | 'display_samba_suport' => $this->config['expressoAdmin_samba_support'] == 'true' ? '' : 'display:none', |
---|
| 305 | 'color_bg1' => "#E8F0F0", |
---|
| 306 | 'color_bg2' => "#D3DCE3", |
---|
| 307 | 'color_font1' => "#DDDDDD", |
---|
| 308 | 'color_font2' => "#EEEEEE", |
---|
| 309 | 'type' => "edit", |
---|
| 310 | 'display_manager_select' => 'none', |
---|
[309] | 311 | 'input_manager_lid_disabled'=> 'disabled', |
---|
[180] | 312 | 'error_messages' => $_POST['error_messages'] == '' ? '' : '<script language="JavaScript1.3">alert("'.$_POST['error_messages'].'");</script>', |
---|
| 313 | 'manager_lid' => $_POST['manager_lid'], |
---|
| 314 | 'hidden_manager_lid' => $_POST['manager_lid'], |
---|
| 315 | 'context' => $_POST['context'], |
---|
[309] | 316 | |
---|
[180] | 317 | 'input_context_fields' => $input_context_fields, |
---|
| 318 | 'options_contexts' => $options_context, |
---|
[309] | 319 | |
---|
[180] | 320 | 'hidden_manager_lid' => $hidden_manager_lid, |
---|
| 321 | 'app_list' => $applications_list |
---|
[2] | 322 | ); |
---|
| 323 | $p->set_var($var); |
---|
[64] | 324 | |
---|
| 325 | // Cria dinamicamente os langs e seta acls |
---|
| 326 | foreach ($tpl_vars as $atribute) |
---|
| 327 | { |
---|
| 328 | $acl = strstr($atribute, 'acl_'); |
---|
| 329 | $lang = strstr($atribute, 'lang_'); |
---|
| 330 | // Recuperar os valores das ACLS |
---|
| 331 | if ($acl !== false) |
---|
| 332 | { |
---|
| 333 | if ($first_time) |
---|
[317] | 334 | $p->set_var($atribute, $manager_acl[$atribute] === '1' ? 'checked' : ''); |
---|
[64] | 335 | else |
---|
[317] | 336 | $p->set_var($atribute, $_POST[$atribute] === '1' ? 'checked' : ''); |
---|
[64] | 337 | } |
---|
| 338 | // Setar os langs do tpl. |
---|
| 339 | elseif($lang !== false) |
---|
| 340 | { |
---|
| 341 | $p->set_var($atribute, $this->make_lang($atribute)); |
---|
| 342 | } |
---|
| 343 | } |
---|
| 344 | |
---|
[2] | 345 | echo $p->fp('out','form'); |
---|
| 346 | } |
---|
[309] | 347 | |
---|
[64] | 348 | function make_lang($ram_lang) |
---|
| 349 | { |
---|
[5593] | 350 | $a_lang = preg_split('/_/', $ram_lang); |
---|
[64] | 351 | $a_lang_reverse = array_reverse ( $a_lang, true ); |
---|
| 352 | //Retira o lang do array. |
---|
| 353 | array_pop ( $a_lang_reverse ); |
---|
| 354 | $a_lang = array_reverse ( $a_lang_reverse, true ); |
---|
| 355 | $a_new_lang = implode ( " ", $a_lang ); |
---|
| 356 | return lang($a_new_lang); |
---|
| 357 | } |
---|
| 358 | |
---|
| 359 | function make_app_list($manager_app_list) |
---|
| 360 | { |
---|
| 361 | $this->nextmatchs = createobject('phpgwapi.nextmatchs'); |
---|
| 362 | $apps = CreateObject('phpgwapi.applications',$_account_id); |
---|
| 363 | $db_perms = $apps->read_account_specific(); |
---|
| 364 | $availableApps = $GLOBALS['phpgw_info']['apps']; |
---|
| 365 | |
---|
| 366 | uasort($availableApps,create_function('$a,$b','return strcasecmp($a["title"],$b["title"]);')); |
---|
| 367 | |
---|
| 368 | // Loop para criar dinamicamente uma tabela com 3 colunas, cada coluna com um aplicativo e um check box. |
---|
| 369 | $applications_list = ''; |
---|
| 370 | $app_col1 = ''; |
---|
| 371 | $app_col2 = ''; |
---|
| 372 | $app_col3 = ''; |
---|
| 373 | $total_apps = count($availableApps); |
---|
| 374 | $i = 0; |
---|
| 375 | |
---|
| 376 | foreach($availableApps as $app => $data) |
---|
| 377 | { |
---|
| 378 | // 1 coluna |
---|
| 379 | if (($i +1) % 3 == 1) |
---|
| 380 | { |
---|
| 381 | if ($manager_app_list[$app] == 1) |
---|
| 382 | $checked = 'checked'; |
---|
| 383 | else |
---|
| 384 | $checked = ''; |
---|
| 385 | $app_col1 = sprintf("<td>%s</td><td width='10'><input type='checkbox' name='applications_list[%s]' value='1' %s %s></td>\n", |
---|
| 386 | $data['title'],$app,$checked, $disabled); |
---|
| 387 | |
---|
| 388 | if ($i == ($total_apps-1)) |
---|
| 389 | $applications_list .= sprintf('<tr bgcolor="%s">%s</tr>',$this->nextmatchs->alternate_row_color(), $app_col1); |
---|
| 390 | } |
---|
| 391 | // 2 coluna |
---|
| 392 | if (($i +1) % 3 == 2) |
---|
| 393 | { |
---|
| 394 | if ($manager_app_list[$app] == 1) |
---|
| 395 | $checked = 'checked'; |
---|
| 396 | else |
---|
| 397 | $checked = ''; |
---|
| 398 | $app_col2 = sprintf("<td>%s</td><td width='10'><input type='checkbox' name='applications_list[%s]' value='1' %s %s></td>\n", |
---|
| 399 | $data['title'],$app,$checked, $disabled); |
---|
| 400 | |
---|
| 401 | if ($i == ($total_apps-1)) |
---|
| 402 | $applications_list .= sprintf('<tr bgcolor="%s">%s%s</tr>',$this->nextmatchs->alternate_row_color(), $app_col1,$app_col2); |
---|
| 403 | } |
---|
| 404 | // 3 coluna |
---|
| 405 | if (($i +1) % 3 == 0) |
---|
| 406 | { |
---|
| 407 | if ($manager_app_list[$app] == 1) |
---|
| 408 | $checked = 'checked'; |
---|
| 409 | else |
---|
| 410 | $checked = ''; |
---|
| 411 | $app_col3 = sprintf("<td>%s</td><td width='10'><input type='checkbox' name='applications_list[%s]' value='1' %s %s></td>\n", |
---|
| 412 | $data['title'],$app,$checked, $disabled); |
---|
| 413 | |
---|
| 414 | // Cria nova linha |
---|
| 415 | $applications_list .= sprintf('<tr bgcolor="%s">%s%s%s</tr>',$this->nextmatchs->alternate_row_color(), $app_col1, $app_col2, $app_col3); |
---|
| 416 | } |
---|
[7655] | 417 | ++$i; |
---|
[64] | 418 | } |
---|
| 419 | return $applications_list; |
---|
| 420 | } |
---|
[2] | 421 | } |
---|
[5593] | 422 | ?> |
---|