phpDocumentor VFront
VFront_XML
[ class tree: VFront ] [ index: VFront ] [ all elements ]

Source for file xsl.php

Documentation is available at xsl.php

  1. <?php
  2. /**
  3.  * Genera un XSL dinamico prendendo le informazioni di tabella.
  4.  * 
  5.  * @desc File XSL dinamico di default
  6.  * @package VFront
  7.  * @subpackage VFront_XML
  8.  * @author M.Marcello Verona
  9.  * @copyright 2007 M.Marcello Verona
  10.  * @version 0.90
  11.  * @license http://www.gnu.org/licenses/gpl.html GNU Public License
  12.  */
  13.  
  14.  
  15. require("../inc/conn.php");
  16. require("../inc/func.comuni.php");
  17. require("../inc/func.frontend.php");
  18.  
  19. function genera_xsl_base($rif_tabella,$solo_visibili=0){
  20.     
  21.     global $link,$db1;
  22.     
  23.     
  24.     $QB (isset($_GET['querybased']&& $_GET['querybased']=='@'1:0;
  25.     
  26.     // richiesta di foglio querybased
  27.     if($QB){
  28.         
  29.         $nome_report preg_replace("|[^a-z0-9_-]+|i","_",$_GET['action']);
  30.         
  31.         // prendi la query
  32.         $q_def vmsql_query("SELECT def_query FROM {$db1['frontend']}.xml_rules WHERE nome_report='$nome_reportLIMIT 1",$link);
  33.         
  34.         list($sql_def)=vmsql_fetch_row($q_def);
  35.         
  36.         if(vmsql_try($sql_def,$link)){
  37.             $q_campi=vmsql_query($sql_def,$link);
  38.             
  39.             $RS=vmsql_fetch_assoc($q_campi);
  40.                         
  41.             $cols=array_keys($RS);
  42.         }
  43.         else{
  44.             $cols=array();
  45.         }
  46.         
  47.         $titolo "Report $nome_report";
  48.         
  49.     }
  50.     else{
  51.         
  52.         if(is_tabella($rif_tabella)){
  53.             
  54.             // PRENDE LE CARATTERISTICHE DELLA TABELLA
  55.             $tabella $rif_tabella;
  56.         }
  57.         else{
  58.             
  59.             // prende il nome della tabella
  60.             $tabella oid2name($rif_tabella);
  61.             
  62.         }
  63.         
  64.         list($n,$n,$n,$cols)prendi_colonne_frontend($tabella,'*',$solo_visibili,intval($_SESSION['gid']));
  65.     
  66.         $titolo="Tabella $tabella";
  67.     }
  68.     
  69.  
  70. $XSL=<<<XSL
  71. <?xml version="1.0" encoding="utf-8" ?>
  72. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  73. <xsl:output method="xhtmlindent="yes"
  74.     doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
  75.     doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN
  76.     omit-xml-declaration="yes"
  77.     />
  78. <xsl:template match="/recordset">
  79. <html xmlns="http://www.w3.org/1999/xhtmllang="it">
  80. <head>
  81. <title>$titolo</title>
  82. <style type="text/css">
  83.  
  84.     body{
  85.     
  86.         font-familyArial,sans;
  87.     }
  88.     
  89.     h1{
  90.         font-size:1.8em;
  91.         color:#6495ED;
  92.         border-top:2px solid #6495ED;
  93.         border-bottom:2px solid #6495ED;
  94.     }
  95.     
  96.     table{
  97.         border:0;
  98.         border-collapse:collapse;
  99.         margin-bottom:20px;
  100.     }
  101.     
  102.     table tr td{    
  103.         padding: 0.1em 0.7em;
  104.         font-size:0.75em;
  105.     }
  106.     
  107.     table tr th{    
  108.         padding: 0.1em 0.7em;
  109.         text-align:right;
  110.         font-size:0.75em;
  111.     }
  112.     
  113. </style>
  114. </head>
  115.  
  116. <body>
  117. <h1>$titolo</h1>
  118. <xsl:for-each select="row">
  119. <table summary="tabella riepilogo">
  120. XSL;
  121. foreach($cols as $k=>$val){
  122.     
  123.     $XSL.="<tr><th>$val: </th><td><xsl:value-of select=\"$val\" /></td></tr>\n";
  124. }
  125.  
  126. $XSL.=<<<XSL
  127. </table>
  128. <hr />
  129. </xsl:for-each>
  130.  
  131. </body>
  132. </html>
  133.  
  134.  
  135. </xsl:template>
  136. </xsl:stylesheet>
  137. XSL;
  138. header("Content-Type: text/xml");
  139. echo $XSL;
  140.  
  141. }
  142. genera_xsl_base($_GET['action'],!intval($_GET['vis']));
  143.  
  144. ?>

Documentation generated on Sat, 22 Sep 2007 11:51:57 +0200 by phpDocumentor 1.4.0a2