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