/** * Render select_default_assignment_filter control * * Parameters: * * - user - User - User using the page * - value - integer - ID of selected filter * - optional - boolean - Value is optional? * * @param array $params * @param Smarty $smarty * @return string */ function smarty_function_select_default_assignment_filter($params, &$smarty) { $user = array_var($params, 'user', null, true); $value = array_var($params, 'value', null, true); $optional = array_var($params, 'optional', true, true); $default_filter_id = (int) ConfigOptions::getValue('default_assignments_filter'); $default_filter = $default_filter_id ? AssignmentFilters::findById($default_filter_id) : null; $options = array(); if (instance_of($default_filter, 'AssignmentFilter') && $optional) { $options[] = option_tag(lang('-- System Default (:filter) --', array('filter' => $default_filter->getName())), ''); } // if $grouped_filters = AssignmentFilters::findGrouped($user, true); if (is_foreachable($grouped_filters)) { foreach ($grouped_filters as $group_name => $filters) { $group_options = array(); foreach ($filters as $filter) { $group_options[] = option_tag($filter->getName(), $filter->getId(), array('selected' => $value == $filter->getId())); } // foreach if (count($options) > 0) { $options[] = option_tag('', ''); } // if $options[] = option_group_tag($group_name, $group_options); } // foreach } // if return select_box($options, $params); }
/** * Show filter details * * @param void * @return null */ function index() { if ($this->active_filter->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$this->active_filter->canUse($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if list($assignments, $pagination) = AssignmentFilters::executeFilter($this->logged_user, $this->active_filter, null, (int) $this->request->get('page')); $this->smarty->assign(array('assignments' => $assignments, 'pagination' => $pagination, 'grouped_filters' => AssignmentFilters::findGrouped($this->logged_user))); }
/** * Shows a assignments page * */ function assignments() { $filter_id = $this->request->getId('filter_id'); if (!$filter_id) { $filter_id = UserConfigOptions::getValue('default_assignments_filter', $this->logged_user); } // if if ($filter_id) { $active_filter = AssignmentFilters::findById($filter_id); } // if $page = $this->getPaginationPage(); $per_page = 15; $pagination = null; if (instance_of($active_filter, 'AssignmentFilter')) { list($assignments, $pagination) = AssignmentFilters::executeFilter($this->logged_user, $active_filter, true, $page, $per_page); } else { $assignments = array(); } // if $this->smarty->assign(array("objects" => $assignments, "page_title" => lang('Assignments'), 'grouped_filters' => AssignmentFilters::findGrouped($this->logged_user), "active_filter" => $active_filter, 'pagination' => $pagination, 'pagination_url' => assemble_url('mobile_access_assignments'))); }
/** * Show assignments index * * @param void * @return null */ function index() { list($assignments, $pagination) = AssignmentFilters::executeFilter($this->logged_user, $this->active_filter, null, (int) $this->request->get('page')); $this->wireframe->addRssFeed($this->owner_company->getName() . ' - ' . $this->active_filter->getName(), $this->active_filter->getRssUrl($this->logged_user), FEED_RSS); $this->smarty->assign(array('assignments' => $assignments, 'pagination' => $pagination, 'grouped_filters' => AssignmentFilters::findGrouped($this->logged_user))); }