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
+6 -6
View File
@@ -146,8 +146,8 @@ class template_test extends \advanced_testcase {
// Some cooked variables for the regular expression.
$replace = [
'{authorfullname}' => fullname($author),
'{timeadded}' => userdate($entry->timecreated),
'{timemodified}' => userdate($entry->timemodified),
'{timeadded}' => userdate($entry->timecreated, get_string('strftimedatemonthabbr', 'langconfig')),
'{timemodified}' => userdate($entry->timemodified, get_string('strftimedatemonthabbr', 'langconfig')),
'{fieldid}' => $field->field->id,
'{entryid}' => $entry->id,
'{cmid}' => $cm->id,
@@ -256,12 +256,12 @@ class template_test extends \advanced_testcase {
],
'Teacher timeadded tag' => [
'templatecontent' => 'Some ##timeadded## tag',
'expected' => '|Some {timeadded} tag|',
'expected' => '|Some <span.*>{timeadded}</span> tag|',
'rolename' => 'editingteacher',
],
'Teacher timemodified tag' => [
'templatecontent' => 'Some ##timemodified## tag',
'expected' => '|Some {timemodified} tag|',
'expected' => '|Some <span.*>{timemodified}</span> tag|',
'rolename' => 'editingteacher',
],
'Teacher approve tag approved entry' => [
@@ -552,12 +552,12 @@ class template_test extends \advanced_testcase {
],
'Student timeadded tag' => [
'templatecontent' => 'Some ##timeadded## tag',
'expected' => '|Some {timeadded} tag|',
'expected' => '|Some <span.*>{timeadded}</span> tag|',
'rolename' => 'student',
],
'Student timemodified tag' => [
'templatecontent' => 'Some ##timemodified## tag',
'expected' => '|Some {timemodified} tag|',
'expected' => '|Some <span.*>{timemodified}</span> tag|',
'rolename' => 'student',
],
'Student approve tag approved entry' => [