/** * @return AgileDashboard_Milestone_Backlog_DescendantItemsCollection */ private function getItemsForUser(PFUser $user, DataAccessResult $result, $found_rows) { $items = new AgileDashboard_Milestone_Backlog_DescendantItemsCollection(); foreach ($result as $row) { $item = $this->artifact_factory->getInstanceFromRow($row); if ($item->userCanView($user)) { $items->push($item); } } $items->setTotalAvaialableSize($found_rows); return $items; }
/** * Return the parent artifact * * @param PFUser $user * @param Tracker_Artifact $child * * @return null| Tracker_Artifact */ public function getParentArtifact(PFUser $user, Tracker_Artifact $child) { $dar = $this->hierarchy_dao->getParentsInHierarchy($child->getId()); if ($dar && !$dar->isError()) { $parents = array(); foreach ($dar as $row) { $parents[] = $this->artifact_factory->getInstanceFromRow($row); } if (count($parents) > 1) { $warning = $GLOBALS['Language']->getText('plugin_tracker_hierarchy', 'error_more_than_one_parent', array($this->getParentTitle($child), $this->getParentsList($parents))); $GLOBALS['Response']->addFeedback('warning', $warning, CODENDI_PURIFIER_LIGHT); } if ($parents) { return $parents[0]; } } return null; }
/** * Return the parent artifact * * @param User $user * @param Tracker_Artifact $child * * @throws Tracker_Hierarchy_MoreThanOneParentException * * @return null| Tracker_Artifact */ public function getParentArtifact(User $user, Tracker_Artifact $child) { $dar = $this->hierarchy_dao->getParentsInHierarchy($child->getId()); if ($dar && !$dar->isError()) { switch ($dar->rowCount()) { case 0: return null; case 1: return $this->artifact_factory->getInstanceFromRow($dar->getRow()); default: $parents = array(); foreach ($dar as $row) { $parents[] = $this->artifact_factory->getInstanceFromRow($row); } throw new Tracker_Hierarchy_MoreThanOneParentException($child, $parents); } } return null; }
private function getBareArtifact(Tracker $tracker, PFUser $user, $submitted_on) { return $this->artifact_factory->getInstanceFromRow(array('id' => 0, 'tracker_id' => $tracker->id, 'submitted_by' => $user->getId(), 'submitted_on' => $submitted_on, 'use_artifact_permissions' => 0)); }