MDL-75684 mod_data: Add metadata to templates

Each template should display at the top the information about the
user who has created the entry, when it was created and modified.

Apart from that, this commit also includes:
- For the Journal preset, a link on each card entry title has been
added, to open the Single view.
- For the Resources preset, the Author field has been renamed to
"Author of resource" and the Description to "Content".
- For the Resources preset, the Author and Type fields will be
hidden in the List view for small devices.
This commit is contained in:
Sara Arjona
2022-10-24 13:01:39 +02:00
parent e80ec13230
commit 16ba7cbe96
26 changed files with 303 additions and 159 deletions
+11 -3
View File
@@ -503,7 +503,7 @@ class template {
if (!isset($user->picture)) {
$user = core_user::get_user($entry->userid);
}
return $OUTPUT->user_picture($user, ['courseid' => $cm->course]);
return $OUTPUT->user_picture($user, ['courseid' => $cm->course, 'size' => 64]);
}
/**
@@ -551,7 +551,11 @@ class template {
* @return string the tag replacement
*/
protected function get_tag_timeadded_replacement(stdClass $entry, bool $canmanageentry): string {
return userdate($entry->timecreated);
return html_writer::tag(
'span',
userdate($entry->timecreated, get_string('strftimedatemonthabbr', 'langconfig')),
['title' => userdate($entry->timecreated)]
);
}
/**
@@ -562,7 +566,11 @@ class template {
* @return string the tag replacement
*/
protected function get_tag_timemodified_replacement(stdClass $entry, bool $canmanageentry): string {
return userdate($entry->timemodified);
return html_writer::tag(
'span',
userdate($entry->timemodified, get_string('strftimedatemonthabbr', 'langconfig')),
['title' => userdate($entry->timecreated)]
);
}
/**