本文整理汇总了PHP中Tracker_Artifact::getAllAncestors方法的典型用法代码示例。如果您正苦于以下问题:PHP Tracker_Artifact::getAllAncestors方法的具体用法?PHP Tracker_Artifact::getAllAncestors怎么用?PHP Tracker_Artifact::getAllAncestors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracker_Artifact
的用法示例。
在下文中一共展示了Tracker_Artifact::getAllAncestors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: linkWithParents
public function linkWithParents(Codendi_Request $request, Tracker_Artifact $artifact)
{
$user = $request->getCurrentUser();
$ancestors = $artifact->getAllAncestors($user);
if (count($ancestors) == 0) {
$artifact_id = (int) $request->getValidated('link-artifact-id', 'uint', 0);
$source_artifact = $this->artifact_factory->getArtifactById($artifact_id);
if ($source_artifact) {
foreach ($source_artifact->getAllAncestors($user) as $ancestor) {
$ancestor->linkArtifact($artifact->getId(), $user);
}
}
}
}
示例2: linkWithMilestoneArtifact
private function linkWithMilestoneArtifact(User $user, Tracker_Artifact $artifact, Tracker_Artifact $source_artifact = null)
{
$last_ancestor = $source_artifact;
if ($source_artifact) {
foreach ($source_artifact->getAllAncestors($user) as $ancestor) {
$planning = $this->planning_factory->getPlanningByPlanningTracker($ancestor->getTracker());
if ($planning && $planning->getBacklogTracker() == $artifact->getTracker()) {
$ancestor->linkArtifact($artifact->getId(), $user);
$last_ancestor = $ancestor;
}
}
}
return $last_ancestor;
}
示例3: redirectToParentCreationIfNeeded
protected function redirectToParentCreationIfNeeded(Tracker_Artifact $artifact, User $current_user, Tracker_Artifact_Redirect $redirect)
{
$parent_tracker = $this->tracker->getParent();
if ($parent_tracker) {
if (count($artifact->getAllAncestors($current_user)) == 0) {
$art_link = $this->formelement_factory->getAnArtifactLinkField($current_user, $parent_tracker);
if ($art_link) {
$art_link_key = 'artifact[' . $art_link->getId() . '][new_values]';
$redirect_params = array('tracker' => $parent_tracker->getId(), 'func' => 'new-artifact', $art_link_key => $artifact->getId());
$redirect->mode = Tracker_Artifact_Redirect::STATE_CREATE_PARENT;
$redirect->query_parameters = $redirect_params;
}
}
}
}