public function componentFilter() { $pkey = TBGContext::isProjectContext() ? TBGContext::getCurrentProject()->getID() : null; $i18n = TBGContext::getI18n(); $this->selected_operator = isset($this->selected_operator) ? $this->selected_operator : '='; $this->key = isset($this->key) ? $this->key : null; $this->filter = isset($this->filter) ? $this->filter : null; if (in_array($this->filter, array('posted', 'last_updated'))) { $this->selected_value = $this->selected_value ? $this->selected_value : NOW; } else { $this->selected_value = isset($this->selected_value) ? $this->selected_value : 0; } $this->filter_info = isset($this->filter_info) ? $this->filter_info : null; $filters = array(); $filters['status'] = array('description' => $i18n->__('Status'), 'options' => TBGStatus::getAll()); $filters['category'] = array('description' => $i18n->__('Category'), 'options' => TBGCategory::getAll()); $filters['priority'] = array('description' => $i18n->__('Priority'), 'options' => TBGPriority::getAll()); $filters['severity'] = array('description' => $i18n->__('Severity'), 'options' => TBGSeverity::getAll()); $filters['reproducability'] = array('description' => $i18n->__('Reproducability'), 'options' => TBGReproducability::getAll()); $filters['resolution'] = array('description' => $i18n->__('Resolution'), 'options' => TBGResolution::getAll()); $filters['issuetype'] = array('description' => $i18n->__('Issue type'), 'options' => TBGIssuetype::getAll()); $filters['component'] = array('description' => $i18n->__('Component'), 'options' => array()); $filters['build'] = array('description' => $i18n->__('Build'), 'options' => array()); $filters['edition'] = array('description' => $i18n->__('Edition'), 'options' => array()); $filters['milestone'] = array('description' => $i18n->__('Milestone'), 'options' => array()); if (TBGContext::isProjectContext()) { $filters['subprojects'] = array('description' => $i18n->__('Include subproject(s)'), 'options' => array('all' => $this->getI18n()->__('All subprojects'), 'none' => $this->getI18n()->__("Don't include subprojects (default, unless specified otherwise)"))); $projects = TBGProject::getIncludingAllSubprojectsAsArray(TBGContext::getCurrentProject()); foreach ($projects as $project) { if ($project->getID() == TBGContext::getCurrentProject()->getID()) { continue; } $filters['subprojects']['options'][$project->getID()] = "{$project->getName()} ({$project->getKey()})"; } } else { $projects = array(); foreach (TBGProject::getAllRootProjects() as $project) { TBGProject::getSubprojectsArray($project, $projects); } } if (count($projects) > 0) { foreach ($projects as $project) { foreach ($project->getComponents() as $component) { $filters['component']['options'][] = $component; } foreach ($project->getBuilds() as $build) { $filters['build']['options'][] = $build; } foreach ($project->getEditions() as $edition) { $filters['edition']['options'][] = $edition; } foreach ($project->getMilestones() as $milestone) { $filters['milestone']['options'][] = $milestone; } } } $filters['posted_by'] = array('description' => $i18n->__('Posted by')); $filters['assignee_user'] = array('description' => $i18n->__('Assigned to user')); $filters['assignee_team'] = array('description' => $i18n->__('Assigned to team')); $filters['owner_user'] = array('description' => $i18n->__('Owned by user')); $filters['owner_team'] = array('description' => $i18n->__('Owned by team')); $filters['posted'] = array('description' => $i18n->__('Date reported')); $filters['last_updated'] = array('description' => $i18n->__('Date last updated')); $this->filters = $filters; }