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

Source for file export_data.php

Documentation is available at export_data.php

  1. <?php
  2. /**
  3.  * @desc Utility per l'esportazione dei dati delle tabelle in vari formati
  4.  * @package VFront
  5.  * @subpackage Administration
  6.  * @author M.Marcello Verona
  7.  * @copyright 2007 M.Marcello Verona
  8.  * @version 0.90
  9.  * @license http://www.gnu.org/licenses/gpl.html GNU Public License
  10.  */
  11.  
  12. include("../inc/conn.php");
  13. include("../inc/layouts.php");
  14. include("../inc/func.comuni.php");
  15. include("../inc/func.frontend.php");
  16.  
  17.  proteggi(1);
  18.  
  19.  
  20. if(isset($_GET['id_table']&& is_numeric($_GET['id_table'])){
  21.     
  22.     $id_tabella = (int) $_GET['id_table'];
  23.     
  24.     if($id_tabella==|| !is_tabella_by_oid($id_tabella)){
  25.         
  26.         
  27.         header("Location: ".$_SERVER['PHP_SELF']);
  28.         exit;
  29.     }
  30.     
  31.     require_once("../inc/func.export.php");
  32.     
  33.     switch($_GET['formato']){
  34.         
  35.         case 'csv':  tabella_csv($id_tabella(bool) $_GET['raw'],$sep=',');
  36.         break;
  37.         
  38.         case 'html'tabella_html($id_tabella(bool) $_GET['raw']);
  39.         break;
  40.         
  41.         case 'xls':  tabella_xls($id_tabella(bool) $_GET['raw']);
  42.         break;
  43.         
  44.         case 'ods':  tabella_ods($id_tabella(bool) $_GET['raw']);
  45.         break;
  46.         
  47.         defaultheader("Location: ".$_SERVER['PHP_SELF']);    exit;
  48.         
  49.     }
  50.     
  51.     exit;
  52. }
  53.  
  54.  
  55.  
  56.  echo openLayout1("Esportazione Dati"array("sty/admin.css"),'popup');
  57.  
  58.  if(!isset($_GET['idt'])){
  59.      echo "<div id=\"briciole\"><a href=\"index.php\">home amministrazione</a> &raquo; esportazione dati</div>\n";
  60.  }
  61.  
  62.  echo "<h1>Esportazione Dati</h1>\n";
  63.  
  64.  
  65.  echo "<img src=\"../img/db_export.gif\" class=\"img-float\" alt=\"impostazioni registri\" />\n";
  66.  
  67.  
  68.  
  69.  echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"get\" style=\"margin:30px 0px 0px 90px\">\n";
  70.  
  71.  
  72.  if(isset($_GET['idt'])){
  73.      $idt intval(str_replace(_BASE64_PASSFRASE,"",base64_decode($_GET['idt'])));
  74.      
  75.      echo  "<input type=\"hidden\" name=\"id_table\" id=\"id_table\" value=\"$idt\" />\n";
  76.  }
  77.  else{
  78.  
  79.  
  80.      echo "\t\t<label for=\"id_table\"><strong>Tabella da esportare: </strong></label>\n";
  81.      
  82.      $TABELLE=prendi_tabelle();
  83.      
  84.      echo "\t\t<select id=\"id_table\" name=\"id_table\">\n";
  85.      
  86.      for($i=0;$i<count($TABELLE);$i++){
  87.          
  88.          echo "\t\t\t<option value=\"{$TABELLE[$i]['id_table']}\">".$TABELLE[$i]['table_name']."</option>\n";
  89.      }
  90.      
  91.      echo "\t\t</select><br /><br />\n";
  92.  
  93.  }
  94.  echo "\t\t<p><strong>Formato:</strong></p>\n";
  95.  
  96.  echo "\t\t<blockquote>\n";
  97.  echo "\t\t\t<input type=\"radio\" name=\"formato\" id=\"formato_csv\" value=\"csv\" checked=\"checked\"/><label for=\"formato_csv\">CSV (Comma Separate Value)</label>\n<br />";
  98.  echo "\t\t\t<input type=\"radio\" name=\"formato\" id=\"formato_html\" value=\"html\" /><label for=\"formato_html\">HTML</label>\n<br />";
  99.  echo "\t\t\t<input type=\"radio\" name=\"formato\" id=\"formato_ods\" value=\"ods\" /><label for=\"formato_ods\">ODS (Open Document Spreadsheet)</label>\n<br />";
  100.  echo "\t\t\t<input type=\"radio\" name=\"formato\" id=\"formato_xls\" value=\"xls\" /><label for=\"formato_xls\">XLS (Excel)</label>\n<br />";
  101.  
  102.  echo "\t\t</blockquote><br />\n";
  103.  
  104.  
  105.  
  106.   echo "\t\t<p><strong>Modalit&agrave; recupero dati:</strong></p>\n";
  107.  
  108.  echo "\t\t<blockquote>\n";
  109.  echo "\t\t\t<input type=\"radio\" name=\"raw\" id=\"raw_1\" value=\"1\" checked=\"checked\"/><label for=\"raw_1\">Dati come presenti in tabella</label>\n<br />";
  110.  echo "\t\t\t<input type=\"radio\" name=\"raw\" id=\"raw_0\" value=\"0\" /><label for=\"raw_0\">Dati con formattazione impostata nel registro del gruppo</label>\n<br />";
  111.  
  112.  echo "\t\t</blockquote>\n";
  113.  
  114.  echo "<br /><br />\n";
  115.  
  116. // echo "<input type=\"button\" onclick=\"submit();this.disabled=true;this.value='Attendere, prego...';\" name=\"esporta\" value=\" Esporta dati \" />\n";
  117.  echo "<input type=\"button\" onclick=\"submit();\" name=\"esporta\" value=\" Esporta dati \" />\n";
  118.  
  119.  
  120.  echo "</form>\n";
  121.  
  122.  
  123.  
  124.  
  125.  echo closeLayout1();
  126.  
  127. ?>

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