示例#1
0
 /**
  * All artifacts linked by either the root artifact or any of the artifacts in plannedArtifacts()
  * @param User $user
  * @return Array of Tracker_Artifact
  */
 public function getLinkedArtifacts(User $user)
 {
     $artifacts = $this->artifact->getUniqueLinkedArtifacts($user);
     $root_node = $this->getPlannedArtifacts();
     // TODO get rid of this if, in favor of an empty treenode
     if ($root_node) {
         $this->addChildrenNodes($root_node, $artifacts, $user);
     }
     return $artifacts;
 }
示例#2
0
 /**
  * Adds $parent_node children according to $artifact ones.
  *
  * @param type $user
  * @param type $artifact
  * @param type $parent_node
  * @param type $parents     The list of parents to prevent infinite recursion
  *
  * @return boolean
  */
 private function addChildrenPlannedArtifacts(User $user, Tracker_Artifact $artifact, TreeNode $parent_node, array $parents)
 {
     $linked_artifacts = $artifact->getUniqueLinkedArtifacts($user);
     if (!$linked_artifacts) {
         return false;
     }
     if (in_array($artifact->getId(), $parents)) {
         return false;
     }
     $parents[] = $artifact->getId();
     foreach ($linked_artifacts as $linked_artifact) {
         $node = $this->makeNodeWithChildren($user, $linked_artifact, $parents);
         $parent_node->addChild($node);
     }
 }