$blockname = quickmail::_s('pluginname'); $header = quickmail::_s($type); $PAGE->set_context($context); $PAGE->set_course($course); $PAGE->navbar->add($blockname); $PAGE->navbar->add($header); $PAGE->set_title($blockname . ': ' . $header); $PAGE->set_heading($blockname . ': ' . $header); $PAGE->set_url('/blocks/quickmail/emaillog.php', array('courseid' => $courseid)); $PAGE->set_pagetype(quickmail::PAGE_TYPE); $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'));
static function draft_cleanup($contextid, $itemid) { return quickmail::cleanup('block_quickmail_drafts', $contextid, $itemid); }