linea21-modules
[ class tree: linea21-modules ] [ index: linea21-modules ] [ all elements ]

Source for file export_xml.php

Documentation is available at export_xml.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage dashboard
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. /***********************
  12.  * paramétrage du fichier XML
  13.  *
  14.  * *************************/
  15.  
  16. /*********************
  17.  * contenu du fichier XML
  18.  * valeurs posssibles :
  19.  * P (format public)
  20.  * A (format admin)
  21.  ************************/
  22. $format="P";
  23.  
  24. /*********************
  25.  * liste des indicateurs
  26.  * valeurs posssibles :
  27.  * R (statut<>'E')
  28.  * P (statut='P')
  29.  ************************/
  30. if ($format=="A")$filter_sdi="R";
  31. else $filter_sdi="P";
  32. /*********************
  33.  * liste des valeurs
  34.  * valeurs posssibles :
  35.  * D (statut<>'E')
  36.  * SCP (statut='P') sdiv_date_published ASC
  37.  * SCD (statut='P') sdiv_date_published DESC
  38.  * SCA (statut<>'E') sdiv_date_published DESC
  39.  ************************/
  40.  
  41. if ($format=="A"$filter_value="D";
  42. else $filter_value="SCD";
  43.  
  44. define('TAB_LINE',"   ");
  45.  
  46. include_once("../config/define.php");
  47. include_once("../lib/no_cache.php");
  48. include_once("../lib/functions_auth.php");
  49. IncludeAdminLang("dashboard");
  50. include_once("../class/system/class.".SQL.".php");
  51. include_once(SQL.'.inc.php');
  52. include_once('../class/class.sdi.php');
  53. $sql_entity=SQL;
  54. $sql_object new $sql_entity;
  55. $sql_object -> DBInitialise();
  56. $sql_object -> DBConnexion();
  57.  
  58.  
  59. $sdi_objectnew sdi;
  60. $result=$sql_object->DBSelect($req_list_theme);
  61.  
  62. $req_sdi=SQL_getListSdi($filter_sdi$valueparam=0);
  63. $result_sdi $sql_object -> DBSelect($req_sdi);
  64. header('Content-Type: text/xml');
  65. $listing="<?xml version=\"1.0\" encoding=\"".CHARSET."\"?>".END_LINE."<dashboard>" END_LINE;
  66.  
  67. $current_sdtheme='';
  68. $current_theme='';
  69. for ($i=0;$i<count($result);$i++){
  70.   if ($result[$i]['sdtheme_id']!=$current_sdtheme{
  71.     $current_sdtheme=$result[$i]['sdtheme_id'];
  72.     $aff_theme=false;
  73.     if ($i!=0)$listing.=TAB_LINE."</theme>".END_LINE."</sdtheme>" END_LINE;
  74.     $listing.="<sdtheme id=\"".$result[$i]['sdtheme_id']."\" title=\"".formatText($result[$i]['sdtheme_name']'2XML')."\">" END_LINE;
  75.  
  76.   }
  77.   else $aff_theme=true;
  78.  
  79.   if ($result[$i]['theme_id']!=$current_theme{
  80.     $current_theme=$result[$i]['theme_id'];
  81.     if ($aff_theme==true$listing.=TAB_LINE."</theme>" END_LINE;
  82.     $listing.= TAB_LINE."<theme id=\"".$result[$i]['theme_id']."\" title=\"".formatText($result[$i]['theme_name']'2XML')."\">" END_LINE;
  83.   }
  84.  
  85.  
  86.   for ($j=0;$j<count($result_sdi);$j++){
  87.     if ($result[$i]['theme_id']==$result_sdi[$j]['sdii_theme']{
  88.  
  89.  
  90.       $req_sdii=SQL_getInfoSdi($result_sdi[$j]['sdii_id']);
  91.       $result_sdii $sql_object -> DBSelect($req_sdii);
  92.  
  93.       $req_sdir=SQL_getRules$result_sdi[$j]['sdii_id']$sql_object-1);
  94.       $result_r $sql_object -> DBSelect($req_sdir);
  95.  
  96.       $req_sdie=SQL_getEvaluation$result_sdi[$j]['sdii_id']$sql_object,-1);
  97.       $result_e $sql_object -> DBSelect($req_sdie);
  98.  
  99.       $req_sdip=SQL_getProvider$result_sdi[$j]['sdii_id']$sql_object,-1);
  100.       $result_p $sql_object -> DBSelect($req_sdip);
  101.  
  102.       $req_scale=SQL_getlistscale(0);
  103.       $resultscale $sql_object -> DBSelect($req_scale);
  104.  
  105.       //formattage des infos générales
  106.       $listing.=TAB_LINE.TAB_LINE."<indicator id=\"".$result_sdi[$j]['sdii_id']."\">" END_LINE;
  107.       $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<title>".formatText($result_sdi[$j]['sdii_name']'2XML')."</title>" END_LINE;
  108.       $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<description>".formatText($result_sdii[0]['sdii_description']'2XML')."</description>" END_LINE;
  109.       $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<comment>".formatText($result_sdii[0]['sdii_comment']'2XML')."</comment>" END_LINE;
  110.       $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<range>".formatText($result_sdii[0]['sdii_range']'2XML')."</range>" END_LINE;
  111.       $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<goal>".formatText($result_sdii[0]['sdii_goal']'2XML')."</goal>" END_LINE;
  112.       $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<consulting>".formatText($result_sdii[0]['sdii_consulting']'2XML')."</consulting>" END_LINE;
  113.       $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<unit>".formatText($result_sdii[0]['sdii_unit']'2XML')."</unit>" END_LINE;
  114.       $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<max_value>".formatText($result_sdii[0]['sdii_max_value']'2XML')."</max_value>" END_LINE;
  115.       $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<min_value>".formatText($result_sdii[0]['sdii_min_value']'2XML')."</min_value>" END_LINE;
  116.       $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<threshold_value>".formatText($result_sdii[0]['sdii_threshold_value']'2XML')."</threshold_value>" END_LINE;
  117.       $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<threshold_relative>".formatText($result_sdii[0]['sdii_threshold_relative']'2XML')."</threshold_relative>" END_LINE;
  118.  
  119.       if ($format=="A"){
  120.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<frequency>".formatText($result_sdii[0]['sdii_frequency']'2XML')."</frequency>" END_LINE;
  121.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<date_crea>".formatText($result_sdii[0]['sdii_date_crea']'2XML')."</date_crea>" END_LINE;
  122.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<last_modify>".formatText($result_sdii[0]['sdii_last_modify']'2XML')."</last_modify>" END_LINE;
  123.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<statut>".formatText($result_sdii[0]['sdii_statut']'2XML')."</statut>" END_LINE;
  124.         //formattage des infos du fournisseur
  125.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<provider id=\"".$result_p[0]['sdip_id']."\">"END_LINE;
  126.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<title>".formatText($result_p[0]['sdip_name']'2XML')."</title>" END_LINE;
  127.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<service>".formatText($result_p[0]['sdip_service']'2XML')."</service>" END_LINE;
  128.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<description>".formatText($result_p[0]['sdip_description']'2XML')."</description>" END_LINE;
  129.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<incharge>".formatText($result_p[0]['sdip_incharge']'2XML')."</incharge>" END_LINE;
  130.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<address>".formatText($result_p[0]['sdip_address']'2XML')."</address>" END_LINE;
  131.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<phone>".formatText($result_p[0]['sdip_phone']'2XML')."</phone>" END_LINE;
  132.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<fax>".formatText($result_p[0]['sdip_fax']'2XML')."</fax>" END_LINE;
  133.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<email>".formatText($result_p[0]['sdip_email']'2XML')."</email>" END_LINE;
  134.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<date_crea>".formatText($result_p[0]['date_c']'2XML')."</date_crea>" END_LINE;
  135.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<last_modify>".formatText($result_p[0]['date_m']'2XML')."</last_modify>" END_LINE;
  136.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE."</provider>"END_LINE;
  137.  
  138.         //formattage des infos de réglementation
  139.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<reglementation id=\"".$result_r[0]['sdir_id']."\">"END_LINE;
  140.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<title>".formatText($result_r[0]['sdir_title']'2XML')."</title>" END_LINE;
  141.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<body>".formatText($result_r[0]['sdir_body']'2XML')."</body>" END_LINE;
  142.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<referer_uri>".formatText($result_r[0]['sdir_referer_uri']'2XML')."</referer_uri>" END_LINE;
  143.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<mask_uri>".formatText($result_r[0]['sdir_mask_uri']'2XML')."</mask_uri>" END_LINE;
  144.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<date_crea>".formatText($result_p[0]['date_c']'2XML')."</date_crea>" END_LINE;
  145.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<last_modify>".formatText($result_p[0]['date_m']'2XML')."</last_modify>" END_LINE;
  146.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE."</reglementation>"END_LINE;
  147.  
  148.         //formattage des infos d'évaluation
  149.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE."<evaluation id=\"".$result_e[0]['sdie_id']."\">"END_LINE;
  150.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<scale_compare>".formatText($result_e[0]['sdie_scale_compare']'2XML')."</scale_compare>" END_LINE;
  151.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<fiability>".formatText($result_e[0]['sdie_fiability']'2XML')."</fiability>" END_LINE;
  152.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<accessibility>".formatText($result_e[0]['sdie_accessibility']'2XML')."</accessibility>" END_LINE;
  153.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<lisibility>".formatText($result_e[0]['sdie_lisibility']'2XML')."</lisibility>" END_LINE;
  154.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<relevance>".formatText($result_e[0]['sdie_relevance']'2XML')."</relevance>" END_LINE;
  155.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<global_performance>".formatText($result_e[0]['sdie_global_performance']'2XML')."</global_performance>" END_LINE;
  156.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<date_crea>".formatText($result_p[0]['date_c']'2XML')."</date_crea>" END_LINE;
  157.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<last_modify>".formatText($result_p[0]['date_m']'2XML')."</last_modify>" END_LINE;
  158.         $listing.=TAB_LINE.TAB_LINE.TAB_LINE."</evaluation>"END_LINE;
  159.       }
  160.       //formattage des valeurs
  161.       for ($z=0;$z<count($resultscale);$z++){
  162.  
  163.         $req_sdiav=SQL_getAllValue($filter_value$resultscale[$z]['scale_id']$result_sdi[$j]['sdii_id']);
  164.         $result_value $sql_object -> DBSelect($req_sdiav);
  165.         if ($result_value[0]['sdiv_value']<>""){
  166.           $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<scale id=\"".$resultscale[$z]['scale_id']."\">"END_LINE;
  167.           $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<title>".formatText($resultscale[$z]['scale_denomination']'2XML')."</title>" END_LINE;
  168.           for ($h=0;$h<count($result_value);$h++){
  169.             $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<value id=\"".$result_value[$h]['sdiv_id']."\">"END_LINE;
  170.             $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<num_value>".formatText($result_value[$h]['sdiv_value']'2XML')."</num_value>" END_LINE;
  171.             $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<date_published>".formatText($result_value[$h]['date_p']'2XML')."</date_published>" END_LINE;
  172.             $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<date_crea>".formatText($result_value[$h]['date_c']'2XML')."</date_crea>" END_LINE;
  173.             $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<last_modify>".formatText($result_value[$h]['date_m']'2XML')."</last_modify>" END_LINE;
  174.             $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."<statut>".formatText($result_value[$h]['sdiv_statut']'2XML')."</statut>" END_LINE;
  175.             $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."</value>"END_LINE;
  176.           }
  177.           $listing.=TAB_LINE.TAB_LINE.TAB_LINE.TAB_LINE."</scale>"END_LINE;
  178.         }
  179.       }
  180.  
  181.       $listing.=TAB_LINE.TAB_LINE."</indicator>" END_LINE;
  182.     }
  183.   }
  184.  
  185. }
  186. $listing.=TAB_LINE."</theme>".END_LINE."</sdtheme>" END_LINE."</dashboard>" END_LINE;
  187.  
  188. echo $listing;
  189.  
  190. ?>

Documentation generated on Thu, 03 May 2012 15:04:32 +0200 by phpDocumentor 1.4.1