]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/scripts/public_html/showquery.php
1e385d46ee1ad57e86584aaeaf40def1670671bb
[helm.git] / helm / software / matita / scripts / public_html / showquery.php
1 <?php require("common.php"); 
2
3   $query = stripslashes($_GET['query']);
4
5   $nqs = explode('###',$query);
6
7   $qs = array();
8   foreach($nqs as $v){
9     $x = explode("@@@",$v);
10     $qs[$x[0]] = $x[1];
11   }
12
13 function prettify($s) {
14   if (preg_match("/^[0-9]{12}$/",$s)) {
15     $year = substr($s,0,4);
16     $month = substr($s,4,2);
17     $day = substr($s,6,2);
18     $hour = substr($s,8,2);
19     $minute = substr($s,10,2);
20     return $day . "/" . $month . "/" . $year . " " . $hour . ":" . $minute;
21   } else
22     return $s;
23 }
24   
25 function printer($q){
26   static $i = 0;
27   if ( $i == 0) {
28       echo "<tr>";
29       foreach( $q as $name => $txt) {
30           echo "<th>$name</th>";
31         }
32       echo "</tr>\n";
33   } else {
34       $i=0;
35       foreach ($q as $k => $v) {
36         $i = $i + 1;
37         if ( $i%2 == 0)
38           echo "<tr class=\"even\">";      
39         else
40           echo "<tr class=\"odd\">";
41         foreach( $v as $name => $txt) {
42           echo "<td>" . prettify($txt) . "</td>";
43         }
44         echo "</tr>\n";      
45       }
46   }
47   $i++;
48 }
49
50 ?>
51 <html>
52   <head>
53   <link type="text/css" rel="stylesheet" href="style.css"/>
54   </head>
55   <body>
56     <h1>QUERY results</h1>
57 <? foreach( $qs as $name => $q) { ?>
58     <h2><? echo $name; ?></h2>
59     <p>
60     <tt><? print $q; ?></tt>
61     </p>
62     <table border=1>
63     <?  query($q,&$printer); ?>
64     </table>
65 <? } ?>
66     <p><a href="bench.php">BACK to the query page</a></p>
67   </body>
68 </html>