Index: branches/2.4/reports/inc/class.uireports_logon.inc.php
===================================================================
--- branches/2.4/reports/inc/class.uireports_logon.inc.php	(revision 5934)
+++ branches/2.4/reports/inc/class.uireports_logon.inc.php	(revision 7228)
@@ -67,5 +67,5 @@
 
 			$grouplist = trim($_POST[setor]);
-			$grouplist = trim(preg_replace('/-/','',$grouplist));
+			$grouplist = trim(ereg_replace("-","",$grouplist));
 
 			$setordn = trim($_POST[setordn]);
@@ -76,5 +76,5 @@
 
 			if ($vnumacesso==999){
-				$numacesso = "Nunca logou";
+				$numacesso = lang('Never login');
 			}
 
@@ -87,5 +87,4 @@
 			$pdf->Open();
 			$pdf->AddPage();
-			$pdf->SetTitle('Relatório Gerado pelo Expresso Reports');
 
 			//Set font and colors
@@ -98,5 +97,5 @@
 			//Table header
 			$SubTitulo = lang('reports title6');
-			$SubTituloR = lang('report of time without logging by Organization');
+			$SubTituloR = lang('Report Generated by Expresso Reports');
 			$SubTitulo1 = $subtitulo1;
 			$GLOBALS['phpgw_info']['apps']['reports']['subtitle'] = $SubTituloR;
@@ -181,9 +180,9 @@
 						$row_cn = $accountr['account_cn'];
 						$account_lid = $accountr['account_lid'];
-						$row_mail = (!$accountr['account_mail'] ? 'Sem E-mail' : $accountr['account_mail']);
+						$row_mail = (!$accountr['account_mail'] ? lang('Without E-mail') : $accountr['account_mail']);
 						$row_timestamp = substr($accountr['createTimestamp'], 6, 2)."/".substr($accountr['createTimestamp'], 4, 2)."/".substr($accountr['createTimestamp'], 0, 4);
-						$row_li_date = $accountr['li_date'] == 'Nunca logou' ? 'Nunca logou' : $accountr['li_date'];
+						$row_li_date = $accountr['li_date'] == lang('Never login') ? lang('Never login') : $accountr['li_date'];
 						$row_li_dias = $accountr['li_dias'];
-						$row_status = $accountr['account_status'] == 'active' ? 'Ativado' : 'Desativado';
+						$row_status = $accountr['account_status'] == 'active' ? lang('Activated') : lang('Disabled');
 						
 						$pdf->Cell(60,5,$account_lid,0,0,'L',0);
@@ -192,5 +191,5 @@
 						$pdf->Cell(25,5,$row_timestamp,0,0,'C',0);
 
-						if ($row_li_date == 'Nunca logou')
+						if ($row_li_date == lang('Never login'))
 						{
 							//Muda cor fonte
@@ -286,6 +285,6 @@
 			// Save query
 			$varorganizacao = explode(",",$contextsdn);
-			$varorganizacao_nome = trim(strtoupper(preg_replace('/ou=/','',$varorganizacao[0])));
-			$varorganizacao_nome = trim(strtoupper(preg_replace('/DC=/','',$varorganizacao_nome)));
+			$varorganizacao_nome = trim(strtoupper(ereg_replace("ou=","",$varorganizacao[0])));
+			$varorganizacao_nome = trim(strtoupper(ereg_replace("DC=","",$varorganizacao_nome)));
 			$user_logon = $GLOBALS['phpgw_info']['user'][account_lid];
 
@@ -329,6 +328,6 @@
 						if ( trim(strtoupper($varorganizacao_nome)) !=  trim(strtoupper($sector)))
 						{
-							$sectorok = trim(strtoupper(preg_replace('/dc=/','',$sector)));
-							$sectorok = trim(strtoupper(preg_replace('/dc=/','',$sectorok)));
+							$sectorok = trim(strtoupper(ereg_replace("dc=","",$sector)));
+							$sectorok = trim(strtoupper(ereg_replace("dc=","",$sectorok)));
 							$sector_options .= "<option value='" . $sectordn . "'>". $sectorok . "</option>";
 						}
@@ -403,5 +402,5 @@
 
 			$grouplist = trim($_POST[setor]);
-			$grouplist = trim(preg_replace('/-/','',$grouplist));
+			$grouplist = trim(ereg_replace("-","",$grouplist));
 			$organizacao = trim($_POST[organizacao]);
 			$setordn = trim($_POST[setordn]);
@@ -474,15 +473,12 @@
 			// ************ PAGINAÇÃO *******************************
 
-			// verifica se exixte usuarios no LDAP
-			$account_info = $this->functions->get_list_user_sector_logon($setordn,$contexts,0,$numacesso);
-
-			if (!count($account_info))
-			{
-				$p->set_var('message',lang('No user found'));
-				$p->parse('rows','row_empty',True);
-			}
-			else if (count($account_info))
-			{ 
-				if ($vnumacesso==0){
+
+			if ($vnumacesso==0){
+				$numreg = $this->functions->get_num_users_sector($setordn,$contexts);
+				if ($numreg==0){
+					$p->set_var('message',lang('No user found'));
+					$p->parse('rows','row_empty',True);
+				}
+				else {
 					//url do paginador 
 					$url = $GLOBALS['phpgw_info']['server']['webserver_url'].'/index.php?menuaction=reports.uireports_logon.report_logon_group_setor_print';
@@ -507,5 +503,4 @@
 	
 					// conta total dos registros
-					$numreg = count($account_info);
 					
 					// numero de registro por paginação
@@ -612,5 +607,5 @@
 							'row_mail'		=> (!$accountr['account_mail']?'<font color=red>Sem E-mail</font>':$accountr['account_mail']),
 							'row_timestamp'		=> substr($accountr['createTimestamp'], 6, 2)."/".substr($accountr['createTimestamp'], 4, 2)."/".substr($accountr['createTimestamp'], 0, 4),
-							'row_li_date'		=> $accountr['li_date'] =='Nunca logou' ? '<font color="#FF0000">'.$accountr['li_date'].'</font>' : $accountr['li_date'],
+							'row_li_date'		=> $accountr['li_date'] ==lang('Never login') ? '<font color="#FF0000">'.$accountr['li_date'].'</font>' : $accountr['li_date'],
 							'row_li_dias'		=> $accountr['li_dias']
 						);
@@ -693,21 +688,26 @@
 					$p->set_var($vart);
 					// ************************* FIM PAGINAÇÃO ***********************							
-
-				}else{
+				}
+			}
+			else{
 				// ******** caso não for zero não vai paginar *****************
-					//url do paginador 
-					$url = $GLOBALS['phpgw_info']['server']['webserver_url'].'/index.php?menuaction=reports.uireports_logon.report_logon_group_setor_print';
-
-					// conta total dos registros
-					$numreg = count($account_info);
-
+				//url do paginador 
+				$url = $GLOBALS['phpgw_info']['server']['webserver_url'].'/index.php?menuaction=reports.uireports_logon.report_logon_group_setor_print';
+
+				// conta total dos registros
+
+				// ********** busca no LDAP as informação total e imprime ****************
+				$paginas =$this->functions->get_list_user_sector_logon($setordn,$contexts,0,$numacesso);
+				
+				if(count($paginas)==0) {
+					$p->set_var('message',lang('No user found'));
+					$p->parse('rows','row_empty',True);
+				}
+				else {
 					// Imprime valores de contagen de registro e pagina
-					$p->set_var('cont_user',$numreg);
+					$p->set_var('cont_user',count($paginas));
 					$p->set_var('cont_page',"1");
 					$p->set_var('page_now',"1");
-
-					// ********** busca no LDAP as informação paginada e imprime ****************
-					$paginas =$this->functions->get_list_user_sector_logon($setordn,$contexts,0,$numacesso);
-
+	
 					$tmpp = array();
 					$contap = 0;
@@ -718,5 +718,5 @@
 						$access_log_array = explode("#",$access_log);
 						
-						if ($numacesso<>"Nunca logou"){
+						if ($numacesso<>lang('Never login')){
 							$accountp['li_dias'] = $access_log_array[1];
 							$accountp['li_date'] = $access_log_array[0];
@@ -749,5 +749,5 @@
 							}
 						}	
-
+	
 						if (count($sortp))
 						{
@@ -778,8 +778,8 @@
 							'row_loginid'	=> $accountr['account_lid'],
 							'row_cn'		=> $accountr['account_cn'],
-							'row_status'	=> $accountr['account_status'] == 'active' ? '<font color="#0033FF">Ativado</font> ' : '<font color="#FF0000">Desativado</font>',
-							'row_mail'		=> (!$accountr['account_mail']?'<font color=red>Sem E-mail</font>':$accountr['account_mail']),
+							'row_status'	=> $accountr['account_status'] == 'active' ? '<font color="#0033FF">'.lang('Activated').'</font> ' : '<font color="#FF0000">'.lang('Disabled').'</font>',
+							'row_mail'		=> (!$accountr['account_mail']?'<font color=red>'.lang('Without E-mail').'</font>':$accountr['account_mail']),
 							'row_timestamp'		=> substr($accountr['createTimestamp'], 6, 2)."/".substr($accountr['createTimestamp'], 4, 2)."/".substr($accountr['createTimestamp'], 0, 4),
-							'row_li_date'		=> $accountr['li_date'] =='Nunca logou' ? '<font color="#FF0000">'.$accountr['li_date'].'</font>' : $accountr['li_date'],
+							'row_li_date'		=> $accountr['li_date'] ==lang('Never login') ? '<font color="#FF0000">'.$accountr['li_date'].'</font>' : $accountr['li_date'],
 							'row_li_dias'		=> $accountr['li_dias']
 						);
@@ -789,6 +789,6 @@
 						$p->parse('rows','row',True);
 					}
-					// ********************** Fim ****************************
-				}
+				}
+			// ********************** Fim ****************************
 			}
 
