1<?php
2/**
3 * Sono qui definite le procedure per gestire i report di VFront.
4 *
5 * @desc Modulo di gestione dei report
6 * @package VFront
7 * @subpackage Administration
8 * @author M.Marcello Verona
9 * @copyright 2007-2010 M.Marcello Verona
10 * @version 0.96 $Id: xmlreport.php 921 2011-01-25 15:49:35Z marciuz $
11 * @license http://www.gnu.org/licenses/gpl.html GNU Public License
12 */
13
14include("../inc/conn.php");
15include("../inc/layouts.php");
16include("../inc/func.comuni.php");
17include("../inc/func.frontend.php");
18
19 proteggi(2);
20
21
22 ######################################
23 #
24 #	INSERIMENTO IN DB
25 #
26 ######################################
27
28 if(isset($_GET['creanew'])){
29
30
31 	$_dati=$vmreg->recursive_escape($_POST);
32
33
34
35
36 	// gestione file -------------------------------------------------------------------------------
37 	if($_FILES['new_xsl']['size']>0){
38
39 		// è stato richiesto un nuovo file XSL da uplodare
40 		$NEW_XSL_NAME=preg_replace("'[^a-z0-9_.]'i","_",$_FILES['new_xsl']['name']);
41
42 		while(is_file(_PATH_XSL."/".$NEW_XSL_NAME)){
43
44 			$NEW_XSL_NAME="_".$NEW_XSL_NAME;
45 		}
46
47 		$test_xsl=move_uploaded_file($_FILES['new_xsl']['tmp_name'],_PATH_XSL."/".$NEW_XSL_NAME);
48 	}
49 	else{
50
51 		if($_dati['xsl']!='default') $NEW_XSL_NAME=$_dati['xsl'];
52 		else $NEW_XSL_NAME='';
53
54
55 	}// gestione file -------------------------------------------------------------------------------
56
57
58 	// gestione file -------------------------------------------------------------------------------
59 	if($_FILES['new_fo']['size']>0){
60
61 		// è stato richiesto un nuovo file XSL da uplodare
62 		$NEW_XSLFO_NAME=preg_replace("'[^a-z0-9_.]'i","_",$_FILES['new_fo']['name']);
63
64 		while(is_file(_PATH_XSL."/".$NEW_XSLFO_NAME)){
65
66 			$NEW_XSLFO_NAME="_".$NEW_XSLFO_NAME;
67 		}
68
69
70 		$test_xslfo=move_uploaded_file($_FILES['new_fo']['tmp_name'],_PATH_XSL."/".$NEW_XSLFO_NAME);
71 	}
72 	else{
73
74 		if($_dati['fo']=='') $NEW_XSLFO_NAME='-1';
75 		else if($_dati['fo']!='default') $NEW_XSLFO_NAME=$_dati['xsl'];
76 		else $NEW_XSLFO_NAME='';
77
78
79 	}// gestione file -------------------------------------------------------------------------------
80
81
82
83 	$nome_report = preg_replace("|[^\w-_]+|","_",$_dati['nome_report']);
84
85 	$nome_report=strtolower($nome_report);
86
87 	if(!is_array($_dati['gid'])) $_dati['gid']=array();
88
89 	$sql=sprintf("INSERT INTO {$db1['frontend']}{$db1['sep']}xml_rules (nome_report,tabella,accesso, accesso_gruppo, autore, lastData, xsl, xslfo, def_query, tipo_report)
90 				  VALUES ('%s','%s','%s','%s',%d,'%s','%s','%s','%s','%s')",
91 				$nome_report,
92 				$_dati['tabella'],
93 				$_dati['accesso'],
94 				implode(",",$_dati['gid']),
95 				$_SESSION['user']['uid'],
96 				date("Y-m-d H:i:s"),
97 				$NEW_XSL_NAME,
98 				$NEW_XSLFO_NAME,
99 				$_dati['def_query'],
100 				$_dati['tipo_report']
101 				);
102
103 	$q=$vmreg->query($sql);
104
105 	if($vmreg->affected_rows($q)==1){
106 		header("Location: ".$_SERVER['PHP_SELF']."?feed=ok");
107 	}
108 	else{
109 		header("Location: ".$_SERVER['PHP_SELF']."?feed=ko");
110 	}
111
112 	exit;
113
114 }
115
116
117  ######################################
118 #
119 #	MODIFICA IN DB
120 #
121 ######################################
122
123 if(isset($_GET['appmod'])){
124
125 	$_dati=$vmreg->recursive_escape($_POST);
126
127
128 	// gestione file -------------------------------------------------------------------------------
129 	if($_FILES['new_xsl']['size']>0){
130
131 		// è stato richiesto un nuovo file XSL da uplodare
132 		$NEW_XSL_NAME=preg_replace("'[^a-z0-9_.]'i","_",$_FILES['new_xsl']['name']);
133
134 		while(is_file(_PATH_XSL."/".$NEW_XSL_NAME)){
135
136 			$NEW_XSL_NAME="_".$NEW_XSL_NAME;
137 		}
138
139
140 		$test_xsl=move_uploaded_file($_FILES['new_xsl']['tmp_name'],_PATH_XSL."/".$NEW_XSL_NAME);
141 	}
142 	else{
143
144 		if($_dati['xsl']!='default') $NEW_XSL_NAME=$_dati['xsl'];
145 		else $NEW_XSL_NAME='';
146
147
148 	}// gestione file -------------------------------------------------------------------------------
149
150
151 	// gestione file -------------------------------------------------------------------------------
152 	if($_FILES['new_fo']['size']>0){
153
154 		// E' stato richiesto un nuovo file XSL da uplodare
155 		$NEW_XSLFO_NAME=preg_replace("'[^a-z0-9_.]'i","_",$_FILES['new_fo']['name']);
156
157 		while(is_file(_PATH_XSL."/".$NEW_XSLFO_NAME)){
158
159 			$NEW_XSLFO_NAME="_".$NEW_XSLFO_NAME;
160 		}
161
162
163 		$test_xslfo=move_uploaded_file($_FILES['new_fo']['tmp_name'],_PATH_XSL."/".$NEW_XSLFO_NAME);
164 	}
165 	else{
166
167 		if($_dati['fo']=='') $NEW_XSLFO_NAME='-1';
168 		else if($_dati['fo']!='default') $NEW_XSLFO_NAME=$_dati['fo'];
169 		else $NEW_XSLFO_NAME='';
170
171
172 	}// gestione file -------------------------------------------------------------------------------
173
174
175
176 	if(!is_array($_dati['gid'])) $_dati['gid']=array();
177
178 	$nome_report = preg_replace("|[^\w-_]+|","_",strtolower($_dati['nome_report']));
179
180 	$sql=sprintf("UPDATE {$db1['frontend']}{$db1['sep']}xml_rules SET
181 				  nome_report='%s', accesso='%s', accesso_gruppo='%s', autore=%d,
182 				  lastData='%s', xsl='%s', xslfo='%s', def_query='%s'
183 				  WHERE id_xml_rules=%d",
184 				$nome_report,
185 				$_dati['accesso'],
186 				implode(",",$_dati['gid']),
187 				$_SESSION['user']['uid'],
188 				date("Y-m-d H:i:s"),
189 				$NEW_XSL_NAME,
190 				$NEW_XSLFO_NAME,
191 				$_dati['def_query'],
192 				$_dati['id_xml_rules']
193 				);
194
195 	$q=$vmreg->query($sql);
196
197 	if($vmreg->affected_rows($q)==1){
198 		header("Location: ".$_SERVER['PHP_SELF']."?feed=ok");
199 	}
200 	else{
201 		header("Location: ".$_SERVER['PHP_SELF']."?feed=ko");
202 	}
203
204 	exit;
205
206 }
207
208
209 ######################################
210 #
211 #	CANCELLAZIONE DAL DB
212 #
213 ######################################
214 else if(isset($_GET['del'])){
215
216 	// verifico che l'allegato sia presente in un solo record
217 	$sql_xsl="SELECT count(id_xml_rules) FROM {$db1['frontend']}{$db1['sep']}xml_rules
218 						WHERE xsl=(SELECT xsl FROM {$db1['frontend']}{$db1['sep']}xml_rules WHERE id_xml_rules=".intval($_GET['del']).")";
219 	$q_xsl=$vmreg->query($sql_xsl);
220
221 	list($n_xsl)=$vmreg->fetch_row($q_xsl);
222
223
224
225 	$q=$vmreg->query("DELETE FROM {$db1['frontend']}{$db1['sep']}xml_rules WHERE id_xml_rules=".intval($_GET['del']));
226
227 	 if($vmreg->affected_rows($q)==1){
228 		header("Location: ".$_SERVER['PHP_SELF']."?feed=delok");
229 	}
230 	else{
231 		header("Location: ".$_SERVER['PHP_SELF']."?feed=delko");
232 	}
233
234 	exit;
235 }
236
237
238
239 ######################################
240 #
241 #	CREA NUOVO
242 #
243 ######################################
244else if(isset($_GET['new']) || isset($_GET['newquery'])){
245
246 	$files=array("js/test_query.js");
247
248 	$TIPO_NEW = (isset($_GET['new'])) ? "tabella" : "query";
249
250 	echo openLayout1(_("XML Administration and Reports"),$files);
251
252 	$title_ = _("New XML report");
253
254	echo breadcrumbs(array("HOME","ADMIN","xmlreport.php"=>_("XML administration and reports"), $title_));
255
256	$testo_tit = ($TIPO_NEW=="tabella") ? _("table based") : _("query based");
257
258	echo "<h1>". $title_ ." $testo_tit</h1>\n";
259
260 	echo "<form action=\"".$_SERVER['PHP_SELF']."?creanew\" method=\"post\" enctype=\"multipart/form-data\" >\n";
261
262
263 	echo "<label for=\"nome_report\" >"._("Report name (use only letters, numbers, underscore and dashes):")."</label>\n ";
264 	echo "<input type=\"text\" name=\"nome_report\" id=\"nome_report\" maxlength=\"250\" size=\"40\" /><br /><br />\n";
265
266 	if($TIPO_NEW=="tabella"){
267
268 		// prendi tabelle
269	 	$tab=prendi_tabelle();
270
271
272 		echo "<input type=\"hidden\" name=\"tipo_report\" value=\"t\" />\n";
273 		echo "<input type=\"hidden\" name=\"def_query\" value=\"\" />\n";
274
275	 	echo "<label for=\"tabella\" >"._("Table:")."</label>\n ";
276	 	echo "<select name=\"tabella\" id=\"tabella\">\n";
277	 	for($i=0;$i<count($tab);$i++){
278
279	 		echo "<option value=\"".$tab[$i]['table_name']."\">".$tab[$i]['table_name']."</option>\n";
280
281	 	}
282	 	echo "</select>\n";
283
284 	}
285 	else{
286
287 		echo "<input type=\"hidden\" name=\"tabella\" value=\"\" />\n";
288 		echo "<input type=\"hidden\" name=\"tipo_report\" value=\"q\" />\n";
289
290 		echo "<label for=\"def_query\" >"._("SQL query for the report:")."</label>\n ";
291 		echo "<input value=\""._("Test")."\" onclick=\"try_query(document.getElementById('def_query').value,1)\" type=\"button\" />\n";
292 		echo "<span id=\"feed_altro_1\" class=\"feed_altro\">&nbsp;</span>\n";
293 		echo "<br />\n";
294
295 		echo "<textarea name=\"def_query\" id=\"def_query\" cols=\"80\" rows=\"8\"></textarea>\n";
296
297
298 	}
299
300
301 	echo "<br /><br /><label for=\"accesso\" >"._("Access type:")."</label>\n ";
302 	echo "<select name=\"accesso\" id=\"accesso\" onchange=\"if(this.value=='GROUP'){ document.getElementById('gruppi').style.display='';} else {document.getElementById('gruppi').style.display='none';}\">
303 		<option value=\"RESTRICT\" >"._("Not allowed")."</option>
304 		<option value=\"PUBLIC\" >"._("Public (web)")."</option>
305 		<option value=\"FRONTEND\" >"._("Frontend (only authenticated users)")."</option>
306 		<option value=\"GROUP\" >"._("Only for groups (select)")."</option>
307 		</select>\n";
308
309
310 	// prendi gruppi
311 	$gruppi=prendi_gruppi();
312
313
314 	echo "<div id=\"gruppi\" style=\"display:none;\">
315 	<br /><br /><label for=\"gid\" >"._("Allowed groups:")."</label><select name=\"gid[]\" id=\"gid\" multiple=\"multiple\" size=\"5\">
316 	";
317
318 	for($g=0;$g<count($gruppi);$g++){
319
320 		echo "<option value=\"".$gruppi[$g]['gid']."\">".$gruppi[$g]['gid']." - ".$gruppi[$g]['nome_gruppo']."</option>\n";
321 	}
322
323 	echo "</select>
324
325 	</div>";
326
327 	// cerca fogli di stile XSL custom
328
329 	$dir_xsl = _PATH_XSL;
330
331 	if (is_dir($dir_xsl)) {
332	   if ($dh = opendir($dir_xsl)) {
333	      while (($file_xsl = readdir($dh)) !== false) {
334	             if($file_xsl!='.' && $file_xsl!='..' && is_file($dir_xsl."/".$file_xsl)) $xsl_custom[]=$file_xsl;
335	        }
336	        closedir($dh);
337	    }
338	}
339
340
341 	echo "<br /><br /><label for=\"xsl\" >"._("XSL sheet to be linked:")."</label>\n<select name=\"xsl\" id=\"xsl\">
342 			<option value=\"default\">"._("default")."</option>";
343
344 	for($i=0;$i<count($xsl_custom);$i++){
345
346 		echo "\t\t<option value=\"".$xsl_custom[$i]."\">".$xsl_custom[$i]."</option>\n";
347
348 	}
349
350 	echo "</select>\n";
351
352 	echo _("otherwise link a new file:")." <input type=\"file\" name=\"new_xsl\" id=\"new_xsl\" size=\"48\" />\n";
353
354
355
356 	###################################################
357 	#
358 	#	FO
359 	#
360
361 	// cerca fogli di stile FO custom
362
363 	$dir_fo = _PATH_XSL;
364 	$fo_custom=array();
365
366 	if (is_dir($dir_fo)) {
367	   if ($dh = opendir($dir_fo)) {
368	      while (($file_fo = readdir($dh)) !== false) {
369	             if($file_fo!='.' && $file_fo!='..' && is_file($dir_fo."/".$file_fo)) $fo_custom[]=$file_fo;
370	        }
371	        closedir($dh);
372	    }
373	}
374
375
376 	echo "<br /><br /><label for=\"fo\" >"._("XSL-FO stylesheet to be associed:")."</label>\n<select name=\"fo\" id=\"fo\">
377 			<option value=\"\"> - "._("-")." - </option>
378 			<option value=\"default\">"._("default")."</option>
379 			";
380
381 	for($i=0;$i<count($fo_custom);$i++){
382
383 		echo "\t\t<option value=\"".$fo_custom[$i]."\">".$fo_custom[$i]."</option>\n";
384
385 	}
386
387 	echo "</select>\n";
388
389 	echo _("otherwise link a new file:")." <input type=\"file\" name=\"new_fo\" id=\"new_fo\" size=\"48\" />\n";
390
391 	echo "<br /><br /><input type=\"submit\" name=\"invia\" value=\"   "._("Save")."   \" />\n";
392
393 	echo "</form>\n";
394
395 	echo closeLayout1();
396 	exit;
397 }
398
399
400
401
402 ######################################
403 #
404 #	MODIFICA
405 #
406 ######################################
407
408
409else if(isset($_GET['mod']) && $_GET['mod']>0){
410
411 	$files=array("js/test_query.js");
412
413 	echo openLayout1(_("XML Administration and Reports"),$files);
414
415	echo breadcrumbs(array("HOME","ADMIN","xmlreport.php"=>_("XML administration and reports"), _("XML report")));
416
417	echo "<h1>"._("Modify XML report")."</h1>\n";
418
419 	echo "<form action=\"".$_SERVER['PHP_SELF']."?appmod\" method=\"post\" enctype=\"multipart/form-data\" >\n";
420
421 	$q=$vmreg->query("SELECT * FROM {$db1['frontend']}{$db1['sep']}xml_rules WHERE id_xml_rules=".intval($_GET['mod']));
422
423 	$RS=$vmreg->fetch_assoc($q);
424
425 	$TIPO_REPORT = ((string) $RS['tipo_report']=='t') ? "t" : "q";
426
427 	$sel_RESTRICT = ($RS['accesso']=='RESTRICT') ? "selected=\"selected\"" : "";
428 	$sel_PUBLIC = ($RS['accesso']=='PUBLIC') ? "selected=\"selected\"" : "";
429 	$sel_FRONTEND = ($RS['accesso']=='FRONTEND') ? "selected=\"selected\"" : "";
430 	$sel_GROUP = ($RS['accesso']=='GROUP') ? "selected=\"selected\"" : "";
431
432
433 	echo "<label for=\"nome_report\" >"._("Report name (use only letters, numbers, underscore and dashes):")."</label>\n ";
434 	echo "<input type=\"text\" name=\"nome_report\" id=\"nome_report\" maxlength=\"250\" size=\"40\" value=\"".$RS['nome_report']."\"/><br /><br />\n";
435
436
437 	if($TIPO_REPORT=="t"){
438
439 		echo "<input type=\"hidden\" name=\"tipo_report\" value=\"t\" />\n";
440 	}
441 	else if ($TIPO_REPORT=="q"){
442
443 		echo "<input type=\"hidden\" name=\"tabella\" value=\"\" />\n";
444 		echo "<input type=\"hidden\" name=\"tipo_report\" value=\"q\" />\n";
445
446 		echo "<label for=\"def_query\" >"._("SQL query for the report:")."</label>\n ";
447 		echo "<input value=\""._("Test")."\" onclick=\"try_query(document.getElementById('def_query').value,1)\" type=\"button\" />\n";
448 		echo "<span id=\"feed_altro_1\" class=\"feed_altro\">&nbsp;</span>\n";
449 		echo "<br />\n";
450
451 		echo "<textarea name=\"def_query\" id=\"def_query\" cols=\"80\" rows=\"8\">".stripslashes($RS['def_query'])."</textarea>\n";
452
453 	}
454
455
456 	echo "<br /><br /><label for=\"accesso\" >"._("Access type:")."</label>\n ";
457
458
459
460
461
462 	// TENDINA ACCESS TYPE
463
464 	echo "<select name=\"accesso\" id=\"accesso\" onchange=\"if(this.value=='GROUP'){ document.getElementById('gruppi').style.display='';} else {document.getElementById('gruppi').style.display='none';}\">
465 		<option value=\"RESTRICT\" $sel_RESTRICT>"._("Not allowed")."</option>
466 		<option value=\"PUBLIC\" $sel_PUBLIC>"._("Public (web)")."</option>
467 		<option value=\"FRONTEND\" $sel_FRONTEND>"._("Frontend (only authenticated users)")."</option>
468 		<option value=\"GROUP\" $sel_GROUP>"._("Only for groups (select)")."</option>
469 		</select>\n";
470
471
472
473
474
475 	// prendi gruppi
476 	$gruppi=prendi_gruppi();
477
478 	$sty_gruppi = ($sel_GROUP=='') ? "display:none;" :"";
479
480 	echo "<div id=\"gruppi\" style=\"$sty_gruppi\">
481 	<br /><br /><label for=\"gid\" >"._("Allowed groups:")."</label><select name=\"gid[]\" id=\"gid\" multiple=\"multiple\" size=\"5\">
482 	";
483
484 	$gids=explode(",",$RS['accesso_gruppo']);
485
486 	for($g=0;$g<count($gruppi);$g++){
487
488 		if(is_array($gids) && in_array($gruppi[$g]['gid'],$gids)){
489 			$gsel="selected=\"selected\"";
490 		}
491 		else $gsel="";
492
493 		echo "<option value=\"".$gruppi[$g]['gid']."\" $gsel>".$gruppi[$g]['gid']." - ".$gruppi[$g]['nome_gruppo']."</option>\n";
494 	}
495
496 	echo "</select>
497
498 	</div>";
499
500
501
502
503
504
505
506 	// cerca fogli di stile XSL custom
507
508 	$dir_xsl = _PATH_XSL;
509
510 	if (is_dir($dir_xsl)) {
511	   if ($dh = opendir($dir_xsl)) {
512	      while (($file_xsl = readdir($dh)) !== false) {
513	             if($file_xsl!='.' && $file_xsl!='..' && is_file($dir_xsl."/".$file_xsl)) $xsl_custom[]=$file_xsl;
514	        }
515	        closedir($dh);
516	    }
517	}
518
519
520
521
522 	echo "<br /><br /><label for=\"xsl\" >"._("XSL sheet to be linked:")."</label>\n<select name=\"xsl\" id=\"xsl\">
523 			<option value=\"default\">"._("default")."</option>";
524
525 	for($i=0;$i<count($xsl_custom);$i++){
526
527 		$sel_xsl=($RS['xsl']==$xsl_custom[$i]) ? "selected=\"selected\"" : "";
528
529 		echo "\t\t<option value=\"".$xsl_custom[$i]."\" $sel_xsl>".$xsl_custom[$i]."</option>\n";
530
531 	}
532
533 	echo "</select>\n";
534
535 	echo _("otherwise link a new file:")." <input type=\"file\" name=\"new_xsl\" id=\"new_xsl\" size=\"48\" />\n";
536
537
538
539 	###################################################
540 	#
541 	#	FO
542 	#
543
544 	// cerca fogli di stile FO custom
545
546 	$dir_fo = _PATH_XSL;
547 	$fo_custom=array();
548
549 	if (is_dir($dir_fo)) {
550	   if ($dh = opendir($dir_fo)) {
551	      while (($file_fo = readdir($dh)) !== false) {
552	             if($file_fo!='.' && $file_fo!='..' && is_file($file_fo)) $fo_custom[]=$file_fo;
553	        }
554	        closedir($dh);
555	    }
556	}
557
558	$sel_fo_none=($RS['xslfo']=='-1') ?  "selected=\"selected\"" : "";
559
560 	echo "<br /><br /><label for=\"fo\" >"._("XSL-FO stylesheet to be associed:")."</label>\n<select name=\"fo\" id=\"fo\">
561 			<option value=\"default\">"._("default")."</option>
562 			<option value=\"-1\" $sel_fo_none> - "._("nobody")." - </option>
563 			";
564
565 	for($i=0;$i<count($fo_custom);$i++){
566
567 		$sel_fo=($RS['xsl']==$fo_custom[$i]) ? "selected=\"selected\"" : "";
568
569 		echo "\t\t<option value=\"".$fo_custom[$i]."\" $sel_fo>".$fo_custom[$i]."</option>\n";
570
571 	}
572
573 	echo "</select>\n";
574
575 	echo _("otherwise link a new file:")." <input type=\"file\" name=\"new_fo\" id=\"new_fo\" size=\"48\" />\n";
576
577 	echo "<input type=\"hidden\" name=\"id_xml_rules\" value=\"".intval($_GET['mod'])."\" />\n";
578 	echo "<br /><br /><input type=\"submit\" name=\"invia\" value=\"   "._("Save")."   \" />\n";
579
580 	echo "</form>\n";
581
582 	echo closeLayout1();
583 	exit;
584 }
585
586
587
588
589
590
591
592
593
594
595 $files=array('sty/tabelle.css');
596
597
598
599
600
601 echo openLayout1(_("XML Administration and Reports"),$files);
602
603	echo breadcrumbs(array("HOME","ADMIN","xmlreport.php"=>_("XML administration and reports")));
604
605	echo "<h1>"._("XML Administration and Reports")."</h1>\n";
606
607
608	echo "<p><a href=\"?new\">"._("Create new XML report from table or view")."</a> <span class=\"nocss\">|</span> <br /><br /><a href=\"?newquery\">"._("Create new XML report from query")."</a></p>";
609
610	// PRENDI RECORD IN DB
611
612	$q=$vmreg->query("SELECT x.*, ".$vmreg->concat("u.nome,' ',u.cognome", 'nomecognome')." FROM {$db1['frontend']}{$db1['sep']}xml_rules x, {$db1['frontend']}{$db1['sep']}utente u
613					WHERE x.autore=u.id_utente
614					ORDER BY tabella ASC");
615
616	$mat_xml=$vmreg->fetch_assoc_all($q);
617
618	echo "<table class=\"tab-color\" summary=\"Tabella Log\">
619
620	 	<tr>
621			<th>"._("report name")."</th>
622			<th>"._("report type")."</th>
623			<th>"._("table")."</th>
624			<th>XSL</th>
625			<th>XSL-FO</th>
626			<th>"._("access")."</th>
627			<th>"._("Authorized groups")."</th>
628			<th>"._("author")."</th>
629			<th>"._("date")."</th>
630			<th>"._("preview")."</th>
631			<th>"._("modify")."</th>
632			<th class=\"arancio\">"._("delete")."</th>
633		</tr>
634
635		";
636
637	 for($i=0;$i<count($mat_xml);$i++){
638
639	 	$data = date_encode($mat_xml[$i]['lastData'],true,'string');
640
641	 	$xsl_riga=($mat_xml[$i]['xsl']=='') ? '<em>'._("default").'</em>' : "<em>".$mat_xml[$i]['xsl']."</em>";
642
643	 	if($mat_xml[$i]['xslfo']=='-1')  $xslfo_riga="-";
644	 	else if($mat_xml[$i]['xslfo']=='') $xslfo_riga="<em>"._("default")."</em>";
645	 	else  $xslfo_riga=$mat_xml[$i]['xslfo'];
646
647
648
649	 	$tipo_report= ($mat_xml[$i]['tipo_report'].""=='t') ? "da tabella" : "da query";
650
651
652	 	// link anteprima
653	 	$link_anteprima = ($mat_xml[$i]['tipo_report'].""=='t') ?
654	 					  FRONT_DOCROOT."/xml/".$mat_xml[$i]['tabella']
655	 					  :
656	 					  FRONT_DOCROOT."/xml/@".$mat_xml[$i]['nome_report'] ;
657
658	 	echo "
659	 	<tr>
660			<td>".$mat_xml[$i]['nome_report']."</td>
661			<td>".$tipo_report."</td>
662			<td>".$mat_xml[$i]['tabella']."</td>
663			<td>".$xsl_riga."</td>
664			<td>".$xslfo_riga."</td>
665			<td>".$mat_xml[$i]['accesso']."</td>
666			<td>".$mat_xml[$i]['accesso_gruppo']."</td>
667			<td>".$mat_xml[$i]['nomecognome']."</td>
668			<td>".$data."</td>
669			<td><a href=\"".$link_anteprima."/\">"._("preview")."</a></td>
670			<td><a href=\"xmlreport.php?mod=".$mat_xml[$i]['id_xml_rules']."\">"._("modify")."</a></td>
671			<td><a href=\"xmlreport.php?del=".$mat_xml[$i]['id_xml_rules']."\">"._("delete")."</a></td>
672		</tr>
673		 ";
674	 }
675
676	 echo "</table>\n";
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691echo closeLayout1();
692
693
694
695?>