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