Queue::search PHP Method

    public function search()
    {
        $criteria = new CDbCriteria();
        $criteria->compare('id', $this->id, true);
        $criteria->compare('worker', $this->worker, true);
        if ($this->create_time) {
            $criteria->compare('DATE(create_time)', date('Y-m-d', strtotime($this->create_time)));
        }
        $criteria->compare('task', $this->task, true);
        if ($this->start_time) {
            $criteria->compare('DATE(start_time)', date('Y-m-d', strtotime($this->start_time)));
        }
        if ($this->complete_time) {
            $criteria->compare('DATE(complete_time)', date('Y-m-d', strtotime($this->complete_time)));
        }
        $criteria->compare('status', $this->status);
        $criteria->compare('notice', $this->notice, true);
        $criteria->compare('priority', $this->priority, true);
        return new CActiveDataProvider(get_class($this), ['criteria' => $criteria, 'sort' => ['defaultOrder' => 'id DESC']]);
    }

Usage Example

Example #1
0
 public function get_open_calls()
 {
     // Set up the parameters for the search
     $params = array('call_status' => 'open', 'its_assigned_group' => $this->itsgroupid);
     $open_tickets = Queue::search($params);
     return $open_tickets;
 }