Esempio n. 1
0
<?php

$show_button = false;
?>
<li id="filter_<?php 
echo $key;
?>
">
	<?php 
if (in_array($filter, TBGSearchFilter::getValidSearchFilters())) {
    ?>
		<?php 
    if ($filter == 'project_id' && !TBGContext::isProjectContext()) {
        ?>
			<label<?php 
        if (!TBGContext::isProjectContext()) {
            ?>
 for="filter_project_id_<?php 
            echo $key;
            ?>
"<?php 
        }
        ?>
><?php 
        echo __('Project');
        ?>
</label>
			<?php 
        if (!TBGContext::isProjectContext()) {
            ?>
				<select name="filters[project_id][<?php 
Esempio n. 2
0
 public function runAddFilter(TBGRequest $request)
 {
     if ($request['filter_name'] == 'project_id' && count(TBGProject::getAll()) == 0) {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => TBGContext::getI18n()->__('No projects exist so this filter can not be added')));
     } elseif (in_array($request['filter_name'], TBGSearchFilter::getValidSearchFilters()) || TBGCustomDatatype::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' => TBGContext::getI18n()->__('This is not a valid search field')));
     }
 }
</div>
				</div>
				<?php 
            break;
        case 'priority':
        case 'resolution':
        case 'reproducability':
        case 'severity':
            include_template('search/interactivefilter_choice', compact('filter'));
            break;
        case 'posted':
        case 'last_updated':
            include_template('search/interactivefilter_date', compact('filter'));
            break;
        default:
            if (!in_array($filter->getFilterKey(), TBGSearchFilter::getValidSearchFilters())) {
                switch ($filter->getFilterType()) {
                    case TBGCustomDatatype::DATE_PICKER:
                        include_template('search/interactivefilter_date', compact('filter'));
                        break;
                    case TBGCustomDatatype::RADIO_CHOICE:
                    case TBGCustomDatatype::DROPDOWN_CHOICE_TEXT:
                        include_template('search/interactivefilter_choice', compact('filter'));
                        break;
                    case TBGCustomDatatype::COMPONENTS_CHOICE:
                    case TBGCustomDatatype::EDITIONS_CHOICE:
                    case TBGCustomDatatype::RELEASES_CHOICE:
                    case TBGCustomDatatype::MILESTONE_CHOICE:
                        include_template('search/interactivefilter_affected', compact('filter'));
                        break;
                    case TBGCustomDatatype::USER_CHOICE: