Skip to content

Commit

Permalink
Merge branch 'MDL-65935-master' of git://github.com/junpataleta/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Sep 11, 2019
2 parents 28be82a + 0aa833d commit 20cc24e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
15 changes: 0 additions & 15 deletions mod/feedback/feedback.js

This file was deleted.

1 change: 1 addition & 0 deletions mod/feedback/lang/en/feedback.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
$string['importfromthisfile'] = 'Import from this file';
$string['import_questions'] = 'Import questions';
$string['import_successfully'] = 'Import successfully';
$string['includeuserinrecipientslist'] = 'Include {$a} in the list of recipients';
$string['indicator:cognitivedepth'] = 'Feedback cognitive';
$string['indicator:cognitivedepth_help'] = 'This indicator is based on the cognitive depth reached by the student in a Feedback activity.';
$string['indicator:socialbreadth'] = 'Feedback social';
Expand Down
40 changes: 27 additions & 13 deletions mod/feedback/show_nonrespondents.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@

require_capability('mod/feedback:viewreports', $context);

if ($action == 'sendmessage' AND has_capability('moodle/course:bulkmessaging', $coursecontext)) {
$canbulkmessaging = has_capability('moodle/course:bulkmessaging', $coursecontext);
if ($action == 'sendmessage' AND $canbulkmessaging) {
$shortname = format_string($course->shortname,
true,
array('context' => $coursecontext));
Expand Down Expand Up @@ -164,9 +165,22 @@
$tablecolumns = array('userpic', 'fullname', 'status');
$tableheaders = array(get_string('userpic'), get_string('fullnameuser'), get_string('status'));

if (has_capability('moodle/course:bulkmessaging', $coursecontext)) {
if ($canbulkmessaging) {
$tablecolumns[] = 'select';
$tableheaders[] = get_string('select');

// Build the select/deselect all control.
$selectallid = 'selectall-non-respondents';
$mastercheckbox = new \core\output\checkbox_toggleall('feedback-non-respondents', true, [
'id' => $selectallid,
'name' => $selectallid,
'value' => 1,
'label' => get_string('select'),
// Consistent label to prevent the select column from resizing.
'selectall' => get_string('select'),
'deselectall' => get_string('select'),
'labelclasses' => 'm-0',
]);
$tableheaders[] = $OUTPUT->render($mastercheckbox);
}

$table = new flexible_table('feedback-shownonrespondents-'.$course->id);
Expand Down Expand Up @@ -232,7 +246,6 @@
echo $OUTPUT->notification(get_string('noexistingparticipants', 'enrol'));
} else {

$canbulkmessaging = has_capability('moodle/course:bulkmessaging', $coursecontext);
if ($canbulkmessaging) {
echo '<form class="mform" action="show_nonrespondents.php" method="post" id="feedback_sendmessageform">';
}
Expand All @@ -251,7 +264,15 @@

//selections to bulk messaging
if ($canbulkmessaging) {
$data[] = '<input type="checkbox" class="usercheckbox" name="messageuser[]" value="'.$student->id.'" />';
$checkbox = new \core\output\checkbox_toggleall('feedback-non-respondents', false, [
'id' => 'messageuser-' . $student->id,
'name' => 'messageuser[]',
'class' => 'mr-1',
'value' => $student->id,
'label' => get_string('includeuserinrecipientslist', 'mod_feedback', fullname($student)),
'labelclasses' => 'accesshide',
]);
$data[] = $OUTPUT->render($checkbox);
}
$table->add_data($data);
}
Expand All @@ -268,11 +289,7 @@
$allurl->param('showall', 1);
echo $OUTPUT->container(html_writer::link($allurl, get_string('showall', '', $matchcount)), array(), 'showall');
}
if (has_capability('moodle/course:bulkmessaging', $coursecontext)) {
echo '<div class="buttons"><br />';
echo '<input type="button" id="checkall" value="'.get_string('selectall').'" class="btn btn-secondary" /> ';
echo '<input type="button" id="checknone" value="'.get_string('deselectall').'" class="btn btn-secondary" /> ';
echo '</div>';
if ($canbulkmessaging) {
echo '<fieldset class="clearfix">';
echo '<legend class="ftoggler">'.get_string('send_message', 'feedback').'</legend>';
echo '<div>';
Expand All @@ -290,9 +307,6 @@
echo '<input type="hidden" name="id" value="'.$id.'" />';
echo '</fieldset>';
echo '</form>';
//include the needed js
$module = array('name'=>'mod_feedback', 'fullpath'=>'/mod/feedback/feedback.js');
$PAGE->requires->js_init_call('M.mod_feedback.init_sendmessage', null, false, $module);
}
}

Expand Down

0 comments on commit 20cc24e

Please sign in to comment.