Tomorrow night will be the due date for my students to submit a Lab Report created in Mahara. I told them that I was not going to accept reports modified after the due date but I hadn’t realized that Mahara pages don’t show last update information so I had to hack the code to get it.
This is what I did:
########################################
# Hacking Mahara 1.8.1 to display ‘last update’ on pages #
########################################
We need to modify two files:
a.- /var/www/mahara/view/view.php (Lines 359, 360 and 361)
b.- /var/www/mahara/theme/raw/templates/view/view.tpl (Lines 37 and 38)
a.- First I added two new lines (and a comment) to /view/view.php (Lines 359, 360 and 361). Open the file with your favourite editor and add lines in blue
user@maharaserver:/# nano -wc /var/www/mahara/view/view.php
if ($viewgroupform) { $smarty->assign('view_group_submission_form', $viewgroupform); } # Hack: 2 lines added to display 'last update' on pages $smarty->assign('datecreation', $view->get('ctime')); $smarty->assign('datemodifica', $view->get('mtime')); $smarty->display('view/view.tpl');
b.- Then I added 1 line (and a comment) to /theme/raw/templates/view/view.tpl (Lines 37 and 38). Open the file with your favourite editor and add lines in magenta
user@maharaserver:/# nano -wc /var/www/mahara/theme/raw/templates/view/view.tpl
{if $tags}<div><label>{str tag=tags}:</label> {list_tags owner=$owner tags=$tags}</div>{/if}
<!-- //Hack: 1 line added to display 'last update' on pages ---> {if $datemodifica == $datecreation}<div><label>{str tag=Created}{else}<div><label>{str tag=Updated}{/if}</label> {$datemodifica}</div>
{if $releaseform}<div>{$releaseform|safe}</div>{/if} {if $view_group_submission_form}<div>{$view_group_submission_form|safe}</div>{/if}
That’s all. Now you will see the last update at the footer of pages created with Mahara. The date format shows y/m/d hh:mm:ss. It means 2014:02:02 01:40. Another more elegant hack could be:
<!– //Hack: 1 line added to display ‘last update’ on pages —>
{if $datemodifica == $datecreation}<div><label>{str tag=Created}{else}<div><label>{str tag=Updated}{/if}</label> {$datemodifica|strtotime|format_date:’strftimedate‘}</div>
This hack display a more friendly date format: 02 Feb 2014. I choose the long one because I need to check hours too.
I don’t know if it’s the best way to hack the code but I needed it and it works for me. I hope it helps you 🙂
Muchas gracias, es precisamente lo que necesitaba, lo tomo prestado para mi blog.
toni buen día, quería hacer una pregunta por si sabes el método para hacerlo, en el menú de profile un bloque es el de navigation, quiero activar este bloque en el menú del dashboard.
Hay alguna manera de hacer esto?
Mil Gracias