MDL-46088 quiz secure window: further Atto JS fixes.
[moodle.git] / grade / export / txt / export.php
blob3ddcb59cd10f2a1f3d345431be6aaaf103ba9f09
1 <?php
3 // This file is part of Moodle - http://moodle.org/
4 //
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 require_once '../../../config.php';
19 require_once $CFG->dirroot.'/grade/export/lib.php';
20 require_once 'grade_export_txt.php';
22 $id = required_param('id', PARAM_INT); // course id
23 $groupid = optional_param('groupid', 0, PARAM_INT);
24 $itemids = required_param('itemids', PARAM_RAW);
25 $export_feedback = optional_param('export_feedback', 0, PARAM_BOOL);
26 $separator = optional_param('separator', 'comma', PARAM_ALPHA);
27 $updatedgradesonly = optional_param('updatedgradesonly', false, PARAM_BOOL);
28 $displaytype = optional_param('displaytype', $CFG->grade_export_displaytype, PARAM_INT);
29 $decimalpoints = optional_param('decimalpoints', $CFG->grade_export_decimalpoints, PARAM_INT);
30 $onlyactive = optional_param('export_onlyactive', 0, PARAM_BOOL);
32 if (!$course = $DB->get_record('course', array('id'=>$id))) {
33 print_error('nocourseid');
36 require_login($course);
37 $context = context_course::instance($id);
39 require_capability('moodle/grade:export', $context);
40 require_capability('gradeexport/txt:view', $context);
42 if (groups_get_course_groupmode($COURSE) == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) {
43 if (!groups_is_member($groupid, $USER->id)) {
44 print_error('cannotaccessgroup', 'grades');
48 // print all the exported data here
49 $export = new grade_export_txt($course, $groupid, $itemids, $export_feedback, $updatedgradesonly, $displaytype, $decimalpoints, $separator, $onlyactive, true);
50 $export->print_grades();