2009-07-07 02:26:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// This file is part of Moodle - http://moodle.org/
|
|
|
|
//
|
|
|
|
// Moodle 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 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// Moodle 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.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
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_txt.php';
|
2007-07-18 08:13:09 +00:00
|
|
|
|
2007-08-31 18:42:50 +00:00
|
|
|
$id = required_param('id', PARAM_INT); // course id
|
2007-07-24 08:51:45 +00:00
|
|
|
|
2010-01-16 15:39:56 +00:00
|
|
|
$PAGE->set_url('/grade/export/txt/index.php', array('id'=>$id));
|
2009-10-15 06:58:21 +00:00
|
|
|
|
2008-06-01 17:59:13 +00:00
|
|
|
if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
2022-04-12 09:38:41 +05:30
|
|
|
throw new \moodle_exception('invalidcourseid');
|
2007-07-24 08:51:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
require_login($course);
|
2012-07-24 14:04:40 +08:00
|
|
|
$context = context_course::instance($id);
|
2007-07-24 08:51:45 +00:00
|
|
|
|
|
|
|
require_capability('moodle/grade:export', $context);
|
|
|
|
require_capability('gradeexport/txt:view', $context);
|
|
|
|
|
2022-08-20 15:40:26 +10:00
|
|
|
$actionbar = new \core_grades\output\export_action_bar($context, null, 'txt');
|
2021-10-27 11:47:00 +08:00
|
|
|
print_grade_page_head($COURSE->id, 'export', 'txt',
|
|
|
|
get_string('exportto', 'grades') . ' ' . get_string('pluginname', 'gradeexport_txt'),
|
|
|
|
false, false, true, null, null, null, $actionbar);
|
2013-04-29 10:15:08 +08:00
|
|
|
export_verify_grades($COURSE->id);
|
2007-05-16 08:21:46 +00:00
|
|
|
|
2007-09-27 06:51:54 +00:00
|
|
|
if (!empty($CFG->gradepublishing)) {
|
|
|
|
$CFG->gradepublishing = has_capability('gradeexport/txt:publish', $context);
|
|
|
|
}
|
|
|
|
|
2014-07-31 10:06:21 +08:00
|
|
|
$actionurl = new moodle_url('/grade/export/txt/export.php');
|
|
|
|
$formoptions = array(
|
|
|
|
'includeseparator'=>true,
|
|
|
|
'publishing' => true,
|
2014-08-22 10:50:08 +08:00
|
|
|
'simpleui' => true,
|
|
|
|
'multipledisplaytypes' => true
|
2014-07-31 10:06:21 +08:00
|
|
|
);
|
2007-08-29 12:38:23 +00:00
|
|
|
|
2014-07-31 10:06:21 +08:00
|
|
|
$mform = new grade_export_form($actionurl, $formoptions);
|
|
|
|
|
|
|
|
$groupmode = groups_get_course_groupmode($course); // Groups are being used.
|
2009-05-04 13:15:00 +00:00
|
|
|
$currentgroup = groups_get_course_group($course, true);
|
2014-07-31 10:06:21 +08:00
|
|
|
if (($groupmode == SEPARATEGROUPS) &&
|
|
|
|
(!$currentgroup) &&
|
|
|
|
(!has_capability('moodle/site:accessallgroups', $context))) {
|
|
|
|
|
2009-08-06 08:16:46 +00:00
|
|
|
echo $OUTPUT->heading(get_string("notingroup"));
|
2009-08-06 14:12:17 +00:00
|
|
|
echo $OUTPUT->footer();
|
2009-11-01 12:11:29 +00:00
|
|
|
die;
|
2009-05-04 13:15:00 +00:00
|
|
|
}
|
|
|
|
|
2007-09-06 10:19:24 +00:00
|
|
|
groups_print_course_menu($course, 'index.php?id='.$id);
|
|
|
|
echo '<div class="clearer"></div>';
|
2007-08-31 18:42:50 +00:00
|
|
|
|
2007-05-24 08:57:36 +00:00
|
|
|
$mform->display();
|
2007-05-18 08:49:00 +00:00
|
|
|
|
2009-08-06 14:12:17 +00:00
|
|
|
echo $OUTPUT->footer();
|
2009-11-01 12:11:29 +00:00
|
|
|
|