Automatically generated installer lang files
[moodle.git] / grade / export / ods / index.php
CommitLineData
e060e33d 1<?php
89bd8357 2
e060e33d 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.
14//
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/>.
5c2aa198 17
89bd8357 18require_once '../../../config.php';
19require_once $CFG->dirroot.'/grade/export/lib.php';
20require_once 'grade_export_ods.php';
5c2aa198 21
caffc55a 22$id = required_param('id', PARAM_INT); // course id
89bd8357 23
a6855934 24$PAGE->set_url('/grade/export/ods/index.php', array('id'=>$id));
beebcf26 25
f400841b 26if (!$course = $DB->get_record('course', array('id'=>$id))) {
89bd8357 27 print_error('nocourseid');
28}
29
30require_login($course);
31$context = get_context_instance(CONTEXT_COURSE, $id);
32
33require_capability('moodle/grade:export', $context);
34require_capability('gradeexport/ods:view', $context);
35
b5e7b2bf 36print_grade_page_head($COURSE->id, 'export', 'ods', get_string('exportto', 'grades') . ' ' . get_string('pluginname', 'gradeexport_ods'));
abd110f8 37export_verify_grades($COURSE->id);
985d1ee1 38
0a3bdfaf 39if (!empty($CFG->gradepublishing)) {
40 $CFG->gradepublishing = has_capability('gradeexport/ods:publish', $context);
41}
42
caffc55a 43$mform = new grade_export_form(null, array('publishing' => true));
a5bc4e6e 44
666979d3 45$groupmode = groups_get_course_groupmode($course); // Groups are being used
46$currentgroup = groups_get_course_group($course, true);
47if ($groupmode == SEPARATEGROUPS and !$currentgroup and !has_capability('moodle/site:accessallgroups', $context)) {
c018f973 48 echo $OUTPUT->heading(get_string("notingroup"));
5a931394 49 echo $OUTPUT->footer();
6c3ef410 50 die;
666979d3 51}
52
a5bc4e6e 53// process post information
294ce987 54if ($data = $mform->get_data()) {
78ab98bc 55 $export = new grade_export_ods($course, $currentgroup, '', false, false, $data->display, $data->decimals, $data->export_onlyactive);
caffc55a 56
0e2d708e 57 // print the grades on screen for feedbacks
caffc55a 58 $export->process_form($data);
caffc55a 59 $export->print_continue();
567883c8 60 $export->display_preview();
5a931394 61 echo $OUTPUT->footer();
567883c8 62 exit;
985d1ee1 63}
7759d327 64
b2bc96d1 65groups_print_course_menu($course, 'index.php?id='.$id);
66echo '<div class="clearer"></div>';
caffc55a 67
a5bc4e6e 68$mform->display();
69
5a931394 70echo $OUTPUT->footer();
6c3ef410 71