Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
c14ecfd5
Commit
c14ecfd5
authored
Dec 08, 2006
by
Richard Mansfield
Browse files
Use get_artefact_hierarchy() for artefact ancestor links
parent
996b4440
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/view/view.php
View file @
c14ecfd5
...
...
@@ -30,33 +30,33 @@ require(get_config('libroot') . 'view.php');
$viewid
=
param_integer
(
'view'
);
$artefactid
=
param_integer
(
'artefact'
,
null
);
$ancestors
=
param_variable
(
'artefactlist'
,
null
);
$view
=
new
View
(
$viewid
);
if
(
!
can_view_view
(
$viewid
))
{
throw
new
AccessDeniedException
();
}
// if ($artefactid && !artefact_in_view($viewid, $artefactid)) {
// throw new AccessDeniedException("Artefact $artefactid not in View $viewid");
// }
$getstring
=
quotestrings
(
array
(
'message'
,
'makepublic'
,
'placefeedback'
,
'cancel'
,
'complaint'
,
'notifysiteadministrator'
,
'addtowatchlist'
,
'nopublicfeedback'
,
'reportobjectionablematerial'
,
'print'
));
$view
=
new
View
(
$viewid
);
if
(
$artefactid
)
{
// Link parent artefacts back to the view
$hierarchy
=
$view
->
get_artefact_hierarchy
();
log_debug
(
$hierarchy
);
$artefact
=
$hierarchy
[
'refs'
][
$artefactid
];
$ancestorid
=
$artefact
->
parent
;
$links
=
array
();
while
(
$ancestorid
&&
isset
(
$hierarchy
[
'refs'
][
$ancestorid
]))
{
$ancestor
=
$hierarchy
[
'refs'
][
$ancestorid
];
$link
=
'<a href="view.php?view='
.
$viewid
.
'&artefact='
.
$ancestorid
.
'">'
.
$ancestor
->
title
.
"</a>
\n
"
;
array_unshift
(
$links
,
$link
);
$ancestorid
=
$ancestor
->
parent
;
}
$javascript
=
'var artefact = '
.
$artefactid
.
";
\n
"
;
$artefact
=
get_record
(
'artefact'
,
'id'
,
$artefactid
);
$title
=
'<div><a href="view.php?view='
.
$viewid
.
'">'
.
$view
->
get
(
'title'
)
.
"</a></div>
\n
"
;
if
(
$ancestors
)
{
$alist
=
explode
(
','
,
$ancestors
);
$links
=
array
();
for
(
$i
=
0
;
$i
<
count
(
$alist
);
$i
++
)
{
$atitle
=
get_field
(
'artefact'
,
'title'
,
'id'
,
$alist
[
$i
]);
$links
[]
=
'<a href="view.php?view='
.
$viewid
.
'&artefact='
.
$alist
[
$i
]
.
(
$i
?
'&artefactlist='
.
implode
(
','
,
array_slice
(
$alist
,
0
,
$i
))
:
''
)
.
'">'
.
$atitle
.
"</a>"
;
}
$title
.
=
'<div>'
.
implode
(
' | '
,
$links
)
.
"</div>
\n
"
;
}
$title
.
=
implode
(
' | '
,
$links
);
$title
.
=
"<h3>
$artefact->title
</h3>"
;
}
else
{
...
...
@@ -65,7 +65,12 @@ else {
$content
=
$view
->
render
();
}
$javascript
.
=
<<<JAVASCRIPT
$getstring
=
quotestrings
(
array
(
'message'
,
'makepublic'
,
'placefeedback'
,
'cancel'
,
'complaint'
,
'notifysiteadministrator'
,
'addtowatchlist'
,
'nopublicfeedback'
,
'reportobjectionablematerial'
,
'print'
));
$javascript
.
=
<<<EOF
var view = {$viewid};
...
...
@@ -169,7 +174,7 @@ feedbacklist.emptycontent = {$getstring['nopublicfeedback']};
feedbacklist.updateOnLoad();
JAVASCRIPT
;
EOF
;
$smarty
=
smarty
(
array
(
'tablerenderer'
));
//$smarty->clear_assign('MAINNAV');
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment