|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00018 require_once '../../../config.php'; 00019 require_once $CFG->dirroot.'/grade/export/lib.php'; 00020 require_once 'grade_export_ods.php'; 00021 00022 $id = required_param('id', PARAM_INT); // course id 00023 00024 $PAGE->set_url('/grade/export/ods/index.php', array('id'=>$id)); 00025 00026 if (!$course = $DB->get_record('course', array('id'=>$id))) { 00027 print_error('nocourseid'); 00028 } 00029 00030 require_login($course); 00031 $context = get_context_instance(CONTEXT_COURSE, $id); 00032 00033 require_capability('moodle/grade:export', $context); 00034 require_capability('gradeexport/ods:view', $context); 00035 00036 print_grade_page_head($COURSE->id, 'export', 'ods', get_string('exportto', 'grades') . ' ' . get_string('pluginname', 'gradeexport_ods')); 00037 00038 if (!empty($CFG->gradepublishing)) { 00039 $CFG->gradepublishing = has_capability('gradeexport/ods:publish', $context); 00040 } 00041 00042 $mform = new grade_export_form(null, array('publishing' => true)); 00043 00044 $groupmode = groups_get_course_groupmode($course); // Groups are being used 00045 $currentgroup = groups_get_course_group($course, true); 00046 if ($groupmode == SEPARATEGROUPS and !$currentgroup and !has_capability('moodle/site:accessallgroups', $context)) { 00047 echo $OUTPUT->heading(get_string("notingroup")); 00048 echo $OUTPUT->footer(); 00049 die; 00050 } 00051 00052 // process post information 00053 if ($data = $mform->get_data()) { 00054 $export = new grade_export_ods($course, $currentgroup, '', false, false, $data->display, $data->decimals); 00055 00056 // print the grades on screen for feedbacks 00057 $export->process_form($data); 00058 $export->print_continue(); 00059 $export->display_preview(); 00060 echo $OUTPUT->footer(); 00061 exit; 00062 } 00063 00064 groups_print_course_menu($course, 'index.php?id='.$id); 00065 echo '<div class="clearer"></div>'; 00066 00067 $mform->display(); 00068 00069 echo $OUTPUT->footer(); 00070