| Server IP : 103.161.17.216 / Your IP : 216.73.216.1 Web Server : nginx/1.18.0 System : Linux tipsysaigoncharming 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/app.houseland.info/application/services/tasks/ |
Upload File : |
<?php
namespace app\services\tasks;
use app\services\AbstractKanban;
class TasksKanban extends AbstractKanban
{
protected function table(): string
{
return 'tasks';
}
public function defaultSortDirection(): string
{
return 'ASC';
}
public function defaultSortColumn(): string
{
return 'kanban_order';
}
public function limit()
{
return get_option('tasks_kanban_limit');
}
public function forProject($projectId): TasksKanban
{
return $this->tapQuery(function ($status, $ci) use ($projectId) {
if ($projectId) {
$ci->db->where('rel_type', 'project')
->where('rel_id', $projectId);
}
});
}
protected function applySearchQuery($q): self
{
if (!startsWith($q, '#')) {
$q = $this->ci->db->escape_like_str($q);
$this->ci->db->where('(' . db_prefix() . 'tasks.name LIKE "%' . $q . '%" ESCAPE \'!\' OR ' . db_prefix() . 'tasks.description LIKE "%' . $q . '%" ESCAPE \'!\')');
} else {
$this->ci->db->where(db_prefix() . 'tasks.id IN
(SELECT rel_id FROM ' . db_prefix() . 'taggables WHERE tag_id IN
(SELECT id FROM ' . db_prefix() . 'tags WHERE name="' . $this->ci->db->escape_str(strafter($q, '#')) . '")
AND ' . db_prefix() . 'taggables.rel_type=\'task\' GROUP BY rel_id HAVING COUNT(tag_id) = 1)
');
}
return $this;
}
protected function initiateQuery(): self
{
$where = '';
if (staff_cant('view', 'tasks')) {
$where = get_tasks_where_string(false);
}
$this->ci->db->select(tasks_rel_name_select_query() . ' as rel_name,rel_type,rel_id,id,priority,name,duedate,startdate,status,' . get_sql_select_task_total_checklist_items() . ',' . get_sql_select_task_total_finished_checklist_items() . ',(SELECT COUNT(id) FROM ' . db_prefix() . 'task_comments WHERE taskid=' . db_prefix() . 'tasks.id) as total_comments,(SELECT COUNT(id) FROM ' . db_prefix() . 'files WHERE rel_id=' . db_prefix() . 'tasks.id AND rel_type="task") as total_files,' . get_sql_select_task_asignees_full_names() . ' as assignees' . ',' . get_sql_select_task_assignees_ids() . ' as assignees_ids,(SELECT staffid FROM ' . db_prefix() . 'task_assigned WHERE taskid=' . db_prefix() . 'tasks.id AND staffid=' . get_staff_user_id() . ') as current_user_is_assigned, (SELECT CASE WHEN addedfrom=' . get_staff_user_id() . ' AND is_added_from_contact=0 THEN 1 ELSE 0 END) as current_user_is_creator');
$this->ci->db->from('tasks');
$this->ci->db->where('status', $this->status);
if ($where != '') {
$this->ci->db->where($where);
}
return $this;
}
}