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

Source for file class.sdi.php

Documentation is available at class.sdi.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage sdi
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  *  SDI (Sustainable Development Indicators) Management
  10.  */
  11.  
  12. class sdi {
  13.   /* @param
  14.    * */
  15.   // nom des tables utilisées dans l'objet.
  16.   var $TDB_SDI_INFO = T_SDI_INFO ;
  17.   var $TDB_SDI_EVAL = T_SDI_EVAL ;
  18.   var $TDB_SDI_PROVIDER = T_SDI_PROVIDER ;
  19.   var $TDB_SDI_RULES = T_SDI_RULES ;
  20.   var $TDB_SDI_VALUE = T_SDI_VALUE ;
  21.   var $TDB_SD_THEME = T_SD_THEME ;
  22.   // variables utilisées pour caractéristiques principales d'un IDD
  23.   var $I_ID;
  24.   var $I_NAME;
  25.   var $I_DESCRIPTION;
  26.   var $I_COMMENT;
  27.   var $I_THEME;
  28.   var $I_RANGE;
  29.   var $I_GOAL;
  30.   var $I_CONSULTING;
  31.   var $I_UNIT;
  32.   var $I_MAX_VALUE;
  33.   var $I_MIN_VALUE;
  34.   var $I_THRESHOLD;
  35.   var $I_FREQUENCY;
  36.   var $I_PROVIDER;
  37.   var $I_EVALUATION;
  38.   var $I_DATE_CREA;
  39.   var $I_LAST_MODIFY;
  40.   var $I_STATUT;
  41.   // variables utilisées pour critères d'évaluation d'un ID
  42.   var $E_ID;
  43.   var $E_SCALE;
  44.   var $E_FIABILITY;
  45.   var $E_LISIBILITY;
  46.   var $E_RELEVANCE;
  47.   var $E_DATE_CREA;
  48.   var $E_LAST_MODIFY;
  49.   // variables utilisées pour organisme fournisseur d'un IDD
  50.   var $P_ID;
  51.   var $P_NAME;
  52.   var $P_SERVICE;
  53.   var $P_DESCRIPTION;
  54.   var $P_INCHARGE;
  55.   var $P_ADDRESS;
  56.   var $P_PHONE;
  57.   var $P_FAX;
  58.   var $P_EMAIL;
  59.   var $P_DATE_CREA;
  60.   var $P_LAST_MODIFY;
  61.   // variables utilisées pour réglementation d'un IDD
  62.   var $R_ID;
  63.   var $R_TITLE;
  64.   var $R_BODY;
  65.   var $R_REFERER_URI;
  66.   var $R_MASK_URI;
  67.   var $R_DATE_CREA;
  68.   var $R_LAST_MODIFY;
  69.   // variables utilisées pour valeur d'un IDD
  70.   var $V_ID;
  71.   var $V_VALUE;
  72.   var $V_SDI_ID;
  73.   var $V_SCALE;
  74.   var $V_DATE_CREA;
  75.   var $V_LAST_MODIFY;
  76.   var $V_STATUT;
  77.  
  78.   /**
  79.    * sdi::CheckDataIntegrity_value()
  80.    * Vérification d'une valeur d'un indicateur
  81.    *
  82.    * @access public
  83.    * @param array $table contient les composants d'un indicateur
  84.    * @return boolean si vrai renvoie true sinon message d'erreurs (string)
  85.    */
  86.   function CheckDataIntegrity_value($table$sql_object)
  87.   {
  88.  
  89.     $notvalue _t('dashboard','object_notvalue');
  90.     $notgoodvalue _t('dashboard','object_notgoodvalue');
  91.  
  92.     if (!is_numeric($table[0])) return $notvalue;
  93.  
  94.     $result $this->_GetInfoSdi($table[1]$sql_object);
  95.  
  96.     if($result[0]['sdii_max_value'$result[0]['sdii_min_value']{
  97.       if ($table[0$result[0]['sdii_min_value'||  $table[0$result[0]['sdii_max_value']return $notgoodvalue;
  98.     else {
  99.       if($table[0$result[0]['sdii_min_value'|| $table[0$result[0]['sdii_max_value']return $notgoodvalue;
  100.     }
  101.     return checkdate_validity($table[3]);
  102.  
  103.   }
  104.  
  105.   /**
  106.    * sdi::CheckDataIntegrity_info()
  107.    * Vérification des données générales d'un indicateur
  108.    *
  109.    * @access public
  110.    * @param array $table contient les composants d'un indicateur
  111.    * @return boolean si vrai renvoie true sinon message d'erreurs (string)
  112.    */
  113.  
  114.   function CheckDataIntegrity_info($table)
  115.   {
  116.  
  117.     $notname _t('sdi','object_notname');
  118.     $notdescription _t('sdi','object_notdescription');
  119.     $nottheme _t('sdi','object_nottheme');
  120.     //$notrange = _t('sdi','object_notrange');
  121.     $notunit _t('sdi','object_notunit');
  122.     $notmax_value _t('sdi','object_notmax_value');
  123.     $notmin_value _t('sdi','object_notmin_value');
  124.     $notthreshold_value _t('sdi','object_notthreshold_value');
  125.     $notfrequency _t('sdi','object_notfrequency');
  126.  
  127.     if (strlen($table[0]2return $notname;
  128.     if (strlen($table[1]2return $notdescription;
  129.     if ($table[3<= || !is_numeric($table[3])) return $nottheme;
  130.  
  131.     $table[7]=trim($table[7]);
  132.     if (empty($table[7])) return $notunit;
  133.     if (!is_numeric($table[8])) return $notmax_value;
  134.     if (!is_numeric($table[9])) return $notmin_value;
  135.     if (!is_numeric($table[10])) return $notthreshold_value;
  136.     if (!is_numeric($table[11])) return $notfrequency;
  137.  
  138.     return true;
  139.   }
  140.  
  141.   /**
  142.    * sdi::CheckDataIntegrity_eval()
  143.    * Vérification des données d'évaluation d'un indicateur
  144.    *
  145.    * @access public
  146.    * @param array $table contient les composants évaluation d'un indicateur
  147.    * @return boolean si vrai renvoie true sinon message d'erreurs (string)
  148.    */
  149.  
  150.   function CheckDataIntegrity_eval($table)
  151.   {
  152.  
  153.     $note_scale_compare _t('sdi','object_note_scale_compare');
  154.     $note_fiability _t('sdi','object_note_fiability');
  155.     $note_accessibility _t('sdi','object_note_accessibility');
  156.     $note_lisibility _t('sdi','object_note_lisibility');
  157.     $note_relevance _t('sdi','object_note_relevance');
  158.     $note_global_performance _t('sdi','object_note_global_performance');
  159.  
  160.     if (!is_numeric($table[13])) return $note_scale_compare;
  161.     if (!is_numeric($table[14])) return $note_fiability;
  162.     if (!is_numeric($table[15])) return $note_accessibility;
  163.     if (!is_numeric($table[16])) return $note_lisibility;
  164.     if (!is_numeric($table[17])) return $note_relevance;
  165.     if (!is_numeric($table[18])) return $note_global_performance;
  166.  
  167.     return true;
  168.   }
  169.  
  170.   /**
  171.    * sdi::CheckDataIntegrity_provider()
  172.    * Vérification des données d'un fournisseur d'un indicateur
  173.    *
  174.    * @access public
  175.    * @param array $table contient les composants évaluation d'un indicateur
  176.    * @return boolean si vrai renvoie true sinon message d'erreurs (string)
  177.    */
  178.   function CheckDataIntegrity_provider($table)
  179.   {
  180.  
  181.     $notp_name _t('sdi','object_notp_name');
  182.     $notp_address _t('sdi','object_notp_address');
  183.     $notp_phone _t('sdi','object_notp_phone');
  184.     $notp_fax _t('sdi','object_notp_fax');
  185.     $notp_mail _t('sdi','object_notp_mail');
  186.  
  187.     if (strlen($table[19]2return $notp_name;
  188.     if (strlen($table[23]2return $notp_address;
  189.  
  190.     if (trim($table[24]!= '' && !is_numeric($table[24])) return $notp_phone;
  191.     if (trim($table[25]!= '' && !is_numeric($table[25])) return $notp_fax;
  192.  
  193.     $testmail $this->_checkEmailValidity($table[26]);
  194.     if ($testmail != 1return $notp_mail;
  195.  
  196.     return true;
  197.   }
  198.  
  199.   /**
  200.    * sdi::_checkEmailValidity()
  201.    * Vérification du mail
  202.    *
  203.    * @access private
  204.    * @param string $email contient les composants d'un mail
  205.    * @return boolean si vrai renvoie true sinon message d'erreurs (string)
  206.    */
  207.   function _checkEmailValidity($email)
  208.   {
  209.     $email strtolower($email);
  210.     if (strlen($email|| !ereg("@"$email|| preg_match_all("/([^a-zA-Z0-9_\@\.\-])/i"$email$trouve|| !preg_match("/^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}\$/i"$email)) {
  211.       return 0;
  212.     }
  213.     return 1;
  214.   }
  215.  
  216.   /**
  217.    * sdi::CheckDataIntegrity_reglementation()
  218.    * Vérification des données de réglementation d'un indicateur
  219.    *
  220.    * @access public
  221.    * @param array $table contient les composants réglementation d'un indicateur
  222.    * @return boolean si vrai renvoie true sinon message d'erreurs (string)
  223.    */
  224.   function CheckDataIntegrity_reglementation($table)
  225.   {
  226.  
  227.     $notr_title _t('sdi','object_notr_title');
  228.     $notr_body _t('sdi','object_notr_body');
  229.  
  230.     if (strlen($table[27]2return $notr_title;
  231.     if (strlen($table[28]2return $notr_body;
  232.  
  233.     if(CHECK_LINK==true && !empty($table[29])) {
  234.       if (!$this->CheckOnlineFile($table[29])) return _t('sdi','server_noresponse');
  235.     }
  236.  
  237.     return true;
  238.   }
  239.  
  240.   /**
  241.    * resources::CheckOnlineFile()
  242.    * vérifie l'existence d'un fichier en ligne
  243.    *
  244.    * @access public
  245.    * @param  $path 
  246.    * @return boolean 
  247.    */
  248.   function CheckOnlineFile($path)
  249.   {
  250.     $file_pt @fopen($path'r');
  251.     if (!$file_ptreturn false;
  252.     else {
  253.       fclose($file_pt);
  254.       return true;
  255.     }
  256.   }
  257.  
  258.   /**
  259.    * sdi::_AddProvider()
  260.    * Ajout d'un nouveau fournisseur d'un IDD
  261.    *
  262.    * @access private
  263.    * @param object $sql_object 
  264.    * @return integer $last_id
  265.    */
  266.   function _AddProvider($sql_object)
  267.   {
  268.     $requete "INSERT INTO " $this->TDB_SDI_PROVIDER . " (sdip_name, sdip_service, sdip_description, sdip_incharge, sdip_address, sdip_phone, sdip_fax, sdip_email, sdip_date_crea) VALUES ('','','', '', '', '', '', '',NOW());";
  269.     $last_id $sql_object->DBInsert ($requete1);
  270.     return $last_id;
  271.   }
  272.  
  273.   /**
  274.    * sdi::_AddEvaluation()
  275.    * Ajout de critères d'évaluation d'un IDD
  276.    *
  277.    * @access private
  278.    * @param object $sql_object 
  279.    * @return integer $last_id
  280.    */
  281.   function _AddEvaluation ($sql_object)
  282.   {
  283.     $requete "INSERT INTO " $this->TDB_SDI_EVAL . " (sdie_scale_compare, sdie_fiability, sdie_accessibility, sdie_lisibility, sdie_relevance, sdie_global_performance, sdie_date_crea)VALUES (DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT,NOW());";
  284.     $last_id $sql_object->DBInsert ($requete1);
  285.     return $last_id;
  286.   }
  287.  
  288.  
  289.   /**
  290.    * sdi::_AddRules()
  291.    * Ajout d'une réglementation d'un IDD
  292.    *
  293.    * @access private
  294.    * @param object $sql_object 
  295.    * @return integer $last_id
  296.    */
  297.   function _AddRules($sql_object)
  298.   {
  299.     $requete "INSERT INTO " $this->TDB_SDI_RULES . " (sdir_title, sdir_body, sdir_referer_uri, sdir_mask_uri, sdir_date_crea) VALUES ('', '', '', '', NOW());";
  300.     $last_id $sql_object->DBInsert ($requete1);
  301.     return $last_id;
  302.   }
  303.  
  304.  
  305.   /**
  306.    * sdi::AddSdi()
  307.    * Ajout d'un IDD
  308.    *
  309.    * @access public
  310.    * @param array $table_sdi_info contient les infos detaillees d'un IDD
  311.    * @param object $sql_object 
  312.    * @return integer $last_id
  313.    */
  314.   function AddSdi($table_sdi_info$sql_object)
  315.   {
  316.     $table_sdi_info=$sql_object->DBescape($table_sdi_info);
  317.  
  318.     $this->I_NAME = strip_input($table_sdi_info[0]);
  319.     $this->I_DESCRIPTION = strip_input($table_sdi_info[1]true);
  320.     $this->I_COMMENT = strip_input($table_sdi_info[2]true);
  321.     $this->I_THEME = $table_sdi_info[3];
  322.     $this->I_RANGE = $table_sdi_info[4];
  323.     $this->I_GOAL = strip_input($table_sdi_info[5]true);
  324.     $this->I_CONSULTING = strip_input($table_sdi_info[6]true);
  325.     $this->I_UNIT = strip_input($table_sdi_info[7]);
  326.     $this->I_MAX_VALUE = $table_sdi_info[8];
  327.     $this->I_MIN_VALUE = $table_sdi_info[9];
  328.     $this->I_THRESHOLD = $table_sdi_info[10];
  329.     $this->I_FREQUENCY = $table_sdi_info[11];
  330.  
  331.     $this->I_PROVIDER = $this->_AddProvider($sql_object);
  332.     $this->I_EVALUATION = $this->_AddEvaluation($sql_object);
  333.     $this->I_REGLEMENTATION = $this->_AddRules($sql_object);
  334.     $this->I_STATUT = $table_sdi_info[12];
  335.     $this->I_THRESHOLD_RELATIVE = $table_sdi_info[14];
  336.  
  337.  
  338.  
  339.     $requete "INSERT INTO " $this->TDB_SDI_INFO . " (sdii_name, sdii_description, sdii_comment, sdii_theme, sdii_range, sdii_goal,
  340.         sdii_consulting, sdii_unit, sdii_max_value, sdii_min_value, sdii_threshold_value, sdii_threshold_relative, sdii_frequency, sdii_provider, sdii_evaluation,
  341.         sdii_reglementation, sdii_statut, sdii_date_crea) VALUES ('" $this->I_NAME . "', '" $this->I_DESCRIPTION . "', '"
  342.         . $this->I_COMMENT . "', " $this->I_THEME . ", " $this->I_RANGE . ", '" $this->I_GOAL . "', '"
  343.         . $this->I_CONSULTING . "' , '" $this->I_UNIT . "' , " $this->I_MAX_VALUE . " , " $this->I_MIN_VALUE . " , "
  344.         . $this->I_THRESHOLD . " , '" $this->I_THRESHOLD_RELATIVE . "' , " $this->I_FREQUENCY . " , " $this->I_PROVIDER . " , " $this->I_EVALUATION . " , "
  345.         . $this->I_REGLEMENTATION . " ,'" $this->I_STATUT . "' , NOW());";
  346.  
  347.         $result $sql_object->DBInsert ($requete1);
  348.         return $result;
  349.   }
  350.  
  351.   /**
  352.    * sdi::AddValue()
  353.    * Ajout d'une valeur IDD
  354.    *
  355.    * @access public
  356.    * @param array $table_sdi_value contient les composants d'une valeur d'un IDD
  357.    * @param object $sql_object 
  358.    * @return integer $last_id
  359.    */
  360.   function AddValue($table_sdi_value$sql_object)
  361.   {
  362.     $table_sdi_value=$sql_object->DBescape($table_sdi_value);
  363.  
  364.     $this->V_VALUE = $table_sdi_value[0];
  365.     $this->V_SDI_ID = $table_sdi_value[1];
  366.     $this->V_SCALE = $table_sdi_value[2];
  367.     $this->V_DATE_PUBLISHED = formatDate($table_sdi_value[3]true);
  368.     $this->V_STATUT = $table_sdi_value[4];
  369.  
  370.     $requete "INSERT INTO " $this->TDB_SDI_VALUE . " (sdiv_value, sdiv_sdi_info, sdiv_scale, sdiv_date_published, sdiv_statut, sdiv_date_crea)
  371.         VALUES (" $this->V_VALUE . ", " $this->V_SDI_ID . ", "
  372.         . $this->V_SCALE . ", '" $this->V_DATE_PUBLISHED . "', '" $this->V_STATUT . "', NOW());";
  373.  
  374.         $last_id $sql_object->DBInsert ($requete1);
  375.         return $last_id;
  376.   }
  377.  
  378.   /**
  379.    * sdi::ModifySdi()
  380.    * modification d'un IDD
  381.    *
  382.    * @access public
  383.    * @param int $ID identifiant de l'IDD
  384.    * @param object $sql_object 
  385.    * @param array $table_sdi_info contient les composants d'un IDD
  386.    * @return bool $result
  387.    */
  388.   function ModifySdi($ID$table_sdi_info$sql_object)
  389.   {
  390.     $table_sdi_info=$sql_object->DBescape($table_sdi_info);
  391.  
  392.     if (is_numeric($ID)) {
  393.       $this->I_ID = $ID;
  394.     else return false;
  395.  
  396.     $this->I_NAME = strip_input($table_sdi_info[0]);
  397.     $this->I_DESCRIPTION = strip_input($table_sdi_info[1]true);
  398.     $this->I_COMMENT = strip_input($table_sdi_info[2]true);
  399.     $this->I_THEME = $table_sdi_info[3];
  400.     $this->I_RANGE = $table_sdi_info[4];
  401.     $this->I_GOAL = strip_input($table_sdi_info[5]true);
  402.     $this->I_CONSULTING = strip_input($table_sdi_info[6]true);
  403.     $this->I_UNIT = strip_input($table_sdi_info[7]);
  404.     $this->I_MAX_VALUE = $table_sdi_info[8];
  405.     $this->I_MIN_VALUE = $table_sdi_info[9];
  406.     $this->I_THRESHOLD = $table_sdi_info[10];
  407.     $this->I_FREQUENCY = $table_sdi_info[11];
  408.     $this->I_STATUT = $table_sdi_info[12];
  409.     $this->I_THRESHOLD_RELATIVE = $table_sdi_info[13];
  410.  
  411.     $requete "UPDATE " $this->TDB_SDI_INFO . " SET sdii_name='" $this->I_NAME . "', sdii_description='"
  412.     . $this->I_DESCRIPTION . "', sdii_comment='" $this->I_COMMENT . "', sdii_theme="
  413.     . $this->I_THEME . ", sdii_range=" $this->I_RANGE . ", sdii_goal='"
  414.     . $this->I_GOAL . "', sdii_consulting='" $this->I_CONSULTING . "', sdii_unit='"
  415.     . $this->I_UNIT . "', sdii_max_value=" $this->I_MAX_VALUE . ", sdii_min_value="
  416.     . $this->I_MIN_VALUE . ", sdii_threshold_value=" $this->I_THRESHOLD . ", sdii_threshold_relative='" $this->I_THRESHOLD_RELATIVE . "', sdii_frequency="
  417.     . $this->I_FREQUENCY . ", sdii_statut='"
  418.     . $this->I_STATUT . "', sdii_last_modify= NOW()
  419.         WHERE sdii_id=" $this->I_ID . ";";
  420.     $result $sql_object->DBQuery ($requete);
  421.     return $result;
  422.   }
  423.  
  424.   /**
  425.    * sdi::_GetKeysSdi()
  426.    * récupération des clés d'un ID
  427.    *
  428.    * @access private
  429.    * @param int $id_id identifiant de l'IDD
  430.    * @param object $sql_object 
  431.    * @return array $table_key
  432.    */
  433.   function _GetKeysSdi($sdi_id$sql_object)
  434.   {
  435.     if (is_numeric($sdi_id)) {
  436.       $this->I_ID = $sdi_id;
  437.     }
  438.     $requete "SELECT sdii_provider, sdii_evaluation, sdii_reglementation
  439.         FROM " $this->TDB_SDI_INFO . "
  440.         WHERE sdii_id=" $this->I_ID . ";";
  441.     $result $sql_object->DBSelect($requete);
  442.  
  443.     return $result;
  444.  
  445.   }
  446.  
  447.   /**
  448.    * sdi::ModifyParam()
  449.    * modification des paramètres d'un IDD en fonction de son sdii_id
  450.    *
  451.    * @access public
  452.    * @param int $ID identifiant de l'IDD
  453.    * @param array $tableparam contient les composants d'un IDD
  454.    * @param string $param paramètre passé :
  455.    *  E -> evaluation
  456.    *  P -> provider
  457.    *  R -> reglementation
  458.    * @param object $sql_object 
  459.    * @return bool $result
  460.    */
  461.   function ModifyParam($ID$tableparam$param$sql_object)
  462.   {
  463.     $param strtoupper($param);
  464.     switch ($param{
  465.       case 'E':
  466.         $data $this->_GetKeysSdi($ID$sql_object);
  467.         $id_e $data[0]['sdii_evaluation'];
  468.         $result $this->_ModifyEvaluation($id_e$tableparam$sql_object);
  469.         break;
  470.       case 'P':
  471.         $data $this->_GetKeysSdi($ID$sql_object);
  472.         $id_p $data[0]['sdii_provider'];
  473.         $result $this->_ModifyProvider($id_p$tableparam$sql_object);
  474.         break;
  475.       case 'R':
  476.         $data $this->_GetKeysSdi($ID$sql_object);
  477.         $id_r $data[0]['sdii_reglementation'];
  478.         $result $this->_ModifyRules($id_r$tableparam$sql_object);
  479.         break;
  480.     }
  481.     return $result;
  482.   }
  483.   /**
  484.    * sdi::DeleteSdi()
  485.    * suppression d'un IDD
  486.    *
  487.    * @access public
  488.    * @param int $id identifiant de l'IDD a supprimer
  489.    * @param object $sql_object 
  490.    * @return bool $result
  491.    */
  492.   function DeleteSdi($ID$sql_object)
  493.   {
  494.     $state "E";
  495.     $result $this->StateSdi($ID$state$sql_object);
  496.     $requete "UPDATE " $this->TDB_SDI_VALUE . " SET sdiv_statut='" $state "' WHERE sdiv_sdi_info=" $ID ";";
  497.     $result2 $sql_object->DBQuery ($requete);
  498.     return $result;
  499.   }
  500.  
  501.   /**
  502.    * sdi::_ModifyEvaluation()
  503.    * modification d'une évaluation IDD
  504.    *
  505.    * @access private
  506.    * @param int $ID identifiant de l'évaluation
  507.    * @param object $sql_object 
  508.    * @param array $table_sdi_eval contient les composants d'un IDD
  509.    * @return bool $result
  510.    */
  511.   function _ModifyEvaluation($ID$table_sdi_eval$sql_object)
  512.   {
  513.     $table_sdi_eval=$sql_object->DBescape($table_sdi_eval);
  514.  
  515.     if (is_numeric($ID)) {
  516.       $this->E_ID = $ID;
  517.     else return false;
  518.  
  519.     $this->E_SCALE = empty_numeric($table_sdi_eval[0]);
  520.     $this->E_FIABILITY = empty_numeric($table_sdi_eval[1]);
  521.     $this->E_ACCESSIBILITY = empty_numeric($table_sdi_eval[2]);
  522.     $this->E_LISIBILITY = empty_numeric($table_sdi_eval[3]);
  523.     $this->E_RELEVANCE = empty_numeric($table_sdi_eval[4]);
  524.     $this->E_GLOBAL_PERFORMANCE = empty_numeric($table_sdi_eval[5]);
  525.  
  526.  
  527.     $requete "UPDATE " $this->TDB_SDI_EVAL . " SET sdie_scale_compare='" $this->E_SCALE . "', sdie_fiability='"
  528.     . $this->E_FIABILITY . "', sdie_accessibility='" $this->E_ACCESSIBILITY . "', sdie_lisibility='"
  529.     . $this->E_LISIBILITY . "', sdie_relevance='" $this->E_RELEVANCE . "', sdie_global_performance='"
  530.     . $this->E_GLOBAL_PERFORMANCE . "', sdie_last_modify = NOW()
  531.         WHERE sdie_id=" $this->E_ID . ";";
  532.     $result $sql_object->DBQuery ($requete);
  533.     return $result;
  534.   }
  535.  
  536.   /**
  537.    * sdi::_ModifyProvider()
  538.    * modification d'un fournisseur IDD
  539.    *
  540.    * @access private
  541.    * @param int $ID identifiant du fournisseur
  542.    * @param object $sql_object 
  543.    * @param array $table_sdi_provider contient les composants d'un fournisseur
  544.    * @return bool $result
  545.    */
  546.   function _ModifyProvider ($ID$table_sdi_provider$sql_object)
  547.   {
  548.     $table_sdi_provider=$sql_object->DBescape($table_sdi_provider);
  549.  
  550.     if (is_numeric($ID)) {
  551.       $this->P_ID = $ID;
  552.     else return false;
  553.  
  554.     $this->P_NAME = strip_input($table_sdi_provider[0]);
  555.     $this->P_SERVICE = strip_input($table_sdi_provider[1]);
  556.     $this->P_DESCRIPTION = strip_input($table_sdi_provider[2]true);
  557.     $this->P_INCHARGE = strip_input($table_sdi_provider[3]);
  558.     $this->P_ADDRESS = strip_input($table_sdi_provider[4]true);
  559.     $this->P_PHONE = strip_input($table_sdi_provider[5]);
  560.     $this->P_FAX = strip_input($table_sdi_provider[6]);
  561.     $this->P_EMAIL = strip_input($table_sdi_provider[7]);
  562.  
  563.     $requete "UPDATE " $this->TDB_SDI_PROVIDER . " SET sdip_name= '" $this->P_NAME . "', sdip_service='"
  564.     . $this->P_SERVICE . "', sdip_description='" $this->P_DESCRIPTION . "', sdip_incharge='"
  565.     . $this->P_INCHARGE . "', sdip_address='" $this->P_ADDRESS . "', sdip_phone='"
  566.     . $this->P_PHONE . "', sdip_fax='" $this->P_FAX . "', sdip_email='"
  567.     . $this->P_EMAIL . "', sdip_last_modify = NOW()
  568.         WHERE sdip_id='" $this->P_ID . "';";
  569.     $result $sql_object->DBQuery ($requete);
  570.     return $result;
  571.   }
  572.  
  573.   /**
  574.    * sdi::_ModifyRules()
  575.    * modification d'une réglementation
  576.    *
  577.    * @access private
  578.    * @param int $ID identifiant d'une réglementation
  579.    * @param object $sql_object 
  580.    * @param array $table_sdi_rules contient les composants d'une réglementation
  581.    * @return bool $result
  582.    */
  583.   function _ModifyRules ($ID$table_sdi_rules$sql_object)
  584.   {
  585.     $table_sdi_rules=$sql_object->DBescape($table_sdi_rules);
  586.  
  587.     if (is_numeric($ID)) {
  588.       $this->R_ID = $ID;
  589.     else return false;
  590.  
  591.     $this->R_TITLE = strip_input($table_sdi_rules[0]);
  592.     $this->R_BODY = strip_input($table_sdi_rules[1]true);
  593.     $this->R_REFERER_URI = strip_input($table_sdi_rules[2]);
  594.     $this->R_MASK_URI = strip_input($table_sdi_rules[3]);
  595.  
  596.     $requete "UPDATE " $this->TDB_SDI_RULES . " SET sdir_title= '" $this->R_TITLE . "', sdir_body='"
  597.     . $this->R_BODY . "', sdir_referer_uri='" $this->R_REFERER_URI . "', sdir_mask_uri='"
  598.     . $this->R_MASK_URI . "',  sdir_last_modify = NOW()
  599.         WHERE sdir_id='" $this->R_ID . "';";
  600.     $result $sql_object->DBQuery ($requete);
  601.     return $result;
  602.   }
  603.  
  604.   /**
  605.    * sdi::ModifyValue()
  606.    * modification d'une valeur
  607.    *
  608.    * @access public
  609.    * @param int $ID identifiant d'une valeur
  610.    * @param object $sql_object 
  611.    * @param array $table_sdi_value contient les composants d'une valeur
  612.    * @return bool $result
  613.    */
  614.   function ModifyValue ($ID$table_sdi_value$sql_object)
  615.   {
  616.     $table_sdi_value=$sql_object->DBescape($table_sdi_value);
  617.  
  618.     if (is_numeric($ID)) {
  619.       $this->V_ID = $ID;
  620.     else return false;
  621.  
  622.     $this->V_VALUE = $table_sdi_value[0];
  623.     $this->V_SDI_ID = $table_sdi_value[1];
  624.     $this->V_SCALE = $table_sdi_value[2];
  625.     $this->V_DATE_PUBLISHED = formatDate($table_sdi_value[3]true);
  626.     $this->V_STATUT = $table_sdi_value[4];
  627.  
  628.     $requete "UPDATE " $this->TDB_SDI_VALUE . " SET sdiv_value=" $this->V_VALUE . ", sdiv_sdi_info="
  629.     . $this->V_SDI_ID . ", sdiv_scale=" $this->V_SCALE . ",sdiv_date_published='" $this->V_DATE_PUBLISHED . "',sdiv_statut='" $this->V_STATUT . "', sdiv_last_modify = NOW()
  630.         WHERE sdiv_id=" $this->V_ID . ";";
  631.     $result $sql_object->DBQuery ($requete);
  632.     return $result;
  633.   }
  634.  
  635.   /**
  636.    * sdi::ModifyRange()
  637.    * modification simple du rang d'un IDD
  638.    *
  639.    * @access public
  640.    * @param int $ID identifiant de l'IDD
  641.    * @param object $sql_object 
  642.    * @param int $range contient la valeur du rang à modifier
  643.    * @return bool $result
  644.    */
  645.   function ModifyRange ($ID$range$sql_object)
  646.   {
  647.     if (is_numeric($ID)) {
  648.       $this->I_ID = $ID;
  649.     else return false;
  650.  
  651.     if (is_numeric($range)) {
  652.       $this->I_RANGE = $range;
  653.     else return false;
  654.  
  655.     $requete "UPDATE " $this->TDB_SDI_INFO . " SET sdii_range=" $this->I_RANGE . ",
  656.         sdii_last_modify= NOW()
  657.         WHERE sdii_id='" $this->I_ID . "';";
  658.     $result $sql_object->DBQuery ($requete);
  659.     return $result;
  660.   }
  661.  
  662.   /**
  663.    * sdi::StateSdi()
  664.    * modification simple du statut d'un IDD
  665.    *
  666.    * @access public
  667.    * @param int $ID identifiant de l'IDD
  668.    * @param object $sql_object 
  669.    * @param string $state contient la valeur du statut à modifier
  670.    * @return bool $result
  671.    */
  672.   function StateSdi ($ID$state$sql_object)
  673.   {
  674.     if (is_numeric($ID)) {
  675.       $this->ID $ID;
  676.     else return false;
  677.  
  678.     $requete "UPDATE " $this->TDB_SDI_INFO . " SET sdii_statut='" $state "' WHERE sdii_id=" $this->ID ";";
  679.     $result $sql_object->DBQuery ($requete);
  680.     return $result;
  681.   }
  682.  
  683.  
  684.  
  685.   /**
  686.    * sdi::StateValue()
  687.    * modification simple du statut d'une valeur d'un IDD
  688.    *
  689.    * @access public
  690.    * @param int $id identifiant de l'IDD
  691.    * @param object $sql_object 
  692.    * @param string $state contient la valeur du statut à modifier
  693.    * @return bool $result
  694.    */
  695.   function StateValue ($ID$state$sql_object)
  696.   {
  697.     if (is_numeric($ID)) {
  698.       $this->ID $ID;
  699.     else return false;
  700.     $requete "UPDATE " $this->TDB_SDI_VALUE . " SET sdiv_statut='" $state "' WHERE sdiv_id=" $this->ID ";";
  701.     $result $sql_object->DBQuery ($requete);
  702.     return $result;
  703.   }
  704.  
  705.   /**
  706.    * sdi::DeleteValue()
  707.    * suppression  d'une valeur d'un IDD
  708.    *
  709.    * @access public
  710.    * @param int $id identifiant de la valeur a supprimer
  711.    * @param object $sql_object 
  712.    * @return bool $result
  713.    */
  714.   function DeleteValue ($ID$sql_object)
  715.   {
  716.     $state "E";
  717.     $result $this->StateValue($ID$state$sql_object);
  718.     return $result;
  719.   }
  720.  
  721.  
  722.   function _GetInfoSdi($id$sql_object)
  723.   {
  724.     if(SQL=='mysql'$datefunction="DATE_FORMAT";
  725.     if(SQL=='pgsql'$datefunction="to_char";
  726.     $requete "SELECT II.sdii_id, II.sdii_name, II.sdii_description, II.sdii_comment, T.theme_name, II.sdii_theme,
  727.         II.sdii_range, II.sdii_goal, II.sdii_consulting, II.sdii_unit, II.sdii_max_value, II.sdii_min_value,
  728.         II.sdii_threshold_value, II.sdii_threshold_relative, II.sdii_frequency, II.sdii_provider, IP.sdip_name, II.sdii_evaluation, II.sdii_reglementation,
  729.         " $datefunction "(II.sdii_date_crea, '" toStringSqlDate("' ) AS date_c, II.sdii_statut            
  730.         FROM " $this->TDB_SDI_INFO . " AS II LEFT OUTER JOIN theme as T on II.sdii_theme=T.theme_id 
  731.         LEFT OUTER JOIN sdi_provider as IP on II.sdii_provider=IP.sdip_id";
  732.     $requete .= " WHERE II.sdii_id=" $id ";";
  733.     
  734.     $result $sql_object->DBSelect ($requete);
  735.  
  736.     return $result;
  737.   }
  738.  
  739.  
  740. }
  741.  
  742. ?>

Documentation generated on Fri, 16 Oct 2009 09:30:13 +0200 by phpDocumentor 1.4.1