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

Source for file class.workshop_report.php

Documentation is available at class.workshop_report.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage workshoprep
  5.  * @see workshop
  6.  * @author linea21 <info@linea21.com>
  7.  * @version $id SVN
  8.  * @access public
  9.  * @license http://opensource.org/licenses/gpl-3.0.html
  10.  *  Work group report Management
  11.  */
  12. class workshop_report {
  13.   /* @param
  14.    * */
  15.   var $TDB_WORKREP = T_WORK_REP// nom de la table.
  16.   var $ID;
  17.   var $TITLE;
  18.   var $RESUME;
  19.   var $WORKSHOP_ID;
  20.   var $PUBLISHED_DATE;
  21.   var $COMMENT;
  22.   var $DATE_CREA;
  23.   var $LAST_MODIFY;
  24.   var $STATUT;
  25.  
  26.   /**
  27.    * workshop_report::CheckDataIntegrity()
  28.    * Vérification intégrité des données
  29.    *
  30.    * @access public
  31.    * @param array $table : contient les composants d'un compte rendu
  32.    * @return boolean true
  33.    *  si verifié, sinon string 'message d'erreur'
  34.    */
  35.   function CheckDataIntegrity($table$sql_object)
  36.   {
  37.     if (strlen($table[0]3return _t('workshoprep','no_title');
  38.     if (strlen($table[1]3return _t('workshoprep','no_resume');
  39.  
  40.     return true;
  41.   }
  42.  
  43.  
  44.   /**
  45.    * workshop_report::AddWorkshopReport()
  46.    * Ajout d'un un rapport de groupe de travail
  47.    *
  48.    * @access public
  49.    * @param array $table_workrep contient les composants du rapport
  50.    * @param object $sql_object 
  51.    * @return integer $last_id
  52.    */
  53.   function AddWorkshopReport($table_workrep$sql_object)
  54.   {
  55.     $table_workrep=$sql_object->DBescape($table_workrep);
  56.  
  57.     $this->TITLE = strip_input(trim($table_workrep[0]));
  58.     $this->RESUME = strip_input(trim($table_workrep[1]true));
  59.     $this->COMMENT = strip_input(trim($table_workrep[2]true));
  60.     $this->STATUT = strtoupper($table_workrep[3]);
  61.     $this->WORKSHOP_ID = $table_workrep[4];
  62.     $this->PUBLISHED_DATE = "NOW()";
  63.  
  64.     if ($this->STATUT == 'P'{
  65.       $this->PUBLISHED_DATE = "NOW()";
  66.     else {
  67.       $this->PUBLISHED_DATE = "'0001-01-01'";
  68.     }
  69.  
  70.     $requete "INSERT INTO " $this->TDB_WORKREP . " (workrep_title, workrep_resume, workrep_workshop_id, workrep_published_date, workrep_comment, workrep_statut, workrep_date_crea) VALUES('" $this->TITLE . "', '" $this->RESUME . "', " $this->WORKSHOP_ID . ", " $this->PUBLISHED_DATE . ", '" $this->COMMENT . "', '" $this->STATUT . "', NOW());";
  71.     $last_id $sql_object->DBInsert ($requete1);
  72.     return $last_id;
  73.   }
  74.  
  75.  
  76.   /**
  77.    * workshop_report::ModifyWorkshopReport()
  78.    * modification d'un rapport de groupe de travail
  79.    *
  80.    * @access public
  81.    * @param int $ID identifiant du rapport de workshop
  82.    * @param array $table_workrep contient les composants du rapport
  83.    * @param object $sql_object 
  84.    * @return bool $result
  85.    */
  86.   function ModifyWorkshopReport($ID$table_workrep$sql_object)
  87.   {
  88.     $table_workrep=$sql_object->DBescape($table_workrep);
  89.  
  90.     $this->ID = $ID;
  91.     $this->TITLE = strip_input(trim($table_workrep[0]));
  92.     $this->RESUME = strip_input(trim($table_workrep[1]true));
  93.     $this->COMMENT = strip_input(trim($table_workrep[2]true));
  94.     $this->STATUT = $table_workrep[3];
  95.  
  96.     $mask $this->_HavePublishedDate($table_workrep[4]);
  97.  
  98.     $requete "UPDATE  " $this->TDB_WORKREP . " SET workrep_title='" $this->TITLE . "', workrep_resume='" $this->RESUME . "', workrep_comment='" $this->COMMENT . "', workrep_statut='" $this->STATUT . "', workrep_last_modify=NOW() " $mask " WHERE workrep_id='" $this->ID . "';";
  99.     $result $sql_object->DBQuery($requete);
  100.     return $result;
  101.   }
  102.  
  103.  
  104.   /**
  105.    * workshop_report::_HavePublishedDate()
  106.    * Détermine la date de publication a inserer dans la bdd
  107.    *
  108.    * @access private
  109.    * @param string $current_status : statut actuel de la publication
  110.    * @return string $sql_mask
  111.    */
  112.   function _HavePublishedDate($current_status)
  113.   {
  114.     switch ($this->STATUT{
  115.       case 'P':
  116.         if ($current_status == 'D'$sql_mask ", workrep_published_date= NOW()";
  117.         else $sql_mask '';
  118.         break;
  119.       case 'D':
  120.         $sql_mask ", workrep_published_date= '0001-01-01'";
  121.         break;
  122.       default:
  123.         $sql_mask '';
  124.     }
  125.     return $sql_mask;
  126.   }
  127.  
  128.  
  129.   /**
  130.    * workshop_report::DeleteWorkshopReport()
  131.    * suppression d'un rapport de groupe de travail
  132.    *
  133.    * @access public
  134.    * @param int $ID id du rapport de groupe de travail
  135.    * @param object $sql_object 
  136.    * @return bool $result
  137.    */
  138.   function DeleteWorkshopReport($ID$sql_object)
  139.   {
  140.     $this->ID = $ID;
  141.     $requete "UPDATE  " $this->TDB_WORKREP . " set workrep_statut='E', workrep_last_modify=NOW() WHERE workrep_id='" $this->ID . "';";
  142.     $result $sql_object->DBQuery($requete);
  143.  
  144.     return $result;
  145.   }
  146.  
  147. }
  148.  
  149. ?>

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