[3471] | 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 | {
|
---|
[3666] | 33 | $this->user = CreateObject('reports.user');
|
---|
[3471] | 34 | $this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
---|
[3666] | 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
|
---|
[3471] | 39 |
|
---|
[3666] | 40 | $c = CreateObject('phpgwapi.config','reports'); // cria o objeto relatorio no $c
|
---|
[3471] | 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 | }
|
---|
[3666] | 48 | $GLOBALS['phpgw']->js->validate_file('jscode','cc','reports');
|
---|
[3471] | 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 | {
|
---|
[3666] | 65 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/reports/inc/access_denied.php'));
|
---|
[3471] | 66 | }
|
---|
| 67 |
|
---|
| 68 | $grouplist = trim($_POST[setor]);
|
---|
| 69 | $grouplist = trim(ereg_replace("-","",$grouplist));
|
---|
| 70 |
|
---|
| 71 | $setordn = trim($_POST[setordn]);
|
---|
| 72 | $subtitulo1 = trim($_POST[subtitulo]);
|
---|
| 73 |
|
---|
| 74 | $vnumacesso = trim($_POST[nacesso]);
|
---|
| 75 | $numacesso = abs(round($vnumacesso));
|
---|
| 76 |
|
---|
| 77 | if ($vnumacesso==999){
|
---|
| 78 | $numacesso = "Nunca logou";
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 |
|
---|
| 82 | define('FPDF_FONTPATH','font/');
|
---|
| 83 | $data_atual = date("d/m/Y");
|
---|
[3666] | 84 | $titulo_system = $GLOBALS['phpgw_info']['apps']['reports']['title'];
|
---|
[3471] | 85 |
|
---|
| 86 | $pdf=new uireports_fpdf("L");
|
---|
| 87 | $pdf->Open();
|
---|
| 88 | $pdf->AddPage();
|
---|
| 89 | $pdf->SetTitle('Relatório Gerado pelo Expresso Reports');
|
---|
| 90 |
|
---|
| 91 | //Set font and colors
|
---|
| 92 | $pdf->SetFont('Arial','B',14);
|
---|
| 93 | $pdf->SetFillColor(0,0,0);
|
---|
| 94 | $pdf->SetTextColor(0,0,200);
|
---|
| 95 | $pdf->SetDrawColor(0,0,0);
|
---|
| 96 | $pdf->SetLineWidth(.2);
|
---|
| 97 |
|
---|
| 98 | //Table header
|
---|
| 99 | $SubTitulo = lang('reports title6');
|
---|
| 100 | $SubTituloR = lang('report of time without logging by Organization');
|
---|
| 101 | $SubTitulo1 = $subtitulo1;
|
---|
[3666] | 102 | $GLOBALS['phpgw_info']['apps']['reports']['subtitle'] = $SubTituloR;
|
---|
[3471] | 103 | $pdf->Cell(0,8,$SubTitulo,0,1,'C',0);
|
---|
| 104 |
|
---|
| 105 |
|
---|
| 106 | //Set font and colors
|
---|
| 107 | $pdf->SetFont('Arial','B',8);
|
---|
| 108 | $pdf->SetFillColor(0,0,0);
|
---|
| 109 | $pdf->SetTextColor(0,0,200);
|
---|
| 110 | $pdf->SetDrawColor(0,0,0);
|
---|
| 111 | $pdf->SetLineWidth(.3);
|
---|
| 112 |
|
---|
| 113 | // $pdf->Cell(0,10,$SubTitulo1,0,1,'C',0);
|
---|
| 114 | $pdf->MultiCell(0,3,$SubTitulo1,0,'C',0);
|
---|
| 115 |
|
---|
| 116 | $pdf->Cell(0,2,' ',0,1,'C',0);
|
---|
| 117 | $pdf->Cell(0,5,'Data..: '.$data_atual,0,0,'L',0);
|
---|
| 118 | $pdf->Cell(0,5,$titulo_system,0,1,'R',0);
|
---|
| 119 |
|
---|
| 120 | $account_info = $this->functions->get_list_user_sector_logon($setordn,$contexts,0,$numacesso);
|
---|
| 121 |
|
---|
| 122 | if (count($account_info))
|
---|
| 123 | {
|
---|
| 124 | //Restore font and colors
|
---|
| 125 | $pdf->SetFont('Arial','',8);
|
---|
| 126 | $pdf->SetFillColor(224,235,255);
|
---|
| 127 | $pdf->SetTextColor(0);
|
---|
| 128 |
|
---|
| 129 | $pdf->Cell(60,5,lang('loginid'),1,0,'L',1);
|
---|
| 130 | $pdf->Cell(60,5,lang('name'),1,0,'L',1);
|
---|
| 131 | $pdf->Cell(70,5,lang('report email'),1,0,'L',1);
|
---|
| 132 | $pdf->Cell(25,5,lang('Creation Date'),1,0,'C',1);
|
---|
| 133 | $pdf->Cell(25,5,lang('Last access'),1,0,'C',1);
|
---|
| 134 | $pdf->Cell(22,5,lang('Days without login'),1,0,'L',1);
|
---|
| 135 | $pdf->Cell(18,5,lang('status'),1,1,'L',1);
|
---|
| 136 |
|
---|
| 137 |
|
---|
| 138 | while (list($null,$accountp) = each($account_info))
|
---|
| 139 | {
|
---|
| 140 |
|
---|
| 141 | $access_log = $this->functions->show_access_log($accountp['account_id']);
|
---|
| 142 |
|
---|
| 143 | $access_log_array = explode("#",$access_log);
|
---|
| 144 |
|
---|
| 145 | $accountp['li_dias'] = $access_log_array[1];
|
---|
| 146 | $accountp['li_date'] = $access_log_array[0];
|
---|
| 147 |
|
---|
| 148 | $tmpp[$contap]['account_id'] = $accountp['account_id'];
|
---|
| 149 | $tmpp[$contap]['account_lid'] = $accountp['account_lid'];
|
---|
| 150 | $tmpp[$contap]['account_cn'] = $accountp['account_cn'];
|
---|
| 151 | $tmpp[$contap]['account_status'] = $accountp['account_accountstatus'];
|
---|
| 152 | $tmpp[$contap]['account_mail'] = $accountp['account_mail'];
|
---|
| 153 | $tmpp[$contap]['createTimestamp'] = $accountp['createtimestamp'];
|
---|
| 154 | $tmpp[$contap]['li_dias']= $accountp['li_dias'];
|
---|
| 155 | $tmpp[$contap]['li_date']= $accountp['li_date'];
|
---|
| 156 |
|
---|
| 157 | $sortp[] = $accountp['li_dias'];
|
---|
| 158 |
|
---|
| 159 | if (count($sortp))
|
---|
| 160 | {
|
---|
| 161 | natcasesort($sortp);
|
---|
| 162 | }
|
---|
| 163 |
|
---|
| 164 | $contap = $contap + 1;
|
---|
| 165 | }
|
---|
| 166 |
|
---|
| 167 | while (list($key,$accountr1) = each($sortp))
|
---|
| 168 | {
|
---|
| 169 | if ($key == 0){
|
---|
| 170 | $key = '';
|
---|
| 171 | $returnp[] = $tmpp[$key];
|
---|
| 172 | }else{
|
---|
| 173 | $returnp[] = $tmpp[$key];
|
---|
| 174 | }
|
---|
| 175 | }
|
---|
| 176 |
|
---|
| 177 | $returnp = array_reverse($returnp);
|
---|
| 178 |
|
---|
| 179 | while (list($null,$accountr) = each($returnp))
|
---|
| 180 | {
|
---|
| 181 | $row_cn = $accountr['account_cn'];
|
---|
| 182 | $account_lid = $accountr['account_lid'];
|
---|
| 183 | $row_mail = (!$accountr['account_mail'] ? 'Sem E-mail' : $accountr['account_mail']);
|
---|
| 184 | $row_timestamp = substr($accountr['createTimestamp'], 6, 2)."/".substr($accountr['createTimestamp'], 4, 2)."/".substr($accountr['createTimestamp'], 0, 4);
|
---|
| 185 | $row_li_date = $accountr['li_date'] == 'Nunca logou' ? 'Nunca logou' : $accountr['li_date'];
|
---|
| 186 | $row_li_dias = $accountr['li_dias'];
|
---|
| 187 | $row_status = $accountr['account_status'] == 'active' ? 'Ativado' : 'Desativado';
|
---|
| 188 |
|
---|
| 189 | $pdf->Cell(60,5,$account_lid,0,0,'L',0);
|
---|
| 190 | $pdf->Cell(60,5,$row_cn,0,0,'L',0);
|
---|
| 191 | $pdf->Cell(70,5,$row_mail,0,0,'L',0);
|
---|
| 192 | $pdf->Cell(25,5,$row_timestamp,0,0,'C',0);
|
---|
| 193 |
|
---|
| 194 | if ($row_li_date == 'Nunca logou')
|
---|
| 195 | {
|
---|
| 196 | //Muda cor fonte
|
---|
| 197 | $pdf->SetTextColor(256,0,0);
|
---|
| 198 | $pdf->Cell(25,5,$row_li_date,0,0,'C',0);
|
---|
| 199 | //Restaura cor fonte
|
---|
| 200 | $pdf->SetTextColor(0);
|
---|
| 201 | }
|
---|
| 202 | else
|
---|
| 203 | {
|
---|
| 204 | //Restaura cor fonte
|
---|
| 205 | $pdf->SetTextColor(0);
|
---|
| 206 | $pdf->Cell(25,5,$row_li_date,0,0,'C',0);
|
---|
| 207 | }
|
---|
| 208 |
|
---|
| 209 | $pdf->Cell(22,5,$row_li_dias,0,0,'C',0);
|
---|
| 210 |
|
---|
| 211 | if ($row_status == 'Ativado')
|
---|
| 212 | {
|
---|
| 213 | //Restaura cor fonte
|
---|
| 214 | $pdf->SetTextColor(0);
|
---|
| 215 | $pdf->Cell(18,5,$row_status,0,1,'L',0);
|
---|
| 216 | }
|
---|
| 217 | else
|
---|
| 218 | {
|
---|
| 219 | //Muda cor fonte
|
---|
| 220 | $pdf->SetTextColor(256,0,0);
|
---|
| 221 | $pdf->Cell(18,5,$row_status,0,1,'L',0);
|
---|
| 222 | //Restaura cor fonte
|
---|
| 223 | $pdf->SetTextColor(0);
|
---|
| 224 | }
|
---|
| 225 | }
|
---|
| 226 | }
|
---|
| 227 |
|
---|
| 228 | $pdf->Output();
|
---|
| 229 |
|
---|
| 230 | return;
|
---|
| 231 | }
|
---|
| 232 |
|
---|
| 233 | function report_logon_group()
|
---|
| 234 | {
|
---|
| 235 | $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
|
---|
| 236 | $manager_acl = $this->functions->read_acl($account_lid);
|
---|
| 237 | $raw_context = $acl['raw_context'];
|
---|
| 238 | $contexts = $manager_acl['contexts'];
|
---|
| 239 | $conta_context = count($manager_acl['contexts_display']);
|
---|
| 240 | foreach ($manager_acl['contexts_display'] as $index=>$tmp_context)
|
---|
| 241 | {
|
---|
| 242 | $index = $index +1;
|
---|
| 243 |
|
---|
| 244 | if ($conta_context == $index)
|
---|
| 245 | {
|
---|
| 246 | $context_display .= $tmp_context;
|
---|
| 247 | }
|
---|
| 248 | else
|
---|
| 249 | {
|
---|
| 250 | $context_display .= $tmp_context.' | ';
|
---|
| 251 | }
|
---|
| 252 | }
|
---|
| 253 |
|
---|
| 254 | // Verifica se tem acesso a este modulo
|
---|
| 255 | if (!$this->functions->check_acl($account_lid,'list_sectors'))
|
---|
| 256 | {
|
---|
[3666] | 257 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/reports/inc/access_denied.php'));
|
---|
[3471] | 258 | }
|
---|
| 259 |
|
---|
| 260 | unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
---|
| 261 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
---|
| 262 |
|
---|
[3666] | 263 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['reports']['title'].' - '.lang('report of time without logging by Organization');
|
---|
[3471] | 264 | $GLOBALS['phpgw']->common->phpgw_header();
|
---|
| 265 |
|
---|
| 266 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
---|
| 267 | $p->set_file(array('groups' => 'report_logon_group.tpl'));
|
---|
| 268 | $p->set_block('groups','list','list');
|
---|
| 269 | $p->set_block('groups','row','row');
|
---|
| 270 | $p->set_block('groups','row_empty','row_empty');
|
---|
| 271 |
|
---|
| 272 | // Seta as variaveis padroes.
|
---|
| 273 | $var = Array(
|
---|
| 274 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
---|
[3666] | 275 | 'back_url' => $GLOBALS['phpgw']->link('/reports/index.php'),
|
---|
[3471] | 276 | 'context_display' => $context_display
|
---|
| 277 | );
|
---|
| 278 | $p->set_var($var);
|
---|
| 279 | $p->set_var($this->functions->make_dinamic_lang($p, 'list'));
|
---|
| 280 |
|
---|
| 281 |
|
---|
| 282 | $GLOBALS['organizacaodn'] = $_POST['organizacaodn'];
|
---|
| 283 |
|
---|
| 284 | $contextsdn = $GLOBALS['organizacaodn'];
|
---|
| 285 |
|
---|
| 286 | // Save query
|
---|
| 287 | $varorganizacao = explode(",",$contextsdn);
|
---|
| 288 | $varorganizacao_nome = trim(strtoupper(ereg_replace("ou=","",$varorganizacao[0])));
|
---|
| 289 | $varorganizacao_nome = trim(strtoupper(ereg_replace("DC=","",$varorganizacao_nome)));
|
---|
| 290 | $user_logon = $GLOBALS['phpgw_info']['user'][account_lid];
|
---|
| 291 |
|
---|
| 292 | // carrega os grupos no listbox
|
---|
| 293 | /************* DESCOMENTE ESTE PARTE DO CODIGO PARA LISTAR TODOS OS GRUPOS, SEM LISTAR POR USUSARIO LOGADO ***********
|
---|
| 294 | $sectors_info = $this->functions->get_groups_list($contexts,"*");
|
---|
| 295 | $sectors_info_dn = $this->functions->get_groups_list_dn($contexts,"*");
|
---|
| 296 | /* ************************************* FIM *********************************************************************** */
|
---|
| 297 |
|
---|
| 298 | $sectors_info = $this->functions->get_list_context_logon($user_logon,$contexts,0);
|
---|
| 299 | $sectors_info_dn = $this->functions->get_list_groups_dn($user_logon,$contexts,0);
|
---|
| 300 |
|
---|
| 301 | if (!count($sectors_info))
|
---|
| 302 | {
|
---|
| 303 | $p->set_var('notselect',lang('No matches found'));
|
---|
| 304 | }
|
---|
| 305 | else
|
---|
| 306 | {
|
---|
| 307 | foreach($sectors_info as $context=>$sector)
|
---|
| 308 | {
|
---|
| 309 |
|
---|
| 310 | $sectordn = $sectors_info_dn[$context];
|
---|
| 311 |
|
---|
| 312 | $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
|
---|
| 313 |
|
---|
| 314 | if ($context == 0 && $contextsdn <> "")
|
---|
| 315 | {
|
---|
| 316 | if (trim(strtoupper($varorganizacao_nome)) == trim(strtoupper($sector)))
|
---|
| 317 | {
|
---|
| 318 | $sector_options .= "<option selected value='" .$contextsdn. "'>" .$varorganizacao_nome. "</option>";
|
---|
| 319 | }
|
---|
| 320 | else
|
---|
| 321 | {
|
---|
| 322 | $sector_options .= "<option selected value='" .$contextsdn. "'>" .$varorganizacao_nome. "</option>";
|
---|
| 323 | $sector_options .= "<option value='" . $sectordn . "'>". $sector . "</option>";
|
---|
| 324 | }
|
---|
| 325 |
|
---|
| 326 | }
|
---|
| 327 | else
|
---|
| 328 | {
|
---|
| 329 | if ( trim(strtoupper($varorganizacao_nome)) != trim(strtoupper($sector)))
|
---|
| 330 | {
|
---|
| 331 | $sectorok = trim(strtoupper(ereg_replace("dc=","",$sector)));
|
---|
| 332 | $sectorok = trim(strtoupper(ereg_replace("dc=","",$sectorok)));
|
---|
| 333 | $sector_options .= "<option value='" . $sectordn . "'>". $sectorok . "</option>";
|
---|
| 334 | }
|
---|
| 335 | }
|
---|
| 336 |
|
---|
| 337 | $varselect = Array(
|
---|
| 338 | 'tr_color' => $tr_color,
|
---|
| 339 | 'organizacaodn' => $contextsdn,
|
---|
| 340 | 'group_name' => $sector_options
|
---|
| 341 | );
|
---|
| 342 | }
|
---|
| 343 |
|
---|
| 344 | $p->set_var($varselect);
|
---|
| 345 | }
|
---|
| 346 |
|
---|
| 347 | // ************** inicio carregar a sub-lista das organizações ****************
|
---|
| 348 | //Admin make a search
|
---|
| 349 | if ($GLOBALS['organizacaodn'] != '')
|
---|
| 350 | {
|
---|
| 351 | // Conta a quantidade de Usuario do grupo raiz
|
---|
[4033] | 352 | $account_user = $this->functions->get_count_user_sector($contextsdn,$contexts,0);
|
---|
| 353 | $totaluser = "(".$account_user.")";
|
---|
[3471] | 354 |
|
---|
| 355 | $p->set_var('organizacao', $varorganizacao_nome);
|
---|
| 356 | $p->set_var('all_user', lang('all'));
|
---|
| 357 | $p->set_var('total_user', $totaluser);
|
---|
| 358 |
|
---|
| 359 | $setorg = $contextsdn;
|
---|
| 360 |
|
---|
| 361 | $groups_info = $this->functions->get_sectors_list($contexts,$setorg);
|
---|
| 362 |
|
---|
| 363 | if (!count($groups_info))
|
---|
| 364 | {
|
---|
| 365 | $p->set_var('message',lang('No sector found'));
|
---|
| 366 | $p->parse('rows','row_empty',True);
|
---|
| 367 | }
|
---|
| 368 | else
|
---|
| 369 | {
|
---|
| 370 | $ii = 0;
|
---|
| 371 | foreach($groups_info as $context=>$groups)
|
---|
| 372 | {
|
---|
| 373 | $explode_groups = explode("#",$groups);
|
---|
| 374 | $ii = $ii + 1;
|
---|
| 375 | $tr_color = $this->nextmatchs->alternate_row_color($tr_color);
|
---|
| 376 | $varsuborg = Array(
|
---|
| 377 | 'tr_color' => $tr_color,
|
---|
| 378 | 'div_nacesso' => "div_nacesso".$ii,
|
---|
| 379 | 'formname' => "form".$ii,
|
---|
| 380 | 'formsubmit' => "document.form".$ii.".submit()",
|
---|
| 381 | 'sector_name' => $explode_groups[0],
|
---|
| 382 | 'sector_namedn' => $explode_groups[1],
|
---|
| 383 | 'sector_namedn_completo' => $explode_groups[2],
|
---|
| 384 | );
|
---|
| 385 |
|
---|
| 386 | $p->set_var($varsuborg);
|
---|
| 387 | $p->parse('rows','row',True);
|
---|
| 388 | }
|
---|
| 389 | }
|
---|
| 390 | }
|
---|
| 391 |
|
---|
| 392 | $p->pfp('out','list');
|
---|
| 393 | }
|
---|
| 394 |
|
---|
| 395 | function report_logon_group_setor_print()
|
---|
| 396 | {
|
---|
| 397 | $vnumacesso = trim($_POST[nacesso]);
|
---|
| 398 | $numacesso = abs(round($vnumacesso));
|
---|
| 399 |
|
---|
| 400 | if ($vnumacesso==999){
|
---|
| 401 | $numacesso = "Nunca logou";
|
---|
| 402 | }
|
---|
| 403 |
|
---|
| 404 | $grouplist = trim($_POST[setor]);
|
---|
| 405 | $grouplist = trim(ereg_replace("-","",$grouplist));
|
---|
| 406 | $organizacao = trim($_POST[organizacao]);
|
---|
| 407 | $setordn = trim($_POST[setordn]);
|
---|
| 408 | $organizacaodn = trim($_POST[organizacaodn]);
|
---|
| 409 | $sectornamedncompleto = trim($_POST[sectornamedncompleto]);
|
---|
| 410 | $Psectornamedncompleto = trim($_POST[Psectornamedncompleto]);
|
---|
| 411 |
|
---|
| 412 | if ($sectornamedncompleto=="" && $Psectornamedncompleto=="")
|
---|
| 413 | {
|
---|
| 414 | $sectornamedncompleto = $organizacao;
|
---|
| 415 | }
|
---|
| 416 | else if ($sectornamedncompleto=="" && $Psectornamedncompleto <> "")
|
---|
| 417 | {
|
---|
| 418 | $sectornamedncompleto = $Psectornamedncompleto;
|
---|
| 419 | }
|
---|
| 420 | else
|
---|
| 421 | {
|
---|
| 422 | $sectornamedncompleto = $organizacao." | ".$sectornamedncompleto;
|
---|
| 423 | }
|
---|
| 424 |
|
---|
| 425 | $data_atual = date("d/m/Y");
|
---|
[3666] | 426 | $titulo_system = $GLOBALS['phpgw_info']['apps']['reports']['title'];
|
---|
[3471] | 427 |
|
---|
| 428 | $account_lid = $GLOBALS['phpgw']->accounts->data['account_lid'];
|
---|
| 429 | $acl = $this->functions->read_acl($account_lid);
|
---|
| 430 | $raw_context = $acl['raw_context'];
|
---|
| 431 | $contexts = $acl['contexts'];
|
---|
| 432 | foreach ($acl['contexts_display'] as $index=>$tmp_context)
|
---|
| 433 | {
|
---|
| 434 | $context_display .= $tmp_context;
|
---|
| 435 | }
|
---|
| 436 | // Verifica se o administrador tem acesso.
|
---|
| 437 | if (!$this->functions->check_acl($account_lid,'list_users'))
|
---|
| 438 | {
|
---|
[3666] | 439 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/reports/inc/access_denied.php'));
|
---|
[3471] | 440 | }
|
---|
| 441 |
|
---|
| 442 | unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
---|
| 443 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
---|
[3666] | 444 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['reports']['title'].' - '.lang('report user');
|
---|
[3471] | 445 | $GLOBALS['phpgw']->common->phpgw_header();
|
---|
| 446 |
|
---|
| 447 | $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
---|
| 448 | $p->set_file(Array('accounts' => 'report_logon_group_print.tpl'));
|
---|
| 449 | $p->set_block('accounts','body');
|
---|
| 450 | $p->set_block('accounts','rowpag');
|
---|
| 451 | $p->set_block('accounts','row');
|
---|
| 452 | $p->set_block('accounts','row_empty');
|
---|
| 453 |
|
---|
| 454 | $var = Array(
|
---|
| 455 | 'bg_color' => $GLOBALS['phpgw_info']['theme']['bg_color'],
|
---|
| 456 | 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
---|
| 457 | 'subtitulo' => lang('reports title6'),
|
---|
| 458 | 'subtitulo1' => $sectornamedncompleto,
|
---|
| 459 | 'context' => $raw_context,
|
---|
| 460 | 'titulo' => $titulo_system,
|
---|
| 461 | 'data_atual' => $data_atual,
|
---|
| 462 | 'context_display' => $context_display,
|
---|
| 463 | 'organizacaodn' => $organizacaodn,
|
---|
| 464 | 'organizacao' => $organizacao,
|
---|
| 465 | 'sector_name' => $grouplist,
|
---|
| 466 | 'sector_namedn' => $setordn,
|
---|
| 467 | 'nacesso' => $vnumacesso,
|
---|
| 468 | 'imapDelimiter' => $_SESSION['phpgw_info']['expresso']['email_server']['imapDelimiter']
|
---|
| 469 | );
|
---|
| 470 |
|
---|
| 471 | $p->set_var($var);
|
---|
| 472 | $p->set_var($this->functions->make_dinamic_lang($p, 'body'));
|
---|
| 473 |
|
---|
| 474 | // ************ PAGINAÇÃO *******************************
|
---|
| 475 |
|
---|
| 476 | // verifica se exixte usuarios no LDAP
|
---|
| 477 | $account_info = $this->functions->get_list_user_sector_logon($setordn,$contexts,0,$numacesso);
|
---|
| 478 |
|
---|
| 479 | if (!count($account_info))
|
---|
| 480 | {
|
---|
| 481 | $p->set_var('message',lang('No user found'));
|
---|
| 482 | $p->parse('rows','row_empty',True);
|
---|
| 483 | }
|
---|
| 484 | else if (count($account_info))
|
---|
| 485 | {
|
---|
| 486 | if ($vnumacesso==0){
|
---|
| 487 | //url do paginador
|
---|
[4035] | 488 | $url = $GLOBALS['phpgw_info']['server']['webserver_url'].'/index.php?menuaction=reports.uireports_logon.report_logon_group_setor_print';
|
---|
[3471] | 489 |
|
---|
| 490 | // **** Grupo de paginas ****
|
---|
| 491 | $gpag = $_POST[gpage];
|
---|
| 492 |
|
---|
| 493 | $grupopage = 20;
|
---|
| 494 |
|
---|
| 495 | if (!$gpag){
|
---|
| 496 | $gpag = 1;
|
---|
| 497 | }
|
---|
| 498 |
|
---|
| 499 | // recebe o numero da pagina
|
---|
| 500 | $npag = $_POST[page];
|
---|
| 501 |
|
---|
| 502 | // verifica se o get com o numero da pagina é nulo
|
---|
| 503 | if (!$npag)
|
---|
| 504 | {
|
---|
| 505 | $npag = 1;
|
---|
| 506 | }
|
---|
| 507 |
|
---|
| 508 | // conta total dos registros
|
---|
| 509 | $numreg = count($account_info);
|
---|
| 510 |
|
---|
| 511 | // numero de registro por paginação
|
---|
| 512 | $numpage = 53;
|
---|
| 513 |
|
---|
| 514 | $tp = ceil($numreg/$numpage);
|
---|
| 515 | $inicio = $page - 1;
|
---|
| 516 | $inicio = $inicio * $numpage;
|
---|
| 517 |
|
---|
| 518 | // valor maximo de paginação
|
---|
| 519 | $totalnpag = (int)($tp/$grupopage);
|
---|
| 520 | $restonpag = $tp % $grupopage;
|
---|
| 521 |
|
---|
| 522 | if ($restonpag > 0)
|
---|
| 523 | {
|
---|
| 524 | $maxtotalnpag = $totalnpag + 1;
|
---|
| 525 | }
|
---|
| 526 | else
|
---|
| 527 | {
|
---|
| 528 | $maxtotalnpag = $totalnpag;
|
---|
| 529 | }
|
---|
| 530 | // inicio fim para imprimir a paginação
|
---|
| 531 | if( $tp > $grupopage)
|
---|
| 532 | {
|
---|
| 533 | // inicio do for da paginação
|
---|
| 534 | if ($gpag <= ($totalnpag))
|
---|
| 535 | {
|
---|
| 536 | $fimgpg = $gpag * $grupopage;
|
---|
| 537 | $iniciogpg = (($fimgpg - $grupopage)+1);
|
---|
| 538 | }
|
---|
| 539 | else
|
---|
| 540 | {
|
---|
| 541 | $iniciogpg = (($gpag - 1) * $grupopage);
|
---|
| 542 | $fimgpg = $iniciogpg + $restonpag;
|
---|
| 543 | }
|
---|
| 544 | }
|
---|
| 545 | else
|
---|
| 546 | {
|
---|
| 547 | // inicio do for da paginação
|
---|
| 548 | $iniciogpg = 1;
|
---|
| 549 | $fimgpg = $tp;
|
---|
| 550 | }
|
---|
| 551 |
|
---|
| 552 |
|
---|
| 553 | // Imprime valores de contagen de registro e pagina
|
---|
| 554 | $p->set_var('cont_user',$numreg);
|
---|
| 555 | $p->set_var('cont_page',$tp);
|
---|
| 556 | $p->set_var('page_now',$npag);
|
---|
| 557 |
|
---|
| 558 | // ********** busca no LDAP as informação paginada e imprime ****************
|
---|
| 559 | $paginas = $this->functions->Paginate_user_logon('accounts',$setordn,$contexts,'cn','asc',$npag,$numpage,$numacesso);
|
---|
| 560 |
|
---|
| 561 | $tmpp = array();
|
---|
| 562 | $contap = 0;
|
---|
| 563 | while (list($null,$accountp) = each($paginas))
|
---|
| 564 | {
|
---|
| 565 | $access_log = $this->functions->show_access_log($accountp['uidNumber'][0]);
|
---|
| 566 |
|
---|
| 567 | $access_log_array = explode("#",$access_log);
|
---|
| 568 |
|
---|
| 569 | $accountp['li_dias'][0] = $access_log_array[1];
|
---|
| 570 | $accountp['li_date'][0] = $access_log_array[0];
|
---|
| 571 |
|
---|
| 572 | $tmpp[$contap]['account_id'] = $accountp['uidNumber'][0];
|
---|
| 573 | $tmpp[$contap]['account_lid'] = $accountp['uid'][0];
|
---|
| 574 | $tmpp[$contap]['account_cn'] = $accountp['cn'][0];
|
---|
| 575 | $tmpp[$contap]['account_status'] = $accountp['accountStatus'][0];
|
---|
| 576 | $tmpp[$contap]['account_mail'] = $accountp['mail'][0];
|
---|
| 577 | $tmpp[$contap]['createTimestamp'] = $accountp['createTimestamp'][0];
|
---|
| 578 | $tmpp[$contap]['li_dias']= $accountp['li_dias'][0];
|
---|
| 579 | $tmpp[$contap]['li_date']= $accountp['li_date'][0];
|
---|
| 580 |
|
---|
| 581 | $sortp[] = $accountp['li_dias'][0];
|
---|
| 582 |
|
---|
| 583 | if (count($sortp))
|
---|
| 584 | {
|
---|
| 585 | natcasesort($sortp);
|
---|
| 586 | }
|
---|
| 587 |
|
---|
| 588 | $contap = $contap + 1;
|
---|
| 589 | }
|
---|
| 590 |
|
---|
| 591 | while (list($key,$accountr1) = each($sortp))
|
---|
| 592 | {
|
---|
| 593 | $returnp[] = $tmpp[$key];
|
---|
| 594 | }
|
---|
| 595 |
|
---|
| 596 | $returnp = array_reverse($returnp);
|
---|
| 597 |
|
---|
| 598 | $ii = 0;
|
---|
| 599 |
|
---|
| 600 | while (list($null,$accountr) = each($returnp))
|
---|
| 601 | {
|
---|
| 602 | $this->nextmatchs->template_alternate_row_color($p);
|
---|
| 603 | $ii = $ii + 1;
|
---|
| 604 |
|
---|
| 605 | $varr = array(
|
---|
| 606 | 'formname' => "formlog".$ii,
|
---|
| 607 | 'formsubmit' => "document.formlog".$ii.".submit()",
|
---|
| 608 | 'row_idnumber' => $accountr['account_id'],
|
---|
| 609 | 'row_loginid' => $accountr['account_lid'],
|
---|
| 610 | 'row_cn' => $accountr['account_cn'],
|
---|
| 611 | 'row_status' => $accountr['account_status'] == 'active' ? '<font color="#0033FF">Ativado</font> ' : '<font color="#FF0000">Desativado</font>',
|
---|
| 612 | 'row_mail' => (!$accountr['account_mail']?'<font color=red>Sem E-mail</font>':$accountr['account_mail']),
|
---|
| 613 | 'row_timestamp' => substr($accountr['createTimestamp'], 6, 2)."/".substr($accountr['createTimestamp'], 4, 2)."/".substr($accountr['createTimestamp'], 0, 4),
|
---|
| 614 | 'row_li_date' => $accountr['li_date'] =='Nunca logou' ? '<font color="#FF0000">'.$accountr['li_date'].'</font>' : $accountr['li_date'],
|
---|
| 615 | 'row_li_dias' => $accountr['li_dias']
|
---|
| 616 | );
|
---|
| 617 |
|
---|
| 618 | $p->set_var($varr);
|
---|
| 619 |
|
---|
| 620 | $p->parse('rows','row',True);
|
---|
| 621 | }
|
---|
| 622 | // ********************** Fim ****************************
|
---|
| 623 |
|
---|
| 624 | // grupo de pagina anteriores
|
---|
| 625 | if ($gpag > 1)
|
---|
| 626 | {
|
---|
| 627 | $gpaga = $gpag - 1;
|
---|
| 628 | $varp = Array(
|
---|
| 629 | 'paginat' => "<form name='anterior' method='POST' action='$url'>
|
---|
| 630 | <input type='hidden' name='setor' value='$grouplist'>
|
---|
| 631 | <input type='hidden' name='organizacao' value='$organizacao'>
|
---|
| 632 | <input type='hidden' name='setordn' value='$setordn'>
|
---|
| 633 | <input type='hidden' name='organizacaodn' value='$organizacaodn'>
|
---|
| 634 | <input type='hidden' name='page' value='$npag'>
|
---|
| 635 | <input type='hidden' name='gpage' value='$gpaga'>
|
---|
| 636 | <input type='hidden' name='Psectornamedncompleto' value='$sectornamedncompleto'>
|
---|
| 637 | <div style='float:left;' onClick='document.anterior.submit()'><a href='#'>".lang('Previous Pages')."<< </a></div></form>"
|
---|
| 638 | );
|
---|
| 639 | $p->set_var($varp);
|
---|
| 640 |
|
---|
| 641 | $p->parse('pages','rowpag',True);
|
---|
| 642 | }
|
---|
| 643 | // **** FIM *******
|
---|
| 644 |
|
---|
| 645 | // imprime a paginação
|
---|
| 646 | if ($fimgpg > 1)
|
---|
| 647 | {
|
---|
| 648 | for($x = $iniciogpg; $x <= $fimgpg; $x++)
|
---|
| 649 | {
|
---|
| 650 | $varp = Array(
|
---|
| 651 | 'paginat' => "<form name='form".$x."' method='POST' action='$url'>
|
---|
| 652 | <input type='hidden' name='setor' value='$grouplist'>
|
---|
| 653 | <input type='hidden' name='organizacao' value='$organizacao'>
|
---|
| 654 | <input type='hidden' name='setordn' value='$setordn'>
|
---|
| 655 | <input type='hidden' name='organizacaodn' value='$organizacaodn'>
|
---|
| 656 | <input type='hidden' name='page' value='$x'>
|
---|
| 657 | <input type='hidden' name='gpage' value='$gpag'>
|
---|
| 658 | <input type='hidden' name='Psectornamedncompleto' value='$sectornamedncompleto'>
|
---|
| 659 | <div style='float:left;' onClick='document.form".$x.".submit()'><a href='#'>$x </a></div></form>"
|
---|
| 660 | );
|
---|
| 661 |
|
---|
| 662 | $p->set_var($varp);
|
---|
| 663 |
|
---|
| 664 | $p->parse('pages','rowpag',True);
|
---|
| 665 | }
|
---|
| 666 | }
|
---|
| 667 |
|
---|
| 668 | // proximo grupo de pagina
|
---|
| 669 | if ($gpag < $maxtotalnpag && $maxtotalnpag > 0)
|
---|
| 670 | {
|
---|
| 671 | $gpagp = $gpag + 1;
|
---|
| 672 | $varp = Array(
|
---|
| 673 | 'paginat' => "<form name='proximo' method='POST' action='$url'>
|
---|
| 674 | <input type='hidden' name='setor' value='$grouplist'>
|
---|
| 675 | <input type='hidden' name='organizacao' value='$organizacao'>
|
---|
| 676 | <input type='hidden' name='setordn' value='$setordn'>
|
---|
| 677 | <input type='hidden' name='organizacaodn' value='$organizacaodn'>
|
---|
| 678 | <input type='hidden' name='page' value='$npag'>
|
---|
| 679 | <input type='hidden' name='gpage' value='$gpagp'>
|
---|
| 680 | <input type='hidden' name='Psectornamedncompleto' value='$sectornamedncompleto'>
|
---|
| 681 | <div style='float:left;' onClick='document.proximo.submit()'><a href='#'> >>".lang('Next Page')."</a></div></form>"
|
---|
| 682 | );
|
---|
| 683 | $p->set_var($varp);
|
---|
| 684 |
|
---|
| 685 | $p->parse('pages','rowpag',True);
|
---|
| 686 | }
|
---|
| 687 |
|
---|
| 688 | $vart = Array(
|
---|
| 689 | 'page' => $npag,
|
---|
| 690 | 'gpage' => $gpag
|
---|
| 691 | );
|
---|
| 692 |
|
---|
| 693 | $p->set_var($vart);
|
---|
| 694 | // ************************* FIM PAGINAÇÃO ***********************
|
---|
| 695 |
|
---|
| 696 | }else{
|
---|
| 697 | // ******** caso não for zero não vai paginar *****************
|
---|
| 698 | //url do paginador
|
---|
[4035] | 699 | $url = $GLOBALS['phpgw_info']['server']['webserver_url'].'/index.php?menuaction=reports.uireports_logon.report_logon_group_setor_print';
|
---|
[3471] | 700 |
|
---|
| 701 | // conta total dos registros
|
---|
| 702 | $numreg = count($account_info);
|
---|
| 703 |
|
---|
| 704 | // Imprime valores de contagen de registro e pagina
|
---|
| 705 | $p->set_var('cont_user',$numreg);
|
---|
| 706 | $p->set_var('cont_page',"1");
|
---|
| 707 | $p->set_var('page_now',"1");
|
---|
| 708 |
|
---|
| 709 | // ********** busca no LDAP as informação paginada e imprime ****************
|
---|
| 710 | $paginas =$this->functions->get_list_user_sector_logon($setordn,$contexts,0,$numacesso);
|
---|
| 711 |
|
---|
| 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 |
|
---|
| 720 | if ($numacesso<>"Nunca logou"){
|
---|
| 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 | }
|
---|
| 751 |
|
---|
| 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'],
|
---|
| 780 | 'row_status' => $accountr['account_status'] == 'active' ? '<font color="#0033FF">Ativado</font> ' : '<font color="#FF0000">Desativado</font>',
|
---|
| 781 | 'row_mail' => (!$accountr['account_mail']?'<font color=red>Sem E-mail</font>':$accountr['account_mail']),
|
---|
| 782 | 'row_timestamp' => substr($accountr['createTimestamp'], 6, 2)."/".substr($accountr['createTimestamp'], 4, 2)."/".substr($accountr['createTimestamp'], 0, 4),
|
---|
| 783 | 'row_li_date' => $accountr['li_date'] =='Nunca logou' ? '<font color="#FF0000">'.$accountr['li_date'].'</font>' : $accountr['li_date'],
|
---|
| 784 | 'row_li_dias' => $accountr['li_dias']
|
---|
| 785 | );
|
---|
| 786 |
|
---|
| 787 | $p->set_var($varr);
|
---|
| 788 |
|
---|
| 789 | $p->parse('rows','row',True);
|
---|
| 790 | }
|
---|
| 791 | // ********************** Fim ****************************
|
---|
| 792 | }
|
---|
| 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 | {
|
---|
[3666] | 865 | $GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/reports/inc/access_denied.php'));
|
---|
[3471] | 866 | }
|
---|
| 867 |
|
---|
| 868 | // Seta header.
|
---|
| 869 | unset($GLOBALS['phpgw_info']['flags']['noheader']);
|
---|
| 870 | unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
|
---|
| 871 |
|
---|
[3666] | 872 | $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['reports']['title'].' - '.lang('Access Log');
|
---|
[3471] | 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,
|
---|
[3903] | 911 | 'back_url' => "<form name='formlog' method='POST' action='./index.php?menuaction=reports.uireports_logon.report_logon_group_setor_print'>
|
---|
[3471] | 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 | ?>
|
---|