public function build(User $user, Project $project, Tracker_CrossSearch_Query $cross_search_query, array $already_planned_artifact_ids, $backlog_tracker_id, Planning $planning, $planning_redirect_parameter) { $report = $this->getReport($user); $criteria = $this->getCriteria($user, $project, $report, $cross_search_query); $tracker_ids = $this->hierarchy_factory->getHierarchy(array($backlog_tracker_id))->flatten(); $artifacts = $this->getHierarchicallySortedArtifacts($user, $project, $tracker_ids, $cross_search_query, $already_planned_artifact_ids); $visitor = new Planning_BacklogItemFilterVisitor($backlog_tracker_id, $this->hierarchy_factory, $already_planned_artifact_ids); $artifacts = $artifacts->accept($visitor); return new Planning_SearchContentView($report, $criteria, $artifacts, Tracker_ArtifactFactory::instance(), $this->form_element_factory, $user, $planning, $planning_redirect_parameter); }
public function build(User $user, Project $project, Tracker_CrossSearch_Query $cross_search_query, array $already_planned_artifact_ids, $backlog_tracker_id, Planning $planning, $planning_redirect_parameter) { $backlog_hierarchy = $this->hierarchy_factory->getHierarchy(array($backlog_tracker_id)); $report = $this->getReport($user); $criteria = $this->getCriteria($user, $project, $report, $cross_search_query); $tracker_ids = $backlog_hierarchy->flatten(); $artifacts = $this->getHierarchicallySortedArtifacts($user, $project, $tracker_ids, $cross_search_query, $already_planned_artifact_ids); // The following lines allows to tailor/rebuild the result before display // As of today (aug-12), we decided to display everything and to wait for // user feedback to see if we need to enable one of them. //$visitor = new Planning_BacklogItemFilterVisitor($backlog_tracker_id, $this->hierarchy_factory, $already_planned_artifact_ids); //$artifacts = $artifacts->accept($visitor); //$visitor = new Planning_GroupByParentsVisitor($user); //$artifacts->accept($visitor); $backlog_actions_presenter = new Planning_BacklogActionsPresenter($planning->getBacklogTracker(), $planning_redirect_parameter); return new Planning_SearchContentView($report, $criteria, $artifacts, Tracker_ArtifactFactory::instance(), $this->form_element_factory, $user, $backlog_actions_presenter, $planning, $planning_redirect_parameter); }
protected function buildContentView(Planning_ViewBuilder $view_builder, Planning $planning, Project $project = null) { $already_planned_artifact_ids = $this->getAlreadyPlannedArtifactsIds(); $cross_search_query = $this->getCrossSearchQuery(); $backlog_tracker_ids = $this->hierarchy_factory->getHierarchy(array($planning->getBacklogTrackerId()))->flatten(); $backlog_actions_presenter = new Planning_BacklogActionsPresenter($planning->getBacklogTracker(), $this->milestone, $this->getPlanningRedirectToSelf()); $view = $view_builder->build($this->getCurrentUser(), $project, $cross_search_query, $already_planned_artifact_ids, $backlog_tracker_ids, $planning, $backlog_actions_presenter, $this->getPlanningRedirectToSelf()); return $view; }
public function __construct($backlog_tracker_id, Tracker_HierarchyFactory $hierarchy_factory, array $already_planned_ids) { $this->backlog_tracker_id = $backlog_tracker_id; $this->hierarchy = $hierarchy_factory->getHierarchy(array($backlog_tracker_id)); $this->already_planned_ids = array_flip($already_planned_ids); }
/** * Retrieve a tree of artifacts matching the given search criteria. * * The artifacts tree matches the trackers hierarchy definition. * * @param PFUser $user The user who will see the search result * @param Project $project The project where the search occurs * @param array $tracker_ids The trackers to retrieve artifacts from. * @param Tracker_CrossSearch_Query $query The query that artifacts should match (e.g. title). * @param array $excluded_artifact_ids Some (optional) artifacts to exclude. * @return TreeNode */ public function getHierarchicallySortedArtifacts(PFUser $user, Project $project, $tracker_ids, Tracker_CrossSearch_Query $query, $excluded_artifact_ids = array()) { $hierarchy = $this->hierarchy_factory->getHierarchy($tracker_ids); return $this->getMatchingArtifacts($user, $project, $tracker_ids, $hierarchy, $query, $excluded_artifact_ids); }
/** * Return the hierarchy the tracker belongs to * * @return Tracker_Hierarchy */ public function getHierarchy() { $hierarchy_factory = new Tracker_HierarchyFactory(new Tracker_Hierarchy_Dao(), $this->getTrackerFactory(), $this->getTrackerArtifactFactory()); return $hierarchy_factory->getHierarchy(array($this->getId())); }
private function sortPlanningTrackersIdsUsingHierarchy(array $trackers_ids, Tracker_HierarchyFactory $hierarchy_factory) { $hierarchy = $hierarchy_factory->getHierarchy($trackers_ids); $trackers_ids = $hierarchy->sortTrackerIds($trackers_ids); return $trackers_ids; }