Example #1
0
    die;
}
$printers = explode(',', $CFG->emarking_printername);
if (count($printers) <= 0) {
    print_error('No printers cnofigured. Please notify administrator.');
}
$url = new moodle_url('/mod/emarking/printexam.php', array('exam' => $exam->id));
$PAGE->set_pagelayout('incourse');
$PAGE->set_popup_notification_allowed(false);
$PAGE->set_url($url);
$PAGE->set_context($context);
$PAGE->set_course($course);
$PAGE->set_title(get_string('processtitle', 'mod_emarking'));
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add(get_string('printexam', 'mod_emarking'));
$form = new emarking_printexam_form(null, array('examid' => $exam->id));
if ($form->is_cancelled()) {
    $continue_url = new moodle_url('/mod/emarking/printorders.php', array('category' => $course->category));
    redirect($continue_url);
}
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('printexam', 'mod_emarking'));
$result = exec('lpstat -p -d');
$parts = explode(":", $result);
if (count($parts) != 2) {
    print_error('Invalid printer setup. You must install cups and set a default printer for eMarking to be able to print.');
} else {
    $printer = strtoupper(trim($parts[1]));
    echo $OUTPUT->box('Default printer: ' . $printer);
}
if ($form->get_data()) {
Example #2
0
    $printers = $DB->get_records("emarking_users_printers");
} else {
    if (!($printers = $DB->get_records("emarking_users_printers", array("id_user" => $USER->id)))) {
        print_error('No printers configured. Please notify administrator.');
    }
}
$url = new moodle_url('/mod/emarking/print/printexam.php', array('exam' => $exam->id));
$PAGE->set_pagelayout('incourse');
$PAGE->set_popup_notification_allowed(false);
$PAGE->set_url($url);
$PAGE->set_context($context);
$PAGE->set_course($course);
$PAGE->set_title(get_string('emarking', 'mod_emarking'));
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add(get_string('printexam', 'mod_emarking'));
$form = new emarking_printexam_form(null, array('examid' => $exam->id, 'debug' => $debugprinting), 'get');
if ($form->is_cancelled()) {
    $continue_url = new moodle_url('/mod/emarking/print/printorders.php', array('category' => $course->category));
    redirect($continue_url);
    die;
}
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('printexam', 'mod_emarking'));
// Default printer
$result = exec('lpstat -p -d');
$parts = explode(":", $result);
if (!$debugprinting) {
    if (count($parts) != 2) {
        echo $OUTPUT->notification('Invalid printer setup. 
				You must install cups and set a default printer for eMarking to be able to print.', 'notifyproblem');
        echo $OUTPUT->footer();