Exemple #1
0
    redirect($url, get_string('transactionsuccessfull', 'mod_emarking'));
    die;
}
// If the form is being downloaded.
if ($examid && $downloadform) {
    if (!($newexam = $DB->get_record("emarking_exams", array("id" => $examid)))) {
        print_error(get_string('invalidcategoryid', 'mod_emarking'));
    }
    if (!($course = $DB->get_record("course", array("id" => $newexam->course)))) {
        print_error(get_string('invalidcategoryid', 'mod_emarking'));
    }
    if (!($coursecat = $DB->get_record("course_categories", array("id" => $course->category)))) {
        print_error(get_string('invalidcategoryid', 'mod_emarking'));
    }
    $requestedbyuser = $DB->get_record("user", array("id" => $newexam->requestedby));
    emarking_create_printform($context, $newexam, $USER, $requestedbyuser, $coursecat, $course);
    die;
}
$ordersurl = new moodle_url('/mod/emarking/print/printorders.php', array('category' => $categoryid, 'status' => $statusicon));
$categoryurl = new moodle_url('/course/index.php', array('categoryid' => $categoryid));
$pagetitle = $statusicon == 1 ? get_string('printorders', 'mod_emarking') : get_string('records', 'mod_emarking');
$PAGE->set_context($context);
$PAGE->set_url($url);
$PAGE->requires->js('/mod/emarking/js/printorders.js');
$PAGE->set_pagelayout('course');
$PAGE->navbar->add($category->name, $categoryurl);
$PAGE->navbar->add(get_string('printorders', 'mod_emarking'), $ordersurl);
$PAGE->navbar->add($pagetitle);
$PAGE->set_heading(get_site()->fullname);
$PAGE->set_title(get_string('emarking', 'mod_emarking'));
// Require jquery for modal.
Exemple #2
0
// The context for the page is a course
if ($cmid > 0) {
    $context = context_module::instance($cm->id);
} else {
    $context = context_course::instance($course->id);
}
// First check that the user is logged in
require_login();
if (isguestuser()) {
    die;
}
$newexam = $DB->get_record('emarking_exams', array('id' => $examid));
if ($newexam && $downloadform) {
    $coursecat = $DB->get_record('course_categories', array('id' => $course->category));
    $requestedbyuser = $DB->get_record('user', array('id' => $newexam->requestedby));
    emarking_create_printform($context, $newexam, $USER, $requestedbyuser, $coursecat, emarking_exam_total_pages_to_print($newexam), $course);
    die;
}
require_capability('mod/emarking:grade', $context);
// URL for current page and eMarking home
$url = new moodle_url('/mod/emarking/exams.php', array('id' => $cmid, 'course' => $course->id));
if ($cmid > 0) {
    $urladd = new moodle_url('/mod/emarking/newprintorder.php', array('cm' => $cm->id));
} else {
    $urladd = new moodle_url('/mod/emarking/newprintorder.php', array('course' => $course->id));
}
$PAGE->set_url($url);
$PAGE->requires->js('/mod/emarking/js/printorders.js');
$PAGE->set_context($context);
$PAGE->set_course($course);
if ($cmid > 0) {