. defined('MOODLE_INTERNAL') || die(); /** * A hook function that will process the data and insert the rating value. * The function must be called on the desired page like https://www.moodle.loc/mod/quiz/report.php?id=2&mode=grading&slot=1&qid=1&grade=needsgrading&includeauto=1 * * @return void */ function local_asystgrade_before_footer() { global $PAGE; // Obtaining parameters from URL $qid = optional_param('qid', null, PARAM_INT); $slot = optional_param('slot', false, PARAM_INT); if ($PAGE->url->compare(new moodle_url('/mod/quiz/report.php'), URL_MATCH_BASE) && $slot) { $js_data = [ 'apiendpoint' => 'http://flask:5000/api/autograde', 'qid' => $qid, 'slot' => $slot ]; $PAGE->requires->js(new moodle_url('/local/asystgrade/js/grade.js', ['v' => time()])); $PAGE->requires->js_init_call('M.local_asystgrade.init', [$js_data]); } }