[5291] | 1 | <?php
|
---|
| 2 | /*************************************************************************************\
|
---|
| 3 | * Expresso Relatório *
|
---|
| 4 | * by Elvio Rufino da Silva (elviosilva@yahoo.com.br, elviosilva@cepromat.mt.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 uireports_users
|
---|
| 13 | {
|
---|
| 14 | var $public_functions = array
|
---|
| 15 | (
|
---|
| 16 | 'report_users_print_pdf' => True,
|
---|
| 17 | 'report_users_group' => True,
|
---|
| 18 | 'report_users_group_setor_print' => True,
|
---|
| 19 | 'get_user_info' => True,
|
---|
| 20 | 'css' => True
|
---|
| 21 | );
|
---|
| 22 |
|
---|
| 23 | var $nextmatchs;
|
---|
| 24 | var $user;
|
---|
| 25 | var $functions;
|
---|
| 26 | var $current_config;
|
---|
| 27 | var $ldap_functions;
|
---|
| 28 | var $db_functions;
|
---|
| 29 |
|
---|
| 30 | function uireports_users()
|
---|
| 31 | {
|
---|
| 32 | $this->user = CreateObject('reports.user');
|
---|
| 33 | $this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
---|
| 34 | $this->functions = CreateObject('reports.functions');
|
---|
| 35 | $this->ldap_functions = CreateObject('reports.ldap_functions');
|
---|
| 36 | $this->db_functions = CreateObject('reports.db_functions');
|
---|
| 37 | $this->fpdf = CreateObject('reports.uireports_fpdf'); // Class para PDF
|
---|
| 38 |
|
---|
| 39 | $c = CreateObject('phpgwapi.config','reports'); // cria o objeto relatorio no $c
|
---|
| 40 | $c->read_repository(); // na classe config do phpgwapi le os dados da tabela phpgw_config where relatorio, como passagem acima
|
---|
| 41 | $this->current_config = $c->config_data; // carrega os dados em do array no current_config
|
---|
| 42 |
|
---|
| 43 | if(!@is_object($GLOBALS['phpgw']->js))
|
---|
| 44 | {
|
---|
| 45 | $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
|
---|
| 46 | }
|
---|
| 47 | $GLOBALS['phpgw']->js->validate_file('jscode','cc','reports');
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | function report_users_print_pdf()
|
---|
| 51 | {
|
---|
| 52 | $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
|
---|
| 53 | $acl = $this->functions->read_acl($account_lid);
|
---|
| 54 | $raw_context = $acl['raw_context'];
|
---|
| 55 | $contexts = $acl['contexts'];
|
---|
| 56 | foreach ($acl['contexts_display'] as $index=>$tmp_context)
|
---|
| 57 | {
|
---|
| 58 | $context_display .= $tmp_context;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 | if (!$this->functions->check_acl($account_lid,'list_users'))
|
---|
| 63 | {
|
---|
| 64 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/reports/inc/access_denied.php'));
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | $grouplist = trim($_POST[setor]);
|
---|
[6920] | 68 | $grouplist = trim(ereg_replace("-","",$grouplist));
|
---|
[5291] | 69 |
|
---|
| 70 | $setordn = trim($_POST[setordn]);
|
---|
| 71 | $subtitulo1 = trim($_POST[subtitulo]);
|
---|
| 72 |
|
---|
| 73 | define('FPDF_FONTPATH','font/');
|
---|
| 74 | $data_atual = date("d/m/Y");
|
---|
| 75 | $titulo_system = $GLOBALS['phpgw_info']['apps']['reports']['title'];
|
---|
| 76 |
|
---|
| 77 | $pdf=new uireports_fpdf("L");
|
---|
| 78 | $pdf->Open();
|
---|
| 79 | $pdf->AddPage();
|
---|
[6920] | 80 | $pdf->SetTitle(lang('Report Generated by Expresso Reports'));
|
---|
[5291] | 81 |
|
---|
| 82 | //Set font and colors
|
---|
| 83 | $pdf->SetFont('Arial','B',14);
|
---|
| 84 | $pdf->SetFillColor(0,0,0);
|
---|
| 85 | $pdf->SetTextColor(0,0,200);
|
---|
| 86 | $pdf->SetDrawColor(0,0,0);
|
---|
| 87 | $pdf->SetLineWidth(.2);
|
---|
| 88 |
|
---|
| 89 | //Table header
|
---|
| 90 | $SubTitulo = lang('reports title2');
|
---|
[6920] | 91 | $SubTituloR = lang('Report Generated by Expresso Reports');
|
---|
[5291] | 92 | $SubTitulo1 = $subtitulo1;
|
---|
| 93 | $GLOBALS['phpgw_info']['apps']['reports']['subtitle'] = $SubTituloR;
|
---|
| 94 | $pdf->Cell(0,8,$SubTitulo,0,1,'C',0);
|
---|
| 95 |
|
---|
| 96 | //Set font and colors
|
---|
| 97 | $pdf->SetFont('Arial','B',8);
|
---|
| 98 | $pdf->SetFillColor(0,0,0);
|
---|
| 99 | $pdf->SetTextColor(0,0,200);
|
---|
| 100 | $pdf->SetDrawColor(0,0,0);
|
---|
| 101 | $pdf->SetLineWidth(.3);
|
---|
| 102 |
|
---|
| 103 | $pdf->MultiCell(0,3,$SubTitulo1,0,'C',0);
|
---|
| 104 |
|
---|
| 105 | $pdf->Cell(0,2,' ',0,1,'C',0);
|
---|
| 106 | $pdf->Cell(0,5,'Data..: '.$data_atual,0,0,'L',0);
|
---|
| 107 | $pdf->Cell(0,5,$titulo_system,0,1,'R',0);
|
---|
| 108 |
|
---|
| 109 | $account_info = $this->functions->get_list_user_sector($setordn,$contexts,0);
|
---|
| 110 |
|
---|
| 111 | if (count($account_info))
|
---|
| 112 | {
|
---|
| 113 | //Restore font and colors
|
---|
| 114 | $pdf->SetFont('Arial','',8);
|
---|
| 115 | $pdf->SetFillColor(224,235,255);
|
---|
| 116 | $pdf->SetTextColor(0);
|
---|
| 117 |
|
---|
| 118 | $pdf->Cell(55,5,lang('loginid'),1,0,'L',1);
|
---|
| 119 | $pdf->Cell(80,5,lang('name'),1,0,'L',1);
|
---|
| 120 | $pdf->Cell(80,5,lang('report email'),1,0,'L',1);
|
---|
| 121 | $pdf->Cell(35,5,lang('report phone'),1,0,'L',1);
|
---|
| 122 | $pdf->Cell(20,5,lang('status'),1,1,'L',1);
|
---|
| 123 |
|
---|
| 124 | while (list($null,$account) = each($account_info))
|
---|
| 125 | {
|
---|
| 126 | $row_loginid = $account['account_lid'];
|
---|
| 127 | $row_cn = $account['account_cn'];
|
---|
[6920] | 128 | $row_mail = (!$account['account_mail'] ? '<font color=red>'.lang('Without E-mail').'</font>' : $account['account_mail']);
|
---|
[5291] | 129 | $row_phone = (!$account['account_phone'] ? '-' : $account['account_phone']);
|
---|
[6920] | 130 | $row_status = $account['account_accountstatus'] == 'active' ? lang('Activated') : lang('Disabled');
|
---|
[5291] | 131 | $pdf->Cell(55,5,$row_loginid,0,0,'L',0);
|
---|
| 132 | $pdf->Cell(80,5,$row_cn,0,0,'L',0);
|
---|
| 133 | $pdf->Cell(80,5,$row_mail,0,0,'L',0);
|
---|
| 134 | $pdf->Cell(35,5,$row_phone,0,0,'L',0);
|
---|
[6920] | 135 | if ($row_status == lang('Activated'))
|
---|
[5291] | 136 | {
|
---|
| 137 | //Restaura cor fonte
|
---|
| 138 | $pdf->SetTextColor(0);
|
---|
| 139 | $pdf->Cell(20,5,$row_status,0,1,'L',0);
|
---|
| 140 | }
|
---|
| 141 | else
|
---|
| 142 | {
|
---|
| 143 | //Muda cor fonte
|
---|
| 144 | $pdf->SetTextColor(256,0,0);
|
---|
| 145 | $pdf->Cell(20,5,$row_status,0,1,'L',0);
|
---|
| 146 | //Restaura cor fonte
|
---|
| 147 | $pdf->SetTextColor(0);
|
---|
| 148 | }
|
---|
| 149 | }
|
---|
| 150 | }
|
---|
| 151 |
|
---|
| 152 | $pdf->Output();
|
---|
| 153 |
|
---|
| 154 | return;
|
---|
| 155 | }
|
---|
| 156 |
|
---|
| 157 | function report_users_group()
|
---|
| 158 | {
|
---|
| 159 | $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
|
---|
| 160 | $manager_acl = $this->functions->read_acl($account_lid);
|
---|
| 161 | $raw_context = $acl['raw_context'];
|
---|
| 162 | $contexts = $manager_acl['contexts'];
|
---|
| 163 | $conta_context = count($manager_acl['contexts_display']);
|
---|
| 164 | foreach ($manager_acl['contexts_display'] as $index=>$tmp_context)
|
---|
| 165 | {
|
---|
| 166 | $index = $index +1;
|
---|
| 167 |
|
---|
| 168 | if ($conta_context == $index)
|
---|
| 169 | {
|
---|
| 170 | $context_display .= $tmp_context;
|
---|
| 171 | }
|
---|
| 172 | else
|
---|
| 173 | {
|
---|
| 174 | $context_display .= $tmp_context.' | ';
|
---|
| 175 | }
|
---|
| 176 | }
|
---|
| 177 |
|
---|
| 178 | // Verifica se tem acesso a este modulo
|
---|
| 179 | if (!$this->functions->check_acl($account_lid,'list_sectors'))
|
---|
| 180 | {
|
---|
| 181 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/reports/inc/access_denied.php'));
|
---|
| 182 | }
|
---|
| 183 |
|
---|
| 184 | unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
---|
| 185 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
---|
| 186 |
|
---|
| 187 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['reports']['title'].' - '.lang('report organization');
|
---|
| 188 | $GLOBALS['phpgw']->common->phpgw_header();
|
---|
| 189 |
|
---|
| 190 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
---|
| 191 | $p->set_file(array('groups' => 'report_users_group.tpl'));
|
---|
| 192 | $p->set_block('groups','list','list');
|
---|
| 193 | $p->set_block('groups','row','row');
|
---|
| 194 | $p->set_block('groups','row_empty','row_empty');
|
---|
| 195 |
|
---|
| 196 | // Seta as variaveis padroes.
|
---|
| 197 | $var = Array(
|
---|
| 198 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
---|
| 199 | 'back_url' => $GLOBALS['phpgw']->link('/reports/index.php'),
|
---|
| 200 | 'context_display' => $context_display
|
---|
| 201 | );
|
---|
| 202 | $p->set_var($var);
|
---|
| 203 | $p->set_var($this->functions->make_dinamic_lang($p, 'list'));
|
---|
| 204 |
|
---|
| 205 |
|
---|
| 206 | $GLOBALS['organizacaodn'] = $_POST['organizacaodn'];
|
---|
| 207 |
|
---|
| 208 | $contextsdn = $GLOBALS['organizacaodn'];
|
---|
| 209 |
|
---|
| 210 | // Save query
|
---|
| 211 | $varorganizacao = explode(",",$contextsdn);
|
---|
[6920] | 212 | $varorganizacao_nome = trim(strtoupper(ereg_replace("ou=","",$varorganizacao[0])));
|
---|
| 213 | $varorganizacao_nome = trim(strtoupper(ereg_replace("DC=","",$varorganizacao_nome)));
|
---|
[5291] | 214 | $user_logon = $GLOBALS['phpgw_info']['user'][account_lid];
|
---|
| 215 |
|
---|
| 216 | // carrega os grupos no listbox
|
---|
| 217 | /************* DESCOMENTE ESTE PARTE DO CODIGO PARA LISTAR TODOS OS GRUPOS, SEM LISTAR POR USUSARIO LOGADO ***********
|
---|
| 218 | $sectors_info = $this->functions->get_groups_list($contexts,"*");
|
---|
| 219 | $sectors_info_dn = $this->functions->get_groups_list_dn($contexts,"*");
|
---|
| 220 | /* ************************************* FIM *********************************************************************** */
|
---|
| 221 |
|
---|
| 222 | $sectors_info = $this->functions->get_list_context_logon($user_logon,$contexts,0);
|
---|
| 223 | $sectors_info_dn = $this->functions->get_list_groups_dn($user_logon,$contexts,0);
|
---|
| 224 |
|
---|
| 225 | if (!count($sectors_info))
|
---|
| 226 | {
|
---|
| 227 | $p->set_var('notselect',lang('No matches found'));
|
---|
| 228 | }
|
---|
| 229 | else
|
---|
| 230 | {
|
---|
| 231 | foreach($sectors_info as $context=>$sector)
|
---|
| 232 | {
|
---|
| 233 |
|
---|
| 234 | $sectordn = $sectors_info_dn[$context];
|
---|
| 235 |
|
---|
| 236 | $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
|
---|
| 237 |
|
---|
| 238 | if ($context == 0 && $contextsdn <> "")
|
---|
| 239 | {
|
---|
| 240 | if (trim(strtoupper($varorganizacao_nome)) == trim(strtoupper($sector)))
|
---|
| 241 | {
|
---|
| 242 | $sector_options .= "<option selected value='" .$contextsdn. "'>" .$varorganizacao_nome. "</option>";
|
---|
| 243 | }
|
---|
| 244 | else
|
---|
| 245 | {
|
---|
| 246 | $sector_options .= "<option selected value='" .$contextsdn. "'>" .$varorganizacao_nome. "</option>";
|
---|
| 247 | $sector_options .= "<option value='" . $sectordn . "'>". $sector . "</option>";
|
---|
| 248 | }
|
---|
| 249 |
|
---|
| 250 | }
|
---|
| 251 | else
|
---|
| 252 | {
|
---|
| 253 | if ( trim(strtoupper($varorganizacao_nome)) != trim(strtoupper($sector)))
|
---|
| 254 | {
|
---|
[6920] | 255 | $sectorok = trim(strtoupper(ereg_replace("dc=","",$sector)));
|
---|
| 256 | $sectorok = trim(strtoupper(ereg_replace("dc=","",$sectorok)));
|
---|
[5291] | 257 | $sector_options .= "<option value='" . $sectordn . "'>". $sectorok . "</option>";
|
---|
| 258 | }
|
---|
| 259 | }
|
---|
| 260 |
|
---|
| 261 | $varselect = Array(
|
---|
| 262 | 'tr_color' => $tr_color,
|
---|
| 263 | 'organizacaodn' => $contextsdn,
|
---|
| 264 | 'group_name' => $sector_options
|
---|
| 265 | );
|
---|
| 266 | }
|
---|
| 267 |
|
---|
| 268 | $p->set_var($varselect);
|
---|
| 269 | }
|
---|
| 270 |
|
---|
| 271 | // ************** inicio carregar a sub-lista das organizações ****************
|
---|
| 272 | //Admin make a search
|
---|
| 273 | if ($GLOBALS['organizacaodn'] != '')
|
---|
| 274 | {
|
---|
| 275 | // Conta a quantidade de Usuario do grupo raiz
|
---|
| 276 | $account_user = $this->functions->get_count_user_sector($contextsdn,$contexts,0);
|
---|
| 277 | $totaluser = "(".$account_user.")";
|
---|
| 278 |
|
---|
| 279 | $p->set_var('organizacao', $varorganizacao_nome);
|
---|
| 280 | $p->set_var('all_user', lang('all'));
|
---|
| 281 | $p->set_var('total_user', $totaluser);
|
---|
| 282 |
|
---|
| 283 | $setorg = $contextsdn;
|
---|
| 284 |
|
---|
| 285 | $groups_info = $this->functions->get_sectors_list($contexts,$setorg);
|
---|
| 286 |
|
---|
| 287 | if (!count($groups_info))
|
---|
| 288 | {
|
---|
| 289 | $p->set_var('message',lang('No sector found'));
|
---|
| 290 | $p->parse('rows','row_empty',True);
|
---|
| 291 | }
|
---|
| 292 | else
|
---|
| 293 | {
|
---|
| 294 | $ii = 0;
|
---|
| 295 | foreach($groups_info as $context=>$groups)
|
---|
| 296 | {
|
---|
| 297 | $explode_groups = explode("#",$groups);
|
---|
| 298 | $ii = $ii + 1;
|
---|
| 299 | $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
|
---|
| 300 | $varsuborg = Array(
|
---|
| 301 | 'tr_color' => $tr_color,
|
---|
| 302 | 'formname' => "form".$ii,
|
---|
| 303 | 'formsubmit' => "document.form".$ii.".submit()",
|
---|
| 304 | 'sector_name' => $explode_groups[0],
|
---|
| 305 | 'sector_namedn' => $explode_groups[1],
|
---|
| 306 | 'sector_namedn_completo' => $explode_groups[2],
|
---|
| 307 | );
|
---|
| 308 |
|
---|
| 309 | $p->set_var($varsuborg);
|
---|
| 310 | $p->parse('rows','row',True);
|
---|
| 311 | }
|
---|
| 312 | }
|
---|
| 313 | }
|
---|
| 314 |
|
---|
| 315 | $p->pfp('out','list');
|
---|
| 316 | }
|
---|
| 317 |
|
---|
| 318 | function report_users_group_setor_print()
|
---|
| 319 | {
|
---|
| 320 | $grouplist = trim($_POST[setor]);
|
---|
[6920] | 321 | $grouplist = trim(ereg_replace("-","",$grouplist));
|
---|
[5291] | 322 | $organizacao = trim($_POST[organizacao]);
|
---|
| 323 | $setordn = trim($_POST[setordn]);
|
---|
| 324 | $organizacaodn = trim($_POST[organizacaodn]);
|
---|
| 325 | $sectornamedncompleto = trim($_POST[sectornamedncompleto]);
|
---|
| 326 | $Psectornamedncompleto = trim($_POST[Psectornamedncompleto]);
|
---|
| 327 |
|
---|
| 328 | if ($sectornamedncompleto=="" && $Psectornamedncompleto=="")
|
---|
| 329 | {
|
---|
| 330 | $sectornamedncompleto = $organizacao;
|
---|
| 331 | }
|
---|
| 332 | else if ($sectornamedncompleto=="" && $Psectornamedncompleto <> "")
|
---|
| 333 | {
|
---|
| 334 | $sectornamedncompleto = $Psectornamedncompleto;
|
---|
| 335 | }
|
---|
| 336 | else
|
---|
| 337 | {
|
---|
| 338 | $sectornamedncompleto = $organizacao." | ".$sectornamedncompleto;
|
---|
| 339 | }
|
---|
| 340 |
|
---|
| 341 | $data_atual = date("d/m/Y");
|
---|
| 342 | $titulo_system = $GLOBALS['phpgw_info']['apps']['reports']['title'];
|
---|
| 343 |
|
---|
| 344 | $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
|
---|
| 345 | $acl = $this->functions->read_acl($account_lid);
|
---|
| 346 | $raw_context = $acl['raw_context'];
|
---|
| 347 | $contexts = $acl['contexts'];
|
---|
| 348 | foreach ($acl['contexts_display'] as $index=>$tmp_context)
|
---|
| 349 | {
|
---|
| 350 | $context_display .= $tmp_context;
|
---|
| 351 | }
|
---|
| 352 | // Verifica se o administrador tem acesso.
|
---|
| 353 | if (!$this->functions->check_acl($account_lid,'list_users'))
|
---|
| 354 | {
|
---|
| 355 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/reports/inc/access_denied.php'));
|
---|
| 356 | }
|
---|
| 357 |
|
---|
| 358 | unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
---|
| 359 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
---|
| 360 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['reports']['title'].' - '.lang('report user');
|
---|
| 361 | $GLOBALS['phpgw']->common->phpgw_header();
|
---|
| 362 |
|
---|
| 363 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
---|
| 364 | $p->set_file(Array('accounts' => 'report_users_group_print.tpl'));
|
---|
| 365 | $p->set_block('accounts','body');
|
---|
| 366 | $p->set_block('accounts','rowpag');
|
---|
| 367 | $p->set_block('accounts','row');
|
---|
| 368 | $p->set_block('accounts','row_empty');
|
---|
| 369 |
|
---|
| 370 | $var = Array(
|
---|
| 371 | 'bg_color' => $GLOBALS['phpgw_info']['theme']['bg_color'],
|
---|
| 372 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
---|
| 373 | 'subtitulo' => lang('reports title2'),
|
---|
| 374 | 'subtitulo1' => $sectornamedncompleto,
|
---|
| 375 | 'context' => $raw_context,
|
---|
| 376 | 'titulo' => $titulo_system,
|
---|
| 377 | 'data_atual' => $data_atual,
|
---|
| 378 | 'context_display' => $context_display,
|
---|
| 379 | 'organizacaodn' => $organizacaodn,
|
---|
| 380 | 'organizacao' => $organizacao,
|
---|
| 381 | 'sector_name' => $grouplist,
|
---|
| 382 | 'sector_namedn' => $setordn,
|
---|
| 383 | 'imapDelimiter' => $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter']
|
---|
| 384 | );
|
---|
| 385 |
|
---|
| 386 | $p->set_var($var);
|
---|
| 387 | $p->set_var($this->functions->make_dinamic_lang($p, 'body'));
|
---|
| 388 |
|
---|
| 389 | // ************ PAGINAÇÃO *******************************
|
---|
| 390 |
|
---|
| 391 | // verifica se exixte usuarios no LDAP
|
---|
| 392 | $account_info = $this->functions->get_list_user_sector($setordn,$contexts,0);
|
---|
| 393 |
|
---|
| 394 | if (!count($account_info))
|
---|
| 395 | {
|
---|
| 396 | $p->set_var('message',lang('No user found'));
|
---|
| 397 | $p->parse('rows','row_empty',True);
|
---|
| 398 | }
|
---|
| 399 | else if (count($account_info))
|
---|
| 400 | {
|
---|
| 401 | //url do paginador
|
---|
| 402 | $url = $GLOBALS['phpgw_info']['server']['webserver_url'].'/index.php?menuaction=reports.uireports_users.report_users_group_setor_print';
|
---|
| 403 |
|
---|
| 404 | // **** Grupo de paginas ****
|
---|
| 405 | $gpag = $_POST[gpage];
|
---|
| 406 |
|
---|
| 407 | $grupopage = 20;
|
---|
| 408 |
|
---|
| 409 | if (!$gpag){
|
---|
| 410 | $gpag = 1;
|
---|
| 411 | }
|
---|
| 412 |
|
---|
| 413 | // recebe o numero da pagina
|
---|
| 414 | $npag = $_POST[page];
|
---|
| 415 |
|
---|
| 416 | // verifica se o get com o numero da pagina é nulo
|
---|
| 417 | if (!$npag)
|
---|
| 418 | {
|
---|
| 419 | $npag = 1;
|
---|
| 420 | }
|
---|
| 421 |
|
---|
| 422 | // conta total dos registros
|
---|
| 423 | $numreg = count($account_info);
|
---|
| 424 |
|
---|
| 425 | // numero de registro por paginação
|
---|
| 426 | $numpage = 53;
|
---|
| 427 |
|
---|
| 428 | $tp = ceil($numreg/$numpage);
|
---|
| 429 | $inicio = $page - 1;
|
---|
| 430 | $inicio = $inicio * $numpage;
|
---|
| 431 |
|
---|
| 432 | // valor maximo de paginação
|
---|
| 433 | $totalnpag = (int)($tp/$grupopage);
|
---|
| 434 | $restonpag = $tp % $grupopage;
|
---|
| 435 |
|
---|
| 436 | if ($restonpag > 0)
|
---|
| 437 | {
|
---|
| 438 | $maxtotalnpag = $totalnpag + 1;
|
---|
| 439 | }
|
---|
| 440 | else
|
---|
| 441 | {
|
---|
| 442 | $maxtotalnpag = $totalnpag;
|
---|
| 443 | }
|
---|
| 444 | // inicio fim para imprimir a paginação
|
---|
| 445 | if( $tp > $grupopage)
|
---|
| 446 | {
|
---|
| 447 | // inicio do for da paginação
|
---|
| 448 | if ($gpag <= ($totalnpag))
|
---|
| 449 | {
|
---|
| 450 | $fimgpg = $gpag * $grupopage;
|
---|
| 451 | $iniciogpg = (($fimgpg - $grupopage)+1);
|
---|
| 452 | }
|
---|
| 453 | else
|
---|
| 454 | {
|
---|
| 455 | $iniciogpg = (($gpag - 1) * $grupopage);
|
---|
| 456 | $fimgpg = $iniciogpg + $restonpag;
|
---|
| 457 | }
|
---|
| 458 | }
|
---|
| 459 | else
|
---|
| 460 | {
|
---|
| 461 | // inicio do for da paginação
|
---|
| 462 | $iniciogpg = 1;
|
---|
| 463 | $fimgpg = $tp;
|
---|
| 464 | }
|
---|
| 465 |
|
---|
| 466 | // Imprime valores de contagen de registro e pagina
|
---|
| 467 | $p->set_var('cont_user',$numreg);
|
---|
| 468 | $p->set_var('cont_page',$tp);
|
---|
| 469 | $p->set_var('page_now',$npag);
|
---|
| 470 |
|
---|
| 471 | // ********** busca no LDAP as informação paginada e imprime ****************
|
---|
| 472 | $paginas = $this->functions->Paginate_user('accounts',$setordn,$contexts,'cn','asc',$npag,$numpage);
|
---|
| 473 |
|
---|
| 474 | $tmpp = array();
|
---|
| 475 |
|
---|
| 476 | while (list($null,$accountp) = each($paginas))
|
---|
| 477 | {
|
---|
| 478 | $tmpp[$accountp['uid'][0]]['account_id'] = $accountp['uidNumber'][0];
|
---|
| 479 | $tmpp[$accountp['uid'][0]]['account_lid'] = $accountp['uid'][0];
|
---|
| 480 | $tmpp[$accountp['uid'][0]]['account_cn'] = $accountp['cn'][0];
|
---|
| 481 | $tmpp[$accountp['uid'][0]]['account_phone'] = $accountp['telephoneNumber'][0];
|
---|
| 482 | $tmpp[$accountp['uid'][0]]['account_status']= $accountp['accountStatus'][0];
|
---|
| 483 | $tmpp[$accountp['uid'][0]]['account_mail']= $accountp['mail'][0];
|
---|
| 484 | $sortp[] = $accountp['uid'][0];
|
---|
| 485 | if (count($sortp))
|
---|
| 486 | {
|
---|
| 487 | natcasesort($sortp);
|
---|
| 488 | foreach ($sortp as $user_uidp)
|
---|
| 489 | $returnp[$user_uidp] = $tmpp[$user_uidp];
|
---|
| 490 | }
|
---|
| 491 | }
|
---|
| 492 |
|
---|
| 493 | while (list($null,$accountr) = each($returnp))
|
---|
| 494 | {
|
---|
| 495 | $this->nextmatchs->template_alternate_row_color($p);
|
---|
| 496 |
|
---|
| 497 | $varr = array(
|
---|
| 498 | 'row_loginid' => $accountr['account_lid'],
|
---|
| 499 | 'row_cn' => $accountr['account_cn'],
|
---|
[6920] | 500 | 'row_status' => $accountr['account_status'] == 'active' ? '<font color="#0033FF">'.lang('Activated').'</font> ' : '<font color="#FF0000">'.lang('Disabled').'</font>',
|
---|
[5291] | 501 | 'row_phone' => (!$accountr['account_phone'] ? '-' : $accountr['account_phone']),
|
---|
[6920] | 502 | 'row_mail' => (!$accountr['account_mail'] ? '<font color=red>'.lang('Without E-mail').'</font>' : $accountr['account_mail'])
|
---|
[5291] | 503 | );
|
---|
| 504 |
|
---|
| 505 | $p->set_var($varr);
|
---|
| 506 |
|
---|
| 507 | $p->parse('rows','row',True);
|
---|
| 508 | }
|
---|
| 509 | // ********************** Fim ****************************
|
---|
| 510 |
|
---|
| 511 | // grupo de pagina anteriores
|
---|
| 512 | if ($gpag > 1)
|
---|
| 513 | {
|
---|
| 514 | $gpaga = $gpag - 1;
|
---|
| 515 | $varp = Array(
|
---|
| 516 | 'paginat' => "<form name='anterior' method='POST' action='$url'>
|
---|
| 517 | <input type='hidden' name='setor' value='$grouplist'>
|
---|
| 518 | <input type='hidden' name='organizacao' value='$organizacao'>
|
---|
| 519 | <input type='hidden' name='setordn' value='$setordn'>
|
---|
| 520 | <input type='hidden' name='organizacaodn' value='$organizacaodn'>
|
---|
| 521 | <input type='hidden' name='page' value='$npag'>
|
---|
| 522 | <input type='hidden' name='gpage' value='$gpaga'>
|
---|
| 523 | <input type='hidden' name='Psectornamedncompleto' value='$sectornamedncompleto'>
|
---|
| 524 | <div style='float:left;' onClick='document.anterior.submit()'><a href='#'>".lang('Previous Pages')."<< </a></div></form>"
|
---|
| 525 | );
|
---|
| 526 | $p->set_var($varp);
|
---|
| 527 |
|
---|
| 528 | $p->parse('pages','rowpag',True);
|
---|
| 529 | }
|
---|
| 530 | // **** FIM *******
|
---|
| 531 |
|
---|
| 532 | // imprime a paginação
|
---|
| 533 | if ($fimgpg > 1)
|
---|
| 534 | {
|
---|
| 535 | for($x = $iniciogpg; $x <= $fimgpg; $x++)
|
---|
| 536 | {
|
---|
| 537 | $varp = Array(
|
---|
| 538 | 'paginat' => "<form name='form".$x."' method='POST' action='$url'>
|
---|
| 539 | <input type='hidden' name='setor' value='$grouplist'>
|
---|
| 540 | <input type='hidden' name='organizacao' value='$organizacao'>
|
---|
| 541 | <input type='hidden' name='setordn' value='$setordn'>
|
---|
| 542 | <input type='hidden' name='organizacaodn' value='$organizacaodn'>
|
---|
| 543 | <input type='hidden' name='page' value='$x'>
|
---|
| 544 | <input type='hidden' name='gpage' value='$gpag'>
|
---|
| 545 | <input type='hidden' name='Psectornamedncompleto' value='$sectornamedncompleto'>
|
---|
| 546 | <div style='float:left;' onClick='document.form".$x.".submit()'><a href='#'>$x </a></div></form>"
|
---|
| 547 | );
|
---|
| 548 |
|
---|
| 549 | $p->set_var($varp);
|
---|
| 550 |
|
---|
| 551 | $p->parse('pages','rowpag',True);
|
---|
| 552 | }
|
---|
| 553 | }
|
---|
| 554 |
|
---|
| 555 | // proximo grupo de pagina
|
---|
| 556 | if ($gpag < $maxtotalnpag && $maxtotalnpag > 0)
|
---|
| 557 | {
|
---|
| 558 | $gpagp = $gpag + 1;
|
---|
| 559 | $varp = Array(
|
---|
| 560 | 'paginat' => "<form name='proximo' method='POST' action='$url'>
|
---|
| 561 | <input type='hidden' name='setor' value='$grouplist'>
|
---|
| 562 | <input type='hidden' name='organizacao' value='$organizacao'>
|
---|
| 563 | <input type='hidden' name='setordn' value='$setordn'>
|
---|
| 564 | <input type='hidden' name='organizacaodn' value='$organizacaodn'>
|
---|
| 565 | <input type='hidden' name='page' value='$npag'>
|
---|
| 566 | <input type='hidden' name='gpage' value='$gpagp'>
|
---|
| 567 | <input type='hidden' name='Psectornamedncompleto' value='$sectornamedncompleto'>
|
---|
| 568 | <div style='float:left;' onClick='document.proximo.submit()'><a href='#'> >>".lang('Next Page')."</a></div></form>"
|
---|
| 569 | );
|
---|
| 570 | $p->set_var($varp);
|
---|
| 571 |
|
---|
| 572 | $p->parse('pages','rowpag',True);
|
---|
| 573 | }
|
---|
| 574 |
|
---|
| 575 | // ************************* FIM PAGINAÇÃO ***********************
|
---|
| 576 | }
|
---|
| 577 |
|
---|
| 578 | $p->pfp('out','body');
|
---|
| 579 | }
|
---|
| 580 |
|
---|
| 581 | function get_user_info($userdn,$usercontexts,$usersizelimit)
|
---|
| 582 | {
|
---|
| 583 | $user_info = $this->functions->Paginate_user('accounts',$setordn,$contexts,'cn','asc',$npag,$numpage);
|
---|
| 584 |
|
---|
| 585 | return $user_info;
|
---|
| 586 | }
|
---|
| 587 |
|
---|
| 588 | function css()
|
---|
| 589 | {
|
---|
| 590 | $appCSS =
|
---|
| 591 | 'th.activetab
|
---|
| 592 | {
|
---|
| 593 | color:#000000;
|
---|
| 594 | background-color:#D3DCE3;
|
---|
| 595 | border-top-width : 1px;
|
---|
| 596 | border-top-style : solid;
|
---|
| 597 | border-top-color : Black;
|
---|
| 598 | border-left-width : 1px;
|
---|
| 599 | border-left-style : solid;
|
---|
| 600 | border-left-color : Black;
|
---|
| 601 | border-right-width : 1px;
|
---|
| 602 | border-right-style : solid;
|
---|
| 603 | border-right-color : Black;
|
---|
| 604 | font-size: 12px;
|
---|
| 605 | font-family: Tahoma, Arial, Helvetica, sans-serif;
|
---|
| 606 | }
|
---|
| 607 |
|
---|
| 608 | th.inactivetab
|
---|
| 609 | {
|
---|
| 610 | color:#000000;
|
---|
| 611 | background-color:#E8F0F0;
|
---|
| 612 | border-bottom-width : 1px;
|
---|
| 613 | border-bottom-style : solid;
|
---|
| 614 | border-bottom-color : Black;
|
---|
| 615 | font-size: 12px;
|
---|
| 616 | font-family: Tahoma, Arial, Helvetica, sans-serif;
|
---|
| 617 | }
|
---|
| 618 |
|
---|
| 619 | .td_left {border-left:1px solid Gray; border-top:1px solid Gray; border-bottom:1px solid Gray;}
|
---|
| 620 | .td_right {border-right:1px solid Gray; border-top:1px solid Gray; border-bottom:1px solid Gray;}
|
---|
| 621 |
|
---|
| 622 | div.activetab{ display:inline; }
|
---|
| 623 | div.inactivetab{ display:none; }';
|
---|
| 624 |
|
---|
| 625 | return $appCSS;
|
---|
| 626 | }
|
---|
| 627 |
|
---|
| 628 | }
|
---|
| 629 | ?>
|
---|