From 210da90a384242228903c9efd99c57e29cfef4a4 Mon Sep 17 00:00:00 2001 From: AL Rachels Date: Sat, 11 Nov 2023 11:47:59 -0600 Subject: [PATCH] Added titles --- classes/local/results.php | 6 +++++- classes/privacy/provider.php | 2 ++ upgrade.txt | 6 ++++++ version.php | 4 ++-- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/classes/local/results.php b/classes/local/results.php index 96351e7..fde935f 100644 --- a/classes/local/results.php +++ b/classes/local/results.php @@ -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'), ]; @@ -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, @@ -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, @@ -385,6 +388,7 @@ public static function download_entries($context, $course, $diary) { $d->teacher, $d->timemarked, $d->mailed, + $d->title, strip_tags($d->text), ]; @@ -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); diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index e97a6d3..0cbc2cc 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -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', @@ -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), diff --git a/upgrade.txt b/upgrade.txt index 186a656..ffe831d 100644 --- a/upgrade.txt +++ b/upgrade.txt @@ -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. diff --git a/version.php b/version.php index 8dc28eb..fd95edb 100644 --- a/version.php +++ b/version.php @@ -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];