Skip to content

Commit

Permalink
Added titles
Browse files Browse the repository at this point in the history
  • Loading branch information
drachels committed Nov 11, 2023
1 parent 2424cc7 commit 210da90
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion classes/local/results.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ public static function download_entries($context, $course, $diary) {
get_string('teacher', 'diary'),
get_string('timemarked', 'diary'),
get_string('mailed', 'diary'),
get_string('diarytitle', 'diary'),
get_string('entry', 'diary'),
];

Expand All @@ -317,6 +318,7 @@ public static function download_entries($context, $course, $diary) {
de.userid AS userid,
to_char(to_timestamp(de.timecreated), 'YYYY-MM-DD HH24:MI:SS') AS timecreated,
to_char(to_timestamp(de.timemodified), 'YYYY-MM-DD HH24:MI:SS') AS timemodified,
de.title AS title,
de.text AS text,
de.format AS format,
de.rating AS rating,
Expand All @@ -339,6 +341,7 @@ public static function download_entries($context, $course, $diary) {
de.userid AS userid,
FROM_UNIXTIME(de.timecreated) AS TIMECREATED,
FROM_UNIXTIME(de.timemodified) AS TIMEMODIFIED,
de.title AS title,
de.text AS text,
de.format AS format,
de.rating AS rating,
Expand Down Expand Up @@ -385,6 +388,7 @@ public static function download_entries($context, $course, $diary) {
$d->teacher,
$d->timemarked,
$d->mailed,
$d->title,
strip_tags($d->text),
];

Expand Down Expand Up @@ -484,7 +488,7 @@ public static function download_entries($context, $course, $diary) {

$output = [$d->firstname, $d->lastname, $d->diary, $d->promptid, $d->userid,
$d->timecreated, $d->timemodified, $d->format, $d->rating, $cleanedentrycomment,
$d->teacher, $d->timemarked, $d->mailed, $cleanedentry,
$d->teacher, $d->timemarked, $d->mailed, $d->title, $cleanedentry,
];

$csv->add_data($output);
Expand Down
2 changes: 2 additions & 0 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public static function get_metadata(collection $collection): collection {
'userid' => 'privacy:metadata:diary_entries:userid',
'timecreated' => 'privacy:metadata:diary_entries:timecreated',
'timemodified' => 'privacy:metadata:diary_entries:timemodified',
'title' => 'privacy:metadata:diary_entries:title',
'text' => 'privacy:metadata:diary_entries:text',
'rating' => 'privacy:metadata:diary_entries:rating',
'entrycomment' => 'privacy:metadata:diary_entries:entrycomment',
Expand Down Expand Up @@ -236,6 +237,7 @@ public static function export_user_data(approved_contextlist $contextlist) {
'prompttext' => strip_tags($diary->prompttext),
'timecreated' => $diary->timecreated ? transform::datetime($diary->timecreated) : '',
'timemodified' => $diary->timemodified ? transform::datetime($diary->timemodified) : '',
'title' => strip_tags($diary->title),
'text' => strip_tags($diary->text),
'rating' => $diary->rating,
'entrycomment' => strip_tags($diary->entrycomment),
Expand Down
6 changes: 6 additions & 0 deletions upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ This files describes API changes and other work in the diary code.
20231110 Diary_1115 - Need to add titles to each report entry. Added the needed code
in the classes/local/results.php page in the, function diary_print_user_entry.
Putting the code there fixed the views for both the, report and reportsingle, pages.
20231111 Diary_1116 - Need to add Titles to downloads. Added the needed code, performed
a download, and the titles have been added just before the entries, in the CSV
download. Do need to investigate using another download format.
20231111 Diary_1117 - The provider.php file needs to also handle titles. Created two
new lines of code at line 70 and line 240, so that titles are included in the
metadata and in the export.



Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
*/
defined('MOODLE_INTERNAL') || die();

$plugin->version = 2023110900; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2023111100; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2019052000; // Requires Moodle 3.7 version.
$plugin->cron = 60; // Period for cron to check this module (secs).
$plugin->component = 'mod_diary';
$plugin->maturity = MATURITY_STABLE;
$plugin->release = '3.7.7 (Build: 2023110900)'; // User-friendly version number.
$plugin->release = '3.7.7 (Build: 2023111100)'; // User-friendly version number.
$plugin->supported = [307, 403];

0 comments on commit 210da90

Please sign in to comment.