$dbtable = 'block_quickmail_' . $type; $params = array('userid' => $userid, 'courseid' => $courseid); $count = $DB->count_records($dbtable, $params); switch ($action) { case "confirm": if (quickmail::cleanup($dbtable, $context->id, $typeid)) { $url = new moodle_url('/blocks/quickmail/emaillog.php', array('courseid' => $courseid, 'type' => $type)); redirect($url); } else { print_error('delete_failed', 'block_quickmail', '', $typeid); } case "delete": $html = quickmail::delete_dialog($courseid, $type, $typeid); break; default: $html = quickmail::list_entries($courseid, $type, $page, $perpage, $userid, $count, $can_delete); } if ($courseid == SITEID) { $html .= html_writer::link(new moodle_url('/blocks/quickmail/admin_email.php'), quickmail::_s('composenew')); } else { $html .= html_writer::link(new moodle_url('/blocks/quickmail/email.php', array('courseid' => $courseid)), quickmail::_s('composenew')); } if ($canimpersonate and $USER->id != $userid) { $user = $DB->get_record('user', array('id' => $userid)); // http://docs.moodle.org/dev/Additional_name_fields $header .= ' for ' . fullname($user); } echo $OUTPUT->header(); echo $OUTPUT->heading($header); if ($canimpersonate) { $get_name_string = 'u.firstname, u.lastname';