From c17eb582b099b1e9fe398756f89162f4022e04b4 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Tue, 4 Sep 2018 11:22:04 +1200 Subject: [PATCH] Fix failing tests in master. move some strings into attendance plugin. --- absentee.php | 1 - classes/calendar_helpers.php | 2 +- lang/en/attendance.php | 9 +++++++++ message.html | 6 +++--- messageselect.php | 20 +++++++++++--------- tests/behat/defaultstatus.feature | 2 +- 6 files changed, 25 insertions(+), 15 deletions(-) diff --git a/absentee.php b/absentee.php index 1af4f23..245acbd 100644 --- a/absentee.php +++ b/absentee.php @@ -27,7 +27,6 @@ require_once($CFG->libdir.'/adminlib.php'); require_once($CFG->dirroot.'/mod/attendance/lib.php'); require_once($CFG->dirroot.'/mod/attendance/locallib.php'); require_once($CFG->libdir.'/tablelib.php'); -require_once($CFG->libdir.'/coursecatlib.php'); $category = optional_param('category', 0, PARAM_INT); $attendancecm = optional_param('id', 0, PARAM_INT); diff --git a/classes/calendar_helpers.php b/classes/calendar_helpers.php index 580721f..4a4342f 100644 --- a/classes/calendar_helpers.php +++ b/classes/calendar_helpers.php @@ -132,7 +132,7 @@ function attendance_update_calendar_event($session) { return attendance_create_calendar_event($session); } - // Boring update + // Boring update. $caleventdata = new stdClass(); $caleventdata->timeduration = $timeduration; $caleventdata->timestart = $timestart; diff --git a/lang/en/attendance.php b/lang/en/attendance.php index 88f4b4e..268901b 100644 --- a/lang/en/attendance.php +++ b/lang/en/attendance.php @@ -545,3 +545,12 @@ $string['privacy:metadata:timesent'] = 'Timestamp when warning was sent.'; $string['privacy:metadata:attendancelog'] = 'Log of user attendances recorded.'; $string['privacy:metadata:attendancesessions'] = 'Sessions to which attendance will be recorded.'; $string['privacy:metadata:attendancewarningdone'] = 'Log of warnings sent to users over their attendance record.'; + +$string['coursemessage'] = 'Message course users'; +$string['addedrecip'] = 'Added {$a} new recipient'; +$string['addedrecips'] = 'Added {$a} new recipients'; +$string['keepsearching'] = 'Keep searching'; +$string['formattexttype'] = 'Formatting'; +$string['currentlyselectedusers'] = 'Currently selected users'; +$string['usemessageform'] = 'or use the form below to send a message to the selected students'; +$string['backtoparticipants'] = 'Back to participants list'; diff --git a/message.html b/message.html index 6ee95fb..621d4de 100644 --- a/message.html +++ b/message.html @@ -10,12 +10,12 @@ : - + print_textarea("messagebody", "edit-messagebody", $messagebody, 15, 65); ?> - + box_end(); ?> - +
emailto[$id])) { foreach ($SESSION->emailto[$id] as $user) { diff --git a/messageselect.php b/messageselect.php index 39f43ad..12c3d00 100644 --- a/messageselect.php +++ b/messageselect.php @@ -24,7 +24,8 @@ require_once('../../config.php'); require_once($CFG->dirroot.'/message/lib.php'); $id = required_param('id', PARAM_INT); -$messagebody = optional_param('messagebody', '', PARAM_CLEANHTML); +$messagebody = optional_param_array('messagebody', '', PARAM_CLEANHTML); + $send = optional_param('send', '', PARAM_BOOL); $preview = optional_param('preview', '', PARAM_BOOL); $edit = optional_param('edit', '', PARAM_BOOL); @@ -32,9 +33,7 @@ $returnto = optional_param('returnto', '', PARAM_LOCALURL); $format = optional_param('format', FORMAT_MOODLE, PARAM_INT); $deluser = optional_param('deluser', 0, PARAM_INT); $url = new moodle_url('/user/messageselect.php', array('id' => $id)); -if ($messagebody !== '') { - $url->param('messagebody', $messagebody); -} + if ($send !== '') { $url->param('send', $send); } @@ -53,6 +52,9 @@ if ($format !== FORMAT_MOODLE) { if ($deluser !== 0) { $url->param('deluser', $deluser); } +if (!empty($messagebody['text'])) { + $messagebody = $messagebody['text']; +} $PAGE->set_url($url); if (!$course = $DB->get_record('course', array('id' => $id))) { print_error('invalidcourseid'); @@ -97,7 +99,7 @@ if ($course->id == SITEID) { $strtitle = get_string('sitemessage'); $PAGE->set_pagelayout('admin'); } else { - $strtitle = get_string('coursemessage'); + $strtitle = get_string('coursemessage', 'mod_attendance'); $PAGE->set_pagelayout('incourse'); } $link = null; @@ -113,9 +115,9 @@ echo $OUTPUT->header(); if ($count) { if ($count == 1) { - $heading = get_string('addedrecip', 'moodle', $count); + $heading = get_string('addedrecip', 'mod_attendance', $count); } else { - $heading = get_string('addedrecips', 'moodle', $count); + $heading = get_string('addedrecips', 'mod_attendance', $count); } echo $OUTPUT->heading($heading); } @@ -162,8 +164,8 @@ if (!empty($messagebody) && !$edit && !$deluser && ($preview || $send)) { echo $OUTPUT->notification(get_string('nousersyet')); } } -echo '

'.get_string("keepsearching").''. - ((count($SESSION->emailto[$id])) ? ', '.get_string('usemessageform') : '').'

'; +echo '

'.get_string("keepsearching", 'mod_attendance').''. + ((count($SESSION->emailto[$id])) ? ', '.get_string('usemessageform', 'mod_attendance') : '').'

'; if ((!empty($send) || !empty($preview) || !empty($edit)) && (empty($messagebody))) { echo $OUTPUT->notification(get_string('allfieldsrequired')); } diff --git a/tests/behat/defaultstatus.feature b/tests/behat/defaultstatus.feature index 9701fa6..b3b0aaa 100644 --- a/tests/behat/defaultstatus.feature +++ b/tests/behat/defaultstatus.feature @@ -12,7 +12,7 @@ Feature: Admin can set default status set for use in new attendance | course | user | role | timestart | | C1 | teacher1 | editingteacher | ##yesterday## | And I log in as "admin" - And I navigate to "Attendance" node in "Site administration > Plugins" + And I navigate to "Plugins > Attendance" in site administration And I follow "Default status set" And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[2]/td[3]/input" to "customstatusdescription" And I click on "Update" "button" in the "#preferencesform" "css_element"