Browse Source

Fix failing tests in master.

move some strings into attendance plugin.
MOODLE_36_STABLE
Dan Marsden 6 years ago
parent
commit
c17eb582b0
  1. 1
      absentee.php
  2. 2
      classes/calendar_helpers.php
  3. 9
      lang/en/attendance.php
  4. 6
      message.html
  5. 20
      messageselect.php
  6. 2
      tests/behat/defaultstatus.feature

1
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/lib.php');
require_once($CFG->dirroot.'/mod/attendance/locallib.php'); require_once($CFG->dirroot.'/mod/attendance/locallib.php');
require_once($CFG->libdir.'/tablelib.php'); require_once($CFG->libdir.'/tablelib.php');
require_once($CFG->libdir.'/coursecatlib.php');
$category = optional_param('category', 0, PARAM_INT); $category = optional_param('category', 0, PARAM_INT);
$attendancecm = optional_param('id', 0, PARAM_INT); $attendancecm = optional_param('id', 0, PARAM_INT);

2
classes/calendar_helpers.php

@ -132,7 +132,7 @@ function attendance_update_calendar_event($session) {
return attendance_create_calendar_event($session); return attendance_create_calendar_event($session);
} }
// Boring update // Boring update.
$caleventdata = new stdClass(); $caleventdata = new stdClass();
$caleventdata->timeduration = $timeduration; $caleventdata->timeduration = $timeduration;
$caleventdata->timestart = $timestart; $caleventdata->timestart = $timestart;

9
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:attendancelog'] = 'Log of user attendances recorded.';
$string['privacy:metadata:attendancesessions'] = 'Sessions to which attendance will be 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['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';

6
message.html

@ -10,12 +10,12 @@
<?php print_string("messagebody"); ?>: <?php print_string("messagebody"); ?>:
</b></td> </b></td>
<td align="left"> <td align="left">
<?php print_textarea(true, 15, 65, 1, 1, "messagebody", $messagebody); ?> <?php echo $OUTPUT->print_textarea("messagebody", "edit-messagebody", $messagebody, 15, 65); ?>
</td> </td>
</tr> </tr>
<tr valign="top"> <tr valign="top">
<td align="right"><label for="menuformat"><b><?php print_string("formattexttype"); ?>:</b></label></td> <td align="right"><label for="menuformat"><b><?php print_string("formattexttype", 'mod_attendance'); ?>:</b></label></td>
<td> <td>
<?php <?php
print_string('formathtml'); print_string('formathtml');
@ -30,7 +30,7 @@
</td></tr> </td></tr>
</table> </table>
<?php echo $OUTPUT->box_end(); ?> <?php echo $OUTPUT->box_end(); ?>
<table align="center"><tr><th colspan="4" scope="row"><?php print_string('currentlyselectedusers'); ?></th></tr> <table align="center"><tr><th colspan="4" scope="row"><?php print_string('currentlyselectedusers', 'mod_attendance'); ?></th></tr>
<?php <?php
if (count($SESSION->emailto[$id])) { if (count($SESSION->emailto[$id])) {
foreach ($SESSION->emailto[$id] as $user) { foreach ($SESSION->emailto[$id] as $user) {

20
messageselect.php

@ -24,7 +24,8 @@
require_once('../../config.php'); require_once('../../config.php');
require_once($CFG->dirroot.'/message/lib.php'); require_once($CFG->dirroot.'/message/lib.php');
$id = required_param('id', PARAM_INT); $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); $send = optional_param('send', '', PARAM_BOOL);
$preview = optional_param('preview', '', PARAM_BOOL); $preview = optional_param('preview', '', PARAM_BOOL);
$edit = optional_param('edit', '', 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); $format = optional_param('format', FORMAT_MOODLE, PARAM_INT);
$deluser = optional_param('deluser', 0, PARAM_INT); $deluser = optional_param('deluser', 0, PARAM_INT);
$url = new moodle_url('/user/messageselect.php', array('id' => $id)); $url = new moodle_url('/user/messageselect.php', array('id' => $id));
if ($messagebody !== '') {
$url->param('messagebody', $messagebody);
}
if ($send !== '') { if ($send !== '') {
$url->param('send', $send); $url->param('send', $send);
} }
@ -53,6 +52,9 @@ if ($format !== FORMAT_MOODLE) {
if ($deluser !== 0) { if ($deluser !== 0) {
$url->param('deluser', $deluser); $url->param('deluser', $deluser);
} }
if (!empty($messagebody['text'])) {
$messagebody = $messagebody['text'];
}
$PAGE->set_url($url); $PAGE->set_url($url);
if (!$course = $DB->get_record('course', array('id' => $id))) { if (!$course = $DB->get_record('course', array('id' => $id))) {
print_error('invalidcourseid'); print_error('invalidcourseid');
@ -97,7 +99,7 @@ if ($course->id == SITEID) {
$strtitle = get_string('sitemessage'); $strtitle = get_string('sitemessage');
$PAGE->set_pagelayout('admin'); $PAGE->set_pagelayout('admin');
} else { } else {
$strtitle = get_string('coursemessage'); $strtitle = get_string('coursemessage', 'mod_attendance');
$PAGE->set_pagelayout('incourse'); $PAGE->set_pagelayout('incourse');
} }
$link = null; $link = null;
@ -113,9 +115,9 @@ echo $OUTPUT->header();
if ($count) { if ($count) {
if ($count == 1) { if ($count == 1) {
$heading = get_string('addedrecip', 'moodle', $count); $heading = get_string('addedrecip', 'mod_attendance', $count);
} else { } else {
$heading = get_string('addedrecips', 'moodle', $count); $heading = get_string('addedrecips', 'mod_attendance', $count);
} }
echo $OUTPUT->heading($heading); echo $OUTPUT->heading($heading);
} }
@ -162,8 +164,8 @@ if (!empty($messagebody) && !$edit && !$deluser && ($preview || $send)) {
echo $OUTPUT->notification(get_string('nousersyet')); echo $OUTPUT->notification(get_string('nousersyet'));
} }
} }
echo '<p align="center"><a href="'.$returnto.'">'.get_string("keepsearching").'</a>'. echo '<p align="center"><a href="'.$returnto.'">'.get_string("keepsearching", 'mod_attendance').'</a>'.
((count($SESSION->emailto[$id])) ? ', '.get_string('usemessageform') : '').'</p>'; ((count($SESSION->emailto[$id])) ? ', '.get_string('usemessageform', 'mod_attendance') : '').'</p>';
if ((!empty($send) || !empty($preview) || !empty($edit)) && (empty($messagebody))) { if ((!empty($send) || !empty($preview) || !empty($edit)) && (empty($messagebody))) {
echo $OUTPUT->notification(get_string('allfieldsrequired')); echo $OUTPUT->notification(get_string('allfieldsrequired'));
} }

2
tests/behat/defaultstatus.feature

@ -12,7 +12,7 @@ Feature: Admin can set default status set for use in new attendance
| course | user | role | timestart | | course | user | role | timestart |
| C1 | teacher1 | editingteacher | ##yesterday## | | C1 | teacher1 | editingteacher | ##yesterday## |
And I log in as "admin" 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 follow "Default status set"
And I set the field with xpath "//*[@id='preferencesform']/table/tbody/tr[2]/td[3]/input" to "customstatusdescription" 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" And I click on "Update" "button" in the "#preferencesform" "css_element"

Loading…
Cancel
Save