Beispiel #1
0
 /**
  * Apply condition
  *
  * @access public
  * @return CriteriaInterface
  */
 public function apply()
 {
     $this->query->beginOr();
     foreach ($this->filters as $filter) {
         $filter->withQuery($this->query)->apply();
     }
     $this->query->closeOr();
     return $this;
 }
 /**
  * Filter by comments
  *
  * @access public
  * @param  string  $string
  * @return TaskFilter
  */
 public function filterByComment($string)
 {
     $this->query->beginOr();
     $this->query->ilike(Comment::TABLE . '.comment', '%' . $string . '%');
     $this->query->join(Comment::TABLE, 'task_id', 'id');
     $this->query->closeOr();
 }
Beispiel #3
0
 /**
  * Filter by column name
  *
  * @access public
  * @param  array    $values   List of column name
  * @return TaskFilter
  */
 public function filterByColumnName(array $values)
 {
     $this->query->beginOr();
     foreach ($values as $project) {
         $this->query->ilike(Board::TABLE . '.title', $project);
     }
     $this->query->closeOr();
 }
Beispiel #4
0
 /**
  * Filter by colors
  *
  * @access public
  * @param  array   $colors
  * @return TaskFilter
  */
 public function filterByColors(array $colors)
 {
     $this->query->beginOr();
     foreach ($colors as $color) {
         $this->filterByColor($this->color->find($color));
     }
     $this->query->closeOr();
     return $this;
 }
Beispiel #5
0
 /**
  * Filter by link
  *
  * @access public
  * @param  array    $values   List of links
  * @return TaskFilter
  */
 public function filterByLinkName(array $values)
 {
     $this->query->beginOr();
     $link_query = $this->createLinkQuery()->in(Link::TABLE . '.label', $values);
     $matching_task_ids = $link_query->findAllByColumn('task_id');
     if (empty($matching_task_ids)) {
         $this->query->eq(Task::TABLE . '.id', 0);
     } else {
         $this->query->in(Task::TABLE . '.id', $matching_task_ids);
     }
     $this->query->closeOr();
     return $this;
 }
 /**
  * Apply subquery filter
  *
  * @access protected
  * @param  Table $subquery
  * @return Table
  */
 protected function applySubQueryFilter(Table $subquery)
 {
     if (is_int($this->value) || ctype_digit($this->value)) {
         $subquery->eq(Subtask::TABLE . '.user_id', $this->value);
     } else {
         switch ($this->value) {
             case 'me':
                 $subquery->eq(Subtask::TABLE . '.user_id', $this->currentUserId);
                 break;
             case 'nobody':
                 $subquery->eq(Subtask::TABLE . '.user_id', 0);
                 break;
             default:
                 $subquery->beginOr();
                 $subquery->ilike(User::TABLE . '.username', $this->value . '%');
                 $subquery->ilike(User::TABLE . '.name', '%' . $this->value . '%');
                 $subquery->closeOr();
         }
     }
     return $subquery;
 }