diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php index d3235a76ada..27bb8cafa88 100644 --- a/lib/outputcomponents.php +++ b/lib/outputcomponents.php @@ -167,9 +167,8 @@ class user_picture implements renderable { public $link = true; /** - * @var int Size in pixels. Special values are (true/1 = 100px) and - * (false/0 = 35px) - * for backward compatibility. + * @var int Size in pixels. Special values are (true/1 = 100px) and (false/0 = 35px) for backward compatibility. + * Recommended values (supporting user initials too): 16, 35, 64 and 100. */ public $size = 35; diff --git a/mod/data/classes/template.php b/mod/data/classes/template.php index 010aba681a9..1d8b0e57321 100644 --- a/mod/data/classes/template.php +++ b/mod/data/classes/template.php @@ -240,9 +240,9 @@ class template { * @return pix_icon[] icon name => pix_icon */ protected function get_icons() { - $attrs = ['class' => 'iconsmall']; + $attrs = ['class' => 'iconsmall dataicon']; return [ - 'edit' => new pix_icon('t/edit', get_string('edit'), '', $attrs), + 'edit' => new pix_icon('t/editinline', get_string('edit'), '', $attrs), 'delete' => new pix_icon('t/delete', get_string('delete'), '', $attrs), 'more' => new pix_icon('t/preview', get_string('more', 'data'), '', $attrs), 'approve' => new pix_icon('t/approve', get_string('approve', 'data'), '', $attrs), @@ -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)] + ); } /** diff --git a/mod/data/lang/en/data.php b/mod/data/lang/en/data.php index 5ba69ebc72b..9d173356c80 100644 --- a/mod/data/lang/en/data.php +++ b/mod/data/lang/en/data.php @@ -27,7 +27,6 @@ $string['action'] = 'Action'; $string['actionsmenu'] = 'Actions menu'; $string['add'] = 'Add entry'; $string['addcomment'] = 'Add comment'; -$string['addedby'] = 'Added by'; $string['addentries'] = 'Add entries'; $string['addtemplate'] = 'Add entry template'; $string['advancedsearch'] = 'Advanced search'; @@ -40,8 +39,8 @@ $string['areacontent'] = 'Fields'; $string['ascending'] = 'Ascending'; $string['asearchtemplate'] = 'Advanced search template'; $string['atmaxentry'] = 'You have entered the maximum number of entries allowed!'; -$string['authorfirstname'] = 'Author first name'; -$string['authorlastname'] = 'Author surname'; +$string['authorfirstname'] = 'First name'; +$string['authorlastname'] = 'Last name'; $string['autogenallforms'] = 'Generate all default templates'; $string['autolinkurl'] = 'Autolink the URL'; $string['availablefromdate'] = 'Available from'; @@ -107,9 +106,8 @@ $string['data:viewrating'] = 'View the total rating you received'; $string['data:writeentry'] = 'Write entries'; $string['data:view'] = 'View database activity'; $string['date'] = 'Date'; -$string['dateadded'] = 'Date added'; $string['dateentered'] = 'Date entered'; -$string['datemodified'] = 'Date modified'; +$string['datemodified'] = 'Last modified: '; $string['defaultfielddelimiter'] = '(default is the comma character)'; $string['defaultfieldenclosure'] = '(default is none)'; $string['defaultsortfield'] = 'Default sort field'; @@ -459,3 +457,4 @@ $string['nolisttemplate'] = 'List template is not yet defined'; $string['nosingletemplate'] = 'Single template is not yet defined'; $string['blank'] = 'Blank'; $string['savetemplate'] = 'Save template'; +$string['addedby'] = 'Added by'; diff --git a/mod/data/lang/en/deprecated.txt b/mod/data/lang/en/deprecated.txt index 1963b0c3b2b..3bbe0cf1cc1 100644 --- a/mod/data/lang/en/deprecated.txt +++ b/mod/data/lang/en/deprecated.txt @@ -4,3 +4,4 @@ nosingletemplate,mod_data nolisttemplate,mod_data blank,mod_data savetemplate,mod_data +addedby,mod_data diff --git a/mod/data/preset/imagegallery/addtemplate.html b/mod/data/preset/imagegallery/addtemplate.html index 0f760c5d9c3..9196b8b7606 100644 --- a/mod/data/preset/imagegallery/addtemplate.html +++ b/mod/data/preset/imagegallery/addtemplate.html @@ -1,14 +1,14 @@
-
+
Title
[[title]]
-
+
Image
[[image]]
-
+
Description
[[description]]
diff --git a/mod/data/preset/imagegallery/asearchtemplate.html b/mod/data/preset/imagegallery/asearchtemplate.html index abb4d612152..24e5db57d43 100644 --- a/mod/data/preset/imagegallery/asearchtemplate.html +++ b/mod/data/preset/imagegallery/asearchtemplate.html @@ -1,11 +1,20 @@
-
+
First name
+ ##firstname## +
+
+
Last name
+ ##lastname## +
+ +
+
Title
[[title]]
-
+
Description
[[description]]
diff --git a/mod/data/preset/imagegallery/rsstemplate.html b/mod/data/preset/imagegallery/rsstemplate.html index 18e25db10ee..48c4b428666 100644 --- a/mod/data/preset/imagegallery/rsstemplate.html +++ b/mod/data/preset/imagegallery/rsstemplate.html @@ -1,13 +1,30 @@
-
-

[[title]]

-
-
-
-
[[image]]
+
+
##userpicture##
+
+
+
+ ##user##
##timeadded## +
+
+ Last edited: ##timemodified## +
+
+
##approvalstatus##
+
+
+
+
+ +

[[title]]

+ +
[[description]]
+
+
[[image]]
+
diff --git a/mod/data/preset/imagegallery/singletemplate.html b/mod/data/preset/imagegallery/singletemplate.html index 3d6589f3fcc..ad0a62fc563 100644 --- a/mod/data/preset/imagegallery/singletemplate.html +++ b/mod/data/preset/imagegallery/singletemplate.html @@ -1,27 +1,31 @@
-
-

[[title]]

-
##approvalstatus##
-
##actionsmenu##
+
+
##userpicture##
+
+
+
+ ##user##
##timeadded## +
+
+ Last edited: ##timemodified## +
+
+
##actionsmenu##
+
##approvalstatus##
+
+
+
+
+ +

[[title]]

+
-
-
Author
-
##userpicture## ##user##
-
-
-
Date added
-
##timeadded##
-
-
-
Date modified
-
##timemodified##
+
+
[[description]]
[[image]]
-
-
[[description]]
-
diff --git a/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature b/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature index 09ec21ee46a..9bc936c7a24 100644 --- a/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature +++ b/mod/data/preset/imagegallery/tests/behat/imagegallery_preset.feature @@ -70,6 +70,8 @@ Feature: Users can use the Image gallery preset Given I am on the "Mountain landscapes" "data activity" page logged in as student1 And "First image" "text" should appear before "Second image" "text" When I click on "Advanced search" "checkbox" + And I should see "First name" + And I should see "Last name" And I set the field "title" to "First image" And I press "Save settings" Then I should see "First image" diff --git a/mod/data/preset/journal/addtemplate.html b/mod/data/preset/journal/addtemplate.html index 1725035595e..ae583c14c66 100644 --- a/mod/data/preset/journal/addtemplate.html +++ b/mod/data/preset/journal/addtemplate.html @@ -1,10 +1,10 @@
-
+
Title
[[Title]]
-
+
Content
[[Content]]
diff --git a/mod/data/preset/journal/asearchtemplate.html b/mod/data/preset/journal/asearchtemplate.html index 1c9f2e1f242..470f02544f9 100644 --- a/mod/data/preset/journal/asearchtemplate.html +++ b/mod/data/preset/journal/asearchtemplate.html @@ -1,11 +1,20 @@
-
+
First name
+ ##firstname## +
+
+
Last name
+ ##lastname## +
+ +
+
Title
[[title]]
-
+
Content
[[content]]
diff --git a/mod/data/preset/journal/listtemplate.html b/mod/data/preset/journal/listtemplate.html index 2e58d0b7e2e..6c6e19b03a0 100644 --- a/mod/data/preset/journal/listtemplate.html +++ b/mod/data/preset/journal/listtemplate.html @@ -1,12 +1,28 @@
-
-

[[Title]]

-
##approvalstatus##
-
##actionsmenu##
+
+
+

[[Title]]

+
+
+
##actionsmenu##
+
##approvalstatus##
+
+
[[Content]]
-

##userpicture## ##user##

-

##timeadded##

+
+
##userpicture##
+
+
+
+ ##user##
##timeadded## +
+
+ Last edited: ##timemodified## +
+
+
+
diff --git a/mod/data/preset/journal/rsstemplate.html b/mod/data/preset/journal/rsstemplate.html index 90521468818..cb047ce0d31 100644 --- a/mod/data/preset/journal/rsstemplate.html +++ b/mod/data/preset/journal/rsstemplate.html @@ -1,21 +1,27 @@ -
-
-

[[Title]]

-
-
-
-
Author
-
##userpicture## ##user##
-
-
-
Status
-
[[Content status]]
-
-
-
-

Description

- [[Content]] +
+
+
##userpicture##
+
+
+
+ ##user##
##timeadded## +
+
+ Last edited: ##timemodified## +
+
+
##approvalstatus##
+
+
+ +

[[title]]

+ +
+
+ [[Content]] +
+
diff --git a/mod/data/preset/journal/singletemplate.html b/mod/data/preset/journal/singletemplate.html index 8d9bc608850..411391a6e0e 100644 --- a/mod/data/preset/journal/singletemplate.html +++ b/mod/data/preset/journal/singletemplate.html @@ -1,23 +1,28 @@
-
-

[[Title]]

-
##approvalstatus##
-
##actionsmenu##
-
-
-
-
Author
-
##userpicture## ##user##
-
-
-
Date
-
##timeadded##
-
-
-
-

Reflections

- [[Content]] +
+
##userpicture##
+
+
+
+ ##user##
##timeadded## +
+
+ Last edited: ##timemodified## +
+
+
##actionsmenu##
+
##approvalstatus##
+
+
+ +

[[title]]

+ +
+
+ [[Content]] +
+
diff --git a/mod/data/preset/journal/tests/behat/journal_preset.feature b/mod/data/preset/journal/tests/behat/journal_preset.feature index 1e7aa582293..c795ef15fbc 100644 --- a/mod/data/preset/journal/tests/behat/journal_preset.feature +++ b/mod/data/preset/journal/tests/behat/journal_preset.feature @@ -56,6 +56,8 @@ Feature: Users can use the Journal preset Given I am on the "Student reflections" "data activity" page logged in as student1 And "Reflection created by student" "text" should appear before "Reflection created by teacher" "text" When I click on "Advanced search" "checkbox" + And I should see "First name" + And I should see "Last name" And I set the field "Title" to "student" And I press "Save settings" Then I should see "Reflection created by student" diff --git a/mod/data/preset/proposals/addtemplate.html b/mod/data/preset/proposals/addtemplate.html index c42ab97d55c..ad89ce3c15f 100644 --- a/mod/data/preset/proposals/addtemplate.html +++ b/mod/data/preset/proposals/addtemplate.html @@ -1,18 +1,18 @@
-
+
Title
[[Title]]
-
+
Status
[[Status]]
-
+
Summary
[[Summary]]
-
+
Content
[[Content]]
diff --git a/mod/data/preset/proposals/asearchtemplate.html b/mod/data/preset/proposals/asearchtemplate.html index 7b42d4ae8b3..40c6af1c131 100644 --- a/mod/data/preset/proposals/asearchtemplate.html +++ b/mod/data/preset/proposals/asearchtemplate.html @@ -1,19 +1,28 @@
-
+
First name
+ ##firstname## +
+
+
Last name
+ ##lastname## +
+ +
+
Title
[[Title]]
-
+
Status
[[Status]]
-
+
Summary
[[Summary]]
-
+
Content
[[Content]]
diff --git a/mod/data/preset/proposals/listtemplate.html b/mod/data/preset/proposals/listtemplate.html index cbb46ab90f6..94a19219269 100644 --- a/mod/data/preset/proposals/listtemplate.html +++ b/mod/data/preset/proposals/listtemplate.html @@ -2,16 +2,15 @@