本文整理汇总了PHP中app::addSearchQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP app::addSearchQuery方法的具体用法?PHP app::addSearchQuery怎么用?PHP app::addSearchQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app
的用法示例。
在下文中一共展示了app::addSearchQuery方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeIndex
public function executeIndex(sfWebRequest $request)
{
if (!$this->getUser()->hasAttribute('users_filter')) {
$this->getUser()->setAttribute('users_filter', array());
}
$this->filter_by = $this->getUser()->getAttribute('users_filter');
if ($fb = $request->getParameter('filter_by')) {
$this->filter_by[key($fb)] = current($fb);
$this->getUser()->setAttribute('users_filter', $this->filter_by);
$this->redirect('users/index');
}
if ($request->hasParameter('remove_filter')) {
unset($this->filter_by[$request->getParameter('remove_filter')]);
$this->getUser()->setAttribute('users_filter', $this->filter_by);
$this->redirect('users/index');
}
$q = Doctrine_Core::getTable('Users')->createQuery('u')->leftJoin('u.UsersGroups ug');
if ($request->hasParameter('search')) {
$q = app::addSearchQuery($q, $request->getParameter('search'), 'UsersComments', 'u', $request->getParameter('search_by_extrafields'));
} else {
$q = Users::addFiltersToQuery($q, $this->getUser()->getAttribute('users_filter'));
}
$this->userss = $q->orderBy('ug.name, u.name')->execute();
app::setPageTitle('Users', $this->getResponse());
}
示例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: executeListing
public function executeListing(sfWebRequest $request)
{
if (!isset($this->reports_id)) {
$this->reports_id = false;
}
$q = Doctrine_Core::getTable('Tickets')->createQuery('t')->leftJoin('t.TicketsStatus ts')->leftJoin('t.TicketsTypes tt')->leftJoin('t.Departments td')->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', 'tickets', $this->getUser(), $request->getParameter('projects_id'))) {
$q->addWhere("t.departments_id in (" . implode(',', Departments::getDepartmentIdByUserId($this->getUser()->getAttribute('id'))) . ") or t.users_id='" . $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', 'tickets', $this->getUser())) {
$q->addWhere("t.departments_id in (" . implode(',', Departments::getDepartmentIdByUserId($this->getUser()->getAttribute('id'))) . ") or t.users_id='" . $this->getUser()->getAttribute('id') . "'");
}
}
if ($this->reports_id > 0) {
$q = TicketsReports::addFiltersToQuery($q, $this->reports_id, $this->getUser());
} elseif ($request->hasParameter('search')) {
$q = app::addSearchQuery($q, $request->getParameter('search'), 'TicketsComments', 't', $request->getParameter('search_by_extrafields'));
$q = app::addListingOrder($q, 'tickets', $this->getUser());
} else {
$q = Tickets::addFiltersToQuery($q, $this->getUser()->getAttribute('tickets_filter' . ((int) $request->getParameter('projects_id') > 0 ? $request->getParameter('projects_id') : '')));
$q = app::addListingOrder($q, 'tickets', $this->getUser(), (int) $request->getParameter('projects_id'));
}
if (sfConfig::get('app_rows_limit') > 0) {
$this->pager = new sfDoctrinePager('Tickets', sfConfig::get('app_rows_limit'));
$this->pager->setQuery($q);
$this->pager->setPage($request->getParameter('page', 1));
$this->pager->init();
}
$this->tickets_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=ticketsReports' . $this->reports_id;
$this->display_insert_button = true;
} else {
$this->url_params = 'redirect_to=ticketsList';
if ($request->hasParameter('projects_id')) {
$this->url_params = 'projects_id=' . $request->getParameter('projects_id');
}
$this->display_insert_button = true;
}
$this->tlId = rand(1111111, 9999999);
}
示例4: executeListing
public function executeListing(sfWebRequest $request)
{
if (!isset($this->reports_id)) {
$this->reports_id = false;
}
$q = Doctrine_Core::getTable('Projects')->createQuery('p')->leftJoin('p.ProjectsStatus ps')->leftJoin('p.ProjectsTypes pt')->leftJoin('p.Users');
if (Users::hasAccess('view_own', 'projects', $this->getUser())) {
$q->addWhere("find_in_set('" . $this->getUser()->getAttribute('id') . "',p.team) or p.created_by='" . $this->getUser()->getAttribute('id') . "'");
}
if ($this->reports_id > 0) {
$q = ProjectsReports::addFiltersToQuery($q, $this->reports_id, $this->getUser());
} elseif ($request->hasParameter('search')) {
$q = app::addSearchQuery($q, $request->getParameter('search'), 'ProjectsComments', 'p', $request->getParameter('search_by_extrafields'));
$q = app::addListingOrder($q, 'projects', $this->getUser());
} else {
$q = Projects::addFiltersToQuery($q, $this->getUser()->getAttribute('projects_filter'));
$q = app::addListingOrder($q, 'projects', $this->getUser());
}
if (sfConfig::get('app_rows_limit') > 0) {
$this->pager = new sfDoctrinePager('Projects', sfConfig::get('app_rows_limit'));
$this->pager->setQuery($q);
$this->pager->setPage($request->getParameter('page', 1));
$this->pager->init();
}
$this->projects_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=projectsReports' . $this->reports_id;
$this->display_insert_button = true;
} else {
$this->url_params = '';
$this->display_insert_button = true;
}
$this->tlId = rand(1111111, 9999999);
}