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

Source for file xmlreport.php

Documentation is available at xmlreport.php

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

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