Commit db58c8ce authored by Richard Mansfield's avatar Richard Mansfield

Move view and artefact title html into template

parent 1a4def38
......@@ -1137,19 +1137,6 @@ class View {
}
public function formatted_heading() {
if ($this->get('owner')) {
$link = 'user/view.php?id='.$this->get('owner');
}
else if ($this->get('group')) {
$link = 'group/view.php?id='.$this->get('group');
}
else {
$link = '';
}
return '<a href="' . get_config('wwwroot') . 'view/view.php?id=' . $this->get('id') .'">' . hsc($this->get('title')) . '</a> ' . get_string('by', 'view') . ' <a href="' . get_config('wwwroot') . $link . '">' . $this->formatted_owner() . '</a>';
}
/**
* Makes a URL for a view block editing page
*/
......
......@@ -2,7 +2,12 @@
{include file="columnfullstart.tpl"}
<h2>{$heading}</h2>
<h2>
<a href="{$WWWROOT}view/view.php?id={$viewid}">{$viewtitle}</a> {str tag=by section=view}
<a href="{$WWWROOT}{$ownerlink}">{$ownername}</a>{foreach from=$artefactpath item=a}:
{if $a.url}<a href="{$a.url}">{/if}{$a.title}{if $a.url}</a>{/if}
{/foreach}
</h2>
<div id="view">
<div id="bottom-pane">
......
......@@ -2,7 +2,7 @@
{include file="columnfullstart.tpl"}
<h2>{$heading}</h2>
<h2>{if !$new}<a href="{$WWWROOT}view/view.php?id={$viewid}">{/if}{$viewtitle}{if !$new}</a>{/if} {str tag=by section=view} <a href="{$WWWROOT}{$ownerlink}">{$ownername}</a></h2>
{if $can_edit}
<div class="fr editview">
......
......@@ -87,16 +87,6 @@ $artefactpath[] = array(
'title' => $artefact->display_title(),
);
$heading = $view->formatted_heading();
foreach ($artefactpath as $item) {
if (empty($item['url'])) {
$heading .= ': ' . $item['title'];
}
else {
$heading .= ': <a href="' . $item['url'] . '">' . $item['title'] . '</a>';
}
}
$getstring = quotestrings(array(
'mahara' => array('message', 'cancel'),
'view' => array('makepublic', 'placefeedback', 'complaint',
......@@ -315,16 +305,23 @@ $smarty = smarty(
'stylesheets' => array('style/views.css')
)
);
$smarty->assign('heading', $heading);
$smarty->assign('noheadingescape', true);
$smarty->assign('artefact', $content);
$smarty->assign('artefactpath', $artefactpath);
$smarty->assign('INLINEJAVASCRIPT', $javascript);
$smarty->assign('viewid', $viewid);
$smarty->assign('viewowner', $view->get('owner'));
$smarty->assign('viewtitle', $view->get('title'));
$smarty->assign('formattedowner', $view->formatted_owner());
$viewowner = $view->get('owner');
if ($viewowner) {
$smarty->assign('ownerlink', 'user/view.php?id=' . $viewowner);
}
else if ($view->get('group')) {
$smarty->assign('ownerlink', 'group/view.php?id=' . $view->get('group'));
}
$smarty->assign('ownername', $view->formatted_owner());
$smarty->display('view/artefact.tpl');
......
......@@ -47,16 +47,8 @@ $group = $view->get('group');
$title = $view->get('title');
define('TITLE', $title);
if ($new) {
$heading = hsc($title);
}
else {
$heading = '<a href="' . get_config('wwwroot') . 'view/view.php?id=' . $view->get('id') .'">' . hsc($title) . '</a>';
}
if (!$group) {
$title .= ' ' . get_string('by', 'view') . ' ' . $view->formatted_owner();
$heading .= ' ' . get_string('by', 'view') . ' <a href="' . get_config('wwwroot') .'user/view.php?id=' . $view->get('owner'). '">' . $view->formatted_owner() . '</a>';
}
......@@ -280,18 +272,28 @@ $smarty = smarty(
'stylesheets' => array('style/views.css'),
)
);
$smarty->assign('heading', $heading);
$smarty->assign('INLINEJAVASCRIPT', $javascript);
$smarty->assign('new', $new);
$smarty->assign('viewid', $viewid);
$smarty->assign('viewtitle', $view->get('title'));
$owner = $view->get('owner');
if ($owner) {
$smarty->assign('ownerlink', 'user/view.php?id=' . $owner);
if ($USER->get('id') == $owner) {
$smarty->assign('can_edit', !$view->get('submittedto'));
}
}
else if ($group) {
$smarty->assign('ownerlink', 'group/view.php?id=' . $group);
}
$smarty->assign('ownername', $view->formatted_owner());
$smarty->assign('streditviewbutton', ($new) ? get_string('backtocreatemyview', 'view') : get_string('editmyview', 'view'));
$smarty->assign('viewdescription', $view->get('description'));
$smarty->assign('viewcontent', $view->build_columns());
$smarty->assign('streditviewbutton', ($new) ? get_string('backtocreatemyview', 'view') : get_string('editmyview', 'view'));
if ($USER->get('id') == $view->get('owner')) {
$smarty->assign('can_edit', !$view->get('submittedto'));
$smarty->assign('new', $new);
}
$smarty->display('view/view.tpl');
?>
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