Refactoring/simplification of the pull-request about links
This commit is contained in:
@@ -18,6 +18,24 @@ class TaskFilter extends Base
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function excludeTasks(array $task_ids)
|
||||
{
|
||||
$this->query->notin('id', $task_ids);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function filterByTitle($title)
|
||||
{
|
||||
$this->query->ilike('title', '%'.$title.'%');
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function filterByProjects(array $project_ids)
|
||||
{
|
||||
$this->query->in('project_id', $project_ids);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function filterByProject($project_id)
|
||||
{
|
||||
if ($project_id > 0) {
|
||||
@@ -94,6 +112,20 @@ class TaskFilter extends Base
|
||||
return $this->query->findAll();
|
||||
}
|
||||
|
||||
public function toAutoCompletion()
|
||||
{
|
||||
return $this->query->columns('id', 'title')->filter(function(array $results) {
|
||||
|
||||
foreach ($results as &$result) {
|
||||
$result['value'] = $result['title'];
|
||||
$result['label'] = '#'.$result['id'].' - '.$result['title'];
|
||||
}
|
||||
|
||||
return $results;
|
||||
|
||||
})->findAll();
|
||||
}
|
||||
|
||||
public function toCalendarEvents()
|
||||
{
|
||||
$events = array();
|
||||
|
||||
Reference in New Issue
Block a user