2007-07-24 08:51:45 +00:00
|
|
|
<?php //$Id$
|
|
|
|
|
2007-05-15 08:49:49 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
// //
|
|
|
|
// NOTICE OF COPYRIGHT //
|
|
|
|
// //
|
|
|
|
// Moodle - Modular Object-Oriented Dynamic Learning Environment //
|
|
|
|
// http://moodle.com //
|
|
|
|
// //
|
2007-07-31 17:02:43 +00:00
|
|
|
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
|
2007-05-15 08:49:49 +00:00
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or //
|
|
|
|
// (at your option) any later version. //
|
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License for more details: //
|
|
|
|
// //
|
|
|
|
// http://www.gnu.org/copyleft/gpl.html //
|
|
|
|
// //
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
2007-07-18 08:13:09 +00:00
|
|
|
|
2007-07-24 08:51:45 +00:00
|
|
|
require_once '../../../config.php';
|
|
|
|
require_once $CFG->dirroot.'/grade/export/lib.php';
|
|
|
|
require_once 'grade_export_xml.php';
|
2007-07-18 08:13:09 +00:00
|
|
|
|
2007-07-24 08:51:45 +00:00
|
|
|
$id = required_param('id', PARAM_INT); // course id
|
2007-05-15 08:49:49 +00:00
|
|
|
$feedback = optional_param('feedback', '', PARAM_ALPHA);
|
2007-07-18 19:56:07 +00:00
|
|
|
|
2007-07-24 08:51:45 +00:00
|
|
|
if (!$course = get_record('course', 'id', $id)) {
|
|
|
|
print_error('nocourseid');
|
|
|
|
}
|
|
|
|
|
|
|
|
require_login($course);
|
|
|
|
$context = get_context_instance(CONTEXT_COURSE, $id);
|
|
|
|
|
|
|
|
require_capability('moodle/grade:export', $context);
|
|
|
|
require_capability('gradeexport/xml:view', $context);
|
|
|
|
|
|
|
|
|
2007-07-17 03:32:10 +00:00
|
|
|
$strgrades = get_string('grades', 'grades');
|
2007-07-23 08:13:59 +00:00
|
|
|
$actionstr = get_string('modulename', 'gradeexport_xml');
|
2007-08-01 06:47:35 +00:00
|
|
|
$navigation = grade_build_nav(__FILE__, $actionstr, array('courseid' => $course->id));
|
|
|
|
|
|
|
|
print_header($course->shortname.': '.get_string('grades'), $course->fullname, $navigation);
|
2007-07-30 06:28:41 +00:00
|
|
|
print_grade_plugin_selector($id, 'export', 'xml');
|
2007-05-15 08:49:49 +00:00
|
|
|
// process post information
|
2007-05-18 08:49:00 +00:00
|
|
|
if (($data = data_submitted()) && confirm_sesskey()) {
|
2007-05-16 08:21:46 +00:00
|
|
|
|
|
|
|
if (!is_array($data->itemids)) {
|
|
|
|
$itemidsurl = $data->itemids;
|
|
|
|
} else {
|
|
|
|
$itemidsurl = implode(",",$data->itemids);
|
|
|
|
}
|
2007-07-18 19:56:07 +00:00
|
|
|
|
2007-05-15 08:49:49 +00:00
|
|
|
// print the grades on screen for feedbacks
|
2007-07-18 19:56:07 +00:00
|
|
|
|
2007-08-13 04:19:01 +00:00
|
|
|
$export = new grade_export($id, $data->itemids, $data->export_letters);
|
2007-08-13 08:50:17 +00:00
|
|
|
$export->display_grades($feedback, $data->previewrows);
|
2007-07-18 19:56:07 +00:00
|
|
|
|
2007-05-16 08:21:46 +00:00
|
|
|
// this redirect should trigger a download prompt
|
2007-08-13 08:22:56 +00:00
|
|
|
redirect('export.php?id='.$id.'&itemids='.$itemidsurl.'&export_letters='.$data->export_letters);
|
2007-05-24 02:16:31 +00:00
|
|
|
exit;
|
2007-05-15 08:49:49 +00:00
|
|
|
}
|
2007-07-03 06:20:07 +00:00
|
|
|
|
2007-08-13 09:29:12 +00:00
|
|
|
print_gradeitem_selections($id, array('plugin'=>'xmlexport'));
|
2007-05-22 02:05:00 +00:00
|
|
|
print_footer();
|
2007-07-23 08:13:59 +00:00
|
|
|
?>
|