public function build(Planning_Milestone $milestone, array $status_count, array $backlog_trackers, $has_user_priority_change_permission, $representation_type)
 {
     $this->id = JsonCast::toInt($milestone->getArtifactId());
     $this->uri = self::ROUTE . '/' . $this->id;
     $this->label = $milestone->getArtifactTitle();
     $this->status_value = $milestone->getArtifact()->getStatus();
     $this->semantic_status = $milestone->getArtifact()->getSemanticStatusValue();
     $this->submitted_by = JsonCast::toInt($milestone->getArtifact()->getFirstChangeset()->getSubmittedBy());
     $this->submitted_on = JsonCast::toDate($milestone->getArtifact()->getFirstChangeset()->getSubmittedOn());
     $this->capacity = JsonCast::toFloat($milestone->getCapacity());
     $this->remaining_effort = JsonCast::toFloat($milestone->getRemainingEffort());
     $this->sub_milestone_type = $this->getSubmilestoneType($milestone);
     $this->planning = new PlanningReference();
     $this->planning->build($milestone->getPlanning());
     $this->project = new ProjectReference();
     $this->project->build($milestone->getProject());
     $this->artifact = new ArtifactReference();
     $this->artifact->build($milestone->getArtifact());
     $this->start_date = null;
     if ($milestone->getStartDate()) {
         $this->start_date = JsonCast::toDate($milestone->getStartDate());
         if ($representation_type === self::ALL_FIELDS) {
             $this->number_days_since_start = JsonCast::toInt($milestone->getDaysSinceStart());
         }
     }
     $this->end_date = null;
     if ($milestone->getEndDate()) {
         $this->end_date = JsonCast::toDate($milestone->getEndDate());
         if ($representation_type === self::ALL_FIELDS) {
             $this->number_days_until_end = JsonCast::toInt($milestone->getDaysUntilEnd());
         }
     }
     if ($representation_type === self::ALL_FIELDS) {
         $this->parent = null;
         $parent = $milestone->getParent();
         if ($parent) {
             $this->parent = new MilestoneParentReference();
             $this->parent->build($parent);
         }
     }
     $this->has_user_priority_change_permission = $has_user_priority_change_permission;
     $this->sub_milestones_uri = $this->uri . '/' . self::ROUTE;
     $this->backlog_uri = $this->uri . '/' . BacklogItemRepresentation::BACKLOG_ROUTE;
     $this->content_uri = $this->uri . '/' . BacklogItemRepresentation::CONTENT_ROUTE;
     $this->last_modified_date = JsonCast::toDate($milestone->getLastModifiedDate());
     if ($representation_type === self::ALL_FIELDS && $status_count) {
         $this->status_count = $status_count;
     }
     $finder = new \AgileDashboard_Milestone_Pane_Planning_SubmilestoneFinder(\Tracker_HierarchyFactory::instance(), PlanningFactory::build());
     $submilestone_tracker = $finder->findFirstSubmilestoneTracker($milestone);
     $submilestone_trackers = array();
     if ($submilestone_tracker) {
         $submilestone_tracker_ref = new TrackerReference();
         $submilestone_tracker_ref->build($finder->findFirstSubmilestoneTracker($milestone));
         $submilestone_trackers = array($submilestone_tracker_ref);
     }
     $this->resources['milestones'] = array('uri' => $this->uri . '/' . self::ROUTE, 'accept' => array('trackers' => $submilestone_trackers));
     $this->resources['backlog'] = array('uri' => $this->uri . '/' . BacklogItemRepresentation::BACKLOG_ROUTE, 'accept' => array('trackers' => $this->getTrackersRepresentation($backlog_trackers)));
     $this->resources['content'] = array('uri' => $this->uri . '/' . BacklogItemRepresentation::CONTENT_ROUTE, 'accept' => array('trackers' => $this->getContentTrackersRepresentation($milestone)));
 }
Пример #2
0
 public function getPlanningV2PaneInfo(Planning_Milestone $milestone)
 {
     $submilestone_tracker = $this->submilestone_finder->findFirstSubmilestoneTracker($milestone);
     if (!$submilestone_tracker) {
         return;
     }
     return new AgileDashboard_Milestone_Pane_Planning_PlanningV2PaneInfo($milestone, $this->theme_path, $submilestone_tracker);
 }
 private function getPlanningV2PaneInfo(Planning_Milestone $milestone)
 {
     $submilestone_tracker = $this->submilestone_finder->findFirstSubmilestoneTracker($milestone);
     if (!$submilestone_tracker) {
         return;
     }
     $pane_info = $this->pane_info_factory->getPlanningV2PaneInfo($milestone);
     if ($this->request->get('pane') == AgileDashboard_Milestone_Pane_Planning_PlanningV2PaneInfo::IDENTIFIER) {
         $pane_info->setActive(true);
         $this->active_pane[$milestone->getArtifactId()] = new AgileDashboard_Milestone_Pane_Planning_PlanningV2Pane($pane_info, new AgileDashboard_Milestone_Pane_Planning_PlanningV2Presenter($this->request->getCurrentUser(), $this->request->getProject(), $milestone->getArtifactId()));
     }
     return $pane_info;
 }
 private function getPlanningV2PaneInfo(Planning_Milestone $milestone)
 {
     $submilestone_tracker = $this->submilestone_finder->findFirstSubmilestoneTracker($milestone);
     if (!$submilestone_tracker) {
         return;
     }
     $pane_info = $this->pane_info_factory->getPlanningV2PaneInfo($milestone);
     $this->list_of_default_pane_info[$milestone->getArtifactId()] = $pane_info;
     if ($this->request->get('pane') == AgileDashboard_Milestone_Pane_Planning_PlanningV2PaneInfo::IDENTIFIER) {
         $pane_info->setActive(true);
         $this->active_pane[$milestone->getArtifactId()] = $this->getPlanningV2Pane($pane_info, $milestone);
     }
     return $pane_info;
 }