public function runAddFilter(TBGRequest $request)
 {
     if ($request->getParameter('filter_name') == 'project_id' && count(TBGProject::getAll()) == 0) {
         return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('No projects exist so this filter can not be added')));
     } elseif (in_array($request->getParameter('filter_name'), TBGIssuesTable::getValidSearchFilters()) || TBGCustomDatatype::doesKeyExist($request->getParameter('filter_name'))) {
         return $this->renderJSON(array('failed' => false, 'content' => $this->getComponentHTML('search/filter', array('filter' => $request->getParameter('filter_name'), 'key' => $request->getParameter('key', 0)))));
     } else {
         return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('This is not a valid search field')));
     }
 }
Example #2
0
<li id="filter_<?php 
echo $key;
?>
">
	<?php 
if (in_array($filter, TBGIssuesTable::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()) {
            ?>
				<?php 
            //echo __('%project% is %project_name%', array('%project%' => '', '%project_name%' => '<i>"' . TBGContext::getCurrentProject()->getName() . '"</i>'));
            ?>
			<?php 
        } else {