本文整理汇总了PHP中Tasks::addFiltersToQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Tasks::addFiltersToQuery方法的具体用法?PHP Tasks::addFiltersToQuery怎么用?PHP Tasks::addFiltersToQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tasks
的用法示例。
在下文中一共展示了Tasks::addFiltersToQuery方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeGoto
public function executeGoto(sfWebRequest $request)
{
$q = Doctrine_Core::getTable('Tasks')->createQuery('t')->leftJoin('t.TasksPriority tp')->leftJoin('t.TasksStatus ts')->leftJoin('t.TasksLabels tl')->leftJoin('t.TasksTypes tt')->leftJoin('t.TasksGroups tg')->leftJoin('t.ProjectsPhases pp')->leftJoin('t.Versions v')->leftJoin('t.Projects p')->leftJoin('t.Users');
$q->addWhere('projects_id=?', $request->getParameter('projects_id'));
if (Users::hasAccess('view_own', 'tasks', $this->getUser(), $request->getParameter('projects_id'))) {
$q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',t.assigned_to) or t.created_by='" . $this->getUser()->getAttribute('id') . "'");
}
$q = Tasks::addFiltersToQuery($q, $this->getUser()->getAttribute('tasks_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
$q = app::addListingOrder($q, 'tasks', $this->getUser(), (int) $request->getParameter('projects_id'));
$this->menu = array();
$tasks_ids = array();
foreach ($q->fetchArray() as $tasks) {
if (strlen($sn = app::getArrayName($tasks, 'TasksStatus')) > 0) {
$sn = $sn . ': ';
} else {
$sn = '';
}
if ($request->getParameter('tasks_id') == $tasks['id']) {
$tasks['name'] = '<b>' . $tasks['name'] . '</b>';
}
$this->menu[] = array('title' => $sn . $tasks['name'], 'url' => 'tasksComments/index?projects_id=' . $request->getParameter('projects_id') . '&tasks_id=' . $tasks['id']);
$tasks_ids[] = $tasks['id'];
}
$current_key = array_search($request->getParameter('tasks_id'), $tasks_ids);
$this->previous_tasks_id = false;
$this->next_tasks_id = false;
if (isset($tasks_ids[$current_key - 1])) {
$this->previous_tasks_id = $tasks_ids[$current_key - 1];
}
if (isset($tasks_ids[$current_key + 1])) {
$this->next_tasks_id = $tasks_ids[$current_key + 1];
}
}
示例2: executeListing
public function executeListing(sfWebRequest $request)
{
if (!isset($this->reports_id)) {
$this->reports_id = false;
}
$q = Doctrine_Core::getTable('Tasks')->createQuery('t')->leftJoin('t.TasksPriority tp')->leftJoin('t.TasksStatus ts')->leftJoin('t.TasksLabels tl')->leftJoin('t.TasksTypes tt')->leftJoin('t.TasksGroups tg')->leftJoin('t.ProjectsPhases pp')->leftJoin('t.Versions v')->leftJoin('t.Projects p')->leftJoin('t.Users');
if ($request->hasParameter('projects_id')) {
$q->addWhere('projects_id=?', $request->getParameter('projects_id'));
if (Users::hasAccess('view_own', 'tasks', $this->getUser(), $request->getParameter('projects_id'))) {
$q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',t.assigned_to) or t.created_by='" . $this->getUser()->getAttribute('id') . "'");
}
} else {
if (Users::hasAccess('view_own', 'projects', $this->getUser())) {
$q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',team) or p.created_by='" . $this->getUser()->getAttribute('id') . "'");
}
if (Users::hasAccess('view_own', 'tasks', $this->getUser())) {
$q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',t.assigned_to) or t.created_by='" . $this->getUser()->getAttribute('id') . "'");
}
}
if ($this->reports_id > 0) {
$q = UserReports::addFiltersToQuery($q, $this->reports_id, $this->getUser()->getAttribute('id'));
} elseif ($request->hasParameter('search')) {
$q = app::addSearchQuery($q, $request->getParameter('search'), 'TasksComments', 't', $request->getParameter('search_by_extrafields'));
$q = app::addListingOrder($q, 'tasks', $this->getUser());
} else {
$q = Tasks::addFiltersToQuery($q, $this->getUser()->getAttribute('tasks_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
$q = app::addListingOrder($q, 'tasks', $this->getUser(), (int) $request->getParameter('projects_id'));
}
$this->pager = false;
if (sfConfig::get('app_rows_limit') > 0) {
$this->pager = new sfDoctrinePager('Tasks', sfConfig::get('app_rows_limit'));
$this->pager->setQuery($q);
$this->pager->setPage($request->getParameter('page', 1));
$this->pager->init();
}
$this->tasks_list = $q->fetchArray();
if (isset($this->is_dashboard)) {
$this->url_params = 'redirect_to=dashboard';
$this->display_insert_button = true;
} elseif ($this->reports_id > 0) {
$this->url_params = 'redirect_to=userReports' . $this->reports_id;
$this->display_insert_button = true;
} else {
$this->url_params = 'redirect_to=tasksList';
if ($request->hasParameter('projects_id')) {
$this->url_params = 'projects_id=' . $request->getParameter('projects_id');
}
$this->display_insert_button = true;
}
$this->tlId = rand(1111111, 9999999);
$this->users_schema = Users::getSchema();
}
示例3: getTasks
protected function getTasks($request, $tasks_tree)
{
$q = Doctrine_Core::getTable('Tasks')->createQuery('t')->leftJoin('t.TasksPriority tp')->leftJoin('t.TasksStatus ts')->leftJoin('t.TasksLabels tl')->leftJoin('t.TasksTypes tt')->leftJoin('t.TasksGroups tg')->leftJoin('t.ProjectsPhases pp')->leftJoin('t.Versions v')->leftJoin('t.Projects p')->leftJoin('t.Users');
if ($request->hasParameter('projects_id')) {
$q->addWhere('projects_id=?', $request->getParameter('projects_id'));
if (Users::hasAccess('view_own', 'tasks', $this->getUser(), $request->getParameter('projects_id'))) {
$q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',t.assigned_to) or t.created_by='" . $this->getUser()->getAttribute('id') . "'");
}
} else {
if (Users::hasAccess('view_own', 'projects', $this->getUser())) {
$q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',team) or p.created_by='" . $this->getUser()->getAttribute('id') . "'");
}
if (Users::hasAccess('view_own', 'tasks', $this->getUser())) {
$q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',t.assigned_to) or t.created_by='" . $this->getUser()->getAttribute('id') . "'");
}
}
$q = Tasks::addFiltersToQuery($q, $this->getUser()->getAttribute('gantt_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
$q->addWhere('t.due_date is not null and t.start_date is not null');
$q->orderBy('p.name, t.start_date');
return $q->fetchArray();
}