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

Documentation generated on Fri, 01 Apr 2011 09:29:22 +0200 by phpDocumentor 1.4.1