/**
  * Generate filter conditions for filter search
  * @param string filter
  * @param string pre character for search (default '') optional '%'
  */
 public function generateFilterConditions($filter = null, $pre = '')
 {
     $conditions = parent::generateFilterConditions($filter, $pre);
     foreach ($this->_statuses as $key => $name) {
         if (strtolower($filter) == $name) {
             $conditions['OR']["{$this->alias}.status"] = $key;
             unset($conditions['OR']["{$this->alias}.status LIKE"]);
         }
     }
     foreach ($this->_types as $key => $name) {
         if (strtolower($filter) == $name) {
             $conditions['OR']["{$this->alias}.type"] = $key;
             unset($conditions['OR']["{$this->alias}.type LIKE"]);
         }
     }
 }
Example #2
0
 /**
  * Return jobtypes
  *
  * @param mixed $value value
  * @return array       list of jobtypes
  */
 public static function jobtypes($value = null)
 {
     $options = [self::TYPE_TASK => __d('queue', 'Task'), self::TYPE_MODEL => __d('queue', 'Model (Method)')];
     return parent::enum($value, $options);
 }
Example #3
0
 /**
  * QueuedTask::__construct()
  *
  * @param integer $id
  * @param string $table
  * @param string $ds
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     parent::__construct($id, $table, $ds);
     // set virtualFields
     $this->virtualFields['status'] = '(CASE WHEN ' . $this->alias . '.notbefore > NOW() THEN \'NOT_READY\' WHEN ' . $this->alias . '.fetched IS null THEN \'NOT_STARTED\' WHEN ' . $this->alias . '.fetched IS NOT null AND ' . $this->alias . '.completed IS null AND ' . $this->alias . '.failed = 0 THEN \'IN_PROGRESS\' WHEN ' . $this->alias . '.fetched IS NOT null AND ' . $this->alias . '.completed IS null AND ' . $this->alias . '.failed > 0 THEN \'FAILED\' WHEN ' . $this->alias . '.fetched IS NOT null AND ' . $this->alias . '.completed IS NOT null THEN \'COMPLETED\' ELSE \'UNKNOWN\' END)';
 }