예제 #1
0
 protected function fetchConditions()
 {
     parent::fetchConditions();
     $filter_on_hold = $this->getState('filter.on_hold');
     if (is_bool($filter_on_hold)) {
         if (!$filter_on_hold) {
             $where = array();
             $where[] = array('on_hold' => array('$exists' => false));
             $where[] = array('on_hold' => array('$ne' => true));
             $this->setCondition('$or', $where);
         } else {
             $this->setCondition('on_hold', true);
         }
     }
     $filter_name = $this->getState('filter.name');
     if (strlen($filter_name)) {
         // add $and conditions to the query stack
         if (!($and = $this->getCondition('$and'))) {
             $and = array();
         }
         $details = explode(' ', $filter_name);
         if (count($details) > 1) {
             $and[] = array('$and' => array(array('first_name' => $details[0]), array('last_name' => $details[1])));
         } else {
             $and[] = array('$or' => array(array('username' => strtolower($details[0]))));
         }
         $this->setCondition('$and', $and);
     }
     return $this;
 }
예제 #2
0
 protected function fetchConditions()
 {
     parent::fetchConditions();
     $filter_active_after = $this->getState('filter.active_after');
     if (strlen($filter_active_after)) {
         $this->setCondition('$and', array('last_activity' => array('$gt' => $filter_active_after)), 'append');
     }
     return $this;
 }