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