示例#1
0
 private function getArtifactsFromArtifactInfo($artifacts_info)
 {
     $artifacts = array();
     foreach ($artifacts_info as $artifact_info) {
         $artifacts[] = $this->artifact_factory->getArtifactById($artifact_info['id']);
     }
     return $artifacts;
 }
 /**
  * @return mixed Tracker_Reference || null
  */
 public function getReference($keyword, $artifact_id)
 {
     $artifact = $this->artifact_factory->getArtifactById($artifact_id);
     if (!$artifact) {
         return null;
     }
     return $this->getTrackerReference($artifact, $keyword);
 }
 private function linkArtifact(PFUser $current_user, Tracker_Artifact $new_artifact)
 {
     $artifact_link_id = $this->request->get('artifact-link-id');
     $source_artifact = $this->tracker_artifact_factory->getArtifactById($artifact_link_id);
     if (!$source_artifact) {
         return;
     }
     $source_artifact->linkArtifact($new_artifact->getId(), $current_user);
 }
 protected function getCardsPresenters(array $artifact_ids)
 {
     $cards = array();
     foreach ($artifact_ids as $id) {
         $artifact = $this->artifact_factory->getArtifactById($id);
         $cards[] = $this->presenter_builder->getCardInCellPresenter($artifact, Cardwall_SwimlineTrackerRenderer::FAKE_SWIMLINE_ID_FOR_TRACKER_RENDERER);
     }
     return $cards;
 }
 private function getSourceArtifact()
 {
     $source_artifact = null;
     if ($this->request->get('func') == 'new-artifact-link') {
         $source_artifact = $this->artifact_factory->getArtifactById($this->request->get('id'));
     } elseif ($this->request->get('child_milestone')) {
         $source_artifact = $this->artifact_factory->getArtifactById($this->request->get('child_milestone'));
     }
     return $source_artifact;
 }
 public function exportChildren(SimpleXMLElement $xml)
 {
     while ($artifact_id = $this->children_collector->pop()) {
         $artifact = $this->artifact_factory->getArtifactById($artifact_id);
         if (!$artifact) {
             continue;
         }
         $last_changeset = $artifact->getLastChangeset();
         $this->artifact_xml_updater->exportSnapshotWithoutComments($xml, $last_changeset);
         $index_last_artifact = count($xml->artifact) - 1;
         $this->file_xml_updater->update($xml->artifact[$index_last_artifact]);
     }
 }
示例#7
0
 /**
  * Loads the milestone matching the given planning and artifact ids.
  *
  * Also loads:
  *   - the planning this milestone belongs to
  *   - the planning tracker and the backlog trackers of this planning
  *   - the artifacts planned for this milestone
  *
  * Only objects that should be visible for the given user are loaded.
  *
  * @param User $user
  * @param Project $project
  * @param int $planning_id
  * @param int $artifact_id
  *
  * @return Planning_Milestone
  */
 public function getMilestoneWithPlannedArtifacts(User $user, Project $project, $planning_id, $artifact_id)
 {
     $planning = $this->planning_factory->getPlanningWithTrackers($planning_id);
     $artifact = $this->artifact_factory->getArtifactById($artifact_id);
     if ($artifact) {
         $planned_artifacts = $this->getPlannedArtifacts($user, $artifact);
         $this->removeSubMilestones($user, $artifact, $planned_artifacts);
         $milestone = new Planning_ArtifactMilestone($project, $planning, $artifact, $planned_artifacts);
         return $this->updateMilestoneContextualInfo($user, $milestone);
     } else {
         return new Planning_NoMilestone($project, $planning);
     }
 }
示例#8
0
    public function generateBacklogItems() {
        echo "Create backlog items\n";

        $user = $this->user_manager->getUserByUserName(self::ADMIN_USER_NAME);

        $this->createUserStory($user, 'Believe', '206');
        $this->createUserStory($user, 'Break Free', '205');
        $this->createUserStory($user, 'Hughhhhhhh', '205');
        $this->createUserStory($user, 'Kill you', '205');
        $this->createUserStory($user, 'Back', '205');
        $this->createUserStory($user, 'Forward', '205');

        $release = $this->tracker_artifact_factory->getArtifactById(self::RELEASE_ARTIFACT_ID);
        $release->linkArtifact(self::STORY_1_ARTIFACT_ID, $user);
        $release->linkArtifact(self::STORY_2_ARTIFACT_ID, $user);
        $release->linkArtifact(self::STORY_3_ARTIFACT_ID, $user);
        $release->linkArtifact(self::STORY_4_ARTIFACT_ID, $user);
        $release->linkArtifact(self::STORY_5_ARTIFACT_ID, $user);

        $sprint = $this->tracker_artifact_factory->getArtifactById(self::SPRINT_ARTIFACT_ID);
        $sprint->linkArtifact(self::STORY_1_ARTIFACT_ID, $user);
        $sprint->linkArtifact(self::STORY_2_ARTIFACT_ID, $user);

        return $this;
    }
 private function getArtifact($artifact_id)
 {
     $artifact = $this->artifact_factory->getArtifactById($artifact_id);
     if (!$artifact) {
         throw new Tracker_Artifact_MailGateway_RecipientArtifactDoesNotExistException();
     }
     return $artifact;
 }
 /**
  * @return array
  */
 public function getCards(array $artifact_ids, Tracker_ArtifactFactory $artifact_factory)
 {
     $cards = array();
     foreach ($artifact_ids as $id) {
         $cards[] = new ArtifactNode($artifact_factory->getArtifactById($id));
     }
     return $cards;
 }
 /**
  *
  * @param int $id
  *
  * @return Tracker_Artifact | null
  */
 public function getArtifactByFileInfoId($id)
 {
     $row = $this->dao->searchArtifactIdByFileInfoId($id)->getRow();
     if (!$row) {
         return;
     }
     return $this->artifact_factory->getArtifactById($row['artifact_id']);
 }
 private function getArtifact($artifact_id)
 {
     $artifact = $this->artifact_factory->getArtifactById($artifact_id);
     if ($artifact) {
         return $artifact;
     }
     throw new CardControllerBuilderRequestIdException();
 }
示例#13
0
 private function getArtifactById($artifact_id, $user, $method_name)
 {
     $artifact = $this->artifact_factory->getArtifactById($artifact_id);
     if (!$artifact) {
         throw new SoapFault(get_artifact_fault, 'Could Not Get Artifact', $method_name);
     }
     $this->checkUserCanViewArtifact($artifact, $user);
     return $artifact;
 }
示例#14
0
 /**
  * A Bare Milestone is a milestone with minimal information to display (ie. without planned artifacts).
  *
  * It would deserve a dedicated object but it's a bit complex to setup today due to
  * MilestoneController::getAlreadyPlannedArtifacts()
  *
  * Only objects that should be visible for the given user are loaded.
  *
  * @param PFUser $user
  * @param Project $project
  * @param Integer $planning_id
  * @param Integer $artifact_id
  *
  * @return Planning_Milestone
  * @throws Planning_NoPlanningsException
  */
 public function getBareMilestone(PFUser $user, Project $project, $planning_id, $artifact_id)
 {
     $planning = $this->planning_factory->getPlanning($planning_id);
     $artifact = $this->artifact_factory->getArtifactById($artifact_id);
     if ($artifact && $artifact->userCanView($user)) {
         return $this->getBareMilestoneByArtifactAndPlanning($user, $artifact, $planning);
     } else {
         return new Planning_NoMilestone($project, $planning);
     }
 }
 private function getContextRepresentation()
 {
     $html = '';
     if (!is_null($this->context) && $this->context !== self::NO_CONTEXT) {
         $html .= ' ' . $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'priority_change_in') . ' ';
         if ($this->context === '0') {
             $html .= $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'priority_change_backlog');
         } else {
             $html .= $this->tracker_artifact_factory->getArtifactById($this->context)->fetchColoredXRef();
         }
         $html .= ' ';
     }
     return $html;
 }
示例#16
0
 public function visit(TreeNode $node)
 {
     $html = '';
     $row = $node->getData();
     $artifact = $this->artifact_factory->getArtifactById($row['id']);
     if ($artifact) {
         $html .= '<tr id="tree-node-' . $row['id'] . '" class="' . html_get_alt_row_color($this->current_index++) . '" >';
         $html .= '<td class="first-column">';
         $html .= $row['tree-padding'];
         $html .= sprintf($row['content-template'], $artifact->fetchDirectLinkToArtifact());
         $html .= '</td>';
         $html .= $this->fetchColumnsValues($artifact, $row);
         $html .= '</tr>';
         foreach ($node->getChildren() as $child) {
             $html .= $child->accept($this);
         }
     }
     return $html;
 }
示例#17
0
 private function createLinksBetweenArtifacts(PFUser $user, Tracker_XML_Importer_ArtifactImportedMapping $artifacts_imported_mapping, Tracker_Artifact $root_artifact)
 {
     $comment_message = '';
     $send_notifications = false;
     $original_id = $artifacts_imported_mapping->getOriginal($root_artifact->getId());
     $children = $this->children_collector->getChildrenForParent($original_id);
     if (!$children) {
         return;
     }
     foreach ($children as $key => $original_child_id) {
         $children[$key] = $artifacts_imported_mapping->get($original_child_id);
     }
     $field_id = $root_artifact->getAnArtifactLinkField($user)->getId();
     $fields_data = array($field_id => array(Tracker_FormElement_Field_ArtifactLink::NEW_VALUES_KEY => implode(',', $children)));
     $root_artifact->createNewChangeset($fields_data, $comment_message, $user, $send_notifications, Tracker_Artifact_Changeset_Comment::TEXT_COMMENT);
     foreach ($children as $child_id) {
         $artifact = $this->artifact_factory->getArtifactById($child_id);
         $this->createLinksBetweenArtifacts($user, $artifacts_imported_mapping, $artifact);
     }
 }
 /**
  * @return Tracker_Artifact_PriorityHistoryChange
  */
 public function getInstanceFromRow($row)
 {
     return new Tracker_Artifact_PriorityHistoryChange($this->tracker_artifact_factory, $row['id'], $this->tracker_artifact_factory->getArtifactById($row['moved_artifact_id']), $this->tracker_artifact_factory->getArtifactById($row['artifact_id_higher']), $this->tracker_artifact_factory->getArtifactById($row['artifact_id_lower']), $row['context'], ProjectManager::instance()->getProject($row['project_id']), (bool) $row['has_been_raised'], $this->user_manager->getUserById($row['prioritized_by']), $row['prioritized_on']);
 }
 private function action($artifact_id)
 {
     $this->actions->indexArtifactUpdate($this->artifact_factory->getArtifactById($artifact_id));
     return true;
 }
 /**
  * @param int $artifact_id
  * @return Tracker_Artifact
  */
 private function getArtifact($artifact_id)
 {
     return $this->artifact_factory->getArtifactById($artifact_id);
 }