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.         // Filter data event + return value
  59.         $r $this->dispatcher->filter(new sfEvent($this'calendar.before_datacheck'array('data' => $table))$table);
  60.         $table $r->getReturnValue();
  61.          
  62.         if (strlen($table[1]3return _t('workshop','no_task');
  63.         if (strlen($table[2]3return _t('workshop','no_task_details');
  64.  
  65.         if(is_string(checkdate_validity($table[0]))) {
  66.             return checkdate_validity($table[0]);
  67.         }
  68.  
  69.         // Notify the beginning of the current method
  70.         $this->dispatcher->notify(new sfEvent($this'calendar.after_datacheck'array('data' => $table)));
  71.  
  72.         return $r;
  73.     }
  74.  
  75.     /**
  76.      * calendar::AddTask()
  77.      * Ajout d'une nouvelle tache dans le calendrier
  78.      *
  79.      * @access public
  80.      * @param array $table_task contient les composants d'une tache
  81.      * @param object $sql_object 
  82.      * @return integer $last_id
  83.      */
  84.     function AddTask($table_task$sql_object)
  85.     {
  86.         // Filter data event + return value
  87.         $r $this->dispatcher->filter(new sfEvent($this'calendar.before_add'array('data' => $table_task))$table_task);
  88.         $table_task $r->getReturnValue();
  89.          
  90.         $table_task=$sql_object->DBescape($table_task);
  91.         if ($table_task[0!= ''{
  92.             $this->TASK_DATE = formatDate($table_task[0]true);
  93.         }
  94.         if ($table_task[1!= ''{
  95.             $this->TASK = strip_input(trim($table_task[1]));
  96.         }
  97.         if ($table_task[2!= ''{
  98.             $this->TASK_DETAILS = strip_input(trim($table_task[2])true);
  99.         }
  100.         if (is_numeric($table_task[3])) {
  101.             $this->WORKSHOP_ID = $table_task[3];
  102.         }
  103.         if (is_numeric($table_task[4])) {
  104.             $this->POSTED_BY = $table_task[4];
  105.         }
  106.         if($table_task[5== 1{
  107.             $this->WORKSHOP_ID = 999999999;
  108.         }
  109.  
  110.         $this->VALIDITY = "Y";
  111.  
  112.         $q "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());";
  113.  
  114.         $last_id $sql_object->DBInsert ($q1);
  115.  
  116.         // Notify the end of the current method
  117.         $this->dispatcher->notify(new sfEvent($this'calendar.after_add'array('data' => $table_task'id' => $last_id)));
  118.  
  119.         return $last_id;
  120.     }
  121.  
  122.     /**
  123.      * calendar::DeleteTask()
  124.      * suppression d'une tache
  125.      *
  126.      * @access public
  127.      * @param int $id identifiant de la tache
  128.      * @param object $sql_object 
  129.      * @return bool $result
  130.      */
  131.     function DeleteTask($ID$sql_object)
  132.     {
  133.         // Notify the beginning of the current method
  134.         $this->dispatcher->notify(new sfEvent($this'calendar.delete'array('id' => $ID)));
  135.          
  136.         if (is_numeric($ID)) {
  137.             $this->ID = $ID;
  138.         else return false;
  139.         $q "UPDATE " $this->TDB_CALENDAR . " SET workcal_validity='N' WHERE workcal_id=" $this->ID . ";";
  140.         $result $sql_object->DBQuery ($q);
  141.         return $result;
  142.     }
  143.  
  144.     /**
  145.      * calendar::ModifyTask()
  146.      * modification d'une tache
  147.      *
  148.      * @access public
  149.      * @param int $ID identifiant de la tache
  150.      * @param object $sql_object 
  151.      * @param array $table_task contient les composants d'une tache
  152.      * @return bool $result
  153.      */
  154.     function ModifyTask($ID$table_task$sql_object)
  155.     {
  156.         // Filter data event + return value
  157.         $r $this->dispatcher->filter(new sfEvent($this'calendar.before_modify'array('data' => $table_task'id' => $ID))$table_task);
  158.         $table_task $r->getReturnValue();
  159.         
  160.         $table_task=$sql_object->DBescape($table_task);
  161.         if ($table_task[0!= ''{
  162.             $this->TASK_DATE = formatDate($table_task[0]true);
  163.         }
  164.         if ($table_task[1!= ''{
  165.             $this->TASK = strip_input(trim($table_task[1]));
  166.         }
  167.         if ($table_task[2!= ''{
  168.             $this->TASK_DETAILS = strip_input(trim($table_task[2])true);
  169.         }
  170.  
  171.         $q "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 ";";
  172.         $result $sql_object->DBQuery($q);
  173.  
  174.         // Notify the end of the current method
  175.         $this->dispatcher->notify(new sfEvent($this'calendar.after_modify'array('data' => $table_task'id' => $this->ID)));
  176.  
  177.         return $result;
  178.     }
  179. }
  180.  
  181. ?>

Documentation generated on Thu, 20 Mar 2014 16:46:01 +0100 by phpDocumentor 1.4.1