| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 | 
							- <?php
 
- /*
 
-  * @file
 
-  * Contains message entity class.
 
-  */
 
- /**
 
-  * Entity class for the tmgmt_message entity.
 
-  *
 
-  * @ingroup tmgmt_job
 
-  */
 
- class TMGMTMessage extends Entity {
 
-   /**
 
-    * The ID of the message..
 
-    *
 
-    * @var integer
 
-    */
 
-   public $mid;
 
-   /**
 
-    * The ID of the job.
 
-    *
 
-    * @var integer
 
-    */
 
-   public $tjid;
 
-   /**
 
-    * The ID of the job item.
 
-    *
 
-    * @var integer
 
-    */
 
-   public $tjiid;
 
-   /**
 
-    * User uid.
 
-    *
 
-    * @var integer
 
-    */
 
-   public $uid;
 
-   /**
 
-    * The message text.
 
-    *
 
-    * @var string
 
-    */
 
-   public $message;
 
-   /**
 
-    * An array of string replacement arguments as used by t().
 
-    *
 
-    * @var array
 
-    */
 
-   public $variables;
 
-   /**
 
-    * The time when the message object was created as a timestamp.
 
-    *
 
-    * @var integer
 
-    */
 
-   public $created;
 
-   /**
 
-    * Type of the message (debug, status, warning or error).
 
-    *
 
-    * @var string
 
-    */
 
-   public $type;
 
-   /**
 
-    * {@inheritdoc}
 
-    */
 
-   public function __construct(array $values = array()) {
 
-     parent::__construct($values, 'tmgmt_message');
 
-     if (empty($this->created)) {
 
-       $this->created = REQUEST_TIME;
 
-     }
 
-     if (empty($this->type)) {
 
-       $this->type = 'status';
 
-     }
 
-   }
 
-   /**
 
-    * {@inheritdoc}
 
-    */
 
-   public function defaultLabel() {
 
-     $created = format_date($this->created);
 
-     switch ($this->type) {
 
-       case 'error':
 
-         return t('Error message from @time', array('@time' => $created));
 
-       case 'status':
 
-         return t('Status message from @time', array('@time' => $created));
 
-       case 'warning':
 
-         return t('Warning message from @time', array('@time' => $created));
 
-       case 'debug':
 
-         return t('Debug message from @time', array('@time' => $created));
 
-     }
 
-   }
 
-   /**
 
-    * Returns the translated message.
 
-    *
 
-    * @return
 
-    *   The translated message.
 
-    */
 
-   public function getMessage() {
 
-     $text = $this->message;
 
-     if (is_array($this->variables) && !empty($this->variables)) {
 
-       $text = t($text, $this->variables);
 
-     }
 
-     return $text;
 
-   }
 
-   /**
 
-    * Loads the job entity that this job message is attached to.
 
-    *
 
-    * @return TMGMTJob
 
-    *   The job entity that this job message is attached to or FALSE if there was
 
-    *   a problem.
 
-    */
 
-   public function getJob() {
 
-     if (!empty($this->tjid)) {
 
-       return tmgmt_job_load($this->tjid);
 
-     }
 
-     return FALSE;
 
-   }
 
-   /**
 
-    * Loads the job entity that this job message is attached to.
 
-    *
 
-    * @return TMGMTJobItem
 
-    *   The job item entity that this job message is attached to or FALSE if
 
-    *   there was a problem.
 
-    */
 
-   public function getJobItem() {
 
-     if (!empty($this->tjiid)) {
 
-       return tmgmt_job_item_load($this->tjiid);
 
-     }
 
-     return FALSE;
 
-   }
 
- }
 
 
  |