private function getArtifactLinkId(Tracker_ArtifactLinkInfo $link_info) { return $link_info->getArtifactId(); }
/** * Update cross references of this field * * @param Tracker_Artifact $artifact the artifact that is currently updated * @param array $values the array of added and removed artifact links ($values['added_values'] is a string and $values['removed_values'] is an array of artifact ids */ protected function updateCrossReferences(Tracker_Artifact $artifact, $values) { $added_artifact_ids = array(); if (array_key_exists('new_values', $values)) { if (trim($values['new_values']) != '') { $added_artifact_ids = explode(',', $values['new_values']); } } $removed_artifact_ids = array(); if (array_key_exists('removed_values', $values)) { $removed_artifact_ids = $values['removed_values']; } $af = $this->getArtifactFactory(); $rm = $this->getReferenceManager(); $current_user = $this->getCurrentUser(); foreach ($added_artifact_ids as $added_artifact_id) { $artifact_target = $af->getArtifactById((int) trim($added_artifact_id)); $artifactlink = new Tracker_ArtifactLinkInfo($artifact_target->getId(), $artifact_target->getTracker()->getItemname(), $artifact_target->getTracker()->getGroupId(), $artifact_target->getTracker()->getId(), $artifact_target->getLastChangeset()->getId()); $source_tracker = $artifact->getTracker(); $rm->extractCrossRef($artifactlink->getLabel(), $artifact->getId(), Tracker_Artifact::REFERENCE_NATURE, $source_tracker->getGroupId(), $current_user->getId(), $source_tracker->getItemName()); } // TODO : remove the removed elements }
private function canExportLinkedArtifact(Tracker_ArtifactLinkInfo $artifact_link_info, array $children_trackers) { $is_a_child = in_array($artifact_link_info->getTracker(), $children_trackers); return $is_a_child && $artifact_link_info->userCanView($this->current_user); }