Merge branch 'MDL-52490_master' of https://github.com/dmonllao/moodle

This commit is contained in:
Dan Poltawski 2016-04-20 12:38:15 +01:00
commit 795adc89af
4 changed files with 24 additions and 11 deletions

View File

@ -46,6 +46,7 @@ class mod_assign_grading_batch_operations_form extends moodleform {
$options = array();
$options['lock'] = get_string('locksubmissions', 'assign');
$options['unlock'] = get_string('unlocksubmissions', 'assign');
$options['downloadselected'] = get_string('downloadselectedsubmissions', 'assign');
if ($instance['submissiondrafts']) {
$options['reverttodraft'] = get_string('reverttodraft', 'assign');
}

View File

@ -93,6 +93,7 @@ $string['batchoperationconfirmreverttodraft'] = 'Revert selected submissions to
$string['batchoperationconfirmaddattempt'] = 'Allow another attempt for selected submissions?';
$string['batchoperationconfirmsetmarkingworkflowstate'] = 'Set marking workflow state for all selected submissions?';
$string['batchoperationconfirmsetmarkingallocation'] = 'Set marking allocation for all selected submissions?';
$string['batchoperationconfirmdownloadselected'] = 'Download all selected submissions?';
$string['batchoperationlock'] = 'lock submissions';
$string['batchoperationunlock'] = 'unlock submissions';
$string['batchoperationreverttodraft'] = 'revert submissions to draft';
@ -133,6 +134,7 @@ $string['deleteallsubmissions'] = 'Delete all submissions';
$string['description'] = 'Description';
$string['downloadall'] = 'Download all submissions';
$string['download all submissions'] = 'Download all submissions in a zip file.';
$string['downloadselectedsubmissions'] = 'Download selected submissions in a zip file.';
$string['duedate'] = 'Due date';
$string['duedatecolon'] = 'Due date: {$a}';
$string['duedate_help'] = 'This is when the assignment is due. Submissions will still be allowed after this date but any assignments submitted after this date are marked as late. To prevent submissions after a certain date - set the assignment cut off date.';

View File

@ -2786,9 +2786,10 @@ class assign {
/**
* Download a zip file of all assignment submissions.
*
* @param array $userids Array of user ids to download assignment submissions in a zip file
* @return string - If an error occurs, this will contain the error page.
*/
protected function download_submissions() {
protected function download_submissions($userids = false) {
global $CFG, $DB;
// More efficient to load this here.
@ -2824,6 +2825,10 @@ class assign {
// Get all the files for each student.
foreach ($students as $student) {
$userid = $student->id;
// Download all assigments submission or only selected users.
if ($userids and !in_array($userid, $userids)) {
continue;
}
if ((groups_is_member($groupid, $userid) or !$groupmode or !$groupid)) {
// Get the plugins to add their own files to the zip.
@ -4084,16 +4089,20 @@ class assign {
}
}
foreach ($userlist as $userid) {
if ($data->operation == 'lock') {
$this->process_lock_submission($userid);
} else if ($data->operation == 'unlock') {
$this->process_unlock_submission($userid);
} else if ($data->operation == 'reverttodraft') {
$this->process_revert_to_draft($userid);
} else if ($data->operation == 'addattempt') {
if (!$this->get_instance()->teamsubmission) {
$this->process_add_attempt($userid);
if ($data->operation == 'downloadselected') {
$this->download_submissions($userlist);
} else {
foreach ($userlist as $userid) {
if ($data->operation == 'lock') {
$this->process_lock_submission($userid);
} else if ($data->operation == 'unlock') {
$this->process_unlock_submission($userid);
} else if ($data->operation == 'reverttodraft') {
$this->process_revert_to_draft($userid);
} else if ($data->operation == 'addattempt') {
if (!$this->get_instance()->teamsubmission) {
$this->process_add_attempt($userid);
}
}
}
}

View File

@ -1216,6 +1216,7 @@ class mod_assign_renderer extends plugin_renderer_base {
$this->page->requires->string_for_js('batchoperationconfirmreverttodraft', 'assign');
$this->page->requires->string_for_js('batchoperationconfirmunlock', 'assign');
$this->page->requires->string_for_js('batchoperationconfirmaddattempt', 'assign');
$this->page->requires->string_for_js('batchoperationconfirmdownloadselected', 'assign');
$this->page->requires->string_for_js('batchoperationconfirmsetmarkingworkflowstate', 'assign');
$this->page->requires->string_for_js('batchoperationconfirmsetmarkingallocation', 'assign');
$this->page->requires->string_for_js('editaction', 'assign');