public static function loadFixtures(TBGScope $scope) { $scheme = new TBGIssuetypeScheme(); $scheme->setScope($scope->getID()); $scheme->setName("Default issuetype scheme"); $scheme->setDescription("This is the default issuetype scheme. It is used by all projects with no specific issuetype scheme selected. This scheme cannot be edited or removed."); $scheme->save(); foreach (TBGIssuetype::getAll() as $issuetype) { $scheme->setIssuetypeEnabled($issuetype); if ($issuetype->getIcon() == 'developer_report') { $scheme->setIssuetypeRedirectedAfterReporting($issuetype, false); } if (in_array($issuetype->getIcon(), array('task', 'developer_report', 'idea'))) { $scheme->setIssuetypeReportable($issuetype, false); } } return $scheme; }
/** * Configure issue fields * * @param TBGRequest $request The request object */ public function runConfigureIssuetypes(TBGRequest $request) { $this->mode = $request->getParameter('mode', 'issuetypes'); if ($this->mode == 'issuetypes' || $this->mode == 'scheme') { $this->issue_types = TBGIssuetype::getAll(); $this->icons = TBGIssuetype::getIcons(); } elseif ($this->mode == 'schemes') { $this->issue_type_schemes = TBGIssuetypeScheme::getAll(); } if ($request->hasParameter('scheme_id')) { $this->scheme = TBGContext::factory()->TBGIssuetypeScheme((int) $request->getParameter('scheme_id')); if ($this->mode == 'copy_scheme') { if ($new_name = $request->getParameter('new_name')) { $new_scheme = new TBGIssuetypeScheme(); $new_scheme->setName($new_name); $new_scheme->save(); foreach ($this->scheme->getIssuetypes() as $issuetype) { $new_scheme->setIssuetypeEnabled($issuetype); $new_scheme->setIssuetypeRedirectedAfterReporting($issuetype, $this->scheme->isIssuetypeRedirectedAfterReporting($issuetype)); $new_scheme->setIssuetypeReportable($issuetype, $this->scheme->isIssuetypeReportable($issuetype)); } TBGIssueFieldsTable::getTable()->copyBySchemeIDs($this->scheme->getID(), $new_scheme->getID()); return $this->renderJSON(array('content' => $this->getTemplateHTML('configuration/issuetypescheme', array('scheme' => $new_scheme)))); } else { $this->error = TBGContext::getI18n()->__('Please enter a valid name'); } } elseif ($this->mode == 'delete_scheme') { $this->scheme->delete(); return $this->renderJSON(array('success' => true, 'message' => TBGContext::getI18n()->__('The issuetype scheme was deleted'))); } } }