private function getPlanningAdminPresenterList(PFUser $user, $group_id, $root_planning_name)
 {
     $plannings = array();
     $planning_out_of_hierarchy = array();
     foreach ($this->planning_factory->getPlanningsOutOfRootPlanningHierarchy($user, $group_id) as $planning) {
         $planning_out_of_hierarchy[$planning->getId()] = true;
     }
     foreach ($this->planning_factory->getPlannings($user, $group_id) as $planning) {
         if (isset($planning_out_of_hierarchy[$planning->getId()])) {
             $plannings[] = new Planning_PlanningOutOfHierarchyAdminPresenter($planning, $root_planning_name);
         } else {
             $plannings[] = new Planning_PlanningAdminPresenter($planning);
         }
     }
     return $plannings;
 }
 /**
  * Get a list of planning short access defined in a group_id
  *
  * @param PFUser $user     The user who will see the planning
  * @param int  $group_id
  *
  * @return array of Planning_ShortAccess
  */
 public function getPlanningsShortAccess(PFUser $user, $group_id, Planning_MilestoneFactory $milestone_factory, $theme_path)
 {
     $plannings = $this->planning_factory->getPlannings($user, $group_id);
     $short_access = array();
     foreach ($plannings as $planning) {
         if (!$this->thereIsAtLeastOneBacklogTrackerNotDeleted($planning)) {
             $backlog_tracker_names = array();
             foreach ($planning->getBacklogTrackers() as $tracker) {
                 $backlog_tracker_names[] = $tracker->getName();
             }
             throw new Planning_InvalidConfigurationException($GLOBALS['Language']->getText('plugin_agiledashboard', 'planning_invalidconf_deletedtracker', array($planning->getPlanTitle(), implode(',', $backlog_tracker_names))));
         } elseif ($planning->getPlanningTracker()->isDeleted()) {
             throw new Planning_InvalidConfigurationException($GLOBALS['Language']->getText('plugin_agiledashboard', 'planning_invalidconf_deletedtracker', array($planning->getPlanTitle(), $planning->getPlanningTracker()->getName())));
         } else {
             $short_access[] = $this->getShortAccessForPlanning($planning, $user, $milestone_factory, $theme_path, 0);
         }
     }
     if (!empty($short_access)) {
         end($short_access)->setIsLatest();
     }
     return $short_access;
 }
 private function filterOutAssignedBacklogItems(AgileDashboard_Milestone_Backlog_IBacklogItemCollection $collection, PFUser $user)
 {
     $artifact_ids = $this->getBacklogItemsArtifactIds($collection);
     if (!$artifact_ids) {
         return $collection;
     }
     $collection->rewind();
     $artifact = $collection->current()->getArtifact();
     $project_id = $artifact->getTracker()->getProject()->getID();
     $plannings = $this->planning_factory->getPlannings($user, $project_id);
     $planning_milestone_tracker_ids = $this->getPlanningMilestoneTrackerIds($plannings);
     if (!$planning_milestone_tracker_ids) {
         return $collection;
     }
     $linked_item_artifacts_ids = $this->artifact_factory->getArtifactIdsLinkedToTrackers($artifact_ids, $planning_milestone_tracker_ids);
     return $this->removeLinkedItemsFromCollection($collection, $linked_item_artifacts_ids);
 }
 public function index()
 {
     $plannings = $this->planning_factory->getPlannings($this->getCurrentUser(), $this->group_id);
     $presenter = new Planning_ListPresenter($plannings, $this->group_id);
     $this->render('index', $presenter);
 }