Merge branch 'MDL-81872-main' of https://github.com/sarjona/moodle
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
issueNumber: MDL-81872
|
||||
notes:
|
||||
core_course:
|
||||
- message: >+
|
||||
The reset course page has been improved. The "Delete" or "Remove" wording have been removed from all the options to make it easier to focus on the data to be removed and avoid inconsistencies and duplicated information.
|
||||
Third party plugins implementing reset methods might need to:
|
||||
|
||||
- Add static element in the _reset_course_form_definition method before all the options with the Delete string:
|
||||
`$mform->addElement('static', 'assigndelete', get_string('delete'));`
|
||||
- Review all the strings used in the reset page to remove the "Delete" or "Remove" words from them.
|
||||
|
||||
type: changed
|
||||
+22
-17
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
@@ -22,9 +21,9 @@
|
||||
* specific data. Each module must be modified to take advantage of this new feature.
|
||||
* The feature will also reset the start date of the course if necessary.
|
||||
*
|
||||
* @package core_course
|
||||
* @copyright Mark Flach and moodle.com
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @package course
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require('../config.php');
|
||||
@@ -35,11 +34,11 @@ require_once($CFG->dirroot . '/backup/util/helper/backup_helper.class.php');
|
||||
|
||||
$id = required_param('id', PARAM_INT);
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
||||
throw new \moodle_exception("invalidcourseid");
|
||||
if (!$course = $DB->get_record('course', ['id' => $id])) {
|
||||
throw new \moodle_exception('invalidcourseid');
|
||||
}
|
||||
|
||||
$PAGE->set_url('/course/reset.php', array('id'=>$id));
|
||||
$PAGE->set_url('/course/reset.php', ['id' => $id]);
|
||||
$PAGE->set_pagelayout('admin');
|
||||
|
||||
require_login($course);
|
||||
@@ -56,17 +55,17 @@ $PAGE->set_secondary_active_tab('coursereuse');
|
||||
$mform = new course_reset_form();
|
||||
|
||||
if ($mform->is_cancelled()) {
|
||||
redirect($CFG->wwwroot.'/course/view.php?id='.$id);
|
||||
redirect($CFG->wwwroot . '/course/view.php?id='.$id);
|
||||
|
||||
} else if ($data = $mform->get_data()) { // no magic quotes
|
||||
} else if ($data = $mform->get_data()) { // No magic quotes.
|
||||
|
||||
if (isset($data->selectdefault)) {
|
||||
$_POST = array();
|
||||
$_POST = [];
|
||||
$mform = new course_reset_form();
|
||||
$mform->load_defaults();
|
||||
|
||||
} else if (isset($data->deselectall)) {
|
||||
$_POST = array();
|
||||
$_POST = [];
|
||||
$mform = new course_reset_form();
|
||||
|
||||
} else {
|
||||
@@ -77,24 +76,30 @@ if ($mform->is_cancelled()) {
|
||||
$data->reset_end_date_old = $course->enddate;
|
||||
$status = reset_course_userdata($data);
|
||||
|
||||
$data = array();
|
||||
$data = [];
|
||||
foreach ($status as $item) {
|
||||
$line = array();
|
||||
$line = [];
|
||||
$line[] = $item['component'];
|
||||
$line[] = $item['item'];
|
||||
$line[] = ($item['error'] === false) ? get_string('statusok') : '<div class="notifyproblem">'.$item['error'].'</div>';
|
||||
if ($item['error'] === false) {
|
||||
$line[] = get_string('statusdone');
|
||||
} else {
|
||||
$line[] = '<div class="text-danger">' .
|
||||
$OUTPUT->pix_icon('i/invalid', get_string('error')) . $item['error'] .
|
||||
'</div>';
|
||||
}
|
||||
$data[] = $line;
|
||||
}
|
||||
|
||||
$table = new html_table();
|
||||
$table->head = array(get_string('resetcomponent'), get_string('resettask'), get_string('resetstatus'));
|
||||
$table->size = array('20%', '40%', '40%');
|
||||
$table->align = array('left', 'left', 'left');
|
||||
$table->head = [get_string('resetcomponent'), get_string('resettask'), get_string('resetstatus')];
|
||||
$table->size = ['20%', '40%', '40%'];
|
||||
$table->align = ['left', 'left', 'left'];
|
||||
$table->width = '80%';
|
||||
$table->data = $data;
|
||||
echo html_writer::table($table);
|
||||
|
||||
echo $OUTPUT->continue_button('view.php?id='.$course->id); // Back to course page
|
||||
echo $OUTPUT->continue_button('view.php?id=' . $course->id); // Back to course page.
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
}
|
||||
|
||||
+50
-48
@@ -14,37 +14,34 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Provides the course_reset_form class.
|
||||
*
|
||||
* @package core
|
||||
* @copyright 2007 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once $CFG->libdir.'/formslib.php';
|
||||
require_once($CFG->libdir.'/formslib.php');
|
||||
require_once($CFG->dirroot . '/course/lib.php');
|
||||
|
||||
/**
|
||||
* Defines the course reset settings form.
|
||||
*
|
||||
* @package core_course
|
||||
* @copyright 2007 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class course_reset_form extends moodleform {
|
||||
function definition(){
|
||||
|
||||
/**
|
||||
* Form definition.
|
||||
*/
|
||||
public function definition() {
|
||||
global $CFG, $COURSE, $DB;
|
||||
|
||||
$mform =& $this->_form;
|
||||
$mform = $this->_form;
|
||||
|
||||
$mform->addElement('header', 'generalheader', get_string('general'));
|
||||
|
||||
$mform->addElement('date_time_selector', 'reset_start_date', get_string('startdate'), array('optional' => true));
|
||||
$mform->addElement('date_time_selector', 'reset_start_date', get_string('startdate'), ['optional' => true]);
|
||||
$mform->addHelpButton('reset_start_date', 'startdate');
|
||||
$mform->addElement('date_time_selector', 'reset_end_date', get_string('enddate'), array('optional' => true));
|
||||
$mform->addElement('date_time_selector', 'reset_end_date', get_string('enddate'), ['optional' => true]);
|
||||
$mform->addHelpButton('reset_end_date', 'enddate');
|
||||
$mform->addElement('static', 'generaldelete', get_string('delete'));
|
||||
$mform->addElement('checkbox', 'reset_events', get_string('deleteevents', 'calendar'));
|
||||
$mform->addElement('checkbox', 'reset_notes', get_string('deletenotes', 'notes'));
|
||||
$mform->addElement('checkbox', 'reset_comments', get_string('deleteallcomments', 'moodle'));
|
||||
@@ -54,85 +51,92 @@ class course_reset_form extends moodleform {
|
||||
$mform->addElement('checkbox', 'reset_competency_ratings', get_string('deletecompetencyratings', 'core_competency'));
|
||||
|
||||
$mform->addElement('header', 'rolesheader', get_string('roles'));
|
||||
|
||||
$roles = get_assignable_roles(context_course::instance($COURSE->id));
|
||||
$roles[0] = get_string('noroles', 'role');
|
||||
$roles = array_reverse($roles, true);
|
||||
|
||||
$mform->addElement('select', 'unenrol_users', get_string('unenrolroleusers', 'enrol'), $roles, array('multiple' => 'multiple'));
|
||||
$mform->addElement('checkbox', 'reset_roles_overrides', get_string('deletecourseoverrides', 'role'));
|
||||
$mform->setAdvanced('reset_roles_overrides');
|
||||
$attributes = [
|
||||
'multiple' => 1,
|
||||
'size' => min(count($roles), 10),
|
||||
];
|
||||
$mform->addElement('select', 'unenrol_users', get_string('unenrolroleusers', 'enrol'), $roles, $attributes);
|
||||
$mform->addElement('static', 'rolesdelete', get_string('delete'));
|
||||
$mform->addElement('checkbox', 'reset_roles_local', get_string('deletelocalroles', 'role'));
|
||||
|
||||
$mform->addElement('checkbox', 'reset_roles_overrides', get_string('deletecourseoverrides', 'role'));
|
||||
|
||||
$mform->addElement('header', 'gradebookheader', get_string('gradebook', 'grades'));
|
||||
|
||||
$mform->addElement('static', 'gradebookdelete', get_string('delete'));
|
||||
$mform->addElement('checkbox', 'reset_gradebook_items', get_string('removeallcourseitems', 'grades'));
|
||||
$mform->addHelpButton('reset_gradebook_items', 'removeallcourseitems', 'grades');
|
||||
$mform->addElement('checkbox', 'reset_gradebook_grades', get_string('removeallcoursegrades', 'grades'));
|
||||
$mform->addHelpButton('reset_gradebook_grades', 'removeallcoursegrades', 'grades');
|
||||
$mform->disabledIf('reset_gradebook_grades', 'reset_gradebook_items', 'checked');
|
||||
|
||||
|
||||
$mform->addElement('header', 'groupheader', get_string('groups'));
|
||||
|
||||
$mform->addElement('static', 'groupdelete', get_string('delete'));
|
||||
$mform->addElement('checkbox', 'reset_groups_remove', get_string('deleteallgroups', 'group'));
|
||||
$mform->addElement('checkbox', 'reset_groups_members', get_string('removegroupsmembers', 'group'));
|
||||
$mform->disabledIf('reset_groups_members', 'reset_groups_remove', 'checked');
|
||||
|
||||
$mform->addElement('checkbox', 'reset_groupings_remove', get_string('deleteallgroupings', 'group'));
|
||||
$mform->addElement('checkbox', 'reset_groupings_members', get_string('removegroupingsmembers', 'group'));
|
||||
$mform->disabledIf('reset_groupings_members', 'reset_groupings_remove', 'checked');
|
||||
|
||||
$unsupported_mods = array();
|
||||
$unsupportedmods = [];
|
||||
if ($allmods = $DB->get_records('modules') ) {
|
||||
foreach ($allmods as $mod) {
|
||||
$modname = $mod->name;
|
||||
$modfile = $CFG->dirroot."/mod/$modname/lib.php";
|
||||
$mod_reset_course_form_definition = $modname.'_reset_course_form_definition';
|
||||
$mod_reset__userdata = $modname.'_reset_userdata';
|
||||
$modresetcourseformdefinition = $modname.'_reset_course_form_definition';
|
||||
$modresetuserdata = $modname.'_reset_userdata';
|
||||
if (file_exists($modfile)) {
|
||||
if (!$DB->count_records($modname, array('course'=>$COURSE->id))) {
|
||||
continue; // Skip mods with no instances
|
||||
if (!$DB->count_records($modname, ['course' => $COURSE->id])) {
|
||||
continue; // Skip mods with no instances.
|
||||
}
|
||||
include_once($modfile);
|
||||
if (function_exists($mod_reset_course_form_definition)) {
|
||||
$mod_reset_course_form_definition($mform);
|
||||
} else if (!function_exists($mod_reset__userdata)) {
|
||||
$unsupported_mods[] = $mod;
|
||||
if (function_exists($modresetcourseformdefinition)) {
|
||||
$modresetcourseformdefinition($mform);
|
||||
} else if (!function_exists($modresetuserdata)) {
|
||||
$unsupportedmods[] = $mod;
|
||||
}
|
||||
} else {
|
||||
debugging('Missing lib.php in '.$modname.' module');
|
||||
}
|
||||
}
|
||||
}
|
||||
// mention unsupported mods
|
||||
if (!empty($unsupported_mods)) {
|
||||
// Mention unsupported mods.
|
||||
if (!empty($unsupportedmods)) {
|
||||
$mform->addElement('header', 'unsupportedheader', get_string('resetnotimplemented'));
|
||||
foreach($unsupported_mods as $mod) {
|
||||
$mform->addElement('static', 'unsupportedinfo', get_string('resetnotimplementedinfo'));
|
||||
foreach ($unsupportedmods as $mod) {
|
||||
$mform->addElement('static', 'unsup'.$mod->name, get_string('modulenameplural', $mod->name));
|
||||
$mform->setAdvanced('unsup'.$mod->name);
|
||||
}
|
||||
}
|
||||
|
||||
$mform->addElement('hidden', 'id', $COURSE->id);
|
||||
$mform->setType('id', PARAM_INT);
|
||||
|
||||
$buttonarray = array();
|
||||
$buttonarray = [];
|
||||
$buttonarray[] = &$mform->createElement('submit', 'submitbutton', get_string('resetcourse'));
|
||||
$buttonarray[] = &$mform->createElement('submit', 'selectdefault', get_string('selectdefault'));
|
||||
$buttonarray[] = &$mform->createElement('submit', 'deselectall', get_string('deselectall'));
|
||||
$buttonarray[] = &$mform->createElement('cancel');
|
||||
$mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
|
||||
$mform->addGroup($buttonarray, 'buttonar', '', [' '], false);
|
||||
$mform->closeHeaderBefore('buttonar');
|
||||
}
|
||||
|
||||
function load_defaults() {
|
||||
/**
|
||||
* Method to load default values for the reset course form.
|
||||
*/
|
||||
public function load_defaults() {
|
||||
global $CFG, $COURSE, $DB;
|
||||
|
||||
$mform =& $this->_form;
|
||||
$mform = $this->_form;
|
||||
|
||||
$defaults = array ('reset_events'=>1, 'reset_roles_local'=>1, 'reset_gradebook_grades'=>1, 'reset_notes'=>1);
|
||||
$defaults = [
|
||||
'reset_events' => 1,
|
||||
'reset_roles_local' => 1,
|
||||
'reset_gradebook_grades' => 1,
|
||||
'reset_notes' => 1,
|
||||
];
|
||||
|
||||
// Set student as default in unenrol user list, if role with student archetype exist.
|
||||
if ($studentrole = get_archetype_roles('student')) {
|
||||
@@ -143,11 +147,11 @@ class course_reset_form extends moodleform {
|
||||
foreach ($allmods as $mod) {
|
||||
$modname = $mod->name;
|
||||
$modfile = $CFG->dirroot."/mod/$modname/lib.php";
|
||||
$mod_reset_course_form_defaults = $modname.'_reset_course_form_defaults';
|
||||
$modresetcourseformdefaults = $modname.'_reset_course_form_defaults';
|
||||
if (file_exists($modfile)) {
|
||||
@include_once($modfile);
|
||||
if (function_exists($mod_reset_course_form_defaults)) {
|
||||
if ($moddefs = $mod_reset_course_form_defaults($COURSE)) {
|
||||
if (function_exists($modresetcourseformdefaults)) {
|
||||
if ($moddefs = $modresetcourseformdefaults($COURSE)) {
|
||||
$defaults = $defaults + $moddefs;
|
||||
}
|
||||
}
|
||||
@@ -155,7 +159,7 @@ class course_reset_form extends moodleform {
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($defaults as $element=>$default) {
|
||||
foreach ($defaults as $element => $default) {
|
||||
$mform->setDefault($element, $default);
|
||||
}
|
||||
}
|
||||
@@ -168,8 +172,6 @@ class course_reset_form extends moodleform {
|
||||
* @return array the errors that were found
|
||||
*/
|
||||
public function validation($data, $files) {
|
||||
global $DB;
|
||||
|
||||
$course = get_course($data['id']);
|
||||
|
||||
$errors = parent::validation($data, $files);
|
||||
|
||||
@@ -31,10 +31,10 @@ Feature: Delete activity tags during course reset
|
||||
# Delete book chapter tags using course reset.
|
||||
And I am on the "Course 1" "reset" page
|
||||
And I expand all fieldsets
|
||||
And I click on "Remove all book tags" "checkbox"
|
||||
And I click on "All book tags" "checkbox"
|
||||
And I press "Reset"
|
||||
# Confirm that book chapter tags are deleted.
|
||||
And I should see "Book tags have been deleted" in the "Books" "table_row"
|
||||
And I should see "All book tags" in the "Books" "table_row"
|
||||
And I press "Continue"
|
||||
And I am on the "Test Book" "book activity" page
|
||||
And I should not see "SampleTag"
|
||||
@@ -59,7 +59,7 @@ Feature: Delete activity tags during course reset
|
||||
# Depending on <resetcheck> value, either delete all discussion posts or remove all forum discussion tags only.
|
||||
And I click on "<resetcheck>" "checkbox"
|
||||
# Confirm `Remove all forum tags` is disabled when `Delete all posts` on previous step is checked.
|
||||
And the "Remove all forum tags" "checkbox" should be <canbechecked>
|
||||
And the "All forum tags" "checkbox" should be <canbechecked>
|
||||
And I press "Reset"
|
||||
And I should see "<resetmessage>" in the "Forums" "table_row"
|
||||
And I press "Continue"
|
||||
@@ -71,9 +71,9 @@ Feature: Delete activity tags during course reset
|
||||
And I should not see "DiscussionTag"
|
||||
|
||||
Examples:
|
||||
| resetcheck | resetmessage | canbechecked | forumview |
|
||||
| Delete all posts | Delete all posts | disabled | should |
|
||||
| Remove all forum tags | Forum tags have been deleted | enabled | should not |
|
||||
| resetcheck | resetmessage | canbechecked | forumview |
|
||||
| All posts | All posts | disabled | should |
|
||||
| All forum tags | All forum tags | enabled | should not |
|
||||
|
||||
@javascript
|
||||
Scenario Outline: Delete glossary entry tags using course reuse
|
||||
@@ -93,7 +93,7 @@ Feature: Delete activity tags during course reset
|
||||
# Depending on <resetcheck> value, either delete all glossary entries or remove all glossary entry tags only.
|
||||
And I click on "<resetcheck>" "checkbox"
|
||||
# Confirm `Remove all forum tags` is disabled when `Delete entries from all glossaries` on previous step is checked.
|
||||
And the "Remove all glossary tags" "checkbox" should be <canbechecked>
|
||||
And the "All glossary tags" "checkbox" should be <canbechecked>
|
||||
And I press "Reset"
|
||||
And I should see "<resetmessage>" in the "Glossaries" "table_row"
|
||||
And I press "Continue"
|
||||
@@ -105,6 +105,6 @@ Feature: Delete activity tags during course reset
|
||||
And I should not see "GlossaryTag"
|
||||
|
||||
Examples:
|
||||
| resetcheck | resetmessage | canbechecked | glossaryview |
|
||||
| Delete entries from all glossaries | Delete entries from all glossaries | disabled | should |
|
||||
| Remove all glossary tags | Glossary tags have been deleted | enabled | should not |
|
||||
| resetcheck | resetmessage | canbechecked | glossaryview |
|
||||
| Entries from all glossaries | Entries from all glossaries | disabled | should |
|
||||
| All glossary tags | All glossary tags | enabled | should not |
|
||||
|
||||
@@ -229,4 +229,3 @@ class grade_export_form extends moodleform {
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ $string['configuseexternalblogs'] = 'Enables users to specify external blog feed
|
||||
$string['courseblog'] = 'Course blog: {$a}';
|
||||
$string['courseblogdisable'] = 'Course blogs are not enabled';
|
||||
$string['courseblogs'] = 'Users can only see blogs for people who share a course';
|
||||
$string['deleteblogassociations'] = 'Delete blog associations';
|
||||
$string['deleteblogassociations'] = 'Blog associations';
|
||||
$string['deleteblogassociations_help'] = 'If ticked then blog entries will no longer be associated with this course or any course activities or resources. The blog entries themselves will not be deleted.';
|
||||
$string['deleteentry'] = 'Delete entry';
|
||||
$string['deleteexternalblog'] = 'Unregister this external blog';
|
||||
|
||||
@@ -66,7 +66,7 @@ $string['dayviewtitle'] = 'Day view: {$a}';
|
||||
$string['daywithnoevents'] = 'There are no events this day.';
|
||||
$string['default'] = 'Default';
|
||||
$string['deleteevent'] = 'Delete event';
|
||||
$string['deleteevents'] = 'Delete events';
|
||||
$string['deleteevents'] = 'Events';
|
||||
$string['deleteoneevent'] = 'Delete this event';
|
||||
$string['deleteallevents'] = 'Delete all events';
|
||||
$string['detailedmonthviewfor'] = 'Detailed month view for:';
|
||||
|
||||
@@ -37,7 +37,7 @@ $string['coursemodulecompetencyoutcome_complete'] = 'Complete the competency';
|
||||
$string['coursemodulecompetencyoutcome_evidence'] = 'Attach evidence';
|
||||
$string['coursemodulecompetencyoutcome_none'] = 'Do nothing';
|
||||
$string['coursemodulecompetencyoutcome_recommend'] = 'Send for review';
|
||||
$string['deletecompetencyratings'] = 'Delete competency ratings';
|
||||
$string['deletecompetencyratings'] = 'Competency ratings';
|
||||
$string['duplicateditemname'] = '{$a} (copy)';
|
||||
$string['enablecompetencies'] = 'Enable competencies';
|
||||
$string['enablecompetencies_desc'] = 'Competencies allow users to be assessed according to learning plans.';
|
||||
@@ -200,4 +200,3 @@ $string['usercompetencystatus_idle'] = 'Idle';
|
||||
$string['usercompetencystatus_inreview'] = 'In review';
|
||||
$string['usercompetencystatus_waitingforreview'] = 'Waiting for review';
|
||||
$string['userplans'] = 'Learning plans';
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ $string['defaultactivitycompletionsite'] = 'These are the default completion con
|
||||
$string['defaultactivitycompletioncourse'] = 'These are the default completion conditions for activities in this course.';
|
||||
$string['defaultcompletion'] = 'Default activity completion';
|
||||
$string['defaultcompletionupdated'] = 'Changes saved';
|
||||
$string['deletecompletiondata'] = 'Delete completion data';
|
||||
$string['deletecompletiondata'] = 'Completion data';
|
||||
$string['dependencies'] = 'Dependencies';
|
||||
$string['dependenciescompleted'] = 'Completion of other courses';
|
||||
$string['detail_desc:receivegrade'] = 'Receive a grade';
|
||||
|
||||
@@ -128,3 +128,4 @@ viewresults,core
|
||||
coursesearch,core
|
||||
coursesearch_help,core
|
||||
coursecalendar,core_calendar
|
||||
datechanged,core
|
||||
|
||||
+2
-2
@@ -715,9 +715,9 @@ $string['recovergradesdefault'] = 'Recover grades default';
|
||||
$string['recovergradesdefault_help'] = 'By default recover old grades when re-enrolling a user in a course.';
|
||||
$string['refreshpreview'] = 'Refresh preview';
|
||||
$string['regradeanyway'] = 'Regrade anyway';
|
||||
$string['removeallcoursegrades'] = 'Delete all grades';
|
||||
$string['removeallcoursegrades'] = 'All grades';
|
||||
$string['removeallcoursegrades_help'] = 'If ticked, all grade items and grades that were manually added to the gradebook will be deleted, as well as data on overridden, excluded, hidden and locked grades. Only grade items and grades associated with activities will remain.';
|
||||
$string['removeallcourseitems'] = 'Delete all items and categories';
|
||||
$string['removeallcourseitems'] = 'All items and categories';
|
||||
$string['removeallcourseitems_help'] = 'If ticked, all categories and grade items which were manually added to the gradebook will be deleted, together with grades and data on overridden, excluded, hidden and locked grades. Only grade items associated with activities will remain.';
|
||||
$string['report'] = 'Report';
|
||||
$string['reportdefault'] = 'Report default ({$a})';
|
||||
|
||||
+4
-4
@@ -48,8 +48,8 @@ $string['databaseupgradegroups'] = 'Groups version is now {$a}';
|
||||
$string['defaultgrouping'] = 'Default grouping';
|
||||
$string['defaultgroupingname'] = 'Grouping';
|
||||
$string['defaultgroupname'] = 'Group';
|
||||
$string['deleteallgroupings'] = 'Delete all groupings';
|
||||
$string['deleteallgroups'] = 'Delete all groups';
|
||||
$string['deleteallgroupings'] = 'All groupings';
|
||||
$string['deleteallgroups'] = 'All groups';
|
||||
$string['deletegroupconfirm'] = 'Are you sure you want to delete group \'{$a}\'?';
|
||||
$string['deletegrouping'] = 'Delete grouping';
|
||||
$string['deletegroupingconfirm'] = 'Are you sure you want to delete grouping \'{$a}\'? (Groups in the grouping are not deleted.)';
|
||||
@@ -196,8 +196,8 @@ $string['random'] = 'Randomly';
|
||||
$string['removegroupfromselectedgrouping'] = 'Remove group from grouping';
|
||||
$string['removefromgroup'] = 'Remove user from group {$a}';
|
||||
$string['removefromgroupconfirm'] = 'Do you really want to remove user "{$a->user}" from group "{$a->group}"?';
|
||||
$string['removegroupingsmembers'] = 'Remove all groups from groupings';
|
||||
$string['removegroupsmembers'] = 'Remove all group members';
|
||||
$string['removegroupingsmembers'] = 'All groups from groupings';
|
||||
$string['removegroupsmembers'] = 'All group members';
|
||||
$string['removeselectedusers'] = 'Remove selected users';
|
||||
$string['selectfromgroup'] = 'Select members from group';
|
||||
$string['selectfromgrouping'] = 'Select members from grouping';
|
||||
|
||||
+9
-5
@@ -494,7 +494,6 @@ $string['databaseupgradelocal'] = 'Local database customisations version is now
|
||||
$string['databaseupgrades'] = 'Upgrading database';
|
||||
$string['dataformats'] = 'Data formats';
|
||||
$string['date'] = 'Date';
|
||||
$string['datechanged'] = 'Date changed';
|
||||
$string['datemostrecentfirst'] = 'Date - most recent first';
|
||||
$string['datemostrecentlast'] = 'Date - most recent last';
|
||||
$string['day'] = 'day';
|
||||
@@ -520,8 +519,8 @@ $string['delete'] = 'Delete';
|
||||
$string['deleteablock'] = 'Delete a block';
|
||||
$string['deleteall'] = 'Delete all';
|
||||
$string['deleteallcannotundo'] = 'Delete all - cannot be undone';
|
||||
$string['deleteallcomments'] = 'Delete all comments';
|
||||
$string['deleteallratings'] = 'Delete all ratings';
|
||||
$string['deleteallcomments'] = 'All comments';
|
||||
$string['deleteallratings'] = 'All ratings';
|
||||
$string['deletecategory'] = 'Delete category: {$a}';
|
||||
$string['deletecategoryempty'] = 'This category is empty.';
|
||||
$string['deletecategorycheck'] = 'Are you absolutely sure you want to completely delete this category <b>\'{$a}\'</b>?<br />This will move all courses into the parent category if there is one, or into Miscellaneous.';
|
||||
@@ -1864,12 +1863,13 @@ $string['reset'] = 'Reset';
|
||||
$string['resetcomponent'] = 'Component';
|
||||
$string['resetcourse'] = 'Reset course';
|
||||
$string['resetinfo'] = 'Delete all user data and reset this course to its original state, keeping activities and settings intact.';
|
||||
$string['resetnotimplemented'] = 'Reset not implemented';
|
||||
$string['resetnotimplemented'] = 'Reset not supported';
|
||||
$string['resetnotimplementedinfo'] = 'These activities can\'t be reset:';
|
||||
$string['resetrecordexpired'] = 'The password reset link you used is more than {$a} minutes old and has expired. Please initiate a new password reset.';
|
||||
$string['resetstartdate'] = 'Reset start date';
|
||||
$string['resetstatus'] = 'Status';
|
||||
$string['resettable'] = 'Reset table preferences';
|
||||
$string['resettask'] = 'Task';
|
||||
$string['resettask'] = 'Reset';
|
||||
$string['resettodefaults'] = 'Reset to defaults';
|
||||
$string['resortsubcategoriesby'] = 'Sort subcategories by {$a} ascending';
|
||||
$string['resortsubcategoriesbyreverse'] = 'Sort subcategories by {$a} descending';
|
||||
@@ -2171,6 +2171,7 @@ $string['statswrites'] = 'Posts';
|
||||
$string['status'] = 'Status';
|
||||
$string['statuschecks'] = 'Status checks';
|
||||
$string['statuscritical'] = 'Critical';
|
||||
$string['statusdone'] = 'Done';
|
||||
$string['statusinfo'] = 'Info';
|
||||
$string['statusna'] = 'N/A';
|
||||
$string['statusok'] = 'OK';
|
||||
@@ -2512,3 +2513,6 @@ $string['coursesearch_help'] = 'You can search for multiple words at once and ca
|
||||
* word - find any match of this word within the text
|
||||
* +word - only exact matching words will be found
|
||||
* -word - don\'t include results containing this word.';
|
||||
|
||||
// Deprecated since Moodle 4.5.
|
||||
$string['datechanged'] = 'Date changed';
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ $string['course'] = 'course';
|
||||
$string['coursenotes'] = 'Course notes';
|
||||
$string['created'] = 'created';
|
||||
$string['deleteconfirm'] = 'Delete this note?';
|
||||
$string['deletenotes'] = 'Delete all notes';
|
||||
$string['deletenotes'] = 'All notes';
|
||||
$string['editnote'] = 'Edit note';
|
||||
$string['enablenotes'] = 'Enable notes';
|
||||
$string['eventnotecreated'] = 'Note created';
|
||||
|
||||
+2
-2
@@ -226,8 +226,8 @@ $string['defaultrole'] = 'Default role';
|
||||
$string['defaultx'] = 'Default: {$a}';
|
||||
$string['defineroles'] = 'Define roles';
|
||||
$string['definitionofrolex'] = 'Definition of role \'{$a}\'';
|
||||
$string['deletecourseoverrides'] = 'Delete all overrides in course';
|
||||
$string['deletelocalroles'] = 'Delete all local role assignments';
|
||||
$string['deletecourseoverrides'] = 'All overrides in course';
|
||||
$string['deletelocalroles'] = 'All local role assignments';
|
||||
$string['deleterolesure'] = '<p>Are you sure that you want to delete role "{$a->name} ({$a->shortname})"?</p><p>Currently this role is assigned to {$a->count} users.</p>';
|
||||
$string['deletexrole'] = 'Delete {$a} role';
|
||||
$string['duplicaterole'] = 'Duplicate role';
|
||||
|
||||
+1
-1
@@ -5113,7 +5113,7 @@ function reset_course_userdata($data) {
|
||||
\completion_criteria_date::update_date($data->courseid, $data->timeshift);
|
||||
}
|
||||
|
||||
$status[] = array('component' => $componentstr, 'item' => get_string('datechanged'), 'error' => false);
|
||||
$status[] = ['component' => $componentstr, 'item' => get_string('date'), 'error' => false];
|
||||
}
|
||||
|
||||
if (!empty($data->reset_end_date)) {
|
||||
|
||||
@@ -157,7 +157,7 @@ $string['defaultlayout'] = 'Restore default layout';
|
||||
$string['defaultsettings'] = 'Default assignment settings';
|
||||
$string['defaultsettings_help'] = 'These settings define the defaults for all new assignments.';
|
||||
$string['defaultteam'] = 'Default group';
|
||||
$string['deleteallsubmissions'] = 'Delete all submissions';
|
||||
$string['deleteallsubmissions'] = 'All submissions';
|
||||
$string['description'] = 'Description';
|
||||
$string['disabled'] = 'Disabled';
|
||||
$string['downloadall'] = 'Download all submissions';
|
||||
@@ -303,7 +303,6 @@ $string['gradingstatus'] = 'Grading status';
|
||||
$string['gradingstudent'] = 'Grading student';
|
||||
$string['gradingsummary'] = 'Grading summary';
|
||||
$string['groupoverrides'] = 'Group overrides';
|
||||
$string['groupoverridesdeleted'] = 'Group overrides deleted';
|
||||
$string['groupsnone'] = 'No groups you can access.';
|
||||
$string['hidegrader'] = 'Hide grader identity from students';
|
||||
$string['hidegrader_help'] = 'If enabled, the identity of any user who grades an assignment submission is not shown, so students can\'t see who marked their work.
|
||||
@@ -469,8 +468,8 @@ $string['quickgradingresult'] = 'Quick grading';
|
||||
$string['quickgradingchangessaved'] = 'The grade changes were saved';
|
||||
$string['quickgrading_help'] = 'Quick grading allows you to assign grades (and outcomes) directly in the submissions table. Quick grading is not compatible with advanced grading and is not recommended when there are multiple markers.';
|
||||
$string['relativedatessubmissiontimeleft'] = 'Calculated for each student';
|
||||
$string['removeallgroupoverrides'] = 'Delete all group overrides';
|
||||
$string['removealluseroverrides'] = 'Delete all user overrides';
|
||||
$string['removeallgroupoverrides'] = 'All group overrides';
|
||||
$string['removealluseroverrides'] = 'All user overrides';
|
||||
$string['reopenuntilpassincompatiblewithblindmarking'] = 'Reopen until pass option is incompatible with anonymous submissions, because the grades are not released to the gradebook until the student identities are revealed.';
|
||||
$string['requiresubmissionstatement'] = 'Require that students accept the submission statement';
|
||||
$string['requiresubmissionstatement_help'] = 'Require that students accept the submission statement for all submissions to this assignment.';
|
||||
@@ -639,7 +638,6 @@ $string['userextensiondate'] = 'Extension granted until: {$a}';
|
||||
$string['userassignmentdefaults'] = 'User assignment defaults';
|
||||
$string['useridlistnotcached'] = 'The grade changes were NOT saved, as it was not possible to determine which submission they were for.';
|
||||
$string['useroverrides'] = 'User overrides';
|
||||
$string['useroverridesdeleted'] = 'User overrides deleted';
|
||||
$string['usersubmissioncannotberemoved'] = 'The submission of {$a} cannot be removed.';
|
||||
$string['usersnone'] = 'No students have access to this assignment.';
|
||||
$string['userswhoneedtosubmit'] = 'Users who need to submit: {$a}';
|
||||
@@ -665,5 +663,7 @@ $string['viewrevealidentitiesconfirm'] = 'View reveal student identities confirm
|
||||
$string['workflowfilter'] = 'Workflow filter';
|
||||
$string['xofy'] = '{$a->x} of {$a->y}';
|
||||
|
||||
// Deprecated since Moodle 4.4.
|
||||
// Deprecated since Moodle 4.5.
|
||||
$string['attemptreopenmethod_none'] = 'Never';
|
||||
$string['groupoverridesdeleted'] = 'Group overrides deleted';
|
||||
$string['useroverridesdeleted'] = 'User overrides deleted';
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
attemptreopenmethod_none,mod_assign
|
||||
attemptreopenmethod_none,mod_assign
|
||||
groupoverridesdeleted,mod_assign
|
||||
useroverridesdeleted,mod_assign
|
||||
|
||||
+12
-8
@@ -70,22 +70,25 @@ function assign_reset_userdata($data) {
|
||||
global $CFG, $DB;
|
||||
require_once($CFG->dirroot . '/mod/assign/locallib.php');
|
||||
|
||||
$status = array();
|
||||
$params = array('courseid'=>$data->courseid);
|
||||
$status = [];
|
||||
$params = ['courseid' => $data->courseid];
|
||||
$sql = "SELECT a.id FROM {assign} a WHERE a.course=:courseid";
|
||||
$course = $DB->get_record('course', array('id'=>$data->courseid), '*', MUST_EXIST);
|
||||
$course = $DB->get_record('course', ['id' => $data->courseid], '*', MUST_EXIST);
|
||||
if ($assigns = $DB->get_records_sql($sql, $params)) {
|
||||
foreach ($assigns as $assign) {
|
||||
$cm = get_coursemodule_from_instance('assign',
|
||||
$assign->id,
|
||||
$data->courseid,
|
||||
false,
|
||||
MUST_EXIST);
|
||||
$cm = get_coursemodule_from_instance(
|
||||
'assign',
|
||||
$assign->id,
|
||||
$data->courseid,
|
||||
false,
|
||||
MUST_EXIST,
|
||||
);
|
||||
$context = context_module::instance($cm->id);
|
||||
$assignment = new assign($context, $cm, $course);
|
||||
$status = array_merge($status, $assignment->reset_userdata($data));
|
||||
}
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
@@ -204,6 +207,7 @@ function assign_reset_gradebook($courseid, $type='') {
|
||||
*/
|
||||
function assign_reset_course_form_definition(&$mform) {
|
||||
$mform->addElement('header', 'assignheader', get_string('modulenameplural', 'assign'));
|
||||
$mform->addElement('static', 'assigndelete', get_string('delete'));
|
||||
$name = get_string('deleteallsubmissions', 'assign');
|
||||
$mform->addElement('advcheckbox', 'reset_assign_submissions', $name);
|
||||
$mform->addElement('advcheckbox', 'reset_assign_user_overrides',
|
||||
|
||||
+62
-41
@@ -1187,13 +1187,13 @@ class assign {
|
||||
global $CFG, $DB;
|
||||
|
||||
$componentstr = get_string('modulenameplural', 'assign');
|
||||
$status = array();
|
||||
$status = [];
|
||||
|
||||
$fs = get_file_storage();
|
||||
if (!empty($data->reset_assign_submissions)) {
|
||||
// Delete files associated with this assignment.
|
||||
foreach ($this->submissionplugins as $plugin) {
|
||||
$fileareas = array();
|
||||
$fileareas = [];
|
||||
$plugincomponent = $plugin->get_subtype() . '_' . $plugin->get_type();
|
||||
$fileareas = $plugin->get_file_areas();
|
||||
foreach ($fileareas as $filearea => $notused) {
|
||||
@@ -1201,9 +1201,11 @@ class assign {
|
||||
}
|
||||
|
||||
if (!$plugin->delete_instance()) {
|
||||
$status[] = array('component'=>$componentstr,
|
||||
'item'=>get_string('deleteallsubmissions', 'assign'),
|
||||
'error'=>$plugin->get_error());
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('deleteallsubmissions', 'assign'),
|
||||
'error' => $plugin->get_error(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1216,32 +1218,36 @@ class assign {
|
||||
}
|
||||
|
||||
if (!$plugin->delete_instance()) {
|
||||
$status[] = array('component'=>$componentstr,
|
||||
'item'=>get_string('deleteallsubmissions', 'assign'),
|
||||
'error'=>$plugin->get_error());
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item ' => get_string('deleteallsubmissions', 'assign'),
|
||||
'error' => $plugin->get_error(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$assignids = $DB->get_records('assign', array('course' => $data->courseid), '', 'id');
|
||||
$assignids = $DB->get_records('assign', ['course' => $data->courseid], '', 'id');
|
||||
list($sql, $params) = $DB->get_in_or_equal(array_keys($assignids));
|
||||
|
||||
$DB->delete_records_select('assign_submission', "assignment $sql", $params);
|
||||
$DB->delete_records_select('assign_user_flags', "assignment $sql", $params);
|
||||
|
||||
$status[] = array('component'=>$componentstr,
|
||||
'item'=>get_string('deleteallsubmissions', 'assign'),
|
||||
'error'=>false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('deleteallsubmissions', 'assign'),
|
||||
'error' => false,
|
||||
];
|
||||
|
||||
if (!empty($data->reset_gradebook_grades)) {
|
||||
$DB->delete_records_select('assign_grades', "assignment $sql", $params);
|
||||
// Remove all grades from gradebook.
|
||||
require_once($CFG->dirroot.'/mod/assign/lib.php');
|
||||
require_once($CFG->dirroot . '/mod/assign/lib.php');
|
||||
assign_reset_gradebook($data->courseid);
|
||||
}
|
||||
|
||||
// Reset revealidentities for assign if blindmarking is enabled.
|
||||
if ($this->get_instance()->blindmarking) {
|
||||
$DB->set_field('assign', 'revealidentities', 0, array('id' => $this->get_instance()->id));
|
||||
$DB->set_field('assign', 'revealidentities', 0, ['id' => $this->get_instance()->id]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1250,50 +1256,65 @@ class assign {
|
||||
// Remove user overrides.
|
||||
if (!empty($data->reset_assign_user_overrides)) {
|
||||
$DB->delete_records_select('assign_overrides',
|
||||
'assignid IN (SELECT id FROM {assign} WHERE course = ?) AND userid IS NOT NULL', array($data->courseid));
|
||||
$status[] = array(
|
||||
'assignid IN (SELECT id FROM {assign} WHERE course = ?) AND userid IS NOT NULL', [$data->courseid]);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('useroverridesdeleted', 'assign'),
|
||||
'error' => false);
|
||||
'item' => get_string('useroverrides', 'assign'),
|
||||
'error' => false,
|
||||
];
|
||||
$purgeoverrides = true;
|
||||
}
|
||||
// Remove group overrides.
|
||||
if (!empty($data->reset_assign_group_overrides)) {
|
||||
$DB->delete_records_select('assign_overrides',
|
||||
'assignid IN (SELECT id FROM {assign} WHERE course = ?) AND groupid IS NOT NULL', array($data->courseid));
|
||||
$status[] = array(
|
||||
'assignid IN (SELECT id FROM {assign} WHERE course = ?) AND groupid IS NOT NULL', [$data->courseid]);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('groupoverridesdeleted', 'assign'),
|
||||
'error' => false);
|
||||
'item' => get_string('groupoverrides', 'assign'),
|
||||
'error' => false,
|
||||
];
|
||||
$purgeoverrides = true;
|
||||
}
|
||||
|
||||
// Updating dates - shift may be negative too.
|
||||
if ($data->timeshift) {
|
||||
$DB->execute("UPDATE {assign_overrides}
|
||||
SET allowsubmissionsfromdate = allowsubmissionsfromdate + ?
|
||||
WHERE assignid = ? AND allowsubmissionsfromdate <> 0",
|
||||
array($data->timeshift, $this->get_instance()->id));
|
||||
$DB->execute("UPDATE {assign_overrides}
|
||||
SET duedate = duedate + ?
|
||||
WHERE assignid = ? AND duedate <> 0",
|
||||
array($data->timeshift, $this->get_instance()->id));
|
||||
$DB->execute("UPDATE {assign_overrides}
|
||||
SET cutoffdate = cutoffdate + ?
|
||||
WHERE assignid =? AND cutoffdate <> 0",
|
||||
array($data->timeshift, $this->get_instance()->id));
|
||||
$sql = "UPDATE {assign_overrides}
|
||||
SET allowsubmissionsfromdate = allowsubmissionsfromdate + ?
|
||||
WHERE assignid = ? AND allowsubmissionsfromdate <> 0";
|
||||
$DB->execute(
|
||||
$sql,
|
||||
[$data->timeshift, $this->get_instance()->id],
|
||||
);
|
||||
$sql = "UPDATE {assign_overrides}
|
||||
SET duedate = duedate + ?
|
||||
WHERE assignid = ? AND duedate <> 0";
|
||||
$DB->execute(
|
||||
$sql,
|
||||
[$data->timeshift, $this->get_instance()->id],
|
||||
);
|
||||
$sql = "UPDATE {assign_overrides}
|
||||
SET cutoffdate = cutoffdate + ?
|
||||
WHERE assignid =? AND cutoffdate <> 0";
|
||||
$DB->execute(
|
||||
$sql,
|
||||
[$data->timeshift, $this->get_instance()->id],
|
||||
);
|
||||
|
||||
$purgeoverrides = true;
|
||||
|
||||
// Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.
|
||||
// See MDL-9367.
|
||||
shift_course_mod_dates('assign',
|
||||
array('duedate', 'allowsubmissionsfromdate', 'cutoffdate'),
|
||||
$data->timeshift,
|
||||
$data->courseid, $this->get_instance()->id);
|
||||
$status[] = array('component'=>$componentstr,
|
||||
'item'=>get_string('datechanged'),
|
||||
'error'=>false);
|
||||
shift_course_mod_dates(
|
||||
'assign',
|
||||
['duedate', 'allowsubmissionsfromdate', 'cutoffdate'],
|
||||
$data->timeshift,
|
||||
$data->courseid, $this->get_instance()->id,
|
||||
);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('date'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
if ($purgeoverrides) {
|
||||
|
||||
@@ -48,7 +48,7 @@ Feature: Assign reset
|
||||
And I should see "Submitted for grading"
|
||||
When I am on the "Course 1" "reset" page
|
||||
And I set the following fields to these values:
|
||||
| Delete all submissions | 1 |
|
||||
| All submissions | 1 |
|
||||
And I press "Reset course"
|
||||
And I press "Continue"
|
||||
And I am on the "Test assignment name" Activity page
|
||||
@@ -72,7 +72,7 @@ Feature: Assign reset
|
||||
And I should see "Sam1 Student1"
|
||||
When I am on the "Course 1" "reset" page
|
||||
And I set the following fields to these values:
|
||||
| Delete all user overrides | 1 |
|
||||
| All user overrides | 1 |
|
||||
And I press "Reset course"
|
||||
And I press "Continue"
|
||||
And I am on "Course 1" course homepage
|
||||
@@ -97,7 +97,7 @@ Feature: Assign reset
|
||||
And I should see "Group 1"
|
||||
And I am on the "Course 1" "reset" page
|
||||
And I set the following fields to these values:
|
||||
| Delete all group overrides | 1 |
|
||||
| All group overrides | 1 |
|
||||
And I press "Reset course"
|
||||
And I press "Continue"
|
||||
And I am on the "Test assignment name" Activity page
|
||||
@@ -118,7 +118,7 @@ Feature: Assign reset
|
||||
And I should see "Sam1 Student1"
|
||||
When I am on the "Course 1" "reset" page
|
||||
And I set the following fields to these values:
|
||||
| Delete all submissions | 1 |
|
||||
| All submissions | 1 |
|
||||
And I press "Reset course"
|
||||
And I press "Continue"
|
||||
And I am on the "Test assignment name" Activity page
|
||||
|
||||
@@ -111,11 +111,13 @@ $string['subchapternotice'] = '(Only available once the first chapter has been c
|
||||
$string['subplugintype_booktool'] = 'Book tool';
|
||||
$string['subplugintype_booktool_plural'] = 'Book tools';
|
||||
|
||||
$string['removeallbooktags'] = 'Remove all book tags';
|
||||
$string['removeallbooktags'] = 'All book tags';
|
||||
$string['tagarea_book_chapters'] = 'Book chapters';
|
||||
$string['tagsdeleted'] = 'Book tags have been deleted';
|
||||
|
||||
// Deprecated since Moodle 4.4.
|
||||
$string['navimages'] = 'Images';
|
||||
$string['navtext'] = 'Text';
|
||||
$string['navtoc'] = 'TOC Only';
|
||||
|
||||
// Deprecated since Moodle 4.5.
|
||||
$string['tagsdeleted'] = 'Book tags have been deleted';
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
navimages,mod_book
|
||||
navtext,mod_book
|
||||
navtoc,mod_book
|
||||
tagsdeleted,mod_book
|
||||
|
||||
+4
-4
@@ -143,7 +143,7 @@ function book_reset_userdata($data) {
|
||||
|
||||
if (!empty($data->reset_book_tags)) {
|
||||
// Loop through the books and remove the tags from the chapters.
|
||||
if ($books = $DB->get_records('book', array('course' => $data->courseid))) {
|
||||
if ($books = $DB->get_records('book', ['course' => $data->courseid])) {
|
||||
foreach ($books as $book) {
|
||||
if (!$cm = get_coursemodule_from_instance('book', $book->id)) {
|
||||
continue;
|
||||
@@ -154,11 +154,10 @@ function book_reset_userdata($data) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$status[] = [
|
||||
'component' => get_string('modulenameplural', 'book'),
|
||||
'item' => get_string('tagsdeleted', 'book'),
|
||||
'error' => false
|
||||
'item' => get_string('removeallbooktags', 'book'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -172,6 +171,7 @@ function book_reset_userdata($data) {
|
||||
*/
|
||||
function book_reset_course_form_definition(&$mform) {
|
||||
$mform->addElement('header', 'bookheader', get_string('modulenameplural', 'book'));
|
||||
$mform->addElement('static', 'bookdelete', get_string('delete'));
|
||||
$mform->addElement('checkbox', 'reset_book_tags', get_string('removeallbooktags', 'book'));
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ $string['privacy:metadata:messages:timestamp'] = 'The time when the message was
|
||||
$string['privacy:metadata:messages:userid'] = 'The user ID of the author of the message';
|
||||
$string['refreshroom'] = 'Refresh room';
|
||||
$string['refreshuserlist'] = 'Refresh user list';
|
||||
$string['removemessages'] = 'Remove all messages';
|
||||
$string['removemessages'] = 'All messages';
|
||||
$string['repeatdaily'] = 'At the same time every day';
|
||||
$string['repeatnone'] = 'No repeats - publish the specified time only';
|
||||
$string['repeattimes'] = 'Repeat/publish session times';
|
||||
|
||||
+14
-5
@@ -1208,6 +1208,7 @@ function chat_print_overview() {
|
||||
*/
|
||||
function chat_reset_course_form_definition(&$mform) {
|
||||
$mform->addElement('header', 'chatheader', get_string('modulenameplural', 'chat'));
|
||||
$mform->addElement('static', 'chatdelete', get_string('delete'));
|
||||
$mform->addElement('advcheckbox', 'reset_chat', get_string('removemessages', 'chat'));
|
||||
}
|
||||
|
||||
@@ -1234,26 +1235,34 @@ function chat_reset_userdata($data) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$componentstr = get_string('modulenameplural', 'chat');
|
||||
$status = array();
|
||||
$status = [];
|
||||
|
||||
if (!empty($data->reset_chat)) {
|
||||
$chatessql = "SELECT ch.id
|
||||
FROM {chat} ch
|
||||
WHERE ch.course=?";
|
||||
$params = array($data->courseid);
|
||||
$params = [$data->courseid];
|
||||
|
||||
$DB->delete_records_select('chat_messages', "chatid IN ($chatessql)", $params);
|
||||
$DB->delete_records_select('chat_messages_current', "chatid IN ($chatessql)", $params);
|
||||
$DB->delete_records_select('chat_users', "chatid IN ($chatessql)", $params);
|
||||
$status[] = array('component' => $componentstr, 'item' => get_string('removemessages', 'chat'), 'error' => false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('removemessages', 'chat'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// Updating dates - shift may be negative too.
|
||||
if ($data->timeshift) {
|
||||
// Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.
|
||||
// See MDL-9367.
|
||||
shift_course_mod_dates('chat', array('chattime'), $data->timeshift, $data->courseid);
|
||||
$status[] = array('component' => $componentstr, 'item' => get_string('datechanged'), 'error' => false);
|
||||
shift_course_mod_dates('chat', ['chattime'], $data->timeshift, $data->courseid);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('date'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
return $status;
|
||||
|
||||
@@ -46,7 +46,7 @@ Feature: Chat reset
|
||||
| reset_start_date[month] | January |
|
||||
| reset_start_date[year] | 2030 |
|
||||
And I press "Reset course"
|
||||
And I should see "Date changed" in the "Chats" "table_row"
|
||||
And I should see "Date" in the "Chats" "table_row"
|
||||
And I press "Continue"
|
||||
Then I am on "Course 1" course homepage
|
||||
And I follow "Test chat name"
|
||||
|
||||
@@ -137,7 +137,7 @@ $string['publishinfonever'] = 'The results of this activity will not be publishe
|
||||
$string['publishnames'] = 'Publish full results, showing names and their choices';
|
||||
$string['publishnot'] = 'Do not publish results to students';
|
||||
$string['removemychoice'] = 'Remove my choice';
|
||||
$string['removeresponses'] = 'Remove all responses';
|
||||
$string['removeresponses'] = 'All responses';
|
||||
$string['responses'] = 'Responses';
|
||||
$string['responsesresultgraphheader'] = 'Graph display';
|
||||
$string['responsesa'] = 'Responses: {$a}';
|
||||
|
||||
+16
-7
@@ -725,7 +725,8 @@ function choice_get_post_actions() {
|
||||
*/
|
||||
function choice_reset_course_form_definition(&$mform) {
|
||||
$mform->addElement('header', 'choiceheader', get_string('modulenameplural', 'choice'));
|
||||
$mform->addElement('advcheckbox', 'reset_choice', get_string('removeresponses','choice'));
|
||||
$mform->addElement('static', 'choicedelete', get_string('delete'));
|
||||
$mform->addElement('advcheckbox', 'reset_choice', get_string('removeresponses', 'choice'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -750,23 +751,31 @@ function choice_reset_userdata($data) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$componentstr = get_string('modulenameplural', 'choice');
|
||||
$status = array();
|
||||
$status = [];
|
||||
|
||||
if (!empty($data->reset_choice)) {
|
||||
$choicessql = "SELECT ch.id
|
||||
FROM {choice} ch
|
||||
WHERE ch.course=?";
|
||||
|
||||
$DB->delete_records_select('choice_answers', "choiceid IN ($choicessql)", array($data->courseid));
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('removeresponses', 'choice'), 'error'=>false);
|
||||
$DB->delete_records_select('choice_answers', "choiceid IN ($choicessql)", [$data->courseid]);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('removeresponses', 'choice'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
/// updating dates - shift may be negative too
|
||||
// Updating dates - shift may be negative too.
|
||||
if ($data->timeshift) {
|
||||
// Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.
|
||||
// See MDL-9367.
|
||||
shift_course_mod_dates('choice', array('timeopen', 'timeclose'), $data->timeshift, $data->courseid);
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('datechanged'), 'error'=>false);
|
||||
shift_course_mod_dates('choice', ['timeopen', 'timeclose'], $data->timeshift, $data->courseid);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('date'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
return $status;
|
||||
|
||||
@@ -114,13 +114,13 @@ $string['defaultfieldenclosure'] = '(default is none)';
|
||||
$string['defaultsortfield'] = 'Default sort field';
|
||||
$string['delcheck'] = 'Bulk delete checkbox';
|
||||
$string['delete'] = 'Delete';
|
||||
$string['deleteallentries'] = 'Delete all entries';
|
||||
$string['deleteallentries'] = 'All entries';
|
||||
$string['deletecomment'] = 'Are you sure you want to delete this comment?';
|
||||
$string['deleteconfirm'] = 'Delete preset {$a}?';
|
||||
$string['deleted'] = 'deleted';
|
||||
$string['deleteentry'] = 'Delete entry';
|
||||
$string['deletefield'] = 'Delete field';
|
||||
$string['deletenotenrolled'] = 'Delete entries by users not enrolled';
|
||||
$string['deletenotenrolled'] = 'Entries by users not enrolled';
|
||||
$string['deletewarning'] = 'Deleting a preset removes it from the list of available presets in all courses.';
|
||||
$string['descending'] = 'Descending';
|
||||
$string['directorynotapreset'] = '{$a->directory} Not a preset: missing files: {$a->missing_files}';
|
||||
@@ -381,7 +381,7 @@ $string['recorddeleted'] = 'Entry deleted';
|
||||
$string['recorddisapproved'] = 'Entry unapproved';
|
||||
$string['recordsnotsaved'] = 'No entry was saved. Please check the format of the uploaded file.';
|
||||
$string['recordssaved'] = 'entries saved';
|
||||
$string['removealldatatags'] = 'Remove all database tags';
|
||||
$string['removealldatatags'] = 'All database tags';
|
||||
$string['requireapproval'] = 'Approval required';
|
||||
$string['requireapproval_help'] = 'A teacher has to approve entries before they’re visible to everyone.';
|
||||
$string['required'] = 'Required';
|
||||
@@ -437,7 +437,6 @@ $string['subplugintype_datapreset'] = 'Preset';
|
||||
$string['subplugintype_datapreset_plural'] = 'Presets';
|
||||
$string['tagarea_data_records'] = 'Data records';
|
||||
$string['tags'] = 'Tags';
|
||||
$string['tagsdeleted'] = 'Database tags have been deleted';
|
||||
$string['teachersandstudents'] = '{$a->teachers} and {$a->students}';
|
||||
$string['templates'] = 'Templates';
|
||||
$string['templatereset'] = 'Template reset';
|
||||
@@ -491,3 +490,6 @@ $string['completionentries'] = 'Require entries';
|
||||
|
||||
// Deprecated since Moodle 4.4.
|
||||
$string['fieldallowautolink'] = 'Allow autolink';
|
||||
|
||||
// Deprecated since Moodle 4.5.
|
||||
$string['tagsdeleted'] = 'Database tags have been deleted';
|
||||
|
||||
@@ -10,3 +10,4 @@ todatabase,mod_data
|
||||
fieldids,mod_data
|
||||
completionentries,mod_data
|
||||
fieldallowautolink,mod_data
|
||||
tagsdeleted,mod_data
|
||||
|
||||
+67
-31
@@ -2833,6 +2833,7 @@ function data_preset_path($course, $userid, $shortname) {
|
||||
*/
|
||||
function data_reset_course_form_definition(&$mform) {
|
||||
$mform->addElement('header', 'dataheader', get_string('modulenameplural', 'data'));
|
||||
$mform->addElement('static', 'datadelete', get_string('delete'));
|
||||
$mform->addElement('checkbox', 'reset_data', get_string('deleteallentries','data'));
|
||||
|
||||
$mform->addElement('checkbox', 'reset_data_notenrolled', get_string('deletenotenrolled', 'data'));
|
||||
@@ -2893,7 +2894,7 @@ function data_reset_userdata($data) {
|
||||
require_once($CFG->dirroot.'/rating/lib.php');
|
||||
|
||||
$componentstr = get_string('modulenameplural', 'data');
|
||||
$status = array();
|
||||
$status = [];
|
||||
|
||||
$allrecordssql = "SELECT r.id
|
||||
FROM {data_records} r
|
||||
@@ -2912,13 +2913,13 @@ function data_reset_userdata($data) {
|
||||
// Set the file storage - may need it to remove files later.
|
||||
$fs = get_file_storage();
|
||||
|
||||
// delete entries if requested
|
||||
// Delete entries if requested.
|
||||
if (!empty($data->reset_data)) {
|
||||
$DB->delete_records_select('comments', "itemid IN ($allrecordssql) AND commentarea='database_entry'", array($data->courseid));
|
||||
$DB->delete_records_select('data_content', "recordid IN ($allrecordssql)", array($data->courseid));
|
||||
$DB->delete_records_select('data_records', "dataid IN ($alldatassql)", array($data->courseid));
|
||||
$DB->delete_records_select('comments', "itemid IN ($allrecordssql) AND commentarea='database_entry'", [$data->courseid]);
|
||||
$DB->delete_records_select('data_content', "recordid IN ($allrecordssql)", [$data->courseid]);
|
||||
$DB->delete_records_select('data_records', "dataid IN ($alldatassql)", [$data->courseid]);
|
||||
|
||||
if ($datas = $DB->get_records_sql($alldatassql, array($data->courseid))) {
|
||||
if ($datas = $DB->get_records_sql($alldatassql, [$data->courseid])) {
|
||||
foreach ($datas as $dataid=>$unused) {
|
||||
if (!$cm = get_coursemodule_from_instance('data', $dataid)) {
|
||||
continue;
|
||||
@@ -2936,13 +2937,17 @@ function data_reset_userdata($data) {
|
||||
}
|
||||
|
||||
if (empty($data->reset_gradebook_grades)) {
|
||||
// remove all grades from gradebook
|
||||
// Remove all grades from gradebook.
|
||||
data_reset_gradebook($data->courseid);
|
||||
}
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('deleteallentries', 'data'), 'error'=>false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('deleteallentries', 'data'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// remove entries by users not enrolled into course
|
||||
// Remove entries by users not enrolled into course.
|
||||
if (!empty($data->reset_data_notenrolled)) {
|
||||
$recordssql = "SELECT r.id, r.userid, r.dataid, u.id AS userexists, u.deleted AS userdeleted
|
||||
FROM {data_records} r
|
||||
@@ -2951,13 +2956,13 @@ function data_reset_userdata($data) {
|
||||
WHERE d.course = ? AND r.userid > 0";
|
||||
|
||||
$course_context = context_course::instance($data->courseid);
|
||||
$notenrolled = array();
|
||||
$fields = array();
|
||||
$rs = $DB->get_recordset_sql($recordssql, array($data->courseid));
|
||||
$notenrolled = [];
|
||||
$fields = [];
|
||||
$rs = $DB->get_recordset_sql($recordssql, [$data->courseid]);
|
||||
foreach ($rs as $record) {
|
||||
if (array_key_exists($record->userid, $notenrolled) or !$record->userexists or $record->userdeleted
|
||||
or !is_enrolled($course_context, $record->userid)) {
|
||||
//delete ratings
|
||||
// Delete ratings.
|
||||
if (!$cm = get_coursemodule_from_instance('data', $record->dataid)) {
|
||||
continue;
|
||||
}
|
||||
@@ -2967,7 +2972,7 @@ function data_reset_userdata($data) {
|
||||
$rm->delete_ratings($ratingdeloptions);
|
||||
|
||||
// Delete any files that may exist.
|
||||
if ($contents = $DB->get_records('data_content', array('recordid' => $record->id), '', 'id')) {
|
||||
if ($contents = $DB->get_records('data_content', ['recordid' => $record->id], '', 'id')) {
|
||||
foreach ($contents as $content) {
|
||||
$fs->delete_area_files($datacontext->id, 'mod_data', 'content', $content->id);
|
||||
}
|
||||
@@ -2976,18 +2981,22 @@ function data_reset_userdata($data) {
|
||||
|
||||
core_tag_tag::remove_all_item_tags('mod_data', 'data_records', $record->id);
|
||||
|
||||
$DB->delete_records('comments', array('itemid' => $record->id, 'commentarea' => 'database_entry'));
|
||||
$DB->delete_records('data_content', array('recordid' => $record->id));
|
||||
$DB->delete_records('data_records', array('id' => $record->id));
|
||||
$DB->delete_records('comments', ['itemid' => $record->id, 'commentarea' => 'database_entry']);
|
||||
$DB->delete_records('data_content', ['recordid' => $record->id]);
|
||||
$DB->delete_records('data_records', ['id' => $record->id]);
|
||||
}
|
||||
}
|
||||
$rs->close();
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('deletenotenrolled', 'data'), 'error'=>false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('deletenotenrolled', 'data'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// remove all ratings
|
||||
// Remove all ratings.
|
||||
if (!empty($data->reset_data_ratings)) {
|
||||
if ($datas = $DB->get_records_sql($alldatassql, array($data->courseid))) {
|
||||
if ($datas = $DB->get_records_sql($alldatassql, [$data->courseid])) {
|
||||
foreach ($datas as $dataid=>$unused) {
|
||||
if (!$cm = get_coursemodule_from_instance('data', $dataid)) {
|
||||
continue;
|
||||
@@ -3000,22 +3009,30 @@ function data_reset_userdata($data) {
|
||||
}
|
||||
|
||||
if (empty($data->reset_gradebook_grades)) {
|
||||
// remove all grades from gradebook
|
||||
// Remove all grades from gradebook.
|
||||
data_reset_gradebook($data->courseid);
|
||||
}
|
||||
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('deleteallratings'), 'error'=>false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('deleteallratings'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// remove all comments
|
||||
// Remove all comments.
|
||||
if (!empty($data->reset_data_comments)) {
|
||||
$DB->delete_records_select('comments', "itemid IN ($allrecordssql) AND commentarea='database_entry'", array($data->courseid));
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('deleteallcomments'), 'error'=>false);
|
||||
$DB->delete_records_select('comments', "itemid IN ($allrecordssql) AND commentarea='database_entry'", [$data->courseid]);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('deleteallcomments'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// Remove all the tags.
|
||||
if (!empty($data->reset_data_tags)) {
|
||||
if ($datas = $DB->get_records_sql($alldatassql, array($data->courseid))) {
|
||||
if ($datas = $DB->get_records_sql($alldatassql, [$data->courseid])) {
|
||||
foreach ($datas as $dataid => $unused) {
|
||||
if (!$cm = get_coursemodule_from_instance('data', $dataid)) {
|
||||
continue;
|
||||
@@ -3026,16 +3043,35 @@ function data_reset_userdata($data) {
|
||||
|
||||
}
|
||||
}
|
||||
$status[] = array('component' => $componentstr, 'item' => get_string('tagsdeleted', 'data'), 'error' => false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('removealldatatags', 'data'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// updating dates - shift may be negative too
|
||||
// Updating dates - shift may be negative too.
|
||||
if ($data->timeshift) {
|
||||
// Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.
|
||||
// See MDL-9367.
|
||||
shift_course_mod_dates('data', array('timeavailablefrom', 'timeavailableto',
|
||||
'timeviewfrom', 'timeviewto', 'assesstimestart', 'assesstimefinish'), $data->timeshift, $data->courseid);
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('datechanged'), 'error'=>false);
|
||||
shift_course_mod_dates(
|
||||
'data',
|
||||
[
|
||||
'timeavailablefrom',
|
||||
'timeavailableto',
|
||||
'timeviewfrom',
|
||||
'timeviewto',
|
||||
'assesstimestart',
|
||||
'assesstimefinish',
|
||||
],
|
||||
$data->timeshift,
|
||||
$data->courseid,
|
||||
);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('date'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
return $status;
|
||||
|
||||
@@ -249,7 +249,8 @@ $string['radio'] = 'Multiple choice - single answer';
|
||||
$string['radio_values'] = 'Responses';
|
||||
$string['ready_feedbacks'] = 'Ready feedbacks';
|
||||
$string['required'] = 'Required';
|
||||
$string['resetting_data'] = 'Reset feedback responses';
|
||||
$string['resetting_data'] = 'Responses';
|
||||
$string['resetting_delete'] = 'Delete responses';
|
||||
$string['resetting_feedbacks'] = 'Resetting feedbacks';
|
||||
$string['response_nr'] = 'Response number';
|
||||
$string['responses'] = 'Responses';
|
||||
|
||||
+19
-13
@@ -625,12 +625,12 @@ function feedback_get_post_actions() {
|
||||
function feedback_reset_userdata($data) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$resetfeedbacks = array();
|
||||
$dropfeedbacks = array();
|
||||
$status = array();
|
||||
$resetfeedbacks = [];
|
||||
$dropfeedbacks = [];
|
||||
$status = [];
|
||||
$componentstr = get_string('modulenameplural', 'feedback');
|
||||
|
||||
//get the relevant entries from $data
|
||||
// Get the relevant entries from $data.
|
||||
foreach ($data as $key => $value) {
|
||||
switch(true) {
|
||||
case substr($key, 0, strlen(FEEDBACK_RESETFORM_RESET)) == FEEDBACK_RESETFORM_RESET:
|
||||
@@ -652,21 +652,27 @@ function feedback_reset_userdata($data) {
|
||||
}
|
||||
}
|
||||
|
||||
//reset the selected feedbacks
|
||||
// Reset the selected feedbacks.
|
||||
foreach ($resetfeedbacks as $id) {
|
||||
$feedback = $DB->get_record('feedback', array('id'=>$id));
|
||||
$feedback = $DB->get_record('feedback', ['id' => $id]);
|
||||
feedback_delete_all_completeds($feedback);
|
||||
$status[] = array('component'=>$componentstr.':'.$feedback->name,
|
||||
'item'=>get_string('resetting_data', 'feedback'),
|
||||
'error'=>false);
|
||||
$status[] = [
|
||||
'component' => $componentstr.':'.$feedback->name,
|
||||
'item' => get_string('resetting_data', 'feedback'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// Updating dates - shift may be negative too.
|
||||
if ($data->timeshift) {
|
||||
// Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.
|
||||
// See MDL-9367.
|
||||
$shifterror = !shift_course_mod_dates('feedback', array('timeopen', 'timeclose'), $data->timeshift, $data->courseid);
|
||||
$status[] = array('component' => $componentstr, 'item' => get_string('datechanged'), 'error' => $shifterror);
|
||||
$shifterror = !shift_course_mod_dates('feedback', ['timeopen', 'timeclose'], $data->timeshift, $data->courseid);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('date'),
|
||||
'error' => $shifterror,
|
||||
];
|
||||
}
|
||||
|
||||
return $status;
|
||||
@@ -688,7 +694,7 @@ function feedback_reset_course_form_definition(&$mform) {
|
||||
return;
|
||||
}
|
||||
|
||||
$mform->addElement('static', 'hint', get_string('resetting_data', 'feedback'));
|
||||
$mform->addElement('static', 'hint', get_string('resetting_delete', 'feedback'));
|
||||
foreach ($feedbacks as $feedback) {
|
||||
$mform->addElement('checkbox', FEEDBACK_RESETFORM_RESET.$feedback->id, $feedback->name);
|
||||
}
|
||||
@@ -731,7 +737,7 @@ function feedback_reset_course_form($course) {
|
||||
global $DB, $OUTPUT;
|
||||
|
||||
echo get_string('resetting_feedbacks', 'feedback'); echo ':<br />';
|
||||
if (!$feedbacks = $DB->get_records('feedback', array('course'=>$course->id), 'name')) {
|
||||
if (!$feedbacks = $DB->get_records('feedback', ['course' => $course->id], 'name')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,3 +6,4 @@ completionreplieshelp,mod_forum
|
||||
privacy:request:delete:discussion:name,mod_forum
|
||||
privacy:request:delete:post:message,mod_forum
|
||||
privacy:request:delete:post:subject,mod_forum
|
||||
tagsdeleted,mod_forum
|
||||
|
||||
@@ -613,7 +613,7 @@ $string['qandaforum'] = 'Q and A forum';
|
||||
$string['qandanotify'] = 'This is a question and answer forum. To see other replies, you must first post your reply.';
|
||||
$string['re'] = 'Re:';
|
||||
$string['readtherest'] = 'Read the rest of this topic';
|
||||
$string['removeallforumtags'] = 'Remove all forum tags';
|
||||
$string['removeallforumtags'] = 'All forum tags';
|
||||
$string['removefromfavourites'] = 'Unstar this discussion';
|
||||
$string['replies'] = 'Replies';
|
||||
$string['repliesmany'] = '{$a} replies so far';
|
||||
@@ -628,10 +628,10 @@ $string['replytouser'] = 'Use email address in reply';
|
||||
$string['reply_handler'] = 'Reply to forum posts via email';
|
||||
$string['reply_handler_name'] = 'Reply to forum posts';
|
||||
$string['resetforums'] = 'Delete posts from';
|
||||
$string['resetforumsall'] = 'Delete all posts';
|
||||
$string['resetdigests'] = 'Delete all per-user forum digest preferences';
|
||||
$string['resetsubscriptions'] = 'Delete all forum subscriptions';
|
||||
$string['resettrackprefs'] = 'Delete all forum tracking preferences';
|
||||
$string['resetforumsall'] = 'All posts';
|
||||
$string['resetdigests'] = 'All per-user forum digest preferences';
|
||||
$string['resetsubscriptions'] = 'All forum subscriptions';
|
||||
$string['resettrackprefs'] = 'All forum tracking preferences';
|
||||
$string['rsssubscriberssdiscussions'] = 'RSS feed of discussions';
|
||||
$string['rsssubscriberssposts'] = 'RSS feed of posts';
|
||||
$string['rssarticles'] = 'Number of RSS recent articles';
|
||||
@@ -704,7 +704,6 @@ $string['subscriptionauto'] = 'Auto subscription';
|
||||
$string['subscriptiondisabled'] = 'Subscription disabled';
|
||||
$string['subscriptions'] = 'Subscriptions';
|
||||
$string['tagarea_forum_posts'] = 'Forum posts';
|
||||
$string['tagsdeleted'] = 'Forum tags have been deleted';
|
||||
$string['thisforumisthrottled'] = 'This forum has a limit to the number of forum postings you can make in a given time period - this is currently set at {$a->blockafter} posting(s) in {$a->blockperiod}';
|
||||
$string['thisforumisdue'] = 'The due date for posting to this forum was {$a}.';
|
||||
$string['thisforumhasduedate'] = 'The due date for posting to this forum is {$a}.';
|
||||
@@ -800,3 +799,4 @@ $string['completionreplieshelp'] = 'requiring replies to complete';
|
||||
$string['privacy:request:delete:discussion:name'] = 'Delete at the request of the author';
|
||||
$string['privacy:request:delete:post:message'] = 'The content of this post has been deleted at the request of its author.';
|
||||
$string['privacy:request:delete:post:subject'] = 'Delete at the request of the author';
|
||||
$string['tagsdeleted'] = 'Forum tags have been deleted';
|
||||
|
||||
+90
-57
@@ -5042,26 +5042,26 @@ function forum_reset_userdata($data) {
|
||||
require_once($CFG->dirroot.'/rating/lib.php');
|
||||
|
||||
$componentstr = get_string('modulenameplural', 'forum');
|
||||
$status = array();
|
||||
$status = [];
|
||||
|
||||
$params = array($data->courseid);
|
||||
$params = [$data->courseid];
|
||||
|
||||
$removeposts = false;
|
||||
$typesql = "";
|
||||
$typesql = '';
|
||||
if (!empty($data->reset_forum_all)) {
|
||||
$removeposts = true;
|
||||
$typesstr = get_string('resetforumsall', 'forum');
|
||||
$types = array();
|
||||
} else if (!empty($data->reset_forum_types)){
|
||||
$typesstr = get_string('resetforumsall', 'forum');
|
||||
$types = [];
|
||||
} else if (!empty($data->reset_forum_types)) {
|
||||
$removeposts = true;
|
||||
$types = array();
|
||||
$sqltypes = array();
|
||||
$forum_types_all = forum_get_forum_types_all();
|
||||
$types = [];
|
||||
$sqltypes = [];
|
||||
$forumtypesall = forum_get_forum_types_all();
|
||||
foreach ($data->reset_forum_types as $type) {
|
||||
if (!array_key_exists($type, $forum_types_all)) {
|
||||
if (!array_key_exists($type, $forumtypesall)) {
|
||||
continue;
|
||||
}
|
||||
$types[] = $forum_types_all[$type];
|
||||
$types[] = $forumtypesall[$type];
|
||||
$sqltypes[] = $type;
|
||||
}
|
||||
if (!empty($sqltypes)) {
|
||||
@@ -5075,13 +5075,13 @@ function forum_reset_userdata($data) {
|
||||
FROM {forum_discussions} fd, {forum} f
|
||||
WHERE f.course=? AND f.id=fd.forum";
|
||||
|
||||
$allforumssql = "SELECT f.id
|
||||
FROM {forum} f
|
||||
WHERE f.course=?";
|
||||
$allforumssql = "SELECT f.id
|
||||
FROM {forum} f
|
||||
WHERE f.course=?";
|
||||
|
||||
$allpostssql = "SELECT fp.id
|
||||
FROM {forum_posts} fp, {forum_discussions} fd, {forum} f
|
||||
WHERE f.course=? AND f.id=fd.forum AND fd.id=fp.discussion";
|
||||
$allpostssql = "SELECT fp.id
|
||||
FROM {forum_posts} fp, {forum_discussions} fd, {forum} f
|
||||
WHERE f.course=? AND f.id=fd.forum AND fd.id=fp.discussion";
|
||||
|
||||
$forumssql = $forums = $rm = null;
|
||||
|
||||
@@ -5100,12 +5100,12 @@ function forum_reset_userdata($data) {
|
||||
|
||||
if ($removeposts) {
|
||||
$discussionssql = "$alldiscussionssql $typesql";
|
||||
$postssql = "$allpostssql $typesql";
|
||||
$postssql = "$allpostssql $typesql";
|
||||
|
||||
// now get rid of all attachments
|
||||
// Now get rid of all attachments.
|
||||
$fs = get_file_storage();
|
||||
if ($forums) {
|
||||
foreach ($forums as $forumid=>$unused) {
|
||||
foreach ($forums as $forumid => $unused) {
|
||||
if (!$cm = get_coursemodule_from_instance('forum', $forumid)) {
|
||||
continue;
|
||||
}
|
||||
@@ -5113,7 +5113,7 @@ function forum_reset_userdata($data) {
|
||||
$fs->delete_area_files($context->id, 'mod_forum', 'attachment');
|
||||
$fs->delete_area_files($context->id, 'mod_forum', 'post');
|
||||
|
||||
//remove ratings
|
||||
// Remove ratings.
|
||||
$ratingdeloptions->contextid = $context->id;
|
||||
$rm->delete_ratings($ratingdeloptions);
|
||||
|
||||
@@ -5121,23 +5121,29 @@ function forum_reset_userdata($data) {
|
||||
}
|
||||
}
|
||||
|
||||
// first delete all read flags
|
||||
// First delete all read flags.
|
||||
$DB->delete_records_select('forum_read', "forumid IN ($forumssql)", $params);
|
||||
|
||||
// remove tracking prefs
|
||||
// Remove tracking prefs.
|
||||
$DB->delete_records_select('forum_track_prefs', "forumid IN ($forumssql)", $params);
|
||||
|
||||
// remove posts from queue
|
||||
// Remove posts from queue.
|
||||
$DB->delete_records_select('forum_queue', "discussionid IN ($discussionssql)", $params);
|
||||
|
||||
// all posts - initial posts must be kept in single simple discussion forums
|
||||
$DB->delete_records_select('forum_posts', "discussion IN ($discussionssql) AND parent <> 0", $params); // first all children
|
||||
$DB->delete_records_select('forum_posts', "discussion IN ($discussionssql AND f.type <> 'single') AND parent = 0", $params); // now the initial posts for non single simple
|
||||
// All posts - initial posts must be kept in single simple discussion forums.
|
||||
// First all children.
|
||||
$DB->delete_records_select('forum_posts', "discussion IN ($discussionssql) AND parent <> 0", $params);
|
||||
// Now the initial posts for non single simple.
|
||||
$DB->delete_records_select(
|
||||
'forum_posts',
|
||||
"discussion IN ($discussionssql AND f.type <> 'single') AND parent = 0",
|
||||
$params
|
||||
);
|
||||
|
||||
// finally all discussions except single simple forums
|
||||
// Finally all discussions except single simple forums.
|
||||
$DB->delete_records_select('forum_discussions', "forum IN ($forumssql AND f.type <> 'single')", $params);
|
||||
|
||||
// remove all grades from gradebook
|
||||
// Remove all grades from gradebook.
|
||||
if (empty($data->reset_gradebook_grades)) {
|
||||
if (empty($types)) {
|
||||
forum_reset_gradebook($data->courseid);
|
||||
@@ -5148,25 +5154,29 @@ function forum_reset_userdata($data) {
|
||||
}
|
||||
}
|
||||
|
||||
$status[] = array('component'=>$componentstr, 'item'=>$typesstr, 'error'=>false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => $typesstr,
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// remove all ratings in this course's forums
|
||||
// Remove all ratings in this course's forums.
|
||||
if (!empty($data->reset_forum_ratings)) {
|
||||
if ($forums) {
|
||||
foreach ($forums as $forumid=>$unused) {
|
||||
foreach ($forums as $forumid => $unused) {
|
||||
if (!$cm = get_coursemodule_from_instance('forum', $forumid)) {
|
||||
continue;
|
||||
}
|
||||
$context = context_module::instance($cm->id);
|
||||
|
||||
//remove ratings
|
||||
// Remove ratings.
|
||||
$ratingdeloptions->contextid = $context->id;
|
||||
$rm->delete_ratings($ratingdeloptions);
|
||||
}
|
||||
}
|
||||
|
||||
// remove all grades from gradebook
|
||||
// Remove all grades from gradebook.
|
||||
if (empty($data->reset_gradebook_grades)) {
|
||||
forum_reset_gradebook($data->courseid);
|
||||
}
|
||||
@@ -5185,34 +5195,54 @@ function forum_reset_userdata($data) {
|
||||
}
|
||||
}
|
||||
|
||||
$status[] = array('component' => $componentstr, 'item' => get_string('tagsdeleted', 'forum'), 'error' => false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('removeallforumtags', 'forum'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// remove all digest settings unconditionally - even for users still enrolled in course.
|
||||
// Remove all digest settings unconditionally - even for users still enrolled in course.
|
||||
if (!empty($data->reset_forum_digests)) {
|
||||
$DB->delete_records_select('forum_digests', "forum IN ($allforumssql)", $params);
|
||||
$status[] = array('component' => $componentstr, 'item' => get_string('resetdigests', 'forum'), 'error' => false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('resetdigests', 'forum'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// remove all subscriptions unconditionally - even for users still enrolled in course
|
||||
// Remove all subscriptions unconditionally - even for users still enrolled in course.
|
||||
if (!empty($data->reset_forum_subscriptions)) {
|
||||
$DB->delete_records_select('forum_subscriptions', "forum IN ($allforumssql)", $params);
|
||||
$DB->delete_records_select('forum_discussion_subs', "forum IN ($allforumssql)", $params);
|
||||
$status[] = array('component' => $componentstr, 'item' => get_string('resetsubscriptions', 'forum'), 'error' => false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('resetsubscriptions', 'forum'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// remove all tracking prefs unconditionally - even for users still enrolled in course
|
||||
// Remove all tracking prefs unconditionally - even for users still enrolled in course.
|
||||
if (!empty($data->reset_forum_track_prefs)) {
|
||||
$DB->delete_records_select('forum_track_prefs', "forumid IN ($allforumssql)", $params);
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('resettrackprefs','forum'), 'error'=>false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('resettrackprefs', 'forum'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
/// updating dates - shift may be negative too
|
||||
// Updating dates - shift may be negative too.
|
||||
if ($data->timeshift) {
|
||||
// Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.
|
||||
// See MDL-9367.
|
||||
shift_course_mod_dates('forum', array('assesstimestart', 'assesstimefinish'), $data->timeshift, $data->courseid);
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('datechanged'), 'error'=>false);
|
||||
shift_course_mod_dates('forum', ['assesstimestart', 'assesstimefinish'], $data->timeshift, $data->courseid);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('date'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
return $status;
|
||||
@@ -5225,28 +5255,31 @@ function forum_reset_userdata($data) {
|
||||
*/
|
||||
function forum_reset_course_form_definition(&$mform) {
|
||||
$mform->addElement('header', 'forumheader', get_string('modulenameplural', 'forum'));
|
||||
$mform->addElement('static', 'forumdelete', get_string('delete'));
|
||||
|
||||
$mform->addElement('checkbox', 'reset_forum_all', get_string('resetforumsall','forum'));
|
||||
$mform->addElement('checkbox', 'reset_forum_digests', get_string('resetdigests', 'forum'));
|
||||
|
||||
$mform->addElement('select', 'reset_forum_types', get_string('resetforums', 'forum'), forum_get_forum_types_all(), array('multiple' => 'multiple'));
|
||||
$mform->setAdvanced('reset_forum_types');
|
||||
$mform->disabledIf('reset_forum_types', 'reset_forum_all', 'checked');
|
||||
$mform->addElement('checkbox', 'reset_forum_subscriptions', get_string('resetsubscriptions', 'forum'));
|
||||
|
||||
$mform->addElement('checkbox', 'reset_forum_digests', get_string('resetdigests','forum'));
|
||||
$mform->setAdvanced('reset_forum_digests');
|
||||
$mform->addElement('checkbox', 'reset_forum_all', get_string('resetforumsall', 'forum'));
|
||||
|
||||
$mform->addElement('checkbox', 'reset_forum_subscriptions', get_string('resetsubscriptions','forum'));
|
||||
$mform->setAdvanced('reset_forum_subscriptions');
|
||||
$mform->addElement(
|
||||
'select',
|
||||
'reset_forum_types',
|
||||
get_string('resetforums', 'forum'),
|
||||
forum_get_forum_types_all(),
|
||||
['multiple' => 'multiple'],
|
||||
);
|
||||
$mform->hideIf('reset_forum_types', 'reset_forum_all', 'checked');
|
||||
|
||||
$mform->addElement('checkbox', 'reset_forum_track_prefs', get_string('resettrackprefs','forum'));
|
||||
$mform->setAdvanced('reset_forum_track_prefs');
|
||||
$mform->disabledIf('reset_forum_track_prefs', 'reset_forum_all', 'checked');
|
||||
$mform->addElement('checkbox', 'reset_forum_track_prefs', get_string('resettrackprefs', 'forum'));
|
||||
$mform->hideIf('reset_forum_track_prefs', 'reset_forum_all', 'checked');
|
||||
|
||||
$mform->addElement('checkbox', 'reset_forum_ratings', get_string('deleteallratings'));
|
||||
$mform->disabledIf('reset_forum_ratings', 'reset_forum_all', 'checked');
|
||||
$mform->hideIf('reset_forum_ratings', 'reset_forum_all', 'checked');
|
||||
|
||||
$mform->addElement('checkbox', 'reset_forum_tags', get_string('removeallforumtags', 'forum'));
|
||||
$mform->disabledIf('reset_forum_tags', 'reset_forum_all', 'checked');
|
||||
$mform->hideIf('reset_forum_tags', 'reset_forum_all', 'checked');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
completionentriesgroup,mod_glossary
|
||||
tagsdeleted,mod_glossary
|
||||
|
||||
@@ -109,7 +109,7 @@ $string['definitions'] = 'Definitions';
|
||||
$string['deleteentry'] = 'Delete entry';
|
||||
$string['deletecategory'] = 'Delete category';
|
||||
$string['deleteentrya'] = 'Delete entry: {$a}';
|
||||
$string['deletenotenrolled'] = 'Delete entries by users not enrolled';
|
||||
$string['deletenotenrolled'] = 'Entries by users not enrolled';
|
||||
$string['deletingcomment'] = 'Deleting comment';
|
||||
$string['deletingnoneemptycategory'] = 'Deleting this category will not delete the entries it contains - they will be marked as uncategorised.';
|
||||
$string['descending'] = 'descending';
|
||||
@@ -301,9 +301,9 @@ $string['privacy:metadata:glossary_entries:timemodified'] = 'The timestamp indic
|
||||
$string['question'] = 'Question';
|
||||
$string['rejectedentries'] = 'Rejected entries';
|
||||
$string['rejectionrpt'] = 'Rejection report';
|
||||
$string['removeallglossarytags'] = 'Remove all glossary tags';
|
||||
$string['removeallglossarytags'] = 'All glossary tags';
|
||||
$string['resetglossaries'] = 'Delete entries from';
|
||||
$string['resetglossariesall'] = 'Delete entries from all glossaries';
|
||||
$string['resetglossariesall'] = 'Entries from all glossaries';
|
||||
$string['rssarticles'] = 'Number of RSS recent articles';
|
||||
$string['rssarticles_help'] = 'This setting specifies the number of glossary entry concepts to include in the RSS feed. Between 5 and 20 generally acceptable.';
|
||||
$string['rsssubscriberss'] = 'Display the RSS feed for \'{$a}\' concepts';
|
||||
@@ -328,7 +328,6 @@ $string['special'] = 'Special';
|
||||
$string['standardview'] = 'Browse by alphabet';
|
||||
$string['studentcanpost'] = 'Students can add entries';
|
||||
$string['tagarea_glossary_entries'] = 'Glossary entries';
|
||||
$string['tagsdeleted'] = 'Glossary tags have been deleted';
|
||||
$string['totalentries'] = 'Total entries';
|
||||
$string['usedynalink'] = 'Automatically link glossary entries';
|
||||
$string['usedynalink_help'] = 'If site-wide glossary auto-linking has been enabled by an administrator and this setting is enabled, the "Add a new entry" form includes the option to automatically link the entry wherever the concept words and phrases appear throughout the rest of the course.';
|
||||
@@ -341,3 +340,6 @@ $string['youarenottheauthor'] = 'You are not the author of this comment, so you
|
||||
|
||||
// Deprecated since 4.3.
|
||||
$string['completionentriesgroup'] = 'Require entries';
|
||||
|
||||
// Deprecated since 4.5.
|
||||
$string['tagsdeleted'] = 'Glossary tags have been deleted';
|
||||
|
||||
+74
-42
@@ -2795,24 +2795,24 @@ function glossary_get_post_actions() {
|
||||
*/
|
||||
function glossary_reset_course_form_definition(&$mform) {
|
||||
$mform->addElement('header', 'glossaryheader', get_string('modulenameplural', 'glossary'));
|
||||
$mform->addElement('static', 'glossarydelete', get_string('delete'));
|
||||
$mform->addElement('checkbox', 'reset_glossary_all', get_string('resetglossariesall','glossary'));
|
||||
|
||||
$mform->addElement('select', 'reset_glossary_types', get_string('resetglossaries', 'glossary'),
|
||||
array('main'=>get_string('mainglossary', 'glossary'), 'secondary'=>get_string('secondaryglossary', 'glossary')), array('multiple' => 'multiple'));
|
||||
$mform->setAdvanced('reset_glossary_types');
|
||||
$mform->disabledIf('reset_glossary_types', 'reset_glossary_all', 'checked');
|
||||
$mform->hideIf('reset_glossary_types', 'reset_glossary_all', 'checked');
|
||||
|
||||
$mform->addElement('checkbox', 'reset_glossary_notenrolled', get_string('deletenotenrolled', 'glossary'));
|
||||
$mform->disabledIf('reset_glossary_notenrolled', 'reset_glossary_all', 'checked');
|
||||
$mform->hideIf('reset_glossary_notenrolled', 'reset_glossary_all', 'checked');
|
||||
|
||||
$mform->addElement('checkbox', 'reset_glossary_ratings', get_string('deleteallratings'));
|
||||
$mform->disabledIf('reset_glossary_ratings', 'reset_glossary_all', 'checked');
|
||||
$mform->hideIf('reset_glossary_ratings', 'reset_glossary_all', 'checked');
|
||||
|
||||
$mform->addElement('checkbox', 'reset_glossary_comments', get_string('deleteallcomments'));
|
||||
$mform->disabledIf('reset_glossary_comments', 'reset_glossary_all', 'checked');
|
||||
$mform->hideIf('reset_glossary_comments', 'reset_glossary_all', 'checked');
|
||||
|
||||
$mform->addElement('checkbox', 'reset_glossary_tags', get_string('removeallglossarytags', 'glossary'));
|
||||
$mform->disabledIf('reset_glossary_tags', 'reset_glossary_all', 'checked');
|
||||
$mform->hideIf('reset_glossary_tags', 'reset_glossary_all', 'checked');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2861,7 +2861,7 @@ function glossary_reset_userdata($data) {
|
||||
require_once($CFG->dirroot.'/rating/lib.php');
|
||||
|
||||
$componentstr = get_string('modulenameplural', 'glossary');
|
||||
$status = array();
|
||||
$status = [];
|
||||
|
||||
$allentriessql = "SELECT e.id
|
||||
FROM {glossary_entries} e
|
||||
@@ -2872,7 +2872,7 @@ function glossary_reset_userdata($data) {
|
||||
FROM {glossary} g
|
||||
WHERE g.course = ?";
|
||||
|
||||
$params = array($data->courseid);
|
||||
$params = [$data->courseid];
|
||||
|
||||
$fs = get_file_storage();
|
||||
|
||||
@@ -2881,7 +2881,7 @@ function glossary_reset_userdata($data) {
|
||||
$ratingdeloptions->component = 'mod_glossary';
|
||||
$ratingdeloptions->ratingarea = 'entry';
|
||||
|
||||
// delete entries if requested
|
||||
// Delete entries if requested.
|
||||
if (!empty($data->reset_glossary_all)
|
||||
or (!empty($data->reset_glossary_types) and in_array('main', $data->reset_glossary_types) and in_array('secondary', $data->reset_glossary_types))) {
|
||||
|
||||
@@ -2890,7 +2890,7 @@ function glossary_reset_userdata($data) {
|
||||
$DB->delete_records_select('glossary_alias', "entryid IN ($allentriessql)", $params);
|
||||
$DB->delete_records_select('glossary_entries', "glossaryid IN ($allglossariessql)", $params);
|
||||
|
||||
// now get rid of all attachments
|
||||
// Now get rid of all attachments.
|
||||
if ($glossaries = $DB->get_records_sql($allglossariessql, $params)) {
|
||||
foreach ($glossaries as $glossaryid=>$unused) {
|
||||
if (!$cm = get_coursemodule_from_instance('glossary', $glossaryid)) {
|
||||
@@ -2899,7 +2899,7 @@ function glossary_reset_userdata($data) {
|
||||
$context = context_module::instance($cm->id);
|
||||
$fs->delete_area_files($context->id, 'mod_glossary', 'attachment');
|
||||
|
||||
//delete ratings
|
||||
// Delete ratings.
|
||||
$ratingdeloptions->contextid = $context->id;
|
||||
$rm->delete_ratings($ratingdeloptions);
|
||||
|
||||
@@ -2907,18 +2907,22 @@ function glossary_reset_userdata($data) {
|
||||
}
|
||||
}
|
||||
|
||||
// remove all grades from gradebook
|
||||
// Remove all grades from gradebook.
|
||||
if (empty($data->reset_gradebook_grades)) {
|
||||
glossary_reset_gradebook($data->courseid);
|
||||
}
|
||||
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('resetglossariesall', 'glossary'), 'error'=>false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('resetglossariesall', 'glossary'),
|
||||
'error' => false,
|
||||
];
|
||||
|
||||
} else if (!empty($data->reset_glossary_types)) {
|
||||
$mainentriessql = "$allentriessql AND g.mainglossary=1";
|
||||
$secondaryentriessql = "$allentriessql AND g.mainglossary=0";
|
||||
$mainentriessql = "$allentriessql AND g.mainglossary=1";
|
||||
$secondaryentriessql = "$allentriessql AND g.mainglossary=0";
|
||||
|
||||
$mainglossariessql = "$allglossariessql AND g.mainglossary=1";
|
||||
$mainglossariessql = "$allglossariessql AND g.mainglossary=1";
|
||||
$secondaryglossariessql = "$allglossariessql AND g.mainglossary=0";
|
||||
|
||||
if (in_array('main', $data->reset_glossary_types)) {
|
||||
@@ -2934,7 +2938,7 @@ function glossary_reset_userdata($data) {
|
||||
$context = context_module::instance($cm->id);
|
||||
$fs->delete_area_files($context->id, 'mod_glossary', 'attachment');
|
||||
|
||||
//delete ratings
|
||||
// Delete ratings.
|
||||
$ratingdeloptions->contextid = $context->id;
|
||||
$rm->delete_ratings($ratingdeloptions);
|
||||
|
||||
@@ -2942,18 +2946,22 @@ function glossary_reset_userdata($data) {
|
||||
}
|
||||
}
|
||||
|
||||
// remove all grades from gradebook
|
||||
// Remove all grades from gradebook.
|
||||
if (empty($data->reset_gradebook_grades)) {
|
||||
glossary_reset_gradebook($data->courseid, 'main');
|
||||
}
|
||||
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('resetglossaries', 'glossary').': '.get_string('mainglossary', 'glossary'), 'error'=>false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('resetglossaries', 'glossary').': '.get_string('mainglossary', 'glossary'),
|
||||
'error' => false,
|
||||
];
|
||||
|
||||
} else if (in_array('secondary', $data->reset_glossary_types)) {
|
||||
$params[] = 'glossary_entry';
|
||||
$DB->delete_records_select('comments', "itemid IN ($secondaryentriessql) AND commentarea=?", $params);
|
||||
$DB->delete_records_select('glossary_entries', "glossaryid IN ($secondaryglossariessql)", $params);
|
||||
// remove exported source flag from entries in main glossary
|
||||
// Remove exported source flag from entries in main glossary.
|
||||
$DB->execute("UPDATE {glossary_entries}
|
||||
SET sourceglossaryid=0
|
||||
WHERE glossaryid IN ($mainglossariessql)", $params);
|
||||
@@ -2966,7 +2974,7 @@ function glossary_reset_userdata($data) {
|
||||
$context = context_module::instance($cm->id);
|
||||
$fs->delete_area_files($context->id, 'mod_glossary', 'attachment');
|
||||
|
||||
//delete ratings
|
||||
// Delete ratings.
|
||||
$ratingdeloptions->contextid = $context->id;
|
||||
$rm->delete_ratings($ratingdeloptions);
|
||||
|
||||
@@ -2974,16 +2982,20 @@ function glossary_reset_userdata($data) {
|
||||
}
|
||||
}
|
||||
|
||||
// remove all grades from gradebook
|
||||
// Remove all grades from gradebook.
|
||||
if (empty($data->reset_gradebook_grades)) {
|
||||
glossary_reset_gradebook($data->courseid, 'secondary');
|
||||
}
|
||||
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('resetglossaries', 'glossary').': '.get_string('secondaryglossary', 'glossary'), 'error'=>false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('resetglossaries', 'glossary').': '.get_string('secondaryglossary', 'glossary'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// remove entries by users not enrolled into course
|
||||
// Remove entries by users not enrolled into course.
|
||||
if (!empty($data->reset_glossary_notenrolled)) {
|
||||
$entriessql = "SELECT e.id, e.userid, e.glossaryid, u.id AS userexists, u.deleted AS userdeleted
|
||||
FROM {glossary_entries} e
|
||||
@@ -2991,15 +3003,15 @@ function glossary_reset_userdata($data) {
|
||||
LEFT JOIN {user} u ON e.userid = u.id
|
||||
WHERE g.course = ? AND e.userid > 0";
|
||||
|
||||
$course_context = context_course::instance($data->courseid);
|
||||
$notenrolled = array();
|
||||
$coursecontext = context_course::instance($data->courseid);
|
||||
$notenrolled = [];
|
||||
$rs = $DB->get_recordset_sql($entriessql, $params);
|
||||
if ($rs->valid()) {
|
||||
foreach ($rs as $entry) {
|
||||
if (array_key_exists($entry->userid, $notenrolled) or !$entry->userexists or $entry->userdeleted
|
||||
or !is_enrolled($course_context , $entry->userid)) {
|
||||
$DB->delete_records('comments', array('commentarea'=>'glossary_entry', 'itemid'=>$entry->id));
|
||||
$DB->delete_records('glossary_entries', array('id'=>$entry->id));
|
||||
if (array_key_exists($entry->userid, $notenrolled) || !$entry->userexists || $entry->userdeleted
|
||||
|| !is_enrolled($coursecontext , $entry->userid)) {
|
||||
$DB->delete_records('comments', ['commentarea' => 'glossary_entry', 'itemid' => $entry->id]);
|
||||
$DB->delete_records('glossary_entries', ['id' => $entry->id]);
|
||||
|
||||
if ($cm = get_coursemodule_from_instance('glossary', $entry->glossaryid)) {
|
||||
$context = context_module::instance($cm->id);
|
||||
@@ -3011,14 +3023,18 @@ function glossary_reset_userdata($data) {
|
||||
}
|
||||
}
|
||||
}
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('deletenotenrolled', 'glossary'), 'error'=>false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('deletenotenrolled', 'glossary'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
$rs->close();
|
||||
}
|
||||
|
||||
// remove all ratings
|
||||
// Remove all ratings.
|
||||
if (!empty($data->reset_glossary_ratings)) {
|
||||
//remove ratings
|
||||
// Remove ratings.
|
||||
if ($glossaries = $DB->get_records_sql($allglossariessql, $params)) {
|
||||
foreach ($glossaries as $glossaryid=>$unused) {
|
||||
if (!$cm = get_coursemodule_from_instance('glossary', $glossaryid)) {
|
||||
@@ -3026,24 +3042,32 @@ function glossary_reset_userdata($data) {
|
||||
}
|
||||
$context = context_module::instance($cm->id);
|
||||
|
||||
//delete ratings
|
||||
// Delete ratings.
|
||||
$ratingdeloptions->contextid = $context->id;
|
||||
$rm->delete_ratings($ratingdeloptions);
|
||||
}
|
||||
}
|
||||
|
||||
// remove all grades from gradebook
|
||||
// Remove all grades from gradebook.
|
||||
if (empty($data->reset_gradebook_grades)) {
|
||||
glossary_reset_gradebook($data->courseid);
|
||||
}
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('deleteallratings'), 'error'=>false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('deleteallratings'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// remove comments
|
||||
// Remove comments.
|
||||
if (!empty($data->reset_glossary_comments)) {
|
||||
$params[] = 'glossary_entry';
|
||||
$DB->delete_records_select('comments', "itemid IN ($allentriessql) AND commentarea= ? ", $params);
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('deleteallcomments'), 'error'=>false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('deleteallcomments'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
// Remove all the tags.
|
||||
@@ -3059,15 +3083,23 @@ function glossary_reset_userdata($data) {
|
||||
}
|
||||
}
|
||||
|
||||
$status[] = array('component' => $componentstr, 'item' => get_string('tagsdeleted', 'glossary'), 'error' => false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('removeallglossarytags', 'glossary'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
/// updating dates - shift may be negative too
|
||||
// Updating dates - shift may be negative too.
|
||||
if ($data->timeshift) {
|
||||
// Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.
|
||||
// See MDL-9367.
|
||||
shift_course_mod_dates('glossary', array('assesstimestart', 'assesstimefinish'), $data->timeshift, $data->courseid);
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('datechanged'), 'error'=>false);
|
||||
shift_course_mod_dates('glossary', ['assesstimestart', 'assesstimefinish'], $data->timeshift, $data->courseid);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('date'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
return $status;
|
||||
|
||||
@@ -58,7 +58,7 @@ $string['completion'] = 'Completion';
|
||||
$string['contentbank'] = 'More information about the content bank';
|
||||
$string['contentbank_help'] = 'In the content bank you can create and store content using several authoring tools, including an integrated H5P creator.';
|
||||
$string['correct_answer'] = 'Correct answer';
|
||||
$string['deleteallattempts'] = 'Delete all H5P attempts';
|
||||
$string['deleteallattempts'] = 'All H5P attempts';
|
||||
$string['displayexport'] = 'Allow download';
|
||||
$string['displayembed'] = 'Embed button';
|
||||
$string['displaycopyright'] = 'Copyright button';
|
||||
|
||||
@@ -253,6 +253,7 @@ function h5pactivity_rescale_activity_grades(stdClass $course, stdClass $cm, flo
|
||||
*/
|
||||
function h5pactivity_reset_course_form_definition(&$mform): void {
|
||||
$mform->addElement('header', 'h5pactivityheader', get_string('modulenameplural', 'mod_h5pactivity'));
|
||||
$mform->addElement('static', 'h5pactivitydelete', get_string('delete'));
|
||||
$mform->addElement('advcheckbox', 'reset_h5pactivity', get_string('deleteallattempts', 'mod_h5pactivity'));
|
||||
}
|
||||
|
||||
|
||||
@@ -40,9 +40,9 @@ Feature: Teacher can reset H5P activity grades
|
||||
When I am on the "Course 1" "reset" page
|
||||
And I expand all fieldsets
|
||||
# Check `Delete all grades` in course reset page to reset grades
|
||||
And I click on "Delete all grades" "checkbox"
|
||||
And I click on "All grades" "checkbox"
|
||||
And I press "Reset"
|
||||
Then I should see "OK" in the "Gradebook" "table_row"
|
||||
Then I should see "Done" in the "Gradebook" "table_row"
|
||||
And I press "Continue"
|
||||
# Confirm that previously saved grades are gone
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
completiontimespent,mod_lesson
|
||||
grade,mod_lesson
|
||||
useroverridesdeleted,mod_lesson
|
||||
groupoverridesdeleted,mod_lesson
|
||||
|
||||
@@ -146,7 +146,7 @@ $string['customscoring'] = 'Custom scoring';
|
||||
$string['customscoring_help'] = 'If enabled, a whole number value (positive or negative) may be entered for each answer.';
|
||||
$string['deadline'] = 'Deadline';
|
||||
$string['defaultessayresponse'] = 'Your essay will be graded by your teacher.';
|
||||
$string['deleteallattempts'] = 'Delete all lesson attempts';
|
||||
$string['deleteallattempts'] = 'All lesson attempts';
|
||||
$string['deletedefaults'] = 'Deleted {$a} x lesson default';
|
||||
$string['deletedpage'] = 'Deleted page';
|
||||
$string['deletepagenamed'] = 'Delete page: {$a}';
|
||||
@@ -254,7 +254,6 @@ $string['gradeessay'] = 'Grade essay questions ({$a->notgradedcount} not graded
|
||||
$string['gradeis'] = 'Grade is {$a}';
|
||||
$string['gradeoptions'] = 'Grade options';
|
||||
$string['groupoverrides'] = 'Group overrides';
|
||||
$string['groupoverridesdeleted'] = 'Group overrides deleted';
|
||||
$string['groupsnone'] = 'No groups you can access.';
|
||||
$string['handlingofretakes'] = 'Handling of re-takes';
|
||||
$string['handlingofretakes_help'] = 'If re-takes are allowed, this setting specifies whether the grade for the lesson is the mean or maximum of all attempts.';
|
||||
@@ -515,8 +514,8 @@ $string['rank'] = 'Rank';
|
||||
$string['rawgrade'] = 'Raw grade';
|
||||
$string['receivedcredit'] = 'Received credit';
|
||||
$string['redisplaypage'] = 'Redisplay page';
|
||||
$string['removeallgroupoverrides'] = 'Delete all group overrides';
|
||||
$string['removealluseroverrides'] = 'Delete all user overrides';
|
||||
$string['removeallgroupoverrides'] = 'All group overrides';
|
||||
$string['removealluseroverrides'] = 'All user overrides';
|
||||
$string['report'] = 'Report';
|
||||
$string['reports'] = 'Reports';
|
||||
$string['response'] = 'Response';
|
||||
@@ -592,7 +591,6 @@ $string['usemean'] = 'Use mean';
|
||||
$string['usepassword'] = 'Password protected lesson';
|
||||
$string['usepassword_help'] = 'If enabled, a password is required in order to access the lesson.';
|
||||
$string['useroverrides'] = 'User overrides';
|
||||
$string['useroverridesdeleted'] = 'User overrides deleted';
|
||||
$string['usersnone'] = 'No students have access to this lesson';
|
||||
$string['viewessayanswers'] = 'View essay answers';
|
||||
$string['viewgrades'] = 'View grades';
|
||||
@@ -616,3 +614,7 @@ $string['completiontimespent'] = 'Student must do this activity at least for';
|
||||
|
||||
// Deprecated since Moodle 4.4.
|
||||
$string['grade'] = 'Grade';
|
||||
|
||||
// Deprecated since Moodle 4.5.
|
||||
$string['useroverridesdeleted'] = 'User overrides deleted';
|
||||
$string['groupoverridesdeleted'] = 'Group overrides deleted';
|
||||
|
||||
+29
-18
@@ -836,7 +836,8 @@ function lesson_process_post_save(&$lesson) {
|
||||
*/
|
||||
function lesson_reset_course_form_definition(&$mform) {
|
||||
$mform->addElement('header', 'lessonheader', get_string('modulenameplural', 'lesson'));
|
||||
$mform->addElement('advcheckbox', 'reset_lesson', get_string('deleteallattempts','lesson'));
|
||||
$mform->addElement('static', 'lessondelete', get_string('delete'));
|
||||
$mform->addElement('advcheckbox', 'reset_lesson', get_string('deleteallattempts', 'lesson'));
|
||||
$mform->addElement('advcheckbox', 'reset_lesson_user_overrides',
|
||||
get_string('removealluseroverrides', 'lesson'));
|
||||
$mform->addElement('advcheckbox', 'reset_lesson_group_overrides',
|
||||
@@ -889,14 +890,14 @@ function lesson_reset_userdata($data) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$componentstr = get_string('modulenameplural', 'lesson');
|
||||
$status = array();
|
||||
$status = [];
|
||||
|
||||
if (!empty($data->reset_lesson)) {
|
||||
$lessonssql = "SELECT l.id
|
||||
FROM {lesson} l
|
||||
WHERE l.course=:course";
|
||||
|
||||
$params = array ("course" => $data->courseid);
|
||||
$params = ["course" => $data->courseid];
|
||||
$lessons = $DB->get_records_sql($lessonssql, $params);
|
||||
|
||||
// Get rid of attempts files.
|
||||
@@ -917,12 +918,16 @@ function lesson_reset_userdata($data) {
|
||||
$DB->delete_records_select('lesson_attempts', "lessonid IN ($lessonssql)", $params);
|
||||
$DB->delete_records_select('lesson_branch', "lessonid IN ($lessonssql)", $params);
|
||||
|
||||
// remove all grades from gradebook
|
||||
// Remove all grades from gradebook.
|
||||
if (empty($data->reset_gradebook_grades)) {
|
||||
lesson_reset_gradebook($data->courseid);
|
||||
}
|
||||
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('deleteallattempts', 'lesson'), 'error'=>false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('deleteallattempts', 'lesson'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
$purgeoverrides = false;
|
||||
@@ -930,40 +935,46 @@ function lesson_reset_userdata($data) {
|
||||
// Remove user overrides.
|
||||
if (!empty($data->reset_lesson_user_overrides)) {
|
||||
$DB->delete_records_select('lesson_overrides',
|
||||
'lessonid IN (SELECT id FROM {lesson} WHERE course = ?) AND userid IS NOT NULL', array($data->courseid));
|
||||
$status[] = array(
|
||||
'lessonid IN (SELECT id FROM {lesson} WHERE course = ?) AND userid IS NOT NULL', [$data->courseid]);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('useroverridesdeleted', 'lesson'),
|
||||
'error' => false);
|
||||
'item' => get_string('useroverrides', 'lesson'),
|
||||
'error' => false,
|
||||
];
|
||||
$purgeoverrides = true;
|
||||
}
|
||||
// Remove group overrides.
|
||||
if (!empty($data->reset_lesson_group_overrides)) {
|
||||
$DB->delete_records_select('lesson_overrides',
|
||||
'lessonid IN (SELECT id FROM {lesson} WHERE course = ?) AND groupid IS NOT NULL', array($data->courseid));
|
||||
$status[] = array(
|
||||
'lessonid IN (SELECT id FROM {lesson} WHERE course = ?) AND groupid IS NOT NULL', [$data->courseid]);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('groupoverridesdeleted', 'lesson'),
|
||||
'error' => false);
|
||||
'item' => get_string('groupoverrides', 'lesson'),
|
||||
'error' => false,
|
||||
];
|
||||
$purgeoverrides = true;
|
||||
}
|
||||
/// updating dates - shift may be negative too
|
||||
// Updating dates - shift may be negative too.
|
||||
if ($data->timeshift) {
|
||||
$DB->execute("UPDATE {lesson_overrides}
|
||||
SET available = available + ?
|
||||
WHERE lessonid IN (SELECT id FROM {lesson} WHERE course = ?)
|
||||
AND available <> 0", array($data->timeshift, $data->courseid));
|
||||
AND available <> 0", [$data->timeshift, $data->courseid]);
|
||||
$DB->execute("UPDATE {lesson_overrides}
|
||||
SET deadline = deadline + ?
|
||||
WHERE lessonid IN (SELECT id FROM {lesson} WHERE course = ?)
|
||||
AND deadline <> 0", array($data->timeshift, $data->courseid));
|
||||
AND deadline <> 0", [$data->timeshift, $data->courseid]);
|
||||
|
||||
$purgeoverrides = true;
|
||||
|
||||
// Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.
|
||||
// See MDL-9367.
|
||||
shift_course_mod_dates('lesson', array('available', 'deadline'), $data->timeshift, $data->courseid);
|
||||
$status[] = array('component'=>$componentstr, 'item'=>get_string('datechanged'), 'error'=>false);
|
||||
shift_course_mod_dates('lesson', ['available', 'deadline'], $data->timeshift, $data->courseid);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('date'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
|
||||
if ($purgeoverrides) {
|
||||
|
||||
@@ -46,7 +46,7 @@ Feature: Lesson reset
|
||||
And I should see "Sam1 Student1"
|
||||
And I am on the "Course 1" "reset" page
|
||||
And I set the following fields to these values:
|
||||
| Delete all lesson attempts | 1 |
|
||||
| All lesson attempts | 1 |
|
||||
And I press "Reset course"
|
||||
And I press "Continue"
|
||||
And I am on the "Test lesson name" "lesson activity" page
|
||||
@@ -65,7 +65,7 @@ Feature: Lesson reset
|
||||
And I should see "Sam1 Student1"
|
||||
And I am on the "Course 1" "reset" page
|
||||
And I set the following fields to these values:
|
||||
| Delete all user overrides | 1 |
|
||||
| All user overrides | 1 |
|
||||
And I press "Reset course"
|
||||
And I press "Continue"
|
||||
And I am on the "Test lesson name" "lesson activity" page
|
||||
@@ -84,7 +84,7 @@ Feature: Lesson reset
|
||||
And I should see "Group 1"
|
||||
And I am on the "Course 1" "reset" page
|
||||
And I set the following fields to these values:
|
||||
| Delete all group overrides | 1 |
|
||||
| All group overrides | 1 |
|
||||
And I press "Reset course"
|
||||
And I press "Continue"
|
||||
And I am on the "Test lesson name" "lesson activity" page
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
completionminattemptsgroup,mod_quiz
|
||||
grade,mod_quiz
|
||||
timetaken,mod_quiz
|
||||
attemptsdeleted,mod_quiz
|
||||
gradesdeleted,mod_quiz
|
||||
useroverridesdeleted,mod_quiz
|
||||
groupoverridesdeleted,mod_quiz
|
||||
|
||||
@@ -107,7 +107,6 @@ $string['attemptreviewtitlepaged'] = '{$a->name}: Attempt review (page {$a->curr
|
||||
$string['attempts'] = 'Attempts';
|
||||
$string['attempts_help'] = 'The total number of attempts allowed (not the number of extra attempts).';
|
||||
$string['attemptsallowed'] = 'Attempts allowed';
|
||||
$string['attemptsdeleted'] = 'Quiz attempts deleted';
|
||||
$string['attemptselection'] = 'Select which attempts to analyze per user:';
|
||||
$string['attemptsexist'] = 'You can no longer add or remove questions.';
|
||||
$string['attemptsnum'] = 'Attempts: {$a}';
|
||||
@@ -461,7 +460,6 @@ $string['grademethod_help'] = 'When multiple attempts are allowed, the following
|
||||
* Average (mean) grade of all attempts
|
||||
* First attempt (all other attempts are ignored)
|
||||
* Last attempt (all other attempts are ignored)';
|
||||
$string['gradesdeleted'] = 'Quiz grades deleted';
|
||||
$string['gradesofar'] = '{$a->method}: {$a->mygrade} / {$a->quizgrade}.';
|
||||
$string['gradetopassmustbeset'] = 'Grade to pass cannot be zero as this quiz has its completion method set to require passing grade. Please set a non-zero value.';
|
||||
$string['gradetopassoutof'] = 'Grade to pass: {$a->grade} out of {$a->maxgrade}';
|
||||
@@ -471,7 +469,6 @@ $string['gradingdetailspenalty'] = 'This submission attracted a penalty of {$a}.
|
||||
$string['gradingdetailszeropenalty'] = 'You were not penalized for this submission.';
|
||||
$string['gradingmethod'] = 'Grading method: {$a}';
|
||||
$string['groupoverrides'] = 'Group overrides';
|
||||
$string['groupoverridesdeleted'] = 'Group overrides deleted';
|
||||
$string['groupsnone'] = 'No groups you can access.';
|
||||
$string['guestsno'] = 'Sorry, guests cannot see or attempt quizzes';
|
||||
$string['hidebreaks'] = 'Hide page breaks';
|
||||
@@ -644,7 +641,7 @@ $string['onlyteachersimport'] = 'Only teachers with editing rights can import qu
|
||||
$string['onthispage'] = 'This page';
|
||||
$string['open'] = 'Not answered';
|
||||
$string['openafterclose'] = 'Could not update the quiz. You have specified an open date after the close date.';
|
||||
$string['openclosedatesupdated'] = 'Quiz open and close dates updated';
|
||||
$string['openclosedatesupdated'] = 'Open and close dates';
|
||||
$string['optional'] = 'optional';
|
||||
$string['orderandpaging'] = 'Order and paging';
|
||||
$string['orderandpaging_help'] = 'The numbers 10, 20, 30, ... opposite each question indicate the order of the questions. The numbers increase in steps of 10 to leave space for additional questions to be inserted. To reorder the questions, change the numbers then click the "Reorder questions" button.
|
||||
@@ -867,9 +864,9 @@ $string['regradenotallowed'] = 'You do not have permission to regrade this quiz'
|
||||
$string['regradingquestion'] = 'Regrading "{$a}".';
|
||||
$string['regradingquiz'] = 'Regrading quiz "{$a}"';
|
||||
$string['remove'] = 'Remove';
|
||||
$string['removeallgroupoverrides'] = 'Delete all group overrides';
|
||||
$string['removeallquizattempts'] = 'Delete all quiz attempts';
|
||||
$string['removealluseroverrides'] = 'Delete all user overrides';
|
||||
$string['removeallgroupoverrides'] = 'All group overrides';
|
||||
$string['removeallquizattempts'] = 'All quiz attempts';
|
||||
$string['removealluseroverrides'] = 'All user overrides';
|
||||
$string['removeemptypage'] = 'Remove empty page';
|
||||
$string['removepagebreak'] = 'Remove page break';
|
||||
$string['removeselected'] = 'Remove selected';
|
||||
@@ -1091,7 +1088,6 @@ $string['upgradingveryoldquizattempts'] = 'Upgrading very old quiz attempts: {$a
|
||||
$string['url'] = 'URL';
|
||||
$string['usedcategorymoved'] = 'This category has been preserved and moved to the site level because it is a published category still in use by other courses.';
|
||||
$string['useroverrides'] = 'User overrides';
|
||||
$string['useroverridesdeleted'] = 'User overrides deleted';
|
||||
$string['usersnone'] = 'No students have access to this quiz';
|
||||
$string['validate'] = 'Validate';
|
||||
$string['viewallanswers'] = 'View {$a} quiz attempts';
|
||||
@@ -1117,3 +1113,9 @@ $string['completionminattemptsgroup'] = 'Require attempts';
|
||||
// Deprecated since Moodle 4.4.
|
||||
$string['grade'] = 'Grade';
|
||||
$string['timetaken'] = 'Time taken';
|
||||
|
||||
// Deprecated since Moodle 4.5.
|
||||
$string['attemptsdeleted'] = 'Quiz attempts deleted';
|
||||
$string['gradesdeleted'] = 'Quiz grades deleted';
|
||||
$string['useroverridesdeleted'] = 'User overrides deleted';
|
||||
$string['groupoverridesdeleted'] = 'Group overrides deleted';
|
||||
|
||||
+5
-4
@@ -1415,6 +1415,7 @@ function quiz_questions_in_use($questionids) {
|
||||
*/
|
||||
function quiz_reset_course_form_definition($mform) {
|
||||
$mform->addElement('header', 'quizheader', get_string('modulenameplural', 'quiz'));
|
||||
$mform->addElement('static', 'quizdelete', get_string('delete'));
|
||||
$mform->addElement('advcheckbox', 'reset_quiz_attempts',
|
||||
get_string('removeallquizattempts', 'quiz'));
|
||||
$mform->addElement('advcheckbox', 'reset_quiz_user_overrides',
|
||||
@@ -1482,7 +1483,7 @@ function quiz_reset_userdata($data) {
|
||||
'quiz IN (SELECT id FROM {quiz} WHERE course = ?)', [$data->courseid]);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('attemptsdeleted', 'quiz'),
|
||||
'item' => get_string('removeallquizattempts', 'quiz'),
|
||||
'error' => false];
|
||||
|
||||
// Remove all grades from gradebook.
|
||||
@@ -1493,7 +1494,7 @@ function quiz_reset_userdata($data) {
|
||||
}
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('gradesdeleted', 'quiz'),
|
||||
'item' => get_string('grades'),
|
||||
'error' => false];
|
||||
}
|
||||
|
||||
@@ -1505,7 +1506,7 @@ function quiz_reset_userdata($data) {
|
||||
'quiz IN (SELECT id FROM {quiz} WHERE course = ?) AND userid IS NOT NULL', [$data->courseid]);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('useroverridesdeleted', 'quiz'),
|
||||
'item' => get_string('useroverrides', 'quiz'),
|
||||
'error' => false];
|
||||
$purgeoverrides = true;
|
||||
}
|
||||
@@ -1515,7 +1516,7 @@ function quiz_reset_userdata($data) {
|
||||
'quiz IN (SELECT id FROM {quiz} WHERE course = ?) AND groupid IS NOT NULL', [$data->courseid]);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('groupoverridesdeleted', 'quiz'),
|
||||
'item' => get_string('groupoverrides', 'quiz'),
|
||||
'error' => false];
|
||||
$purgeoverrides = true;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ Feature: Quiz reset
|
||||
When I log in as "teacher1"
|
||||
And I am on the "Course 1" "reset" page
|
||||
And I set the following fields to these values:
|
||||
| Delete all quiz attempts | 1 |
|
||||
| All quiz attempts | 1 |
|
||||
And I press "Reset course"
|
||||
And I press "Continue"
|
||||
And I am on the "Test quiz name" "mod_quiz > Grades report" page
|
||||
@@ -52,7 +52,7 @@ Feature: Quiz reset
|
||||
| Test quiz name | student1 | 2 |
|
||||
When I log in as "teacher1"
|
||||
And I am on the "Course 1" "reset" page
|
||||
And I set the field "Delete all user overrides" to "1"
|
||||
And I set the field "All user overrides" to "1"
|
||||
And I press "Reset course"
|
||||
And I press "Continue"
|
||||
And I am on the "Test quiz name" "mod_quiz > User overrides" page
|
||||
@@ -65,7 +65,7 @@ Feature: Quiz reset
|
||||
When I log in as "teacher1"
|
||||
And I am on the "Course 1" "reset" page
|
||||
And I set the following fields to these values:
|
||||
| Delete all group overrides | 1 |
|
||||
| All group overrides | 1 |
|
||||
And I press "Reset course"
|
||||
And I press "Continue"
|
||||
And I am on the "Test quiz name" "mod_quiz > Group overrides" page
|
||||
|
||||
@@ -107,7 +107,7 @@ $string['defaultdisplaysettings'] = 'Default display settings';
|
||||
$string['defaultgradesettings'] = 'Default grade settings';
|
||||
$string['defaultothersettings'] = 'Other default settings';
|
||||
$string['deleteattemptcheck'] = 'Are you absolutely sure you want to completely delete these attempts?';
|
||||
$string['deleteallattempts'] = 'Delete all SCORM attempts';
|
||||
$string['deleteallattempts'] = 'All SCORM attempts';
|
||||
$string['deleteselected'] = 'Delete selected attempts';
|
||||
$string['deleteuserattemptcheck'] = 'Are you absolutely sure you want to completely delete all your attempts?';
|
||||
$string['details'] = 'Track details';
|
||||
|
||||
+2
-1
@@ -776,6 +776,7 @@ function scorm_option2text($scorm) {
|
||||
*/
|
||||
function scorm_reset_course_form_definition(&$mform) {
|
||||
$mform->addElement('header', 'scormheader', get_string('modulenameplural', 'scorm'));
|
||||
$mform->addElement('static', 'scormdelete', get_string('delete'));
|
||||
$mform->addElement('advcheckbox', 'reset_scorm', get_string('deleteallattempts', 'scorm'));
|
||||
}
|
||||
|
||||
@@ -845,7 +846,7 @@ function scorm_reset_userdata($data) {
|
||||
// Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.
|
||||
// See MDL-9367.
|
||||
shift_course_mod_dates('scorm', array('timeopen', 'timeclose'), $data->timeshift, $data->courseid);
|
||||
$status[] = ['component' => $componentstr, 'item' => get_string('datechanged'), 'error' => false];
|
||||
$status[] = ['component' => $componentstr, 'item' => get_string('date'), 'error' => false];
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
@@ -188,8 +188,8 @@ $string['colles8short'] = 'I\'m critical of readings';
|
||||
$string['colles9'] = 'I explain my ideas to other students.';
|
||||
$string['colles9short'] = 'I explain my ideas';
|
||||
$string['customintro'] = 'Description';
|
||||
$string['deleteallanswers'] = 'Delete all survey responses';
|
||||
$string['deleteanalysis'] = 'Delete response analysis';
|
||||
$string['deleteallanswers'] = 'All survey responses';
|
||||
$string['deleteanalysis'] = 'Response analysis';
|
||||
$string['done'] = 'Done';
|
||||
$string['download'] = 'Download';
|
||||
$string['downloadexcel'] = 'Download data as Excel spreadsheet';
|
||||
|
||||
+4
-3
@@ -726,9 +726,10 @@ function survey_get_post_actions() {
|
||||
*/
|
||||
function survey_reset_course_form_definition(&$mform) {
|
||||
$mform->addElement('header', 'surveyheader', get_string('modulenameplural', 'survey'));
|
||||
$mform->addElement('checkbox', 'reset_survey_answers', get_string('deleteallanswers','survey'));
|
||||
$mform->addElement('checkbox', 'reset_survey_analysis', get_string('deleteanalysis','survey'));
|
||||
$mform->disabledIf('reset_survey_analysis', 'reset_survey_answers', 'checked');
|
||||
$mform->addElement('static', 'surveydelete', get_string('delete'));
|
||||
$mform->addElement('checkbox', 'reset_survey_answers', get_string('deleteallanswers', 'survey'));
|
||||
$mform->addElement('checkbox', 'reset_survey_analysis', get_string('deleteanalysis', 'survey'));
|
||||
$mform->hideIf('reset_survey_analysis', 'reset_survey_answers', 'checked');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
tagsdeleted,mod_wiki
|
||||
@@ -44,7 +44,7 @@ $string['defaultformat_help'] = 'This setting determines the default format used
|
||||
* HTML - The HTML editor is available
|
||||
* Creole - A common wiki markup language for which a small edit toolbar is available
|
||||
* Nwiki - Mediawiki-like markup language used in the contributed Nwiki module';
|
||||
$string['deleteallpages'] = 'Delete all wiki pages';
|
||||
$string['deleteallpages'] = 'All wiki pages';
|
||||
$string['deletecomment'] = 'Deleting comment';
|
||||
$string['deletecommentcheck'] = 'Delete comment';
|
||||
$string['deletecommentcheckfull'] = 'Are you sure you want to delete the comment?';
|
||||
@@ -237,7 +237,7 @@ $string['ratingmode'] = 'Rating mode';
|
||||
$string['reparsetimeout'] = 'Reparsing default timeout';
|
||||
$string['repeatedsection'] = 'Wiki error: Section name cannot be repeated \'{$a}\'';
|
||||
$string['restore'] = 'Restore';
|
||||
$string['removeallwikitags'] = 'Remove all wiki tags';
|
||||
$string['removeallwikitags'] = 'All wiki tags';
|
||||
$string['removepages'] = 'Remove pages';
|
||||
$string['restoreconfirm'] = 'Are you sure you want to restore version #{$a}?';
|
||||
$string['restoreerror'] = 'Version #{$a} could not be restored';
|
||||
@@ -257,9 +257,8 @@ $string['searchwikis'] = 'Search wikis';
|
||||
$string['special'] = 'Special';
|
||||
$string['tableofcontents'] = 'Table of contents';
|
||||
$string['tagarea_wiki_pages'] = 'Wiki pages';
|
||||
$string['tagsdeleted'] = 'Wiki tags have been deleted';
|
||||
$string['teacherrating'] = 'Teacher rating';
|
||||
$string['timesrating']='This page has been rated {$a->c} times with an average of: {$a->s}';
|
||||
$string['timesrating'] = 'This page has been rated {$a->c} times with an average of: {$a->s}';
|
||||
$string['updatedpages'] = "Updated pages";
|
||||
$string['updatedpages_help'] = "Recently updated wiki pages";
|
||||
$string['updatedwikipages'] = "Updated wiki pages";
|
||||
@@ -312,3 +311,5 @@ $string['wikipages'] = 'Wiki pages';
|
||||
$string['wrongversionlock'] = 'Another user has edited this page while you were editing and your content is obsolete.';
|
||||
$string['wrongversionsave'] = 'Another user has created a version while you were editing and you have overwritten his changes, check the page history.';
|
||||
|
||||
// Deprecated since Moodle 4.5.
|
||||
$string['tagsdeleted'] = 'Wiki tags have been deleted';
|
||||
|
||||
+28
-12
@@ -162,15 +162,15 @@ function wiki_delete_instance($id) {
|
||||
* @return boolean|array
|
||||
*/
|
||||
function wiki_reset_userdata($data) {
|
||||
global $CFG,$DB;
|
||||
global $CFG, $DB;
|
||||
require_once($CFG->dirroot . '/mod/wiki/pagelib.php');
|
||||
require_once($CFG->dirroot . "/mod/wiki/locallib.php");
|
||||
|
||||
$componentstr = get_string('modulenameplural', 'wiki');
|
||||
$status = array();
|
||||
$status = [];
|
||||
|
||||
//get the wiki(s) in this course.
|
||||
if (!$wikis = $DB->get_records('wiki', array('course' => $data->courseid))) {
|
||||
// Get the wiki(s) in this course.
|
||||
if (!$wikis = $DB->get_records('wiki', ['course' => $data->courseid])) {
|
||||
return false;
|
||||
}
|
||||
if (empty($data->reset_wiki_comments) && empty($data->reset_wiki_tags) && empty($data->reset_wiki_pages)) {
|
||||
@@ -205,7 +205,7 @@ function wiki_reset_userdata($data) {
|
||||
}
|
||||
if (!empty($data->reset_wiki_pages)) {
|
||||
// Delete any subwikis.
|
||||
$DB->delete_records('wiki_subwikis', array('id' => $subwiki->id), IGNORE_MISSING);
|
||||
$DB->delete_records('wiki_subwikis', ['id' => $subwiki->id]);
|
||||
|
||||
// Delete any attached files.
|
||||
$fs = get_file_storage();
|
||||
@@ -214,27 +214,42 @@ function wiki_reset_userdata($data) {
|
||||
}
|
||||
|
||||
if (!empty($data->reset_wiki_pages)) {
|
||||
$status[] = array('component' => $componentstr, 'item' => get_string('deleteallpages', 'wiki'),
|
||||
'error' => false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('deleteallpages', 'wiki'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
if (!empty($data->reset_wiki_tags)) {
|
||||
$status[] = array('component' => $componentstr, 'item' => get_string('tagsdeleted', 'wiki'), 'error' => false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('removeallwikitags', 'wiki'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all comments.
|
||||
if (!empty($data->reset_wiki_comments) || !empty($data->reset_wiki_pages)) {
|
||||
$DB->delete_records_select('comments', "contextid = ? AND commentarea='wiki_page'", array($context->id));
|
||||
$DB->delete_records_select('comments', "contextid = ? AND commentarea='wiki_page'", [$context->id]);
|
||||
if (!empty($data->reset_wiki_comments)) {
|
||||
$status[] = array('component' => $componentstr, 'item' => get_string('deleteallcomments'), 'error' => false);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('deleteallcomments'),
|
||||
'error' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.
|
||||
// See MDL-9367.
|
||||
shift_course_mod_dates('wiki', array('editbegin', 'editend'), $data->timeshift, $data->courseid);
|
||||
$status[] = array('component' => $componentstr, 'item' => get_string('datechanged'), 'error' => false);
|
||||
shift_course_mod_dates('wiki', ['editbegin', 'editend'], $data->timeshift, $data->courseid);
|
||||
$status[] = [
|
||||
'component' => $componentstr,
|
||||
'item' => get_string('date'),
|
||||
'error' => false,
|
||||
];
|
||||
|
||||
return $status;
|
||||
}
|
||||
@@ -242,6 +257,7 @@ function wiki_reset_userdata($data) {
|
||||
|
||||
function wiki_reset_course_form_definition(&$mform) {
|
||||
$mform->addElement('header', 'wikiheader', get_string('modulenameplural', 'wiki'));
|
||||
$mform->addElement('static', 'wikidelete', get_string('delete'));
|
||||
$mform->addElement('advcheckbox', 'reset_wiki_pages', get_string('deleteallpages', 'wiki'));
|
||||
$mform->addElement('advcheckbox', 'reset_wiki_tags', get_string('removeallwikitags', 'wiki'));
|
||||
$mform->addElement('advcheckbox', 'reset_wiki_comments', get_string('deleteallcomments'));
|
||||
|
||||
@@ -42,13 +42,13 @@ Feature: Teachers can reset wiki pages, tags and files
|
||||
|
||||
Scenario: Reset page, tags and files
|
||||
Given I set the following fields to these values:
|
||||
| Delete all wiki pages | 1 |
|
||||
| Remove all wiki tags | 1 |
|
||||
| All wiki pages | 1 |
|
||||
| All wiki tags | 1 |
|
||||
| reset_wiki_comments | 1 |
|
||||
And I press "Reset course"
|
||||
And I should see "Delete all wiki pages"
|
||||
And I should see "Wiki tags have been deleted"
|
||||
And I should see "Delete all comments"
|
||||
And I should see "All wiki pages"
|
||||
And I should see "All wiki tags"
|
||||
And I should see "All comments"
|
||||
And I press "Continue"
|
||||
And I am on the "Test wiki name" "wiki activity" page
|
||||
And I press "Create page"
|
||||
@@ -62,11 +62,11 @@ Feature: Teachers can reset wiki pages, tags and files
|
||||
|
||||
Scenario: Reset only tags
|
||||
Given I set the following fields to these values:
|
||||
| Remove all wiki tags | 1 |
|
||||
| All wiki tags | 1 |
|
||||
When I press "Reset course"
|
||||
And I should not see "Delete all wiki pages"
|
||||
And I should see "Wiki tags have been deleted"
|
||||
And I should not see "Delete all comments"
|
||||
And I should not see "All wiki pages"
|
||||
And I should see "All wiki tags"
|
||||
And I should not see "All comments"
|
||||
And I press "Continue"
|
||||
And I am on the "Test wiki name" "wiki activity" page
|
||||
Then I should not see "Test tag 1"
|
||||
@@ -80,9 +80,9 @@ Feature: Teachers can reset wiki pages, tags and files
|
||||
Given I set the following fields to these values:
|
||||
| reset_wiki_comments | 1 |
|
||||
When I press "Reset course"
|
||||
And I should not see "Delete all wiki pages"
|
||||
And I should not see "Wiki tags have been deleted"
|
||||
And I should see "Delete all comments"
|
||||
And I should not see "All wiki pages"
|
||||
And I should not see "All wiki tags"
|
||||
And I should see "All comments"
|
||||
And I press "Continue"
|
||||
And I am on the "Test wiki name" "wiki activity" page
|
||||
Then I should see "Test tag 1"
|
||||
|
||||
@@ -318,9 +318,9 @@ $string['reassess'] = 'Re-assess';
|
||||
$string['receivedgrades'] = 'Grades received';
|
||||
$string['recentassessments'] = 'Workshop assessments:';
|
||||
$string['recentsubmissions'] = 'Workshop submissions:';
|
||||
$string['resetassessments'] = 'Delete all assessments';
|
||||
$string['resetassessments'] = 'All assessments';
|
||||
$string['resetassessments_help'] = 'You can choose to delete just allocated assessments without affecting submissions. If submissions are to be deleted, their assessments will be deleted implicitly and this option is ignored. Note this also includes assessments of example submissions.';
|
||||
$string['resetsubmissions'] = 'Delete all submissions';
|
||||
$string['resetsubmissions'] = 'All submissions';
|
||||
$string['resetsubmissions_help'] = 'All the submissions and their assessments will be deleted. This does not affect example submissions.';
|
||||
$string['resetphase'] = 'Switch to the setup phase';
|
||||
$string['resetphase_help'] = 'If enabled, all workshops will be put into the initial setup phase.';
|
||||
|
||||
+19
-12
@@ -1985,15 +1985,17 @@ function workshop_reset_course_form_definition($mform) {
|
||||
|
||||
$mform->addElement('header', 'workshopheader', get_string('modulenameplural', 'mod_workshop'));
|
||||
|
||||
$mform->addElement('advcheckbox', 'reset_workshop_phase', get_string('resetphase', 'mod_workshop'));
|
||||
$mform->addHelpButton('reset_workshop_phase', 'resetphase', 'mod_workshop');
|
||||
|
||||
$mform->addElement('static', 'workshopdelete', get_string('delete'));
|
||||
|
||||
$mform->addElement('advcheckbox', 'reset_workshop_submissions', get_string('resetsubmissions', 'mod_workshop'));
|
||||
$mform->addHelpButton('reset_workshop_submissions', 'resetsubmissions', 'mod_workshop');
|
||||
|
||||
$mform->addElement('advcheckbox', 'reset_workshop_assessments', get_string('resetassessments', 'mod_workshop'));
|
||||
$mform->addHelpButton('reset_workshop_assessments', 'resetassessments', 'mod_workshop');
|
||||
$mform->disabledIf('reset_workshop_assessments', 'reset_workshop_submissions', 'checked');
|
||||
|
||||
$mform->addElement('advcheckbox', 'reset_workshop_phase', get_string('resetphase', 'mod_workshop'));
|
||||
$mform->addHelpButton('reset_workshop_phase', 'resetphase', 'mod_workshop');
|
||||
$mform->hideIf('reset_workshop_assessments', 'reset_workshop_submissions', 'checked');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2023,11 +2025,16 @@ function workshop_reset_userdata(stdClass $data) {
|
||||
|
||||
// Any changes to the list of dates that needs to be rolled should be same during course restore and course reset.
|
||||
// See MDL-9367.
|
||||
shift_course_mod_dates('workshop', array('submissionstart', 'submissionend', 'assessmentstart', 'assessmentend'),
|
||||
$data->timeshift, $data->courseid);
|
||||
$status = array();
|
||||
$status[] = array('component' => get_string('modulenameplural', 'workshop'), 'item' => get_string('datechanged'),
|
||||
'error' => false);
|
||||
shift_course_mod_dates(
|
||||
'workshop',
|
||||
['submissionstart', 'submissionend', 'assessmentstart', 'assessmentend'],
|
||||
$data->timeshift, $data->courseid,
|
||||
);
|
||||
$status[] = [
|
||||
'component' => get_string('modulenameplural', 'workshop'),
|
||||
'item' => get_string('date'),
|
||||
'error' => false,
|
||||
];
|
||||
|
||||
if (empty($data->reset_workshop_submissions)
|
||||
and empty($data->reset_workshop_assessments)
|
||||
@@ -2036,16 +2043,16 @@ function workshop_reset_userdata(stdClass $data) {
|
||||
return $status;
|
||||
}
|
||||
|
||||
$workshoprecords = $DB->get_records('workshop', array('course' => $data->courseid));
|
||||
$workshoprecords = $DB->get_records('workshop', ['course' => $data->courseid]);
|
||||
|
||||
if (empty($workshoprecords)) {
|
||||
// What a boring course - no workshops here!
|
||||
// What a boring course - no workshops here.
|
||||
return $status;
|
||||
}
|
||||
|
||||
require_once($CFG->dirroot . '/mod/workshop/locallib.php');
|
||||
|
||||
$course = $DB->get_record('course', array('id' => $data->courseid), '*', MUST_EXIST);
|
||||
$course = $DB->get_record('course', ['id' => $data->courseid], '*', MUST_EXIST);
|
||||
|
||||
foreach ($workshoprecords as $workshoprecord) {
|
||||
$cm = get_coursemodule_from_instance('workshop', $workshoprecord->id, $course->id, false, MUST_EXIST);
|
||||
|
||||
Reference in New Issue
Block a user