Merge branch 'MDL-27920_grade_export' of git://github.com/andyjdavis/moodle
This commit is contained in:
@@ -230,7 +230,7 @@ abstract class grade_export {
|
||||
}
|
||||
$user = $userdata->user;
|
||||
if ($require_user_idnumber and empty($user->idnumber)) {
|
||||
// some exports require user idnumber
|
||||
// some exports require user idnumber so we can match up students when importing the data
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class grade_export_xml extends grade_export {
|
||||
$user = $userdata->user;
|
||||
|
||||
if (empty($user->idnumber)) {
|
||||
//id number must exist
|
||||
//id number must exist otherwise we cant match up students when importing
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ if (!empty($CFG->gradepublishing)) {
|
||||
$CFG->gradepublishing = has_capability('gradeexport/xml:publish', $context);
|
||||
}
|
||||
|
||||
//'idnumberrequired'=>true excludes grade items that dont have an ID to use during import
|
||||
$mform = new grade_export_form(null, array('idnumberrequired'=>true, 'publishing'=>true, 'updategradesonly'=>true));
|
||||
|
||||
$groupmode = groups_get_course_groupmode($course); // Groups are being used
|
||||
@@ -56,7 +57,10 @@ if ($data = $mform->get_data()) {
|
||||
// print the grades on screen for feedbacks
|
||||
$export->process_form($data);
|
||||
$export->print_continue();
|
||||
$export->display_preview(true);
|
||||
|
||||
$export->display_preview(true); //true == skip users without idnumber as they cannot be identified when importing
|
||||
echo $OUTPUT->container(get_string('useridnumberwarning','gradeexport_xml'), 'useridnumberwarning mdl-align');
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -26,3 +26,4 @@
|
||||
$string['pluginname'] = 'XML file';
|
||||
$string['xml:publish'] = 'Publish XML grade export';
|
||||
$string['xml:view'] = 'Use XML grade export';
|
||||
$string['useridnumberwarning'] = 'User\'s without an ID number are excluded from the XML export as they cannot be imported';
|
||||
+6
-7
@@ -235,7 +235,6 @@ class graded_users_iterator {
|
||||
$result->user = $user;
|
||||
$result->grades = $grades;
|
||||
$result->feedbacks = $feedbacks;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -271,20 +270,20 @@ class graded_users_iterator {
|
||||
/**
|
||||
* _pop
|
||||
*
|
||||
* @return void
|
||||
* @return object current grade object
|
||||
*/
|
||||
function _pop() {
|
||||
global $DB;
|
||||
if (empty($this->gradestack)) {
|
||||
if (!$this->grades_rs) {
|
||||
if (empty($this->grades_rs) || !$this->grades_rs->valid()) {
|
||||
return null; // no grades present
|
||||
}
|
||||
|
||||
if ($this->grades_rs->next()) {
|
||||
return null; // no more grades
|
||||
}
|
||||
$current = $this->grades_rs->current();
|
||||
|
||||
return $this->grades_rs->current();
|
||||
$this->grades_rs->next();
|
||||
|
||||
return $current;
|
||||
} else {
|
||||
return array_pop($this->gradestack);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user