/** * Poller for the planning page * * @Route(url="/boards/:board_id/poll/:mode") * * @param framework\Request $request */ public function runPoll(framework\Request $request) { $this->forward403unless($this->_checkProjectPageAccess('project_planning')); $last_refreshed = $request['last_refreshed']; $board = entities\tables\AgileBoards::getTable()->selectById($request['board_id']); $search_object = $board->getBacklogSearchObject(); if ($search_object instanceof \thebuggenie\core\entities\SavedSearch) { $search_object->setFilter('last_updated', \thebuggenie\core\entities\SearchFilter::createFilter('last_updated', array('o' => \b2db\Criteria::DB_GREATER_THAN_EQUAL, 'v' => $last_refreshed - 2))); } if ($request['mode'] == 'whiteboard') { $milestone_id = $request['milestone_id']; $ids = \thebuggenie\core\entities\tables\Issues::getTable()->getUpdatedIssueIDsByTimestampAndProjectIDAndMilestoneID($last_refreshed - 2, $this->selected_project->getID(), $milestone_id); } else { $ids = \thebuggenie\core\entities\tables\Issues::getTable()->getUpdatedIssueIDsByTimestampAndProjectIDAndIssuetypeID($last_refreshed - 2, $this->selected_project->getID()); $epic_ids = $board->getEpicIssuetypeID() ? \thebuggenie\core\entities\tables\Issues::getTable()->getUpdatedIssueIDsByTimestampAndProjectIDAndIssuetypeID($last_refreshed - 2, $this->selected_project->getID(), $board->getEpicIssuetypeID()) : array(); } $backlog_ids = array(); if ($search_object instanceof \thebuggenie\core\entities\SavedSearch) { foreach ($search_object->getIssues(true) as $backlog_issue) { foreach ($ids as $id_issue) { if ($id_issue['issue_id'] == $backlog_issue->getID()) { continue 2; } } $backlog_ids[] = array('issue_id' => $backlog_issue->getID(), 'last_updated' => $backlog_issue->getLastUpdatedTime()); } } return $this->renderJSON(compact('ids', 'backlog_ids', 'epic_ids', 'milestone_id')); }
protected function _getBoardFromRequest($request) { if ($request->hasParameter('board_id')) { try { $board = agile\entities\tables\AgileBoards::getTable()->selectById((int) $request['board_id']); return $board; } catch (\Exception $e) { } } }
protected function _upgradeFrom4dot1dot3(framework\Request $request) { set_time_limit(0); \thebuggenie\modules\agile\entities\tables\AgileBoards::getTable()->upgrade(\thebuggenie\core\modules\installation\upgrade_413\AgileBoard::getB2DBTable()); $this->upgrade_complete = true; $this->current_version = '4.1.4'; }
/** * @Listener(module='core', identifier='get_backdrop_partial') * @param \thebuggenie\core\framework\Event $event */ public function listen_get_backdrop_partial(framework\Event $event) { $request = framework\Context::getRequest(); $options = array(); switch ($event->getSubject()) { case 'agileboard': $template_name = 'agile/editagileboard'; $board = $request['board_id'] ? entities\tables\AgileBoards::getTable()->selectById($request['board_id']) : new entities\AgileBoard(); if (!$board->getID()) { $board->setAutogeneratedSearch(\thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_OPEN_ISSUES); $board->setTaskIssuetype(framework\Settings::get('issuetype_task')); $board->setEpicIssuetype(framework\Settings::get('issuetype_epic')); $board->setIsPrivate($request->getParameter('is_private', true)); $board->setProject($request['project_id']); } $options['board'] = $board; break; case 'milestone_finish': $template_name = 'agile/milestonefinish'; $options['project'] = \thebuggenie\core\entities\tables\Projects::getTable()->selectById($request['project_id']); $options['board'] = entities\tables\AgileBoards::getTable()->selectById($request['board_id']); $options['milestone'] = \thebuggenie\core\entities\tables\Milestones::getTable()->selectById($request['milestone_id']); if (!$options['milestone']->hasReachedDate()) { $options['milestone']->setReachedDate(time()); } break; case 'agilemilestone': $template_name = 'agile/milestone'; $options['project'] = \thebuggenie\core\entities\tables\Projects::getTable()->selectById($request['project_id']); $options['board'] = entities\tables\AgileBoards::getTable()->selectById($request['board_id']); if ($request->hasParameter('milestone_id')) { $options['milestone'] = \thebuggenie\core\entities\tables\Milestones::getTable()->selectById($request['milestone_id']); } break; default: return; } foreach ($options as $key => $value) { $event->addToReturnList($value, $key); } $event->setReturnValue($template_name); $event->setProcessed(); }