Skip to content

Commit

Permalink
MDL-51988 report_particiption: do not allow messaging when disabled
Browse files Browse the repository at this point in the history
Previously the option to send messages when presented regardless of the
site setting.
  • Loading branch information
danpoltawski committed Nov 11, 2015
1 parent bcf2ea7 commit 1337f77
Showing 1 changed file with 37 additions and 24 deletions.
61 changes: 37 additions & 24 deletions report/participation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,15 @@
$table = new flexible_table('course-participation-'.$course->id.'-'.$cm->id.'-'.$roleid);
$table->course = $course;

$table->define_columns(array('fullname','count','select'));
$table->define_headers(array(get_string('user'),((!empty($action)) ? get_string($action) : get_string('allactions')),get_string('select')));
$actionheader = !empty($action) ? get_string($action) : get_string('allactions');

if (empty($CFG->messaging)) {
$table->define_columns(array('fullname', 'count'));
$table->define_headers(array(get_string('user'), $actionheader));
} else {
$table->define_columns(array('fullname', 'count', 'select'));
$table->define_headers(array(get_string('user'), $actionheader, get_string('select')));
}
$table->define_baseurl($baseurl);

$table->set_attribute('cellpadding','5');
Expand Down Expand Up @@ -336,10 +343,14 @@
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />'."\n";

foreach ($users as $u) {
$data = array('<a href="'.$CFG->wwwroot.'/user/view.php?id='.$u->userid.'&amp;course='.$course->id.'">'.fullname($u,true).'</a>'."\n",
((!empty($u->count)) ? get_string('yes').' ('.$u->count.') ' : get_string('no')),
'<input type="checkbox" class="usercheckbox" name="user'.$u->userid.'" value="'.$u->count.'" />'."\n",
);
$data = array();
$data[] = html_writer::link(new moodle_url('/user/view.php', array('id' => $u->userid, 'course' => $course->id)),
fullname($u, true));
$data[] = !empty($u->count) ? get_string('yes').' ('.$u->count.') ' : get_string('no');

if (!empty($CFG->messaging)) {
$data[] = '<input type="checkbox" class="usercheckbox" name="user'.$u->userid.'" value="'.$u->count.'" />';
}
$table->add_data($data);
}

Expand All @@ -357,25 +368,27 @@
echo html_writer::end_div();
}

echo '<div class="selectbuttons">';
echo '<input type="button" id="checkall" value="'.get_string('selectall').'" /> '."\n";
echo '<input type="button" id="checknone" value="'.get_string('deselectall').'" /> '."\n";
if ($perpage >= $matchcount) {
echo '<input type="button" id="checknos" value="'.get_string('selectnos').'" />'."\n";
if (!empty($CFG->messaging)) {
echo '<div class="selectbuttons">';
echo '<input type="button" id="checkall" value="'.get_string('selectall').'" /> '."\n";
echo '<input type="button" id="checknone" value="'.get_string('deselectall').'" /> '."\n";
if ($perpage >= $matchcount) {
echo '<input type="button" id="checknos" value="'.get_string('selectnos').'" />'."\n";
}
echo '</div>';
echo '<div>';
echo html_writer::label(get_string('withselectedusers'), 'formactionselect');
$displaylist['messageselect.php'] = get_string('messageselectadd');
echo html_writer::select($displaylist, 'formaction', '', array('' => 'choosedots'), array('id' => 'formactionselect'));
echo $OUTPUT->help_icon('withselectedusers');
echo '<input type="submit" value="' . get_string('ok') . '" />'."\n";
echo '</div>';
echo '</div>'."\n";
echo '</form>'."\n";
echo '</div>'."\n";

$PAGE->requires->js_init_call('M.report_participation.init');
}
echo '</div>';
echo '<div>';
echo html_writer::label(get_string('withselectedusers'), 'formactionselect');
$displaylist['messageselect.php'] = get_string('messageselectadd');
echo html_writer::select($displaylist, 'formaction', '', array(''=>'choosedots'), array('id'=>'formactionselect'));
echo $OUTPUT->help_icon('withselectedusers');
echo '<input type="submit" value="' . get_string('ok') . '" />'."\n";
echo '</div>';
echo '</div>'."\n";
echo '</form>'."\n";
echo '</div>'."\n";

$PAGE->requires->js_init_call('M.report_participation.init');
}

echo $OUTPUT->footer();

0 comments on commit 1337f77

Please sign in to comment.