Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/grade/export/xml/index.php
Go to the documentation of this file.
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_xml.php';
00021 
00022 $id = required_param('id', PARAM_INT); // course id
00023 
00024 $PAGE->set_url('/grade/export/xml/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/xml:view', $context);
00035 
00036 print_grade_page_head($COURSE->id, 'export', 'xml', get_string('exportto', 'grades') . ' ' . get_string('pluginname', 'gradeexport_xml'));
00037 
00038 if (!empty($CFG->gradepublishing)) {
00039     $CFG->gradepublishing = has_capability('gradeexport/xml:publish', $context);
00040 }
00041 
00042 //'idnumberrequired'=>true excludes grade items that dont have an ID to use during import
00043 $mform = new grade_export_form(null, array('idnumberrequired'=>true, 'publishing'=>true, 'updategradesonly'=>true));
00044 
00045 $groupmode    = groups_get_course_groupmode($course);   // Groups are being used
00046 $currentgroup = groups_get_course_group($course, true);
00047 if ($groupmode == SEPARATEGROUPS and !$currentgroup and !has_capability('moodle/site:accessallgroups', $context)) {
00048     echo $OUTPUT->heading(get_string("notingroup"));
00049     echo $OUTPUT->footer();
00050     die;
00051 }
00052 
00053 // process post information
00054 if ($data = $mform->get_data()) {
00055     $export = new grade_export_xml($course, $currentgroup, '', false, $data->updatedgradesonly, $data->display, $data->decimals);
00056 
00057     // print the grades on screen for feedbacks
00058     $export->process_form($data);
00059     $export->print_continue();
00060 
00061     $export->display_preview(true); //true == skip users without idnumber as they cannot be identified when importing
00062     echo $OUTPUT->container(get_string('useridnumberwarning','gradeexport_xml'), 'useridnumberwarning mdl-align');
00063 
00064     echo $OUTPUT->footer();
00065     exit;
00066 }
00067 
00068 groups_print_course_menu($course, 'index.php?id='.$id);
00069 echo '<div class="clearer"></div>';
00070 
00071 $mform->display();
00072 
00073 echo $OUTPUT->footer();
00074 
 All Data Structures Namespaces Files Functions Variables Enumerations