[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_logon
|
---|
| 13 | {
|
---|
| 14 | var $public_functions = array
|
---|
| 15 | (
|
---|
| 16 | 'report_logon_print_pdf' => True,
|
---|
| 17 | 'report_logon_group' => True,
|
---|
| 18 | 'report_logon_group_setor_print' => True,
|
---|
| 19 | 'show_access' => True,
|
---|
| 20 | 'get_user_info' => True,
|
---|
| 21 | 'css' => True
|
---|
| 22 | );
|
---|
| 23 |
|
---|
| 24 | var $nextmatchs;
|
---|
| 25 | var $user;
|
---|
| 26 | var $functions;
|
---|
| 27 | var $current_config;
|
---|
| 28 | var $ldap_functions;
|
---|
| 29 | var $db_functions;
|
---|
| 30 |
|
---|
| 31 | function uireports_logon()
|
---|
| 32 | {
|
---|
| 33 | $this->user = CreateObject('reports.user');
|
---|
| 34 | $this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
---|
| 35 | $this->functions = CreateObject('reports.functions');
|
---|
| 36 | $this->ldap_functions = CreateObject('reports.ldap_functions');
|
---|
| 37 | $this->db_functions = CreateObject('reports.db_functions');
|
---|
| 38 | $this->fpdf = CreateObject('reports.uireports_fpdf'); // Class para PDF
|
---|
| 39 |
|
---|
| 40 | $c = CreateObject('phpgwapi.config','reports'); // cria o objeto relatorio no $c
|
---|
| 41 | $c->read_repository(); // na classe config do phpgwapi le os dados da tabela phpgw_config where relatorio, como passagem acima
|
---|
| 42 | $this->current_config = $c->config_data; // carrega os dados em do array no current_config
|
---|
| 43 |
|
---|
| 44 | if(!@is_object($GLOBALS['phpgw']->js))
|
---|
| 45 | {
|
---|
| 46 | $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
|
---|
| 47 | }
|
---|
| 48 | $GLOBALS['phpgw']->js->validate_file('jscode','cc','reports');
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | function report_logon_print_pdf()
|
---|
| 52 | {
|
---|
| 53 | $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
|
---|
| 54 | $acl = $this->functions->read_acl($account_lid);
|
---|
| 55 | $raw_context = $acl['raw_context'];
|
---|
| 56 | $contexts = $acl['contexts'];
|
---|
| 57 | foreach ($acl['contexts_display'] as $index=>$tmp_context)
|
---|
| 58 | {
|
---|
| 59 | $context_display .= $tmp_context;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 | if (!$this->functions->check_acl($account_lid,'list_users'))
|
---|
| 64 | {
|
---|
| 65 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/reports/inc/access_denied.php'));
|
---|
| 66 | }
|
---|
| 67 |
|
---|
[7681] | 68 | $grouplist = trim($_POST['setor']);
|
---|
[6920] | 69 | $grouplist = trim(ereg_replace("-","",$grouplist));
|
---|
[5291] | 70 |
|
---|
[7681] | 71 | $setordn = trim($_POST['setordn']);
|
---|
| 72 | $subtitulo1 = trim($_POST['subtitulo']);
|
---|
[5291] | 73 |
|
---|
[7681] | 74 | $vnumacesso = trim($_POST['nacesso']);
|
---|
[5291] | 75 | $numacesso = abs(round($vnumacesso));
|
---|
| 76 |
|
---|
| 77 | if ($vnumacesso==999){
|
---|
[6920] | 78 | $numacesso = lang('Never login');
|
---|
[5291] | 79 | }
|
---|
| 80 |
|
---|
| 81 |
|
---|
| 82 | define('FPDF_FONTPATH','font/');
|
---|
| 83 | $data_atual = date("d/m/Y");
|
---|
| 84 | $titulo_system = $GLOBALS['phpgw_info']['apps']['reports']['title'];
|
---|
| 85 |
|
---|
| 86 | $pdf=new uireports_fpdf("L");
|
---|
| 87 | $pdf->Open();
|
---|
| 88 | $pdf->AddPage();
|
---|
| 89 |
|
---|
| 90 | //Set font and colors
|
---|
| 91 | $pdf->SetFont('Arial','B',14);
|
---|
| 92 | $pdf->SetFillColor(0,0,0);
|
---|
| 93 | $pdf->SetTextColor(0,0,200);
|
---|
| 94 | $pdf->SetDrawColor(0,0,0);
|
---|
| 95 | $pdf->SetLineWidth(.2);
|
---|
| 96 |
|
---|
| 97 | //Table header
|
---|
| 98 | $SubTitulo = lang('reports title6');
|
---|
[6920] | 99 | $SubTituloR = lang('Report Generated by Expresso Reports');
|
---|
[5291] | 100 | $SubTitulo1 = $subtitulo1;
|
---|
| 101 | $GLOBALS['phpgw_info']['apps']['reports']['subtitle'] = $SubTituloR;
|
---|
| 102 | $pdf->Cell(0,8,$SubTitulo,0,1,'C',0);
|
---|
| 103 |
|
---|
| 104 |
|
---|
| 105 | //Set font and colors
|
---|
| 106 | $pdf->SetFont('Arial','B',8);
|
---|
| 107 | $pdf->SetFillColor(0,0,0);
|
---|
| 108 | $pdf->SetTextColor(0,0,200);
|
---|
| 109 | $pdf->SetDrawColor(0,0,0);
|
---|
| 110 | $pdf->SetLineWidth(.3);
|
---|
| 111 |
|
---|
| 112 | // $pdf->Cell(0,10,$SubTitulo1,0,1,'C',0);
|
---|
| 113 | $pdf->MultiCell(0,3,$SubTitulo1,0,'C',0);
|
---|
| 114 |
|
---|
| 115 | $pdf->Cell(0,2,' ',0,1,'C',0);
|
---|
| 116 | $pdf->Cell(0,5,'Data..: '.$data_atual,0,0,'L',0);
|
---|
| 117 | $pdf->Cell(0,5,$titulo_system,0,1,'R',0);
|
---|
| 118 |
|
---|
| 119 | $account_info = $this->functions->get_list_user_sector_logon($setordn,$contexts,0,$numacesso);
|
---|
| 120 |
|
---|
| 121 | if (count($account_info))
|
---|
| 122 | {
|
---|
| 123 | //Restore font and colors
|
---|
| 124 | $pdf->SetFont('Arial','',8);
|
---|
| 125 | $pdf->SetFillColor(224,235,255);
|
---|
| 126 | $pdf->SetTextColor(0);
|
---|
| 127 |
|
---|
| 128 | $pdf->Cell(60,5,lang('loginid'),1,0,'L',1);
|
---|
| 129 | $pdf->Cell(60,5,lang('name'),1,0,'L',1);
|
---|
| 130 | $pdf->Cell(70,5,lang('report email'),1,0,'L',1);
|
---|
| 131 | $pdf->Cell(25,5,lang('Creation Date'),1,0,'C',1);
|
---|
| 132 | $pdf->Cell(25,5,lang('Last access'),1,0,'C',1);
|
---|
| 133 | $pdf->Cell(22,5,lang('Days without login'),1,0,'L',1);
|
---|
| 134 | $pdf->Cell(18,5,lang('status'),1,1,'L',1);
|
---|
| 135 |
|
---|
| 136 |
|
---|
| 137 | while (list($null,$accountp) = each($account_info))
|
---|
| 138 | {
|
---|
| 139 |
|
---|
| 140 | $access_log = $this->functions->show_access_log($accountp['account_id']);
|
---|
| 141 |
|
---|
| 142 | $access_log_array = explode("#",$access_log);
|
---|
| 143 |
|
---|
| 144 | $accountp['li_dias'] = $access_log_array[1];
|
---|
| 145 | $accountp['li_date'] = $access_log_array[0];
|
---|
| 146 |
|
---|
| 147 | $tmpp[$contap]['account_id'] = $accountp['account_id'];
|
---|
| 148 | $tmpp[$contap]['account_lid'] = $accountp['account_lid'];
|
---|
| 149 | $tmpp[$contap]['account_cn'] = $accountp['account_cn'];
|
---|
| 150 | $tmpp[$contap]['account_status'] = $accountp['account_accountstatus'];
|
---|
| 151 | $tmpp[$contap]['account_mail'] = $accountp['account_mail'];
|
---|
| 152 | $tmpp[$contap]['createTimestamp'] = $accountp['createtimestamp'];
|
---|
| 153 | $tmpp[$contap]['li_dias']= $accountp['li_dias'];
|
---|
| 154 | $tmpp[$contap]['li_date']= $accountp['li_date'];
|
---|
| 155 |
|
---|
| 156 | $sortp[] = $accountp['li_dias'];
|
---|
| 157 |
|
---|
| 158 | if (count($sortp))
|
---|
| 159 | {
|
---|
| 160 | natcasesort($sortp);
|
---|
| 161 | }
|
---|
| 162 |
|
---|
| 163 | $contap = $contap + 1;
|
---|
| 164 | }
|
---|
| 165 |
|
---|
| 166 | while (list($key,$accountr1) = each($sortp))
|
---|
| 167 | {
|
---|
| 168 | if ($key == 0){
|
---|
| 169 | $key = '';
|
---|
| 170 | $returnp[] = $tmpp[$key];
|
---|
| 171 | }else{
|
---|
| 172 | $returnp[] = $tmpp[$key];
|
---|
| 173 | }
|
---|
| 174 | }
|
---|
| 175 |
|
---|
| 176 | $returnp = array_reverse($returnp);
|
---|
| 177 |
|
---|
| 178 | while (list($null,$accountr) = each($returnp))
|
---|
| 179 | {
|
---|
| 180 | $row_cn = $accountr['account_cn'];
|
---|
| 181 | $account_lid = $accountr['account_lid'];
|
---|
[6920] | 182 | $row_mail = (!$accountr['account_mail'] ? lang('Without E-mail') : $accountr['account_mail']);
|
---|
[5291] | 183 | $row_timestamp = substr($accountr['createTimestamp'], 6, 2)."/".substr($accountr['createTimestamp'], 4, 2)."/".substr($accountr['createTimestamp'], 0, 4);
|
---|
[6920] | 184 | $row_li_date = $accountr['li_date'] == lang('Never login') ? lang('Never login') : $accountr['li_date'];
|
---|
[5291] | 185 | $row_li_dias = $accountr['li_dias'];
|
---|
[6920] | 186 | $row_status = $accountr['account_status'] == 'active' ? lang('Activated') : lang('Disabled');
|
---|
[5291] | 187 |
|
---|
| 188 | $pdf->Cell(60,5,$account_lid,0,0,'L',0);
|
---|
| 189 | $pdf->Cell(60,5,$row_cn,0,0,'L',0);
|
---|
| 190 | $pdf->Cell(70,5,$row_mail,0,0,'L',0);
|
---|
| 191 | $pdf->Cell(25,5,$row_timestamp,0,0,'C',0);
|
---|
| 192 |
|
---|
[6920] | 193 | if ($row_li_date == lang('Never login'))
|
---|
[5291] | 194 | {
|
---|
| 195 | //Muda cor fonte
|
---|
| 196 | $pdf->SetTextColor(256,0,0);
|
---|
| 197 | $pdf->Cell(25,5,$row_li_date,0,0,'C',0);
|
---|
| 198 | //Restaura cor fonte
|
---|
| 199 | $pdf->SetTextColor(0);
|
---|
| 200 | }
|
---|
| 201 | else
|
---|
| 202 | {
|
---|
| 203 | //Restaura cor fonte
|
---|
| 204 | $pdf->SetTextColor(0);
|
---|
| 205 | $pdf->Cell(25,5,$row_li_date,0,0,'C',0);
|
---|
| 206 | }
|
---|
| 207 |
|
---|
| 208 | $pdf->Cell(22,5,$row_li_dias,0,0,'C',0);
|
---|
| 209 |
|
---|
| 210 | if ($row_status == 'Ativado')
|
---|
| 211 | {
|
---|
| 212 | //Restaura cor fonte
|
---|
| 213 | $pdf->SetTextColor(0);
|
---|
| 214 | $pdf->Cell(18,5,$row_status,0,1,'L',0);
|
---|
| 215 | }
|
---|
| 216 | else
|
---|
| 217 | {
|
---|
| 218 | //Muda cor fonte
|
---|
| 219 | $pdf->SetTextColor(256,0,0);
|
---|
| 220 | $pdf->Cell(18,5,$row_status,0,1,'L',0);
|
---|
| 221 | //Restaura cor fonte
|
---|
| 222 | $pdf->SetTextColor(0);
|
---|
| 223 | }
|
---|
| 224 | }
|
---|
| 225 | }
|
---|
| 226 |
|
---|
| 227 | $pdf->Output();
|
---|
| 228 |
|
---|
| 229 | return;
|
---|
| 230 | }
|
---|
| 231 |
|
---|
| 232 | function report_logon_group()
|
---|
| 233 | {
|
---|
| 234 | $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
|
---|
| 235 | $manager_acl = $this->functions->read_acl($account_lid);
|
---|
| 236 | $raw_context = $acl['raw_context'];
|
---|
| 237 | $contexts = $manager_acl['contexts'];
|
---|
| 238 | $conta_context = count($manager_acl['contexts_display']);
|
---|
| 239 | foreach ($manager_acl['contexts_display'] as $index=>$tmp_context)
|
---|
| 240 | {
|
---|
| 241 | $index = $index +1;
|
---|
| 242 |
|
---|
| 243 | if ($conta_context == $index)
|
---|
| 244 | {
|
---|
| 245 | $context_display .= $tmp_context;
|
---|
| 246 | }
|
---|
| 247 | else
|
---|
| 248 | {
|
---|
| 249 | $context_display .= $tmp_context.' | ';
|
---|
| 250 | }
|
---|
| 251 | }
|
---|
| 252 |
|
---|
| 253 | // Verifica se tem acesso a este modulo
|
---|
| 254 | if (!$this->functions->check_acl($account_lid,'list_sectors'))
|
---|
| 255 | {
|
---|
| 256 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/reports/inc/access_denied.php'));
|
---|
| 257 | }
|
---|
| 258 |
|
---|
| 259 | unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
---|
| 260 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
---|
| 261 |
|
---|
| 262 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['reports']['title'].' - '.lang('report of time without logging by Organization');
|
---|
| 263 | $GLOBALS['phpgw']->common->phpgw_header();
|
---|
| 264 |
|
---|
| 265 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
---|
| 266 | $p->set_file(array('groups' => 'report_logon_group.tpl'));
|
---|
| 267 | $p->set_block('groups','list','list');
|
---|
| 268 | $p->set_block('groups','row','row');
|
---|
| 269 | $p->set_block('groups','row_empty','row_empty');
|
---|
| 270 |
|
---|
| 271 | // Seta as variaveis padroes.
|
---|
| 272 | $var = Array(
|
---|
| 273 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
---|
| 274 | 'back_url' => $GLOBALS['phpgw']->link('/reports/index.php'),
|
---|
| 275 | 'context_display' => $context_display
|
---|
| 276 | );
|
---|
| 277 | $p->set_var($var);
|
---|
| 278 | $p->set_var($this->functions->make_dinamic_lang($p, 'list'));
|
---|
| 279 |
|
---|
| 280 |
|
---|
| 281 | $GLOBALS['organizacaodn'] = $_POST['organizacaodn'];
|
---|
| 282 |
|
---|
| 283 | $contextsdn = $GLOBALS['organizacaodn'];
|
---|
| 284 |
|
---|
| 285 | // Save query
|
---|
| 286 | $varorganizacao = explode(",",$contextsdn);
|
---|
[6920] | 287 | $varorganizacao_nome = trim(strtoupper(ereg_replace("ou=","",$varorganizacao[0])));
|
---|
| 288 | $varorganizacao_nome = trim(strtoupper(ereg_replace("DC=","",$varorganizacao_nome)));
|
---|
[5291] | 289 | $user_logon = $GLOBALS['phpgw_info']['user'][account_lid];
|
---|
| 290 |
|
---|
| 291 | // carrega os grupos no listbox
|
---|
| 292 | /************* DESCOMENTE ESTE PARTE DO CODIGO PARA LISTAR TODOS OS GRUPOS, SEM LISTAR POR USUSARIO LOGADO ***********
|
---|
| 293 | $sectors_info = $this->functions->get_groups_list($contexts,"*");
|
---|
| 294 | $sectors_info_dn = $this->functions->get_groups_list_dn($contexts,"*");
|
---|
| 295 | /* ************************************* FIM *********************************************************************** */
|
---|
| 296 |
|
---|
| 297 | $sectors_info = $this->functions->get_list_context_logon($user_logon,$contexts,0);
|
---|
| 298 | $sectors_info_dn = $this->functions->get_list_groups_dn($user_logon,$contexts,0);
|
---|
| 299 |
|
---|
| 300 | if (!count($sectors_info))
|
---|
| 301 | {
|
---|
| 302 | $p->set_var('notselect',lang('No matches found'));
|
---|
| 303 | }
|
---|
| 304 | else
|
---|
| 305 | {
|
---|
| 306 | foreach($sectors_info as $context=>$sector)
|
---|
| 307 | {
|
---|
| 308 |
|
---|
| 309 | $sectordn = $sectors_info_dn[$context];
|
---|
| 310 |
|
---|
| 311 | $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
|
---|
| 312 |
|
---|
| 313 | if ($context == 0 && $contextsdn <> "")
|
---|
| 314 | {
|
---|
| 315 | if (trim(strtoupper($varorganizacao_nome)) == trim(strtoupper($sector)))
|
---|
| 316 | {
|
---|
| 317 | $sector_options .= "<option selected value='" .$contextsdn. "'>" .$varorganizacao_nome. "</option>";
|
---|
| 318 | }
|
---|
| 319 | else
|
---|
| 320 | {
|
---|
| 321 | $sector_options .= "<option selected value='" .$contextsdn. "'>" .$varorganizacao_nome. "</option>";
|
---|
| 322 | $sector_options .= "<option value='" . $sectordn . "'>". $sector . "</option>";
|
---|
| 323 | }
|
---|
| 324 |
|
---|
| 325 | }
|
---|
| 326 | else
|
---|
| 327 | {
|
---|
| 328 | if ( trim(strtoupper($varorganizacao_nome)) != trim(strtoupper($sector)))
|
---|
| 329 | {
|
---|
[6920] | 330 | $sectorok = trim(strtoupper(ereg_replace("dc=","",$sector)));
|
---|
| 331 | $sectorok = trim(strtoupper(ereg_replace("dc=","",$sectorok)));
|
---|
[5291] | 332 | $sector_options .= "<option value='" . $sectordn . "'>". $sectorok . "</option>";
|
---|
| 333 | }
|
---|
| 334 | }
|
---|
| 335 |
|
---|
| 336 | $varselect = Array(
|
---|
| 337 | 'tr_color' => $tr_color,
|
---|
| 338 | 'organizacaodn' => $contextsdn,
|
---|
| 339 | 'group_name' => $sector_options
|
---|
| 340 | );
|
---|
| 341 | }
|
---|
| 342 |
|
---|
| 343 | $p->set_var($varselect);
|
---|
| 344 | }
|
---|
| 345 |
|
---|
| 346 | // ************** inicio carregar a sub-lista das organizações ****************
|
---|
| 347 | //Admin make a search
|
---|
| 348 | if ($GLOBALS['organizacaodn'] != '')
|
---|
| 349 | {
|
---|
| 350 | // Conta a quantidade de Usuario do grupo raiz
|
---|
| 351 | $account_user = $this->functions->get_count_user_sector($contextsdn,$contexts,0);
|
---|
| 352 | $totaluser = "(".$account_user.")";
|
---|
| 353 |
|
---|
| 354 | $p->set_var('organizacao', $varorganizacao_nome);
|
---|
| 355 | $p->set_var('all_user', lang('all'));
|
---|
| 356 | $p->set_var('total_user', $totaluser);
|
---|
| 357 |
|
---|
| 358 | $setorg = $contextsdn;
|
---|
| 359 |
|
---|
| 360 | $groups_info = $this->functions->get_sectors_list($contexts,$setorg);
|
---|
| 361 |
|
---|
| 362 | if (!count($groups_info))
|
---|
| 363 | {
|
---|
| 364 | $p->set_var('message',lang('No sector found'));
|
---|
| 365 | $p->parse('rows','row_empty',True);
|
---|
| 366 | }
|
---|
| 367 | else
|
---|
| 368 | {
|
---|
| 369 | $ii = 0;
|
---|
| 370 | foreach($groups_info as $context=>$groups)
|
---|
| 371 | {
|
---|
| 372 | $explode_groups = explode("#",$groups);
|
---|
| 373 | $ii = $ii + 1;
|
---|
| 374 | $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
|
---|
| 375 | $varsuborg = Array(
|
---|
| 376 | 'tr_color' => $tr_color,
|
---|
| 377 | 'div_nacesso' => "div_nacesso".$ii,
|
---|
| 378 | 'formname' => "form".$ii,
|
---|
| 379 | 'formsubmit' => "document.form".$ii.".submit()",
|
---|
| 380 | 'sector_name' => $explode_groups[0],
|
---|
| 381 | 'sector_namedn' => $explode_groups[1],
|
---|
| 382 | 'sector_namedn_completo' => $explode_groups[2],
|
---|
| 383 | );
|
---|
| 384 |
|
---|
| 385 | $p->set_var($varsuborg);
|
---|
| 386 | $p->parse('rows','row',True);
|
---|
| 387 | }
|
---|
| 388 | }
|
---|
| 389 | }
|
---|
| 390 |
|
---|
| 391 | $p->pfp('out','list');
|
---|
| 392 | }
|
---|
| 393 |
|
---|
| 394 | function report_logon_group_setor_print()
|
---|
| 395 | {
|
---|
[7730] | 396 | $vnumacesso = trim($_POST['nacesso']);
|
---|
[5291] | 397 | $numacesso = abs(round($vnumacesso));
|
---|
| 398 |
|
---|
| 399 | if ($vnumacesso==999){
|
---|
| 400 | $numacesso = "Nunca logou";
|
---|
| 401 | }
|
---|
| 402 |
|
---|
[7681] | 403 | $grouplist = trim($_POST['setor']);
|
---|
[6920] | 404 | $grouplist = trim(ereg_replace("-","",$grouplist));
|
---|
[7681] | 405 | $organizacao = trim($_POST['organizacao']);
|
---|
| 406 | $setordn = trim($_POST['setordn']);
|
---|
| 407 | $organizacaodn = trim($_POST['organizacaodn']);
|
---|
| 408 | $sectornamedncompleto = trim($_POST['sectornamedncompleto']);
|
---|
| 409 | $Psectornamedncompleto = trim($_POST['Psectornamedncompleto']);
|
---|
[5291] | 410 |
|
---|
| 411 | if ($sectornamedncompleto=="" && $Psectornamedncompleto=="")
|
---|
| 412 | {
|
---|
| 413 | $sectornamedncompleto = $organizacao;
|
---|
| 414 | }
|
---|
| 415 | else if ($sectornamedncompleto=="" && $Psectornamedncompleto <> "")
|
---|
| 416 | {
|
---|
| 417 | $sectornamedncompleto = $Psectornamedncompleto;
|
---|
| 418 | }
|
---|
| 419 | else
|
---|
| 420 | {
|
---|
| 421 | $sectornamedncompleto = $organizacao." | ".$sectornamedncompleto;
|
---|
| 422 | }
|
---|
| 423 |
|
---|
| 424 | $data_atual = date("d/m/Y");
|
---|
| 425 | $titulo_system = $GLOBALS['phpgw_info']['apps']['reports']['title'];
|
---|
| 426 |
|
---|
| 427 | $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
|
---|
| 428 | $acl = $this->functions->read_acl($account_lid);
|
---|
| 429 | $raw_context = $acl['raw_context'];
|
---|
| 430 | $contexts = $acl['contexts'];
|
---|
| 431 | foreach ($acl['contexts_display'] as $index=>$tmp_context)
|
---|
| 432 | {
|
---|
| 433 | $context_display .= $tmp_context;
|
---|
| 434 | }
|
---|
| 435 | // Verifica se o administrador tem acesso.
|
---|
| 436 | if (!$this->functions->check_acl($account_lid,'list_users'))
|
---|
| 437 | {
|
---|
| 438 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/reports/inc/access_denied.php'));
|
---|
| 439 | }
|
---|
| 440 |
|
---|
| 441 | unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
---|
| 442 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
---|
| 443 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['reports']['title'].' - '.lang('report user');
|
---|
| 444 | $GLOBALS['phpgw']->common->phpgw_header();
|
---|
| 445 |
|
---|
| 446 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
---|
| 447 | $p->set_file(Array('accounts' => 'report_logon_group_print.tpl'));
|
---|
| 448 | $p->set_block('accounts','body');
|
---|
| 449 | $p->set_block('accounts','rowpag');
|
---|
| 450 | $p->set_block('accounts','row');
|
---|
| 451 | $p->set_block('accounts','row_empty');
|
---|
| 452 |
|
---|
| 453 | $var = Array(
|
---|
| 454 | 'bg_color' => $GLOBALS['phpgw_info']['theme']['bg_color'],
|
---|
| 455 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
---|
| 456 | 'subtitulo' => lang('reports title6'),
|
---|
| 457 | 'subtitulo1' => $sectornamedncompleto,
|
---|
| 458 | 'context' => $raw_context,
|
---|
| 459 | 'titulo' => $titulo_system,
|
---|
| 460 | 'data_atual' => $data_atual,
|
---|
| 461 | 'context_display' => $context_display,
|
---|
| 462 | 'organizacaodn' => $organizacaodn,
|
---|
| 463 | 'organizacao' => $organizacao,
|
---|
| 464 | 'sector_name' => $grouplist,
|
---|
| 465 | 'sector_namedn' => $setordn,
|
---|
| 466 | 'nacesso' => $vnumacesso,
|
---|
| 467 | 'imapDelimiter' => $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter']
|
---|
| 468 | );
|
---|
| 469 |
|
---|
| 470 | $p->set_var($var);
|
---|
| 471 | $p->set_var($this->functions->make_dinamic_lang($p, 'body'));
|
---|
| 472 |
|
---|
| 473 | // ************ PAGINAÇÃO *******************************
|
---|
| 474 |
|
---|
| 475 |
|
---|
[6920] | 476 | if ($vnumacesso==0){
|
---|
| 477 | $numreg = $this->functions->get_num_users_sector($setordn,$contexts);
|
---|
| 478 | if ($numreg==0){
|
---|
| 479 | $p->set_var('message',lang('No user found'));
|
---|
| 480 | $p->parse('rows','row_empty',True);
|
---|
| 481 | }
|
---|
| 482 | else {
|
---|
[5291] | 483 | //url do paginador
|
---|
| 484 | $url = $GLOBALS['phpgw_info']['server']['webserver_url'].'/index.php?menuaction=reports.uireports_logon.report_logon_group_setor_print';
|
---|
| 485 |
|
---|
| 486 | // **** Grupo de paginas ****
|
---|
[7681] | 487 | $gpag = $_POST['gpage'];
|
---|
[5291] | 488 |
|
---|
| 489 | $grupopage = 20;
|
---|
| 490 |
|
---|
| 491 | if (!$gpag){
|
---|
| 492 | $gpag = 1;
|
---|
| 493 | }
|
---|
| 494 |
|
---|
| 495 | // recebe o numero da pagina
|
---|
[7681] | 496 | $npag = $_POST['page'];
|
---|
[5291] | 497 |
|
---|
| 498 | // verifica se o get com o numero da pagina é nulo
|
---|
| 499 | if (!$npag)
|
---|
| 500 | {
|
---|
| 501 | $npag = 1;
|
---|
| 502 | }
|
---|
| 503 |
|
---|
| 504 | // conta total dos registros
|
---|
| 505 |
|
---|
| 506 | // numero de registro por paginação
|
---|
| 507 | $numpage = 53;
|
---|
| 508 |
|
---|
| 509 | $tp = ceil($numreg/$numpage);
|
---|
| 510 | $inicio = $page - 1;
|
---|
| 511 | $inicio = $inicio * $numpage;
|
---|
| 512 |
|
---|
| 513 | // valor maximo de paginação
|
---|
| 514 | $totalnpag = (int)($tp/$grupopage);
|
---|
| 515 | $restonpag = $tp % $grupopage;
|
---|
| 516 |
|
---|
| 517 | if ($restonpag > 0)
|
---|
| 518 | {
|
---|
| 519 | $maxtotalnpag = $totalnpag + 1;
|
---|
| 520 | }
|
---|
| 521 | else
|
---|
| 522 | {
|
---|
| 523 | $maxtotalnpag = $totalnpag;
|
---|
| 524 | }
|
---|
| 525 | // inicio fim para imprimir a paginação
|
---|
| 526 | if( $tp > $grupopage)
|
---|
| 527 | {
|
---|
| 528 | // inicio do for da paginação
|
---|
| 529 | if ($gpag <= ($totalnpag))
|
---|
| 530 | {
|
---|
| 531 | $fimgpg = $gpag * $grupopage;
|
---|
| 532 | $iniciogpg = (($fimgpg - $grupopage)+1);
|
---|
| 533 | }
|
---|
| 534 | else
|
---|
| 535 | {
|
---|
| 536 | $iniciogpg = (($gpag - 1) * $grupopage);
|
---|
| 537 | $fimgpg = $iniciogpg + $restonpag;
|
---|
| 538 | }
|
---|
| 539 | }
|
---|
| 540 | else
|
---|
| 541 | {
|
---|
| 542 | // inicio do for da paginação
|
---|
| 543 | $iniciogpg = 1;
|
---|
| 544 | $fimgpg = $tp;
|
---|
| 545 | }
|
---|
| 546 |
|
---|
| 547 |
|
---|
| 548 | // Imprime valores de contagen de registro e pagina
|
---|
| 549 | $p->set_var('cont_user',$numreg);
|
---|
| 550 | $p->set_var('cont_page',$tp);
|
---|
| 551 | $p->set_var('page_now',$npag);
|
---|
| 552 |
|
---|
| 553 | // ********** busca no LDAP as informação paginada e imprime ****************
|
---|
| 554 | $paginas = $this->functions->Paginate_user_logon('accounts',$setordn,$contexts,'cn','asc',$npag,$numpage,$numacesso);
|
---|
| 555 |
|
---|
| 556 | $tmpp = array();
|
---|
| 557 | $contap = 0;
|
---|
| 558 | while (list($null,$accountp) = each($paginas))
|
---|
| 559 | {
|
---|
| 560 | $access_log = $this->functions->show_access_log($accountp['uidNumber'][0]);
|
---|
| 561 |
|
---|
| 562 | $access_log_array = explode("#",$access_log);
|
---|
| 563 |
|
---|
| 564 | $accountp['li_dias'][0] = $access_log_array[1];
|
---|
| 565 | $accountp['li_date'][0] = $access_log_array[0];
|
---|
| 566 |
|
---|
| 567 | $tmpp[$contap]['account_id'] = $accountp['uidNumber'][0];
|
---|
| 568 | $tmpp[$contap]['account_lid'] = $accountp['uid'][0];
|
---|
| 569 | $tmpp[$contap]['account_cn'] = $accountp['cn'][0];
|
---|
| 570 | $tmpp[$contap]['account_status'] = $accountp['accountStatus'][0];
|
---|
| 571 | $tmpp[$contap]['account_mail'] = $accountp['mail'][0];
|
---|
| 572 | $tmpp[$contap]['createTimestamp'] = $accountp['createTimestamp'][0];
|
---|
| 573 | $tmpp[$contap]['li_dias']= $accountp['li_dias'][0];
|
---|
| 574 | $tmpp[$contap]['li_date']= $accountp['li_date'][0];
|
---|
| 575 |
|
---|
| 576 | $sortp[] = $accountp['li_dias'][0];
|
---|
| 577 |
|
---|
| 578 | if (count($sortp))
|
---|
| 579 | {
|
---|
| 580 | natcasesort($sortp);
|
---|
| 581 | }
|
---|
| 582 |
|
---|
| 583 | $contap = $contap + 1;
|
---|
| 584 | }
|
---|
| 585 |
|
---|
| 586 | while (list($key,$accountr1) = each($sortp))
|
---|
| 587 | {
|
---|
| 588 | $returnp[] = $tmpp[$key];
|
---|
| 589 | }
|
---|
| 590 |
|
---|
| 591 | $returnp = array_reverse($returnp);
|
---|
| 592 |
|
---|
| 593 | $ii = 0;
|
---|
| 594 |
|
---|
| 595 | while (list($null,$accountr) = each($returnp))
|
---|
| 596 | {
|
---|
| 597 | $this->nextmatchs->template_alternate_row_color($p);
|
---|
| 598 | $ii = $ii + 1;
|
---|
| 599 |
|
---|
| 600 | $varr = array(
|
---|
| 601 | 'formname' => "formlog".$ii,
|
---|
| 602 | 'formsubmit' => "document.formlog".$ii.".submit()",
|
---|
| 603 | 'row_idnumber' => $accountr['account_id'],
|
---|
| 604 | 'row_loginid' => $accountr['account_lid'],
|
---|
| 605 | 'row_cn' => $accountr['account_cn'],
|
---|
| 606 | 'row_status' => $accountr['account_status'] == 'active' ? '<font color="#0033FF">Ativado</font> ' : '<font color="#FF0000">Desativado</font>',
|
---|
| 607 | 'row_mail' => (!$accountr['account_mail']?'<font color=red>Sem E-mail</font>':$accountr['account_mail']),
|
---|
| 608 | 'row_timestamp' => substr($accountr['createTimestamp'], 6, 2)."/".substr($accountr['createTimestamp'], 4, 2)."/".substr($accountr['createTimestamp'], 0, 4),
|
---|
[6920] | 609 | 'row_li_date' => $accountr['li_date'] ==lang('Never login') ? '<font color="#FF0000">'.$accountr['li_date'].'</font>' : $accountr['li_date'],
|
---|
[5291] | 610 | 'row_li_dias' => $accountr['li_dias']
|
---|
| 611 | );
|
---|
| 612 |
|
---|
| 613 | $p->set_var($varr);
|
---|
| 614 |
|
---|
| 615 | $p->parse('rows','row',True);
|
---|
| 616 | }
|
---|
| 617 | // ********************** Fim ****************************
|
---|
| 618 |
|
---|
| 619 | // grupo de pagina anteriores
|
---|
| 620 | if ($gpag > 1)
|
---|
| 621 | {
|
---|
| 622 | $gpaga = $gpag - 1;
|
---|
| 623 | $varp = Array(
|
---|
| 624 | 'paginat' => "<form name='anterior' method='POST' action='$url'>
|
---|
| 625 | <input type='hidden' name='setor' value='$grouplist'>
|
---|
| 626 | <input type='hidden' name='organizacao' value='$organizacao'>
|
---|
| 627 | <input type='hidden' name='setordn' value='$setordn'>
|
---|
| 628 | <input type='hidden' name='organizacaodn' value='$organizacaodn'>
|
---|
| 629 | <input type='hidden' name='page' value='$npag'>
|
---|
| 630 | <input type='hidden' name='gpage' value='$gpaga'>
|
---|
| 631 | <input type='hidden' name='Psectornamedncompleto' value='$sectornamedncompleto'>
|
---|
| 632 | <div style='float:left;' onClick='document.anterior.submit()'><a href='#'>".lang('Previous Pages')."<< </a></div></form>"
|
---|
| 633 | );
|
---|
| 634 | $p->set_var($varp);
|
---|
| 635 |
|
---|
| 636 | $p->parse('pages','rowpag',True);
|
---|
| 637 | }
|
---|
| 638 | // **** FIM *******
|
---|
| 639 |
|
---|
| 640 | // imprime a paginação
|
---|
| 641 | if ($fimgpg > 1)
|
---|
| 642 | {
|
---|
[7655] | 643 | for($x = $iniciogpg; $x <= $fimgpg; ++$x)
|
---|
[5291] | 644 | {
|
---|
| 645 | $varp = Array(
|
---|
| 646 | 'paginat' => "<form name='form".$x."' method='POST' action='$url'>
|
---|
| 647 | <input type='hidden' name='setor' value='$grouplist'>
|
---|
| 648 | <input type='hidden' name='organizacao' value='$organizacao'>
|
---|
| 649 | <input type='hidden' name='setordn' value='$setordn'>
|
---|
| 650 | <input type='hidden' name='organizacaodn' value='$organizacaodn'>
|
---|
| 651 | <input type='hidden' name='page' value='$x'>
|
---|
| 652 | <input type='hidden' name='gpage' value='$gpag'>
|
---|
| 653 | <input type='hidden' name='Psectornamedncompleto' value='$sectornamedncompleto'>
|
---|
| 654 | <div style='float:left;' onClick='document.form".$x.".submit()'><a href='#'>$x </a></div></form>"
|
---|
| 655 | );
|
---|
| 656 |
|
---|
| 657 | $p->set_var($varp);
|
---|
| 658 |
|
---|
| 659 | $p->parse('pages','rowpag',True);
|
---|
| 660 | }
|
---|
| 661 | }
|
---|
| 662 |
|
---|
| 663 | // proximo grupo de pagina
|
---|
| 664 | if ($gpag < $maxtotalnpag && $maxtotalnpag > 0)
|
---|
| 665 | {
|
---|
| 666 | $gpagp = $gpag + 1;
|
---|
| 667 | $varp = Array(
|
---|
| 668 | 'paginat' => "<form name='proximo' method='POST' action='$url'>
|
---|
| 669 | <input type='hidden' name='setor' value='$grouplist'>
|
---|
| 670 | <input type='hidden' name='organizacao' value='$organizacao'>
|
---|
| 671 | <input type='hidden' name='setordn' value='$setordn'>
|
---|
| 672 | <input type='hidden' name='organizacaodn' value='$organizacaodn'>
|
---|
| 673 | <input type='hidden' name='page' value='$npag'>
|
---|
| 674 | <input type='hidden' name='gpage' value='$gpagp'>
|
---|
| 675 | <input type='hidden' name='Psectornamedncompleto' value='$sectornamedncompleto'>
|
---|
| 676 | <div style='float:left;' onClick='document.proximo.submit()'><a href='#'> >>".lang('Next Page')."</a></div></form>"
|
---|
| 677 | );
|
---|
| 678 | $p->set_var($varp);
|
---|
| 679 |
|
---|
| 680 | $p->parse('pages','rowpag',True);
|
---|
| 681 | }
|
---|
| 682 |
|
---|
| 683 | $vart = Array(
|
---|
| 684 | 'page' => $npag,
|
---|
| 685 | 'gpage' => $gpag
|
---|
| 686 | );
|
---|
| 687 |
|
---|
| 688 | $p->set_var($vart);
|
---|
| 689 | // ************************* FIM PAGINAÇÃO ***********************
|
---|
[6920] | 690 | }
|
---|
| 691 | }
|
---|
| 692 | else{
|
---|
[5291] | 693 | // ******** caso não for zero não vai paginar *****************
|
---|
[6920] | 694 | //url do paginador
|
---|
| 695 | $url = $GLOBALS['phpgw_info']['server']['webserver_url'].'/index.php?menuaction=reports.uireports_logon.report_logon_group_setor_print';
|
---|
[5291] | 696 |
|
---|
[6920] | 697 | // conta total dos registros
|
---|
[5291] | 698 |
|
---|
[6920] | 699 | // ********** busca no LDAP as informação total e imprime ****************
|
---|
| 700 | $paginas =$this->functions->get_list_user_sector_logon($setordn,$contexts,0,$numacesso);
|
---|
| 701 |
|
---|
| 702 | if(count($paginas)==0) {
|
---|
| 703 | $p->set_var('message',lang('No user found'));
|
---|
| 704 | $p->parse('rows','row_empty',True);
|
---|
| 705 | }
|
---|
| 706 | else {
|
---|
[5291] | 707 | // Imprime valores de contagen de registro e pagina
|
---|
[6920] | 708 | $p->set_var('cont_user',count($paginas));
|
---|
[5291] | 709 | $p->set_var('cont_page',"1");
|
---|
| 710 | $p->set_var('page_now',"1");
|
---|
[6920] | 711 |
|
---|
[5291] | 712 | $tmpp = array();
|
---|
| 713 | $contap = 0;
|
---|
| 714 | while (list($null,$accountp) = each($paginas))
|
---|
| 715 | {
|
---|
| 716 | $access_log = $this->functions->show_access_log($accountp['account_id']);
|
---|
| 717 |
|
---|
| 718 | $access_log_array = explode("#",$access_log);
|
---|
| 719 |
|
---|
[6920] | 720 | if ($numacesso<>lang('Never login')){
|
---|
[5291] | 721 | $accountp['li_dias'] = $access_log_array[1];
|
---|
| 722 | $accountp['li_date'] = $access_log_array[0];
|
---|
| 723 |
|
---|
| 724 | $tmpp[$contap]['account_id'] = $accountp['account_id'];
|
---|
| 725 | $tmpp[$contap]['account_lid'] = $accountp['account_lid'];
|
---|
| 726 | $tmpp[$contap]['account_cn'] = $accountp['account_cn'];
|
---|
| 727 | $tmpp[$contap]['account_status'] = $accountp['account_accountstatus'];
|
---|
| 728 | $tmpp[$contap]['account_mail'] = $accountp['account_mail'];
|
---|
| 729 | $tmpp[$contap]['createTimestamp'] = $accountp['createtimestamp'];
|
---|
| 730 | $tmpp[$contap]['li_dias']= $accountp['li_dias'];
|
---|
| 731 | $tmpp[$contap]['li_date']= $accountp['li_date'];
|
---|
| 732 |
|
---|
| 733 | $sortp[] = $accountp['li_dias'];
|
---|
| 734 | }else{
|
---|
| 735 | if ($numacesso == $access_log_array[0]) {
|
---|
| 736 | $accountp['li_dias'] = $access_log_array[1];
|
---|
| 737 | $accountp['li_date'] = $access_log_array[0];
|
---|
| 738 |
|
---|
| 739 | $tmpp[$contap]['account_id'] = $accountp['account_id'];
|
---|
| 740 | $tmpp[$contap]['account_lid'] = $accountp['account_lid'];
|
---|
| 741 | $tmpp[$contap]['account_cn'] = $accountp['account_cn'];
|
---|
| 742 | $tmpp[$contap]['account_status'] = $accountp['account_accountstatus'];
|
---|
| 743 | $tmpp[$contap]['account_mail'] = $accountp['account_mail'];
|
---|
| 744 | $tmpp[$contap]['createTimestamp'] = $accountp['createtimestamp'];
|
---|
| 745 | $tmpp[$contap]['li_dias']= $accountp['li_dias'];
|
---|
| 746 | $tmpp[$contap]['li_date']= $accountp['li_date'];
|
---|
| 747 |
|
---|
| 748 | $sortp[] = $accountp['li_dias'];
|
---|
| 749 | }
|
---|
| 750 | }
|
---|
[6920] | 751 |
|
---|
[5291] | 752 | if (count($sortp))
|
---|
| 753 | {
|
---|
| 754 | natcasesort($sortp);
|
---|
| 755 | }
|
---|
| 756 |
|
---|
| 757 | $contap = $contap + 1;
|
---|
| 758 | }
|
---|
| 759 |
|
---|
| 760 | while (list($key,$accountr1) = each($sortp))
|
---|
| 761 | {
|
---|
| 762 | $returnp[] = $tmpp[$key];
|
---|
| 763 | }
|
---|
| 764 |
|
---|
| 765 | $returnp = array_reverse($returnp);
|
---|
| 766 |
|
---|
| 767 | $ii = 0;
|
---|
| 768 |
|
---|
| 769 | while (list($null,$accountr) = each($returnp))
|
---|
| 770 | {
|
---|
| 771 | $this->nextmatchs->template_alternate_row_color($p);
|
---|
| 772 | $ii = $ii + 1;
|
---|
| 773 |
|
---|
| 774 | $varr = array(
|
---|
| 775 | 'formname' => "formlog".$ii,
|
---|
| 776 | 'formsubmit' => "document.formlog".$ii.".submit()",
|
---|
| 777 | 'row_idnumber' => $accountr['account_id'],
|
---|
| 778 | 'row_loginid' => $accountr['account_lid'],
|
---|
| 779 | 'row_cn' => $accountr['account_cn'],
|
---|
[6920] | 780 | 'row_status' => $accountr['account_status'] == 'active' ? '<font color="#0033FF">'.lang('Activated').'</font> ' : '<font color="#FF0000">'.lang('Disabled').'</font>',
|
---|
| 781 | 'row_mail' => (!$accountr['account_mail']?'<font color=red>'.lang('Without E-mail').'</font>':$accountr['account_mail']),
|
---|
[5291] | 782 | 'row_timestamp' => substr($accountr['createTimestamp'], 6, 2)."/".substr($accountr['createTimestamp'], 4, 2)."/".substr($accountr['createTimestamp'], 0, 4),
|
---|
[6920] | 783 | 'row_li_date' => $accountr['li_date'] ==lang('Never login') ? '<font color="#FF0000">'.$accountr['li_date'].'</font>' : $accountr['li_date'],
|
---|
[5291] | 784 | 'row_li_dias' => $accountr['li_dias']
|
---|
| 785 | );
|
---|
| 786 |
|
---|
| 787 | $p->set_var($varr);
|
---|
| 788 |
|
---|
| 789 | $p->parse('rows','row',True);
|
---|
| 790 | }
|
---|
| 791 | }
|
---|
[6920] | 792 | // ********************** Fim ****************************
|
---|
[5291] | 793 | }
|
---|
| 794 |
|
---|
| 795 | $p->pfp('out','body');
|
---|
| 796 | }
|
---|
| 797 |
|
---|
| 798 | function get_user_info($userdn,$usercontexts,$usersizelimit)
|
---|
| 799 | {
|
---|
| 800 | $user_info = $this->functions->Paginate_user('accounts',$setordn,$contexts,'cn','asc',$npag,$numpage);
|
---|
| 801 |
|
---|
| 802 | return $user_info;
|
---|
| 803 | }
|
---|
| 804 |
|
---|
| 805 | function css()
|
---|
| 806 | {
|
---|
| 807 | $appCSS =
|
---|
| 808 | 'th.activetab
|
---|
| 809 | {
|
---|
| 810 | color:#000000;
|
---|
| 811 | background-color:#D3DCE3;
|
---|
| 812 | border-top-width : 1px;
|
---|
| 813 | border-top-style : solid;
|
---|
| 814 | border-top-color : Black;
|
---|
| 815 | border-left-width : 1px;
|
---|
| 816 | border-left-style : solid;
|
---|
| 817 | border-left-color : Black;
|
---|
| 818 | border-right-width : 1px;
|
---|
| 819 | border-right-style : solid;
|
---|
| 820 | border-right-color : Black;
|
---|
| 821 | font-size: 12px;
|
---|
| 822 | font-family: Tahoma, Arial, Helvetica, sans-serif;
|
---|
| 823 | }
|
---|
| 824 |
|
---|
| 825 | th.inactivetab
|
---|
| 826 | {
|
---|
| 827 | color:#000000;
|
---|
| 828 | background-color:#E8F0F0;
|
---|
| 829 | border-bottom-width : 1px;
|
---|
| 830 | border-bottom-style : solid;
|
---|
| 831 | border-bottom-color : Black;
|
---|
| 832 | font-size: 12px;
|
---|
| 833 | font-family: Tahoma, Arial, Helvetica, sans-serif;
|
---|
| 834 | }
|
---|
| 835 |
|
---|
| 836 | .td_left {border-left:1px solid Gray; border-top:1px solid Gray; border-bottom:1px solid Gray;}
|
---|
| 837 | .td_right {border-right:1px solid Gray; border-top:1px solid Gray; border-bottom:1px solid Gray;}
|
---|
| 838 |
|
---|
| 839 | div.activetab{ display:inline; }
|
---|
| 840 | div.inactivetab{ display:none; }';
|
---|
| 841 |
|
---|
| 842 | return $appCSS;
|
---|
| 843 | }
|
---|
| 844 |
|
---|
| 845 | function show_access()
|
---|
| 846 | {
|
---|
| 847 | $vnumacesso = trim($_POST['nacesso']);
|
---|
| 848 | $account_id = $_POST['account_id'];
|
---|
| 849 | $nome_usuario = $_POST['nome_usuario'];
|
---|
| 850 | $grouplist = $_POST['setor'];
|
---|
| 851 | $organizacao = $_POST['organizacao'];
|
---|
| 852 | $setordn = $_POST['setordn'];
|
---|
| 853 | $organizacaodn = $_POST['organizacaodn'];
|
---|
| 854 | $x = $_POST['page'];
|
---|
| 855 | $gpag = $_POST['gpage'];
|
---|
| 856 | $sectornamedncompleto = $_POST['Psectornamedncompleto'];
|
---|
| 857 |
|
---|
| 858 | $manager_account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
|
---|
| 859 | $tmp = $this->functions->read_acl($manager_account_lid);
|
---|
| 860 | $manager_context = $tmp[0]['context'];
|
---|
| 861 |
|
---|
| 862 | // Verifica se tem acesso a este modulo
|
---|
| 863 | if ((!$this->functions->check_acl($manager_account_lid,'edit_users')) && (!$this->functions->check_acl($manager_account_lid,'change_users_password')))
|
---|
| 864 | {
|
---|
| 865 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/reports/inc/access_denied.php'));
|
---|
| 866 | }
|
---|
| 867 |
|
---|
| 868 | // Seta header.
|
---|
| 869 | unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
---|
| 870 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
---|
| 871 |
|
---|
| 872 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['reports']['title'].' - '.lang('Access Log');
|
---|
| 873 | $GLOBALS['phpgw']->common->phpgw_header();
|
---|
| 874 |
|
---|
| 875 | // Seta templates.
|
---|
| 876 | $t = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
---|
| 877 | $t->set_file(array("body" => "accesslog.tpl"));
|
---|
| 878 | $t->set_block('body','main');
|
---|
| 879 | $t->set_block('body','row','row');
|
---|
| 880 |
|
---|
| 881 | // GET access log from the user.
|
---|
| 882 | $GLOBALS['phpgw']->db->limit_query("select loginid,ip,li,lo,account_id,sessionid from phpgw_access_log WHERE account_id=".$account_id." order by li desc",$start,__LINE__,__FILE__);
|
---|
| 883 | while ($GLOBALS['phpgw']->db->next_record())
|
---|
| 884 | {
|
---|
| 885 | $records[] = array(
|
---|
| 886 | 'loginid' => $GLOBALS['phpgw']->db->f('loginid'),
|
---|
| 887 | 'ip' => $GLOBALS['phpgw']->db->f('ip'),
|
---|
| 888 | 'li' => $GLOBALS['phpgw']->db->f('li'),
|
---|
| 889 | 'lo' => $GLOBALS['phpgw']->db->f('lo'),
|
---|
| 890 | 'account_id' => $GLOBALS['phpgw']->db->f('account_id'),
|
---|
| 891 | 'sessionid' => $GLOBALS['phpgw']->db->f('sessionid')
|
---|
| 892 | );
|
---|
| 893 | }
|
---|
| 894 |
|
---|
| 895 | // Seta as vcariaveis
|
---|
| 896 | while (is_array($records) && list(,$record) = each($records))
|
---|
| 897 | {
|
---|
| 898 | $var = array(
|
---|
| 899 | 'row_loginid' => $record['loginid'],
|
---|
| 900 | 'row_ip' => $record['ip'],
|
---|
| 901 | 'row_li' => date("d/m/Y - H:i:s", $record['li']),
|
---|
| 902 | 'row_lo' => $record['lo'] == 0 ? 0 : date("d/m/Y - H:i:s", $record['lo'])
|
---|
| 903 | );
|
---|
| 904 | $t->set_var($var);
|
---|
| 905 | $t->fp('rows','row',True);
|
---|
| 906 | }
|
---|
| 907 |
|
---|
| 908 | $var = Array(
|
---|
| 909 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
---|
| 910 | 'nome_usuario' => $nome_usuario,
|
---|
| 911 | 'back_url' => "<form name='formlog' method='POST' action='./index.php?menuaction=reports.uireports_logon.report_logon_group_setor_print'>
|
---|
| 912 | <input type='hidden' name='setor' value='$grouplist'>
|
---|
| 913 | <input type='hidden' name='organizacao' value='$organizacao'>
|
---|
| 914 | <input type='hidden' name='setordn' value='$setordn'>
|
---|
| 915 | <input type='hidden' name='organizacaodn' value='$organizacaodn'>
|
---|
| 916 | <input type='hidden' name='page' value='$x'>
|
---|
| 917 | <input type='hidden' name='gpage' value='$gpag'>
|
---|
| 918 | <input type='hidden' name='Psectornamedncompleto' value='$sectornamedncompleto'>
|
---|
| 919 | <input type='hidden' name='nacesso' value='$vnumacesso'>
|
---|
| 920 | <input name='button' type='submit' value='".lang('back')."'></div></form>"
|
---|
| 921 | );
|
---|
| 922 |
|
---|
| 923 | $t->set_var($var);
|
---|
| 924 | $t->set_var($this->functions->make_dinamic_lang($t, 'body'));
|
---|
| 925 | $t->pfp('out','body');
|
---|
| 926 | }
|
---|
| 927 | }
|
---|
| 928 | ?>
|
---|