mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 14:02:32 +02:00
MDL-46548 grades: Update ods grade export to support one step exports.
This commit is contained in:
parent
cca51baa07
commit
1cc43058a8
@ -20,13 +20,6 @@ require_once $CFG->dirroot.'/grade/export/lib.php';
|
||||
require_once 'grade_export_ods.php';
|
||||
|
||||
$id = required_param('id', PARAM_INT); // course id
|
||||
$groupid = optional_param('groupid', 0, PARAM_INT);
|
||||
$itemids = required_param('itemids', PARAM_RAW);
|
||||
$export_feedback = optional_param('export_feedback', 0, PARAM_BOOL);
|
||||
$updatedgradesonly = optional_param('updatedgradesonly', false, PARAM_BOOL);
|
||||
$displaytype = optional_param('displaytype', $CFG->grade_export_displaytype, PARAM_INT);
|
||||
$decimalpoints = optional_param('decimalpoints', $CFG->grade_export_decimalpoints, PARAM_INT);
|
||||
$onlyactive = optional_param('export_onlyactive', 0, PARAM_BOOL);
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
||||
print_error('nocourseid');
|
||||
@ -34,6 +27,7 @@ if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
||||
|
||||
require_login($course);
|
||||
$context = context_course::instance($id);
|
||||
$groupid = groups_get_course_group($course, true);
|
||||
|
||||
require_capability('moodle/grade:export', $context);
|
||||
require_capability('gradeexport/ods:view', $context);
|
||||
@ -43,9 +37,11 @@ if (groups_get_course_groupmode($COURSE) == SEPARATEGROUPS and !has_capability('
|
||||
print_error('cannotaccessgroup', 'grades');
|
||||
}
|
||||
}
|
||||
$mform = new grade_export_form(null, array('publishing' => true, 'simpleui' => true));
|
||||
$data = $mform->get_data();
|
||||
|
||||
// print all the exported data here
|
||||
$export = new grade_export_ods($course, $groupid, $itemids, $export_feedback, $updatedgradesonly, $displaytype, $decimalpoints, $onlyactive, true);
|
||||
$export = new grade_export_ods($course, $groupid, $data);
|
||||
$export->print_grades();
|
||||
|
||||
|
||||
|
@ -40,29 +40,25 @@ if (!empty($CFG->gradepublishing)) {
|
||||
$CFG->gradepublishing = has_capability('gradeexport/ods:publish', $context);
|
||||
}
|
||||
|
||||
$mform = new grade_export_form(null, array('publishing' => true));
|
||||
$actionurl = new moodle_url('/grade/export/ods/export.php');
|
||||
$formoptions = array(
|
||||
'publishing' => true,
|
||||
'simpleui' => true
|
||||
);
|
||||
|
||||
$groupmode = groups_get_course_groupmode($course); // Groups are being used
|
||||
$mform = new grade_export_form($actionurl, $formoptions);
|
||||
|
||||
$groupmode = groups_get_course_groupmode($course); // Groups are being used.
|
||||
$currentgroup = groups_get_course_group($course, true);
|
||||
if ($groupmode == SEPARATEGROUPS and !$currentgroup and !has_capability('moodle/site:accessallgroups', $context)) {
|
||||
|
||||
if (($groupmode == SEPARATEGROUPS) &&
|
||||
(!$currentgroup) &&
|
||||
(!has_capability('moodle/site:accessallgroups', $context))) {
|
||||
echo $OUTPUT->heading(get_string("notingroup"));
|
||||
echo $OUTPUT->footer();
|
||||
die;
|
||||
}
|
||||
|
||||
// process post information
|
||||
if ($data = $mform->get_data()) {
|
||||
$onlyactive = $data->export_onlyactive || !has_capability('moodle/course:viewsuspendedusers', $context);
|
||||
$export = new grade_export_ods($course, $currentgroup, '', false, false, $data->display, $data->decimals, $onlyactive, true);
|
||||
|
||||
// print the grades on screen for feedbacks
|
||||
$export->process_form($data);
|
||||
$export->print_continue();
|
||||
$export->display_preview();
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
groups_print_course_menu($course, 'index.php?id='.$id);
|
||||
echo '<div class="clearer"></div>';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user