From 5e90fbe427624b883a812e2a465a070f22800c50 Mon Sep 17 00:00:00 2001 From: drachels Date: Fri, 28 Aug 2020 11:08:10 -0500 Subject: [PATCH] Code precheck cleanup and two new links to index.php. --- .travis.yml | 70 ---------------------- index.php | 9 ++- lang/en/diary.php | 1 + notes.txt | 150 ---------------------------------------------- report.php | 3 + version.php | 4 +- view.php | 3 +- 7 files changed, 12 insertions(+), 228 deletions(-) delete mode 100644 notes.txt diff --git a/.travis.yml b/.travis.yml index 4cdc10d..e21abc5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,76 +25,6 @@ cache: matrix: include: - - php: 5.6 - env: - DB=pgsql - MOODLE_BRANCH=MOODLE_26_STABLE - MOODLE_CI_VERSION=1 - - php: 5.6 - env: - DB=mysqli - MOODLE_BRANCH=MOODLE_26_STABLE - MOODLE_CI_VERSION=1 - - php: 5.6 - env: - DB=pgsql - MOODLE_BRANCH=MOODLE_27_STABLE - MOODLE_CI_VERSION=1 - - php: 5.6 - env: - DB=mysqli - MOODLE_BRANCH=MOODLE_27_STABLE - MOODLE_CI_VERSION=1 - - php: 5.6 - env: - DB=pgsql - MOODLE_BRANCH=MOODLE_28_STABLE - MOODLE_CI_VERSION=1 - - php: 5.6 - env: - DB=mysqli - MOODLE_BRANCH=MOODLE_28_STABLE - MOODLE_CI_VERSION=1 - - php: 5.6 - env: - DB=pgsql - MOODLE_BRANCH=MOODLE_29_STABLE - MOODLE_CI_VERSION=1 - - php: 5.6 - env: - DB=mysqli - MOODLE_BRANCH=MOODLE_29_STABLE - MOODLE_CI_VERSION=1 - - php: 5.6 - env: - DB=pgsql - MOODLE_BRANCH=MOODLE_30_STABLE - MOODLE_CI_VERSION=1 - - php: 5.6 - env: - DB=mysqli - MOODLE_BRANCH=MOODLE_30_STABLE - MOODLE_CI_VERSION=1 - - php: 5.6 - env: - DB=pgsql - MOODLE_BRANCH=MOODLE_31_STABLE - MOODLE_CI_VERSION=1 - - php: 5.6 - env: - DB=mysqli - MOODLE_BRANCH=MOODLE_31_STABLE - MOODLE_CI_VERSION=1 - - php: 7.1 - env: - DB=pgsql - MOODLE_BRANCH=MOODLE_32_STABLE - MOODLE_CI_VERSION=2 - - php: 7.1 - env: - DB=mysqli - MOODLE_BRANCH=MOODLE_32_STABLE - MOODLE_CI_VERSION=2 - php: 7.1 env: DB=pgsql diff --git a/index.php b/index.php index 75882be..e3e8db1 100644 --- a/index.php +++ b/index.php @@ -28,15 +28,14 @@ $id = required_param('id', PARAM_INT); // Course. -if (! $course = $DB->get_record("course", array("id" => $id))) { +if (! $course = $DB->get_record('course', array('id' => $id))) { print_error("Course ID is incorrect"); } require_course_login($course); - // Header. -$strdiarys = get_string("modulenameplural", "diary"); +$strdiarys = get_string('modulenameplural', 'diary'); $PAGE->set_pagelayout('incourse'); $PAGE->set_url('/mod/diary/index.php', array('id' => $id)); $PAGE->navbar->add($strdiarys); @@ -46,8 +45,8 @@ echo $OUTPUT->header(); echo $OUTPUT->heading($strdiarys); -if (! $diarys = get_all_instances_in_course("diary", $course)) { - notice(get_string('thereareno', 'moodle', get_string("modulenameplural", "diary")), "../../course/view.php?id=$course->id"); +if (! $diarys = get_all_instances_in_course('diary', $course)) { + notice(get_string('thereareno', 'moodle', get_string('modulenameplural', 'diary')), '../../course/view.php?id=$course->id'); die; } diff --git a/lang/en/diary.php b/lang/en/diary.php index b6884e4..52fabab 100644 --- a/lang/en/diary.php +++ b/lang/en/diary.php @@ -137,5 +137,6 @@ $string['timemodified'] = 'Time modified'; $string['userid'] = 'User id'; $string['usertoolbar'] = 'User toolbar:'; +$string['viewalldiaries'] = 'View all course diaries'; $string['viewallentries'] = 'View {$a} diary entries'; $string['viewentries'] = 'View entries'; diff --git a/notes.txt b/notes.txt deleted file mode 100644 index 1d7b4e6..0000000 --- a/notes.txt +++ /dev/null @@ -1,150 +0,0 @@ -Diary is based on a highly modified version of the Journal plugin. -It allows a user to create a new entry each day. Each entry can be -individually graded, with results being shown based on the selected -aggregate type of rating. -Currently, the user can edit any entry, but cannot start a new -entry on a skipped day. - -Sometime ago, due to a forum inquiry, I started to -modify a copy of journal and create a diary module. -Eventually, I removed it from all my Moodle sites, -but have decided to work on it some more. -07/26/2018 Verified I don't have diary installed anywhere. -07/26/2018 Installed diary code to moodle35. -07/26/2018 report.php modified line 136 that used to -be a notification entry, so that it is now: - echo $OUTPUT->notification(get_string("feedbackupdated", "journal", "$count"), "notifysuccess"); -07/26/2018 Added the missing comment lines from 2 thru 15. -07/26/2018 Went through all the SQL statemnts and made sure -that all the "j's" were changed to "d's" for consistency. -07/26/2018 Converted multiple double blank lines to single ones. -05/21/2019 Verified diary is still installed in moodle35. -05/21/2019 Installed a copy into my development site, moodle3dev. -05/23/2019 Modified view.php to force the edit menu cog to show. -05/24/2019 Added timecreated field and have it working along with -the timemodified field, I think. -05/24/2019 I think part of my problem starting a new entry, -might be due to calculations being made based on GMT. -05/26/2019 Set version to 0.8Beta. -05/27/2019 Fixed file handling error in view.php so that -now audio and video files will play. -06/03/2019 Added download and refresh toolbuttons to report.php. -Also started developing toolbar for each entry that allows -the teacher to go to previous and next days, if they exist. -06/04/2019 Got renderer.php working for the activity introduction. -I also moved the diary_print_user_entry and diary_print_feedback -functions to the renderer.php file. -06/05/2019 One step forward, then two steps back. Just not making -any progress. Every time I have tried something, there is always one -step that breaks the method I am trying. Cannot seem to get past -needing $this->, or needing $OUTPUT, to try and get the entry toolbar -to work. - -Had to abandon adding another renderer. Had to abandon putting all -my new stuff in lib.php and moving it to locallib.php. In there I -had to abandon using private function and just make things as function. -Even some that are in there already, (Copied from hotquestion) will -have to have the public function changed to just function. - -If that is the case, then why bother having locallib.php. -Just put everything into lib.php like I had. - -Finally, something WORKED! In view.php, about line143, when getting -the user diary entries, I inserted a $sort = 'timecreated DESC' and -the users entries are now listed from newest, to the oldest! - -Later, should see about making a switch so the user can select the -sort order. Also select month and year, maybe. - -06/06/2019 Made a change to the day check for starting a new entry. -Now using diff function. -06/07/2019 Made a change to the day check for starting a new entry. -Instead of checking for ($diff->d > 0), which is only triggered at 24 -hours, I am trying ($diff->d + $diff->h) > 0. -06/07/2019 Added a third, Save all my feedback, button to the top of -the users with an entry. Checked that all three buttons do work. -06/08/2019 changed back from using diff function to one that uses floor. -Also make it so there is a Save all my feedback at the top of the list, -below each entry, and at the bottom of the page. -Also played with the sort order of the report page, but never could get -the results I wanted. Reverted to old sort. - -06/09/2019 Finally fixed edit.php so that when it is a new calendar -date, it will start a new entry, no matter how many hours have elapsed. -06/06/2019 Finally fixed the double button problem for the user entry -toolbar. Each button used $output and the function was also returning -a $output, which gave two sets of tools. -06/13/2019 Added another color setting so that the view.php has a color -for the whole background as well as another color for the text background. -I also added code in the report.php so that each entry uses one of the -two colors. Still deciding which one to use. For report, the code is -actually in lib.php, in the, function diary_print_user_entry, about line 948. - -06/15/2019 Finally figured out a really simple way to get the entries list -on the report.php page to be in alphabetical order. -06/15/2019 Double whammy! Got the list order to work and just now, I also -have gotten the download_entries to work. Still have a few bugs to work -out due to $this-> not working. Later 1800 - I have the bugs fixed. Just -need to verify things tomorrow and do some code cleanup. - -06/16/2019 Made a slight change to the ORDER BY in SQL for entries list -in report.php file. Added both u.lastname ASC and u.firstname ASC. Also -had to add $sort 'lastname ASC, firstname ASC' in report.php, at about -line 185, so that the list of users with no entry, is alphabetized, too. -Started adding icons for previous and next toolbuttons. Also added css -style for the notice that an entry has changed since the last feedback -was made. It now shows slightly larger, red, and underlined so it stands out. - -06/17/2019 Fixed css style for the notice that an entry has changed since the -last feedback was made for the view.php page. Also made it so the info is -posted below each entry on the page. - -06/17/2019 Fixed backup and restore so they now work, correctly. - -06/18/2018 Added red warnings for needs regrade and needs grading. - -06/21/2019 Discovered was still using one Journal string in report.php -where the code for the, Save all my feedback, button was being assigned -to a variable. Fixed to use Diary string. - -06/21/2019 Discovered the Recent Activity function was ORDER BY timemodified, -and since I had changed the report.php to use lastname, firstname in ASC -order, I changed the Recent Activity to also us alphabetical order. - -06/22/2019 Added a couple of new student users, Moe Money and Allie Katt -so that I could make sure sort was working for both lastname and firstname. - -06/23/2019 FINALLY! Got a toolbar working in report.php. Setup case switches -to change the $DB->get_records to sort various items and ways so that I -get the needed results. Each switch also refreshes the page and changes -the heading to tell which data is being displayed. - -06/25/2019 Removed a LOT of leftover development code that is no longer -needed. - -07/22/2019 Finally have "correct" edit capability. Pushed ver. 0.9.5. -07/25/2019 Pushed ver. 0.9.6 Have things to the point of REALLY needing to -start development for ratings. -08/03/2019 Have started adding code for ratingoptions as ver. 0.9.7 -10/04/2019 Commented out line 53 of lib.php that is calling a function I -not implemented yet. - -05/31/2020 Started transferring tickets from User Support Tracker into -Diary Support Tracker. - -20200709 Diary_499, Need Entries per page selector for view.php page, is - now Being tested. -20200710 Diary_573, Need edit icon for every entry, is now being tested. -20200812 Diary_510, Need to implement Ratings. Finally seem to have the - rating system working. -20200813 Additional changes to Diary Ratings, code cleanup, and - bumped the version. -20200815 Diary_510, Diary - Need to implement Ratings. Added Rating - type and rating to view.php page. -20200821 Finally got gloabal search mostly working. Need to account - for included files. Currently getting: Before calling format_text(), - the content must be processed with file_rewrite_pluginfile_urls(). - Pushed ver '0.13.0 (Build: 2020082000)' to github. -20200823 Submitted to moodle.org as new plugin. -20200824 Pocessed and fixed many of the code prechecks errors/warnings listed. -20200824 Bumped and pushed version to v1.0.1 Build: 2020082400. \ No newline at end of file diff --git a/report.php b/report.php index 44930aa..aaad659 100644 --- a/report.php +++ b/report.php @@ -114,6 +114,9 @@ echo $OUTPUT->header(); echo $OUTPUT->heading(get_string($stringlable, "diary")); +// 20200827 Added link to index.php page. +echo ''; + // Get a list of groups for this course. $currentgroup = groups_get_activity_group($cm, true); if ($currentgroup) { diff --git a/version.php b/version.php index 48f3d57..466aa56 100644 --- a/version.php +++ b/version.php @@ -27,10 +27,10 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2020082402; // The current module version (Date: YYYYMMDDXX). +$plugin->version = 2020082800; // The current module version (Date: YYYYMMDDXX). $plugin->requires = 2015111600; // Requires Moodle 3.0 version. $plugin->cron = 60; // Period for cron to check this module (secs). $plugin->component = 'mod_diary'; $plugin->maturity = MATURITY_STABLE; -$plugin->release = '1.0.2 (Build: 2020082402)'; // User-friendly version number. +$plugin->release = '1.1.0 (Build: 2020082800)'; // User-friendly version number. diff --git a/view.php b/view.php index 205b061..eef2e75 100644 --- a/view.php +++ b/view.php @@ -202,8 +202,9 @@ $entrycount = diary_count_entries($diary, $currentgroup); + // 20200827 Add link to index.php page. echo ''; + get_string('viewallentries', 'diary', $entrycount).'  |  '.get_string('viewalldiaries', 'diary').''; } echo $output->introduction($diary, $cm); // Ouput introduction in renderer.php.