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.   protected $dispatcher = null;
  26.  
  27.   public function __construct()
  28.   {
  29.     $this->dispatcher = $GLOBALS['dispatcher'];
  30.   }
  31.  
  32.   public function __call($method$arguments)
  33.   {
  34.     $event $this->dispatcher->notifyUntil(new sfEvent($this'workshop_report.extensible_function'array(
  35.       'method'    => $method,
  36.       'arguments' => $arguments
  37.     )));
  38.     if (!$event->isProcessed())
  39.     {
  40.       throw new Exception(sprintf('Call to undefined method %s::%s.'get_class($this)$method));
  41.     }
  42.  
  43.     return $event->getReturnValue();
  44.   }
  45.  
  46.   /**
  47.    * workshop_report::CheckDataIntegrity()
  48.    * Vérification intégrité des données
  49.    *
  50.    * @access public
  51.    * @param array $table : contient les composants d'un compte rendu
  52.    * @return boolean true
  53.    *  si verifié, sinon string 'message d'erreur'
  54.    */
  55.   function CheckDataIntegrity($table$sql_object)
  56.   {
  57.       // Filter data event + return value
  58.       $r $this->dispatcher->filter(new sfEvent($this'workshopreport.before_datacheck'array('data' => $table))$table);
  59.       $table $r->getReturnValue();
  60.       
  61.     if (strlen($table[0]3return _t('workshoprep','no_title');
  62.     if (strlen($table[1]3return _t('workshoprep','no_resume');
  63.     
  64.     // Notify the beginning of the current method
  65.     $this->dispatcher->notify(new sfEvent($this'workshopreport.after_datacheck'array('data' => $table)));
  66.  
  67.     return true;
  68.   }
  69.  
  70.  
  71.   /**
  72.    * workshop_report::AddWorkshopReport()
  73.    * Ajout d'un un rapport de groupe de travail
  74.    *
  75.    * @access public
  76.    * @param array $table_workrep contient les composants du rapport
  77.    * @param object $sql_object 
  78.    * @return integer $last_id
  79.    */
  80.   function AddWorkshopReport($table_workrep$sql_object)
  81.   {
  82.       // Filter data event + return value
  83.       $r $this->dispatcher->filter(new sfEvent($this'workshopreport.before_add'array('data' => $table_workrep))$table_workrep);
  84.       $table_workrep $r->getReturnValue();
  85.        
  86.     $table_workrep=$sql_object->DBescape($table_workrep);
  87.  
  88.     $this->TITLE = strip_input(trim($table_workrep[0]));
  89.     $this->RESUME = strip_input(trim($table_workrep[1])true);
  90.     $this->COMMENT = strip_input(trim($table_workrep[2])true);
  91.     $this->STATUT = strtoupper($table_workrep[3]);
  92.     $this->WORKSHOP_ID = $table_workrep[4];
  93.     $this->PUBLISHED_DATE = "NOW()";
  94.  
  95.     if ($this->STATUT == 'P'{
  96.       $this->PUBLISHED_DATE = "NOW()";
  97.     else {
  98.       $this->PUBLISHED_DATE = "'0001-01-01'";
  99.     }
  100.  
  101.     $q "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());";
  102.     $last_id $sql_object->DBInsert ($q1);
  103.     
  104.     // Notify the end of the current method
  105.     $this->dispatcher->notify(new sfEvent($this'workshopreport.after_add'array('data' => $table_workrep'id' => $last_id)));
  106.     
  107.     return $last_id;
  108.   }
  109.  
  110.  
  111.   /**
  112.    * workshop_report::ModifyWorkshopReport()
  113.    * modification d'un rapport de groupe de travail
  114.    *
  115.    * @access public
  116.    * @param int $ID identifiant du rapport de workshop
  117.    * @param array $table_workrep contient les composants du rapport
  118.    * @param object $sql_object 
  119.    * @return bool $result
  120.    */
  121.   function ModifyWorkshopReport($ID$table_workrep$sql_object)
  122.   {
  123.       // Filter data event + return value
  124.       $r $this->dispatcher->filter(new sfEvent($this'workshopreport.before_modify'array('data' => $table_workrep'id' => $ID))$table_workrep);
  125.       $table_workrep $r->getReturnValue();
  126.       
  127.     $table_workrep=$sql_object->DBescape($table_workrep);
  128.  
  129.     $this->ID = $ID;
  130.     $this->TITLE = strip_input(trim($table_workrep[0]));
  131.     $this->RESUME = strip_input(trim($table_workrep[1])true);
  132.     $this->COMMENT = strip_input(trim($table_workrep[2])true);
  133.     $this->STATUT = $table_workrep[3];
  134.  
  135.     $mask $this->_HavePublishedDate($table_workrep[4]);
  136.  
  137.     $q "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 . "';";
  138.     $result $sql_object->DBQuery($q);
  139.     
  140.     // Notify the end of the current method
  141.     $this->dispatcher->notify(new sfEvent($this'workshopreport.after_modify'array('data' => $table_workrep'id' => $this->ID)));
  142.     
  143.     return $result;
  144.   }
  145.  
  146.  
  147.   /**
  148.    * workshop_report::_HavePublishedDate()
  149.    * Détermine la date de publication a inserer dans la bdd
  150.    *
  151.    * @access private
  152.    * @param string $current_status : statut actuel de la publication
  153.    * @return string $sql_mask
  154.    */
  155.   function _HavePublishedDate($current_status)
  156.   {
  157.     switch ($this->STATUT{
  158.       case 'P':
  159.         if ($current_status == 'D'$sql_mask ", workrep_published_date= NOW()";
  160.         else $sql_mask '';
  161.         break;
  162.       case 'D':
  163.         $sql_mask ", workrep_published_date= '0001-01-01'";
  164.         break;
  165.       default:
  166.         $sql_mask '';
  167.     }
  168.     return $sql_mask;
  169.   }
  170.  
  171.  
  172.   /**
  173.    * workshop_report::DeleteWorkshopReport()
  174.    * suppression d'un rapport de groupe de travail
  175.    *
  176.    * @access public
  177.    * @param int $ID id du rapport de groupe de travail
  178.    * @param object $sql_object 
  179.    * @return bool $result
  180.    */
  181.   function DeleteWorkshopReport($ID$sql_object)
  182.   {
  183.       // Notify the beginning of the current method
  184.       $this->dispatcher->notify(new sfEvent($this'workshopreport.delete'array('id' => $ID)));
  185.       
  186.     $this->ID = $ID;
  187.     $q "UPDATE  " $this->TDB_WORKREP . " set workrep_statut='E', workrep_last_modify=NOW() WHERE workrep_id='" $this->ID . "';";
  188.     $result $sql_object->DBQuery($q);
  189.  
  190.     return $result;
  191.   }
  192.  
  193. }
  194.  
  195. ?>

Documentation generated on Thu, 20 Mar 2014 16:47:11 +0100 by phpDocumentor 1.4.1