Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
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/>.
17
 
18
require_once '../../../config.php';
19
require_once $CFG->dirroot.'/grade/export/lib.php';
20
require_once 'grade_export_xml.php';
21
 
22
$id = required_param('id', PARAM_INT); // course id
23
 
24
$PAGE->set_url('/grade/export/xml/index.php', array('id'=>$id));
25
 
26
if (!$course = $DB->get_record('course', array('id'=>$id))) {
27
    throw new \moodle_exception('invalidcourseid');
28
}
29
 
30
require_login($course);
31
$context = context_course::instance($id);
32
 
33
require_capability('moodle/grade:export', $context);
34
require_capability('gradeexport/xml:view', $context);
35
 
36
$actionbar = new \core_grades\output\export_action_bar($context, null, 'xml');
37
print_grade_page_head($COURSE->id, 'export', 'xml',
38
    get_string('exportto', 'grades') . ' ' . get_string('pluginname', 'gradeexport_xml'),
39
    false, false, true, null, null, null, $actionbar);
40
export_verify_grades($COURSE->id);
41
 
42
if (!empty($CFG->gradepublishing)) {
43
    $CFG->gradepublishing = has_capability('gradeexport/xml:publish', $context);
44
}
45
 
46
$actionurl = new moodle_url('/grade/export/xml/export.php');
47
// The option 'idnumberrequired' excludes grade items that dont have an ID to use during import.
48
$formoptions = array(
49
    'idnumberrequired' => true,
50
    'updategradesonly' => true,
51
    'publishing' => true,
52
    'simpleui' => true,
53
    'multipledisplaytypes' => false
54
);
55
 
56
$mform = new grade_export_form($actionurl, $formoptions);
57
 
58
$groupmode    = groups_get_course_groupmode($course);   // Groups are being used.
59
$currentgroup = groups_get_course_group($course, true);
60
if (($groupmode == SEPARATEGROUPS) &&
61
    (!$currentgroup) &&
62
    (!has_capability('moodle/site:accessallgroups', $context))) {
63
    echo $OUTPUT->heading(get_string("notingroup"));
64
    echo $OUTPUT->footer();
65
    die;
66
}
67
 
68
groups_print_course_menu($course, 'index.php?id='.$id);
69
echo '<div class="clearer"></div>';
70
 
71
$mform->display();
72
 
73
echo $OUTPUT->footer();
74