Beispiel #1
0
@ini_set('default_socket_timeout', 900);
$CFG->debug = E_ALL | E_STRICT;
// === DEBUG_DEVELOPER - NOT FOR PRODUCTION SERVERS!
$CFG->debugdisplay = 1;
// NOT FOR PRODUCTION SERVERS!
require_once $CFG->libdir . '/clilib.php';
// cli only functions
require_once $CFG->dirroot . "/lib/pdflib.php";
require_once $CFG->dirroot . "/mod/assign/feedback/editpdf/fpdi/fpdi_bridge.php";
require_once $CFG->dirroot . "/mod/assign/feedback/editpdf/fpdi/fpdi.php";
require_once $CFG->dirroot . "/mod/emarking/lib/phpqrcode/phpqrcode.php";
require_once $CFG->dirroot . '/mod/emarking/lib.php';
require_once $CFG->dirroot . "/mod/emarking/locallib.php";
require_once $CFG->dirroot . '/mod/emarking/print/locallib.php';
// now get cli options
list($options, $unrecognized) = cli_get_params(array('help' => false, 'category' => 0), array('h' => 'help', 'c' => 'category'));
if ($unrecognized) {
    $unrecognized = implode("\n  ", $unrecognized);
    cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
    $help = "Processes PDF files with answers.\n\nOptions:\n-h, --help            Print out this help\n-c, --category        Print out this only exams from course in this category\n            \nExample:\n\$sudo -u www-data /usr/bin/php admin/cli/processpdfanswers.php --category 2\n";
    // TODO: localize - to be translated later when everything is finished
    echo $help;
    die;
}
cli_heading('EMarking processing PDF answers file');
// TODO: localize
emarking_process_digitized_answers();
exit(0);
// 0 means success
 public function execute()
 {
     global $CFG, $DB;
     require_once $CFG->dirroot . '/mod/emarking/print/locallib.php';
     emarking_process_digitized_answers();
 }