/** * Adds an epic * * @Route(url="/boards/:board_id/addepic") * * @param framework\Request $request */ public function runAddEpic(framework\Request $request) { $this->forward403unless($this->_checkProjectPageAccess('project_planning')); $board = entities\tables\AgileBoards::getTable()->selectById($request['board_id']); try { $title = trim($request['title']); $shortname = trim($request['shortname']); if (!$title) { throw new \Exception($this->getI18n()->__('You have to provide a title')); } if (!$shortname) { throw new \Exception($this->getI18n()->__('You have to provide a label')); } $issue = new \thebuggenie\core\entities\Issue(); $issue->setTitle($title); $issue->setShortname($shortname); $issue->setIssuetype($board->getEpicIssuetypeID()); $issue->setProject($board->getProject()); $issue->setPostedBy($this->getUser()); $issue->save(); return $this->renderJSON(array('issue_details' => $issue->toJSON())); } catch (\Exception $e) { $this->getResponse()->setHttpStatus(400); return $this->renderJSON(array('error' => $e->getMessage())); } }
protected function _populateRecentIssues($issuetype) { $issuetype_id = is_object($issuetype) ? $issuetype->getID() : $issuetype; if (!array_key_exists($issuetype_id, $this->_recentissues)) { $this->_recentissues[$issuetype_id] = array(); if ($res = tables\Issues::getTable()->getRecentByProjectIDandIssueType($this->getID(), $issuetype_id)) { while ($row = $res->getNextRow()) { try { $issue = new \thebuggenie\core\entities\Issue($row->get(tables\Issues::ID), $row); if ($issue->hasAccess()) { $this->_recentissues[$issuetype_id][$issue->getID()] = $issue; } } catch (\Exception $e) { } } } } }
public function hasAccess() { $issue_ids = tables\IssueFiles::getTable()->getIssuesByFileID($this->getID()); foreach ($issue_ids as $issue_id) { $issue = new \thebuggenie\core\entities\Issue($issue_id); if ($issue->hasAccess()) { return true; } } $event = \thebuggenie\core\framework\Event::createNew('core', 'thebuggenie\\core\\entities\\File::hasAccess', $this); $event->setReturnValue(false); $event->triggerUntilProcessed(); return $event->getReturnValue(); }