Commit 69c32f56 authored by Robert Lyon's avatar Robert Lyon

Bug 1500215: Loop through artefact ancestors in correct order

Go from child to parent to grandparent etc.

behatnotneeded

Change-Id: If30d63483f33a50888a590875ddd979d6900c613
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit 24407640)
parent 297b6003
......@@ -38,7 +38,7 @@ if (!$artefact->in_view_list()) {
// Build the path to the artefact through its parents.
$artefactpath = array();
$ancestors = $artefact->get_item_ancestors();
$ancestors = array_reverse($artefact->get_item_ancestors());
$artefactok = false;
if (artefact_in_view($artefact, $viewid)) {
......@@ -48,14 +48,16 @@ if (artefact_in_view($artefact, $viewid)) {
if (!empty($ancestors)) {
foreach ($ancestors as $ancestor) {
$pathitem = artefact_instance_from_id($ancestor);
if (artefact_in_view($pathitem, $viewid)) {
$artefactpath[] = array(
'url' => get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $pathitem->get('id') . '&view=' . $viewid,
'title' => $pathitem->display_title(),
);
$artefactok = true;
$baseobject = $pathitem;
if ($ancestor != $artefactid) {
$pathitem = artefact_instance_from_id($ancestor);
if (artefact_in_view($pathitem, $viewid)) {
$artefactpath[] = array(
'url' => get_config('wwwroot') . 'artefact/artefact.php?artefact=' . $pathitem->get('id') . '&view=' . $viewid,
'title' => $pathitem->display_title(),
);
$artefactok = true;
$baseobject = $pathitem;
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment