]> matita.cs.unibo.it Git - helm.git/blob - helm/matita/scripts/public_html/showquery.php
test branch
[helm.git] / helm / 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 ?>
26 <html>
27   <head>
28   <link type="text/css" rel="stylesheet" href="style.css"/>
29   </head>
30   <body>
31     <h1>QUERY results</h1>
32 <? foreach( $qs as $name => $q) { ?>
33     <h2><? echo $name; ?></h2>
34     <p>
35     <tt><? print $q; ?></tt>
36     </p>
37     <table border=1>
38     <? 
39       $q = query($q);
40       echo "<tr>";
41       foreach( $q[0] as $name => $txt) {
42           echo "<th>$name</th>";
43         }
44       echo "</tr>\n";
45       $i=0;
46       foreach ($q as $k => $v) {
47         $i = $i + 1;
48         if ( $i%2 == 0)
49           echo "<tr class=\"even\">";      
50         else
51           echo "<tr class=\"odd\">";
52         foreach( $v as $name => $txt) {
53           echo "<td>" . prettify($txt) . "</td>";
54         }
55         echo "</tr>\n";      
56       }
57     ?>
58     </table>
59 <? } ?>
60     <p><a href="bench.php">BACK to the query page</a></p>
61   </body>
62 </html>