. require_once '../../../config.php'; require_once $CFG->dirroot.'/grade/export/lib.php'; require_once 'grade_export_ods.php'; $id = required_param('id', PARAM_INT); // course id if (!$course = $DB->get_record('course', array('id'=>$id))) { print_error('nocourseid'); } require_login($course); $context = context_course::instance($id); $groupid = groups_get_course_group($course, true); require_capability('moodle/grade:export', $context); require_capability('gradeexport/ods:view', $context); if (groups_get_course_groupmode($COURSE) == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) { if (!groups_is_member($groupid, $USER->id)) { print_error('cannotaccessgroup', 'grades'); } } $mform = new grade_export_form(null, array('publishing' => true, 'simpleui' => true, 'multipledisplaytypes' => true)); $data = $mform->get_data(); // print all the exported data here $export = new grade_export_ods($course, $groupid, $data); $export->print_grades();