$submitstring = get_string('download');
if (empty($features['simpleui'])) {
$submitstring = get_string('submit');
+ } else if (!empty($CFG->gradepublishing)) {
+ $submitstring = get_string('export', 'grades');
}
$this->add_action_buttons(false, $submitstring);
// Implode the grade display types array as moodle_url function doesn't accept arrays.
$displaytypes = implode(',', $this->displaytype);
}
+
+ if (!empty($this->updatedgradesonly)) {
+ $updatedgradesonly = $this->updatedgradesonly;
+ } else {
+ $updatedgradesonly = 0;
+ }
$params = array('id' => $this->course->id,
'groupid' => $this->groupid,
'itemids' => $itemidsparam,
'export_letters' => $this->export_letters,
'export_feedback' => $this->export_feedback,
- 'updatedgradesonly' => $this->updatedgradesonly,
+ 'updatedgradesonly' => $updatedgradesonly,
'decimalpoints' => $this->decimalpoints,
'export_onlyactive' => $this->onlyactive,
'usercustomfields' => $this->usercustomfields,
define('NO_MOODLE_COOKIES', true); // session not used here
require_once '../../../config.php';
+require_once($CFG->dirroot.'/grade/export/ods/grade_export_ods.php');
+
+$id = required_param('id', PARAM_INT);
+$groupid = optional_param('groupid', 0, PARAM_INT);
+$itemids = required_param('itemids', PARAM_RAW);
+$exportfeedback = optional_param('export_feedback', 0, PARAM_BOOL);
+$displaytype = optional_param('displaytype', $CFG->grade_export_displaytype, PARAM_RAW);
+$decimalpoints = optional_param('decimalpoints', $CFG->grade_export_decimalpoints, PARAM_INT);
+$onlyactive = optional_param('export_onlyactive', 0, PARAM_BOOL);
-$id = required_param('id', PARAM_INT); // course id
if (!$course = $DB->get_record('course', array('id'=>$id))) {
print_error('nocourseid');
}
}
$context = context_course::instance($id);
+require_capability('moodle/grade:export', $context);
+require_capability('gradeexport/ods:view', $context);
require_capability('gradeexport/ods:publish', $context);
-// use the same page parameters as export.php and append &key=sdhakjsahdksahdkjsahksadjksahdkjsadhksa
-require 'export.php';
+if (!groups_group_visible($groupid, $COURSE)) {
+ print_error('cannotaccessgroup', 'grades');
+}
+
+// Get all url parameters and create an object to simulate a form submission.
+$formdata = grade_export::export_bulk_export_data($id, $itemids, $exportfeedback, $onlyactive, $displaytype,
+ $decimalpoints);
+
+$export = new grade_export_ods($course, $groupid, $formdata);
+$export->print_grades();
require_once 'grade_export_ods.php';
$id = required_param('id', PARAM_INT); // course id
+$PAGE->set_url('/grade/export/ods/export.php', array('id'=>$id));
if (!$course = $DB->get_record('course', array('id'=>$id))) {
print_error('nocourseid');
require_capability('moodle/grade:export', $context);
require_capability('gradeexport/ods:view', $context);
+// We need to call this method here before any output otherwise the menu won't display.
+// If you use this method without this check, will break the direct grade exporting (without publishing).
+$key = optional_param('key', '', PARAM_RAW);
+if (!empty($CFG->gradepublishing) && !empty($key)) {
+ print_grade_page_head($COURSE->id, 'export', 'ods', get_string('exportto', 'grades') . ' ' . get_string('pluginname', 'gradeexport_ods'));
+}
+
if (groups_get_course_groupmode($COURSE) == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) {
if (!groups_is_member($groupid, $USER->id)) {
print_error('cannotaccessgroup', 'grades');
}
$mform = new grade_export_form(null, array('publishing' => true, 'simpleui' => true, 'multipledisplaytypes' => true));
$data = $mform->get_data();
-
-// print all the exported data here
$export = new grade_export_ods($course, $groupid, $data);
-$export->print_grades();
+
+// If the gradepublishing is enabled and user key is selected print the grade publishing link.
+if (!empty($CFG->gradepublishing) && !empty($key)) {
+ groups_print_course_menu($course, 'index.php?id='.$id);
+ echo $export->get_grade_publishing_url();
+ echo $OUTPUT->footer();
+} else {
+ $export->print_grades();
+}
+
define('NO_MOODLE_COOKIES', true); // session not used here
require_once '../../../config.php';
+require_once($CFG->dirroot.'/grade/export/txt/grade_export_txt.php');
+
+$id = required_param('id', PARAM_INT);
+$groupid = optional_param('groupid', 0, PARAM_INT);
+$itemids = required_param('itemids', PARAM_RAW);
+$exportfeedback = optional_param('export_feedback', 0, PARAM_BOOL);
+$separator = optional_param('separator', 'comma', PARAM_ALPHA);
+$displaytype = optional_param('displaytype', $CFG->grade_export_displaytype, PARAM_RAW);
+$decimalpoints = optional_param('decimalpoints', $CFG->grade_export_decimalpoints, PARAM_INT);
+$onlyactive = optional_param('export_onlyactive', 0, PARAM_BOOL);
-$id = required_param('id', PARAM_INT); // course id
if (!$course = $DB->get_record('course', array('id'=>$id))) {
print_error('nocourseid');
}
}
$context = context_course::instance($id);
+require_capability('moodle/grade:export', $context);
require_capability('gradeexport/txt:publish', $context);
+require_capability('gradeexport/txt:view', $context);
+
+if (!groups_group_visible($groupid, $COURSE)) {
+ print_error('cannotaccessgroup', 'grades');
+}
+
+// Get all url parameters and create an object to simulate a form submission.
+$formdata = grade_export::export_bulk_export_data($id, $itemids, $exportfeedback, $onlyactive, $displaytype,
+ $decimalpoints, null, $separator);
-// use the same page parameters as export.php and append &key=sdhakjsahdksahdkjsahksadjksahdkjsadhksa
-require 'export.php';
+$export = new grade_export_txt($course, $groupid, $formdata);
+$export->print_grades();
require_once 'grade_export_txt.php';
$id = required_param('id', PARAM_INT); // course id
+$PAGE->set_url('/grade/export/txt/export.php', array('id'=>$id));
if (!$course = $DB->get_record('course', array('id'=>$id))) {
print_error('nocourseid');
require_capability('moodle/grade:export', $context);
require_capability('gradeexport/txt:view', $context);
+// We need to call this method here before any print otherwise the menu won't display.
+// If you use this method without this check, will break the direct grade exporting (without publishing).
+$key = optional_param('key', '', PARAM_RAW);
+if (!empty($CFG->gradepublishing) && !empty($key)) {
+ print_grade_page_head($COURSE->id, 'export', 'txt', get_string('exportto', 'grades') . ' ' . get_string('pluginname', 'gradeexport_txt'));
+}
+
if (groups_get_course_groupmode($COURSE) == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) {
if (!groups_is_member($groupid, $USER->id)) {
print_error('cannotaccessgroup', 'grades');
);
$mform = new grade_export_form(null, $params);
$data = $mform->get_data();
-
-// Print all the exported data here.
$export = new grade_export_txt($course, $groupid, $data);
-$export->print_grades();
+
+// If the gradepublishing is enabled and user key is selected print the grade publishing link.
+if (!empty($CFG->gradepublishing) && !empty($key)) {
+ groups_print_course_menu($course, 'index.php?id='.$id);
+ echo $export->get_grade_publishing_url();
+ echo $OUTPUT->footer();
+} else {
+ $export->print_grades();
+}
+
define('NO_MOODLE_COOKIES', true); // session not used here
require_once '../../../config.php';
+require_once($CFG->dirroot.'/grade/export/xls/grade_export_xls.php');
+
+$id = required_param('id', PARAM_INT);
+$groupid = optional_param('groupid', 0, PARAM_INT);
+$itemids = required_param('itemids', PARAM_RAW);
+$exportfeedback = optional_param('export_feedback', 0, PARAM_BOOL);
+$displaytype = optional_param('displaytype', $CFG->grade_export_displaytype, PARAM_RAW);
+$decimalpoints = optional_param('decimalpoints', $CFG->grade_export_decimalpoints, PARAM_INT);
+$onlyactive = optional_param('export_onlyactive', 0, PARAM_BOOL);
-$id = required_param('id', PARAM_INT); // course id
if (!$course = $DB->get_record('course', array('id'=>$id))) {
print_error('nocourseid');
}
}
$context = context_course::instance($id);
+require_capability('moodle/grade:export', $context);
+require_capability('gradeexport/xls:view', $context);
require_capability('gradeexport/xls:publish', $context);
-// use the same page parameters as export.php and append &key=sdhakjsahdksahdkjsahksadjksahdkjsadhksa
-require 'export.php';
+if (!groups_group_visible($groupid, $COURSE)) {
+ print_error('cannotaccessgroup', 'grades');
+}
+
+// Get all url parameters and create an object to simulate a form submission.
+$formdata = grade_export::export_bulk_export_data($id, $itemids, $exportfeedback, $onlyactive, $displaytype,
+ $decimalpoints);
+
+$export = new grade_export_xls($course, $groupid, $formdata);
+$export->print_grades();
require_once 'grade_export_xls.php';
$id = required_param('id', PARAM_INT); // course id
+$PAGE->set_url('/grade/export/xls/export.php', array('id'=>$id));
if (!$course = $DB->get_record('course', array('id'=>$id))) {
print_error('nocourseid');
require_capability('moodle/grade:export', $context);
require_capability('gradeexport/xls:view', $context);
+// We need to call this method here before any print otherwise the menu won't display.
+// If you use this method without this check, will break the direct grade exporting (without publishing).
+$key = optional_param('key', '', PARAM_RAW);
+if (!empty($CFG->gradepublishing) && !empty($key)) {
+ print_grade_page_head($COURSE->id, 'export', 'xls', get_string('exportto', 'grades') . ' ' . get_string('pluginname', 'gradeexport_xls'));
+}
+
if (groups_get_course_groupmode($COURSE) == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) {
if (!groups_is_member($groupid, $USER->id)) {
print_error('cannotaccessgroup', 'grades');
}
$mform = new grade_export_form(null, array('publishing' => true, 'simpleui' => true, 'multipledisplaytypes' => true));
$formdata = $mform->get_data();
-
-// print all the exported data here
$export = new grade_export_xls($course, $groupid, $formdata);
-$export->print_grades();
+// If the gradepublishing is enabled and user key is selected print the grade publishing link.
+if (!empty($CFG->gradepublishing) && !empty($key)) {
+ groups_print_course_menu($course, 'index.php?id='.$id);
+ echo $export->get_grade_publishing_url();
+ echo $OUTPUT->footer();
+} else {
+ $export->print_grades();
+}
define('NO_MOODLE_COOKIES', true); // session not used here
require_once '../../../config.php';
+require_once($CFG->dirroot.'/grade/export/xml/grade_export_xml.php');
+
+$id = required_param('id', PARAM_INT);
+$groupid = optional_param('groupid', 0, PARAM_INT);
+$itemids = required_param('itemids', PARAM_RAW);
+$exportfeedback = optional_param('export_feedback', 0, PARAM_BOOL);
+$updatedgradesonly = optional_param('updatedgradesonly', false, PARAM_BOOL);
+$displaytype = optional_param('displaytype', $CFG->grade_export_displaytype, PARAM_RAW);
+$decimalpoints = optional_param('decimalpoints', $CFG->grade_export_decimalpoints, PARAM_INT);
+$onlyactive = optional_param('export_onlyactive', 0, PARAM_BOOL);
-$id = required_param('id', PARAM_INT); // course id
if (!$course = $DB->get_record('course', array('id'=>$id))) {
print_error('nocourseid');
}
}
$context = context_course::instance($id);
+require_capability('moodle/grade:export', $context);
require_capability('gradeexport/xml:publish', $context);
+require_capability('gradeexport/xml:view', $context);
+
+if (!groups_group_visible($groupid, $COURSE)) {
+ print_error('cannotaccessgroup', 'grades');
+}
+
+// Get all url parameters and create an object to simulate a form submission.
+$formdata = grade_export::export_bulk_export_data($id, $itemids, $exportfeedback, $onlyactive, $displaytype,
+ $decimalpoints, $updatedgradesonly, null);
-// use the same page parameters as export.php and append &key=sdhakjsahdksahdkjsahksadjksahdkjsadhksa
-require 'export.php';
+$export = new grade_export_xml($course, $groupid, $formdata);
+$export->print_grades();
require_once 'grade_export_xml.php';
$id = required_param('id', PARAM_INT); // course id
+$PAGE->set_url('/grade/export/xml/export.php', array('id'=>$id));
if (!$course = $DB->get_record('course', array('id'=>$id))) {
print_error('nocourseid');
require_capability('moodle/grade:export', $context);
require_capability('gradeexport/xml:view', $context);
+// We need to call this method here before any print otherwise the menu won't display.
+// If you use this method without this check, will break the direct grade exporting (without publishing).
+$key = optional_param('key', '', PARAM_RAW);
+if (!empty($CFG->gradepublishing) && !empty($key)) {
+ print_grade_page_head($COURSE->id, 'export', 'xml', get_string('exportto', 'grades') . ' ' . get_string('pluginname', 'gradeexport_xml'));
+}
+
if (groups_get_course_groupmode($COURSE) == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $context)) {
if (!groups_is_member($groupid, $USER->id)) {
print_error('cannotaccessgroup', 'grades');
}
}
$mform = new grade_export_form(null, array('publishing' => true, 'simpleui' => true, 'multipledisplaytypes' => false,
- 'idnumberrequired' => true));
+ 'idnumberrequired' => true, 'updategradesonly' => true));
$formdata = $mform->get_data();
-
-// print all the exported data here
$export = new grade_export_xml($course, $groupid, $formdata);
-$export->print_grades();
+
+// If the gradepublishing is enabled and user key is selected print the grade publishing link.
+if (!empty($CFG->gradepublishing) && !empty($key)) {
+ groups_print_course_menu($course, 'index.php?id='.$id);
+ echo $export->get_grade_publishing_url();
+ echo $OUTPUT->footer();
+} else {
+ $export->print_grades();
+}
$string['gradepreferences'] = 'Grade preferences';
$string['gradepreferenceshelp'] = 'Grade preferences Help';
$string['gradepublishing'] = 'Enable publishing';
+$string['gradepublishinglink'] = 'Download: {$a}';
$string['gradepublishing_help'] = 'Enable publishing in exports and imports: Exported grades can be accessed by accessing a URL, without having to log on to a Moodle site. Grades can be imported by accessing such a URL (which means that a Moodle site can import grades published by another site). By default only administrators may use this feature, please educate users before adding required capabilities to other roles (dangers of bookmark sharing and download accelerators, IP restrictions, etc.).';
$string['gradereport'] = 'Grade report';
$string['graderreport'] = 'Grader report';