public function runAddFilter(framework\Request $request) { if ($request['filter_name'] == 'project_id' && count(entities\Project::getAll()) == 0) { $this->getResponse()->setHttpStatus(400); return $this->renderJSON(array('error' => framework\Context::getI18n()->__('No projects exist so this filter can not be added'))); } elseif (in_array($request['filter_name'], entities\SearchFilter::getValidSearchFilters()) || entities\CustomDatatype::doesKeyExist($request['filter_name'])) { return $this->renderJSON(array('content' => $this->getComponentHTML('search/filter', array('filter' => $request['filter_name'], 'key' => $request->getParameter('key', 0))))); } else { $this->getResponse()->setHttpStatus(400); return $this->renderJSON(array('error' => framework\Context::getI18n()->__('This is not a valid search field'))); } }
</div> </div> <?php break; case 'priority': case 'resolution': case 'reproducability': case 'severity': include_component('search/interactivefilter_choice', compact('filter')); break; case 'posted': case 'last_updated': include_component('search/interactivefilter_date', compact('filter')); break; default: if (!in_array($filter->getFilterKey(), \thebuggenie\core\entities\SearchFilter::getValidSearchFilters())) { switch ($filter->getFilterType()) { case \thebuggenie\core\entities\CustomDatatype::DATE_PICKER: include_component('search/interactivefilter_date', compact('filter')); break; case \thebuggenie\core\entities\CustomDatatype::RADIO_CHOICE: case \thebuggenie\core\entities\CustomDatatype::DROPDOWN_CHOICE_TEXT: include_component('search/interactivefilter_choice', compact('filter')); break; case \thebuggenie\core\entities\CustomDatatype::COMPONENTS_CHOICE: case \thebuggenie\core\entities\CustomDatatype::EDITIONS_CHOICE: case \thebuggenie\core\entities\CustomDatatype::RELEASES_CHOICE: case \thebuggenie\core\entities\CustomDatatype::MILESTONE_CHOICE: include_component('search/interactivefilter_affected', compact('filter')); break; case \thebuggenie\core\entities\CustomDatatype::USER_CHOICE:
<?php $show_button = false; ?> <li id="filter_<?php echo $key; ?> "> <?php if (in_array($filter, \thebuggenie\core\entities\SearchFilter::getValidSearchFilters())) { ?> <?php if ($filter == 'project_id' && !\thebuggenie\core\framework\Context::isProjectContext()) { ?> <label<?php if (!\thebuggenie\core\framework\Context::isProjectContext()) { ?> for="filter_project_id_<?php echo $key; ?> "<?php } ?> ><?php echo __('Project'); ?> </label> <?php if (!\thebuggenie\core\framework\Context::isProjectContext()) { ?> <select name="filters[project_id][<?php