MDL-11515:
[moodle-linuxchix.git] / grade / export / ods / index.php
blob36015d13c4e017c89895cdad43a23fb50750190a
1 <?php //$Id$
3 ///////////////////////////////////////////////////////////////////////////
4 // //
5 // NOTICE OF COPYRIGHT //
6 // //
7 // Moodle - Modular Object-Oriented Dynamic Learning Environment //
8 // http://moodle.com //
9 // //
10 // Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
11 // //
12 // This program is free software; you can redistribute it and/or modify //
13 // it under the terms of the GNU General Public License as published by //
14 // the Free Software Foundation; either version 2 of the License, or //
15 // (at your option) any later version. //
16 // //
17 // This program is distributed in the hope that it will be useful, //
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
20 // GNU General Public License for more details: //
21 // //
22 // http://www.gnu.org/copyleft/gpl.html //
23 // //
24 ///////////////////////////////////////////////////////////////////////////
26 require_once '../../../config.php';
27 require_once $CFG->dirroot.'/grade/export/lib.php';
28 require_once 'grade_export_ods.php';
30 $id = required_param('id', PARAM_INT); // course id
32 if (!$course = get_record('course', 'id', $id)) {
33 print_error('nocourseid');
36 require_login($course);
37 $context = get_context_instance(CONTEXT_COURSE, $id);
39 require_capability('moodle/grade:export', $context);
40 require_capability('gradeexport/ods:view', $context);
43 $strgrades = get_string('grades', 'grades');
44 $actionstr = get_string('modulename', 'gradeexport_ods');
45 $navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course->id));
47 print_header($course->shortname.': '.get_string('grades'), $course->fullname, $navigation);
48 print_grade_plugin_selector($id, 'export', 'ods');
50 if (!empty($CFG->gradepublishing)) {
51 $CFG->gradepublishing = has_capability('gradeexport/ods:publish', $context);
54 $mform = new grade_export_form(null, array('publishing' => true));
56 // process post information
57 if ($data = $mform->get_data()) {
58 $export = new grade_export_ods($course, groups_get_course_group($course));
60 // print the grades on screen for feedbacks
61 $export->process_form($data);
62 $export->print_continue();
63 $export->display_preview();
64 print_footer($course);
65 exit;
68 groups_print_course_menu($course, 'index.php?id='.$id);
69 echo '<div class="clearer"></div>';
71 $mform->display();
73 print_footer();