本文整理汇总了PHP中Projects::addFiltersToQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Projects::addFiltersToQuery方法的具体用法?PHP Projects::addFiltersToQuery怎么用?PHP Projects::addFiltersToQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Projects
的用法示例。
在下文中一共展示了Projects::addFiltersToQuery方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: getFilterProjects
public static function getFilterProjects($m, $path, $params = false, $selected = array(), $sf_user)
{
if (!is_array($selected)) {
$selected = explode(',', $selected);
}
if (count($selected) > 0) {
$ft = 'Preview';
} else {
$ft = '';
}
$q = Doctrine_Core::getTable('Projects')->createQuery('p')->leftJoin('p.ProjectsStatus ps')->leftJoin('p.ProjectsTypes pt')->leftJoin('p.Users');
if (Users::hasAccess('view_own', 'projects', $sf_user)) {
$q->addWhere("find_in_set('" . $sf_user->getAttribute('id') . "',p.team) or p.created_by='" . $sf_user->getAttribute('id') . "'");
}
$projects_filter = array();
$tasks_filter = $sf_user->getAttribute('tasks_filter');
if (isset($tasks_filter['ProjectsStatus'])) {
$projects_filter['ProjectsStatus'] = $tasks_filter['ProjectsStatus'];
}
if (isset($tasks_filter['ProjectsTypes'])) {
$projects_filter['ProjectsTypes'] = $tasks_filter['ProjectsTypes'];
}
$q = Projects::addFiltersToQuery($q, $projects_filter);
$projects_list = $q->orderBy('p.name')->fetchArray();
$s = array();
$t = 'Projects';
foreach ($projects_list as $v) {
$k = $v['id'];
$s[] = array('title' => '<table><tr><td style="padding-right: 10px;"><input class="' . $t . 'Filters' . $ft . '" name="' . $t . $k . '" id="' . $t . $k . '" value="' . $k . '" ' . (in_array($k, $selected) ? 'checked="checked"' : '') . ' type="checkbox"></td><td>' . link_to(app::truncate_text($v['name']), $path, array('query_string' => 'filter_by[' . $t . ']=' . $k . ($params ? '&' . $params : ''))) . '</td></table>');
}
$s[] = array('title' => '<form id="filter_by_' . $t . '_form" action="' . url_for($path . ($params ? '?' . $params : '')) . '" method="post">' . input_hidden_tag('filter_by[' . $t . ']', '') . '<table onClick="filter_by_selected(\'' . $t . '\',\'' . $ft . '\')"><tr><td style="padding-right: 10px;">' . image_tag('icons/arrow_up.png') . '</td><td>' . __('Filter by selected') . '</td></table></form>', 'is_hr' => true);
$m[] = array('title' => __('Projects'), 'submenu' => $s, 'is_hr' => true);
return $m;
}