public function __construct(Planning_Milestone $milestone, $redirect_to_self, PFUser $user, array $quick_link_collection)
 {
     $this->id = $milestone->getArtifactId();
     $this->planning_id = $milestone->getPlanningId();
     $this->milestone_title = $milestone->getArtifact()->getTitle();
     $this->milestone_start_date = $milestone->getStartDate();
     $this->milestone_end_date = $milestone->getEndDate();
     $this->milestone_status = $milestone->getArtifact()->getStatus();
     $this->edit_submilestone_url = $milestone->getArtifact()->getUri();
     $this->redirect_to_self = $redirect_to_self;
     $this->milestone_capacity = $milestone->getCapacity();
     $this->quick_link_collection = $quick_link_collection;
 }
예제 #2
0
 /**
  * @return BreadCrumb_BreadCrumbGenerator
  */
 public function getBreadcrumbs($plugin_path)
 {
     $this->generateBareMilestone();
     if ($this->milestone->getArtifact()) {
         $breadcrumbs_merger = new BreadCrumb_Merger();
         $breadcrumbs_merger->push(new BreadCrumb_VirtualTopMilestone($plugin_path, $this->project));
         foreach (array_reverse($this->milestone->getAncestors()) as $milestone) {
             $breadcrumbs_merger->push(new BreadCrumb_Milestone($plugin_path, $milestone));
         }
         $breadcrumbs_merger->push(new BreadCrumb_Milestone($plugin_path, $this->milestone));
         return $breadcrumbs_merger;
     }
     return new BreadCrumb_NoCrumb();
 }
예제 #3
0
 private function buildAdditionnalPanesInfo(Planning_Milestone $milestone, array &$panes_info)
 {
     if (!$milestone->getArtifact()) {
         return;
     }
     EventManager::instance()->processEvent(AGILEDASHBOARD_EVENT_ADDITIONAL_PANES_INFO_ON_MILESTONE, array('milestone' => $milestone, 'user' => $this->user, 'pane_info_list' => &$panes_info));
 }
 /**
  * @return bool
  */
 public function canPlan(PFUser $user, Planning_Milestone $milestone)
 {
     $art_link_field = $milestone->getArtifact()->getAnArtifactLinkField($user);
     if ($art_link_field && $art_link_field->userCanUpdate($user)) {
         return true;
     }
     return false;
 }
예제 #5
0
 public function itMayBeNull()
 {
     $this->milestone = new Planning_NoMilestone($this->project, $this->planning);
     $this->assertNull($this->milestone->getArtifact());
     $this->assertNull($this->milestone->getArtifactId());
     $this->assertNull($this->milestone->getArtifactTitle());
     $this->assertTrue($this->milestone->userCanView(mock('User')), "any user should be able to read an empty milstone");
 }
예제 #6
0
 /**
  * @return bool
  */
 public function canDrop()
 {
     if ($this->milestone) {
         $art_link_field = $this->milestone->getArtifact()->getAnArtifactLinkField($this->current_user);
         if ($art_link_field && $art_link_field->userCanUpdate($this->current_user)) {
             return true;
         }
     }
     return false;
 }
예제 #7
0
 /**
  * Get all milestones that share the same parent than given milestone.
  *
  * @param User $user
  * @param Planning_Milestone $milestone
  *
  * @return Array of Planning_Milestone
  */
 public function getSiblingMilestones(User $user, Planning_Milestone $milestone)
 {
     $sibling_milestones = array();
     $milestone_artifact = $milestone->getArtifact();
     if ($milestone_artifact) {
         foreach ($milestone_artifact->getSiblings($user) as $sibling) {
             if ($sibling->getId() == $milestone_artifact->getId()) {
                 $sibling_milestones[] = $milestone;
             } else {
                 $sibling_milestones[] = $this->getMilestoneFromArtifact($sibling);
             }
         }
     }
     return $sibling_milestones;
 }
 private function buildAdditionnalPanes(Planning_Milestone $milestone)
 {
     if ($milestone->getArtifact()) {
         EventManager::instance()->processEvent(AGILEDASHBOARD_EVENT_ADDITIONAL_PANES_ON_MILESTONE, array('milestone' => $milestone, 'request' => $this->request, 'user' => $this->request->getCurrentUser(), 'panes' => &$this->list_of_pane_info[$milestone->getArtifactId()], 'active_pane' => &$this->active_pane[$milestone->getArtifactId()], 'milestone_factory' => $this->milestone_factory));
     }
 }
예제 #9
0
 public function milestoneCanBeSubmilestone(Planning_Milestone $potential_submilestone)
 {
     if ($potential_submilestone->getArtifact()->getTracker()->getParent()) {
         return $potential_submilestone->getArtifact()->getTracker()->getParent()->getId() == $this->getArtifact()->getTracker()->getId();
     }
     return false;
 }
 public function getSubmitNewUrlLinkedToMilestone(Planning_Milestone $milestone)
 {
     return $milestone->getArtifact()->getSubmitNewArtifactLinkedToMeUri($this->submilestone_tracker);
 }