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

Source for file class.calendar.php

Documentation is available at class.calendar.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage workshop
  5.  * @author linea21 <info@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  *  Workgroup Calendar Management
  10.  */
  11.  
  12. class calendar {
  13.   /* @param
  14.    * */
  15.  
  16.   var $TDB_CALENDAR = T_WORK_CAL// nom de la table.
  17.   var $ID;
  18.   var $TASK_DATE;
  19.   var $TASK;
  20.   var $TASK_DETAILS;
  21.   var $WORKSHOP_ID;
  22.   var $POSTED_BY;
  23.   var $DATE_CREA;
  24.   var $LAST_MODIFY;
  25.   var $VALIDITY;
  26.   protected $dispatcher = null;
  27.  
  28.   public function __construct()
  29.   {
  30.     $this->dispatcher = $GLOBALS['dispatcher'];
  31.   }
  32.  
  33.   public function __call($method$arguments)
  34.   {
  35.     $event $this->dispatcher->notifyUntil(new sfEvent($this'calendar.extensible_function'array(
  36.       'method'    => $method,
  37.       'arguments' => $arguments
  38.     )));
  39.     if (!$event->isProcessed())
  40.     {
  41.       throw new Exception(sprintf('Call to undefined method %s::%s.'get_class($this)$method));
  42.     }
  43.  
  44.     return $event->getReturnValue();
  45.   }
  46.  
  47.   /**
  48.    * calendar::CheckDataIntegrity()
  49.    * Vérification intégrité des données
  50.    *
  51.    * @access public
  52.    * @param array $table contient les composants d'une tache
  53.    * @return boolean true
  54.    *  si verifié, sinon string 'message d'erreur'
  55.    */
  56.   function CheckDataIntegrity($table$sql_object)
  57.   {
  58.     if (strlen($table[1]3return _t('workshop','no_task');
  59.     if (strlen($table[2]3return _t('workshop','no_task_details');
  60.     return checkdate_validity($table[0]);
  61.     return true;
  62.   }
  63.  
  64.   /**
  65.    * calendar::AddTask()
  66.    * Ajout d'une nouvelle tache dans le calendrier
  67.    *
  68.    * @access public
  69.    * @param array $table_task contient les composants d'une tache
  70.    * @param object $sql_object 
  71.    * @return integer $last_id
  72.    */
  73.   function AddTask($table_task$sql_object)
  74.   {
  75.     $table_task=$sql_object->DBescape($table_task);
  76.     if ($table_task[0!= ''{
  77.       $this->TASK_DATE = formatDate($table_task[0]true);
  78.     }
  79.     if ($table_task[1!= ''{
  80.       $this->TASK = strip_input(trim($table_task[1]));
  81.     }
  82.     if ($table_task[2!= ''{
  83.       $this->TASK_DETAILS = strip_input(trim($table_task[2])true);
  84.     }
  85.     if (is_numeric($table_task[3])) {
  86.       $this->WORKSHOP_ID = $table_task[3];
  87.     }
  88.     if (is_numeric($table_task[4])) {
  89.       $this->POSTED_BY = $table_task[4];
  90.     }
  91.  
  92.     $this->VALIDITY = "Y";
  93.  
  94.     $requete "INSERT INTO " $this->TDB_CALENDAR . " (workcal_task_date, workcal_task, workcal_task_details, workcal_workshop_id, workcal_posted_by, workcal_validity, workcal_date_crea) " "VALUES('" $this->TASK_DATE . "', '" $this->TASK . "', '" $this->TASK_DETAILS . "', " $this->WORKSHOP_ID . ", '" $this->POSTED_BY . "', '" $this->VALIDITY . "', NOW());";
  95.  
  96.     $last_id $sql_object->DBInsert ($requete1);
  97.     return $last_id;
  98.   }
  99.  
  100.   /**
  101.    * calendar::DeleteTask()
  102.    * suppression d'une tache
  103.    *
  104.    * @access public
  105.    * @param int $id identifiant de la tache
  106.    * @param object $sql_object 
  107.    * @return bool $result
  108.    */
  109.   function DeleteTask($ID$sql_object)
  110.   {
  111.     if (is_numeric($ID)) {
  112.       $this->ID = $ID;
  113.     else return false;
  114.     $requete "UPDATE " $this->TDB_CALENDAR . " SET workcal_validity='N' WHERE workcal_id=" $this->ID . ";";
  115.     $result $sql_object->DBQuery ($requete);
  116.     return $result;
  117.   }
  118.  
  119.   /**
  120.    * calendar::ModifyTask()
  121.    * modification d'une tache
  122.    *
  123.    * @access public
  124.    * @param int $ID identifiant de la tache
  125.    * @param object $sql_object 
  126.    * @param array $table_task contient les composants d'une tache
  127.    * @return bool $result
  128.    */
  129.   function ModifyTask($ID$table_task$sql_object)
  130.   {
  131.     $table_task=$sql_object->DBescape($table_task);
  132.     if ($table_task[0!= ''{
  133.       $this->TASK_DATE = formatDate($table_task[0]true);
  134.     }
  135.     if ($table_task[1!= ''{
  136.       $this->TASK = strip_input(trim($table_task[1]));
  137.     }
  138.     if ($table_task[2!= ''{
  139.       $this->TASK_DETAILS = strip_input(trim($table_task[2])true);
  140.     }
  141.  
  142.     $requete "UPDATE  " $this->TDB_CALENDAR . " SET workcal_task_date='" $this->TASK_DATE . "', workcal_task='" $this->TASK . "' , workcal_task_details='" $this->TASK_DETAILS . "', workcal_last_modify=NOW() WHERE workcal_id=" $ID ";";
  143.     $result $sql_object->DBQuery($requete);
  144.     return $result;
  145.   }
  146. }
  147.  
  148. ?>

Documentation generated on Fri, 01 Apr 2011 09:28:13 +0200 by phpDocumentor 1.4.1