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