From 6afd89ca69d03022ced67f0987de7ced1034f5bf Mon Sep 17 00:00:00 2001 From: Laur0r Date: Wed, 5 Apr 2023 16:57:57 +0200 Subject: [PATCH 01/26] Rebase PR #200 on master --- classes/event/all_ratings_deleted.php | 63 +++++++++++++++++++++++++++ lang/en/ratingallocate.php | 16 ++++++- locallib.php | 56 ++++++++++++++++++++++++ mod_form.php | 48 ++++++++++++++++++-- renderer.php | 9 ++++ 5 files changed, 188 insertions(+), 4 deletions(-) create mode 100644 classes/event/all_ratings_deleted.php diff --git a/classes/event/all_ratings_deleted.php b/classes/event/all_ratings_deleted.php new file mode 100644 index 00000000..0da1bebe --- /dev/null +++ b/classes/event/all_ratings_deleted.php @@ -0,0 +1,63 @@ +. + +/** + * The mod_ratingallocate rating_deleted event. + * + * @package mod_ratingallocate + * @copyright 2020 Robin Tschudi + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +namespace mod_ratingallocate\event; +defined('MOODLE_INTERNAL') || die(); +/** + * The mod_ratingallocate rating_deleted event class. + * + * @copyright 2020 Robin Tschudi + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + **/ +class all_ratings_deleted extends \core\event\base { + + public static function create_simple($modulecontext, $ratingallocateid) { + return self::create(array('context' => $modulecontext, 'objectid' => $ratingallocateid)); + } + protected function init() { + $this->data['crud'] = 'd'; + $this->data['edulevel'] = self::LEVEL_TEACHING; + $this->data['objecttable'] = 'ratingallocate_ratings'; + } + + public static function get_name() { + return get_string('log_all_ratings_deleted', 'mod_ratingallocate'); + } + + public function get_description() { + return get_string('log_all_ratings_deleted_description', 'mod_ratingallocate', + array('userid' => $this->userid, 'ratingallocateid' => $this->objectid)); + } + + public function get_url() { + return new \moodle_url('/mod/ratingallocate/view.php', array('m' => $this->objectid)); + } + + public static function get_objectid_mapping() { + return array('db' => 'ratingallocate', 'restore' => 'ratingallocate'); + } + + public static function get_other_mapping() { + return false; + } +} diff --git a/lang/en/ratingallocate.php b/lang/en/ratingallocate.php index e4cce565..b1d8d77e 100644 --- a/lang/en/ratingallocate.php +++ b/lang/en/ratingallocate.php @@ -103,6 +103,12 @@ $string['start_distribution'] = 'Run Allocation Algorithm'; $string['confirm_start_distribution'] = 'Running the algorithm will delete all existing allocations, if any. Are you sure to continue?'; +$string['delete_all_ratings'] = 'Delete all student ratings'; +$string['delete_all_ratings_explanation'] = 'Deletes all ratings that students have submitted so far. Use with caution.'; +$string['confirm_delete_all_ratings'] = 'Are you sure you want to delete all ratings students have submitted so far?'; +$string['error_deleting_all_insufficient_permission'] = 'You don\'t have the permission to do that'; +$string['error_deleting_all_no_rating_possible'] = 'You can\'t delete the ratings when the rating phase is already over'; +$string['success_deleting_all'] = 'Deleted all ratings'; $string['unassigned_users'] = 'Unassigned Users'; $string['invalid_dates'] = 'Dates are invalid. Starting date must be before ending date.'; $string['invalid_publishdate'] = 'Publication date is invalid. Publication date must be after the end of rating.'; @@ -261,9 +267,13 @@ * **Likert Scale** The user can rate each choice with a number from a defined range. The range of numbers can be defined individually (beginning with 0). A high number corresponds to a high preference. * **Give Points** The user can rate the choices by assigning a number of points. The maximum number of points can be defined individually. A high number of points corresponds to a high preference. * **Rank Choices** The user has to rank the available choices. How many choices need to be rated can be defined individually. -* **Tick Accept** The user can state for each choice whether it is acceptable for him/her.'; +* **Tick Accept** The user can state for each choice whether it is acceptable for him/her. + +This option can\'t be changed if a student has already submitted their preference. +'; $string['strategy_not_specified'] = 'You have to select a strategy.'; $string['strategyspecificoptions'] = 'Strategy specific options'; +$string['strategy_altered_after_preferences'] = 'Strategy cannot be changed after preferences where submitted'; $string['err_required'] = 'You need to provide a value for this field.'; $string['err_minimum'] = 'The minimum value for this field is {$a}.'; @@ -395,6 +405,10 @@ $string['log_index_viewed'] = 'User viewed all instances of Fair Allocation'; $string['log_index_viewed_description'] = 'The user with id "{$a->userid}" viewed all instances of Fair Allocation in this course.'; +$string['log_all_ratings_deleted'] = 'All ratings of a Fair Allocation instance were deleted'; +$string['log_all_ratings_deleted_description'] = 'The user with id "{$a->userid}" has deleted all ratings for the Fair Allocation with id "{$a->ratingallocateid}".'; + + $string['no_id_or_m_error'] = 'You must specify a course_module ID or an instance ID'; // Language strings for Privacy API diff --git a/locallib.php b/locallib.php index 35c0d2b9..7bdb6486 100644 --- a/locallib.php +++ b/locallib.php @@ -87,6 +87,7 @@ public static function get_strategies() { define('ACTION_DISABLE_CHOICE', 'disable_choice'); define('ACTION_DELETE_CHOICE', 'delete_choice'); define('ACTION_START_DISTRIBUTION', 'start_distribution'); +define('ACTION_DELETE_ALL_RATINGS', 'delete_all_ratings'); define('ACTION_MANUAL_ALLOCATION', 'manual_allocation'); define('ACTION_PUBLISH_ALLOCATIONS', 'publish_allocations'); // Make them displayable for the users. define('ACTION_SOLVE_LP_SOLVE', 'solve_lp_solve'); // Instead of only generating the mps-file, let it solve. @@ -258,6 +259,26 @@ private function process_action_start_distribution() { return; } + private function delete_all_student_ratings() { + global $USER; + // Disallow to delete ratings for students and tutors. + if (!has_capability('mod/ratingallocate:start_distribution', $this->context, null, false)) { + redirect(new moodle_url('/mod/ratingallocate/view.php', array('id' => $this->coursemodule->id)), + get_string('error_deleting_all_insufficient_permission', ratingallocate_MOD_NAME)); + return; + } + // Disallow deletion when there can't be new ratings submitted + $status = $this->get_status(); + if ($status !== self::DISTRIBUTION_STATUS_RATING_IN_PROGRESS and $status !== self::DISTRIBUTION_STATUS_TOO_EARLY) { + redirect(new moodle_url('/mod/ratingallocate/view.php', array('id' => $this->coursemodule->id)), + get_string('error_deleting_all_no_rating_possible', ratingallocate_MOD_NAME)); + return; + } + $this->delete_all_ratings(); + redirect(new moodle_url('/mod/ratingallocate/view.php', array('id' => $this->coursemodule->id)), + get_string('success_deleting_all', ratingallocate_MOD_NAME)); + } + private function process_action_give_rating() { global $CFG; @@ -796,6 +817,10 @@ public function handle_view() { $this->process_action_delete_rating(); break; + case ACTION_DELETE_ALL_RATINGS: + $this->delete_all_student_ratings(); + break; + case ACTION_SHOW_CHOICES: $this->process_action_show_choices(); return ""; @@ -1274,6 +1299,37 @@ public function get_users_with_ratings() { )); } + /** + * Deletes all ratings in this ratingallocate + */ + public function delete_all_ratings() { + global $DB; + + $transaction = $DB->start_delegated_transaction(); + + try { + $choices = $this->get_choices(); + + foreach ($choices as $id => $choice) { + $data = array( + 'choiceid' => $id + ); + + // Actually delete the rating. + $DB->delete_records('ratingallocate_ratings', $data); + } + + $transaction->allow_commit(); + + // Logging. + $event = \mod_ratingallocate\event\all_ratings_deleted::create_simple( + context_module::instance($this->coursemodule->id), $this->ratingallocateid); + $event->trigger(); + } catch (Exception $e) { + $transaction->rollback($e); + } + } + /** * Delete all ratings of a users * @param int $userid diff --git a/mod_form.php b/mod_form.php index 2cc98ea6..751f2f3c 100644 --- a/mod_form.php +++ b/mod_form.php @@ -66,6 +66,8 @@ public function definition() { global $CFG, $PAGE; $mform = $this->_form; + $disable_strategy = $this->get_disable_strategy(); + // Adding the "general" fieldset, where all the common settings are showed. $mform->addElement('header', 'general', get_string('general', 'form')); @@ -92,9 +94,13 @@ public function definition() { foreach (\strategymanager::get_strategies() as $strategy) { $selectoptions[$strategy] = get_string($strategy . '_name', self::MOD_NAME); } - $mform->addElement('select', $elementname, get_string('select_strategy', self::MOD_NAME), $selectoptions); + $mform->addElement('select', $elementname, get_string('select_strategy', self::MOD_NAME), $selectoptions, + $disable_strategy? ['disabled' => ''] : null); $mform->addHelpButton($elementname, 'select_strategy', self::MOD_NAME); - $mform->addRule('strategy', null, 'required', null, 'client'); + if (!$disable_strategy) { + // disabled elements don't get posted so disable the required rule if strategy selection is disabled. + $mform->addRule('strategy', null, 'required', null, 'client'); + } // Start/end time. $elementname = 'accesstimestart'; @@ -139,6 +145,31 @@ public function definition() { $this->add_action_buttons(); } + public function get_disable_strategy($includeratingallocate = false) { + $update = $this->optional_param('update', 0, PARAM_INT); + if($update != 0) { + global $DB; + $courseid = $update; + $cm = get_coursemodule_from_id('ratingallocate', $courseid, 0, false, MUST_EXIST); + $course = get_course($cm->course); + $ratingallocatedb = $DB->get_record('ratingallocate', array('id' => $cm->instance), '*', MUST_EXIST); + $context = context_module::instance($cm->id); + $ratingallocate = new ratingallocate($ratingallocatedb, $course, $cm, $context); + $disable_strategy = $ratingallocate->get_number_of_active_raters() > 0; + } else { + $ratingallocate = null; + $disable_strategy = false; + } + if (!$includeratingallocate) { + return $disable_strategy; + } else { + return [ + 'ratingallocate' => $ratingallocate, + 'disable_strategy' => $disable_strategy + ]; + } + } + /** * Add an settings element to the form. It is enabled only if the strategy it belongs to is selected. * @param string $stratfieldid id of the element to be added @@ -232,8 +263,19 @@ public function validation($data, $files) { $errors['publishdate'] = get_string('invalid_publishdate', self::MOD_NAME); } - // User has to select one strategy. + $info = $this->get_disable_strategy(true); + $disable_strategy = $info['disable_strategy']; + $ratingallocate = $info['ratingallocate']; + + if ($disable_strategy) { + //If strategy selection is disabled make sure the user didn't change it. + if ($ratingallocate->ratingallocate->dbrecord->strategy !== $data['strategy']) { + $errors['strategy'] = get_string('strategy_altered_after_preferences', self::MOD_NAME); + } + } + if (empty($data['strategy'])) { + // User has to select one strategy. $errors['strategy'] = get_string('strategy_not_specified', self::MOD_NAME); } else { $strategyclassp = 'ratingallocate\\' . $data['strategy'] . '\\strategy'; diff --git a/renderer.php b/renderer.php index 547666a5..c8c2115d 100644 --- a/renderer.php +++ b/renderer.php @@ -297,6 +297,7 @@ public function modify_allocation_group($ratingallocateid, $coursemoduleid, $sta $status !== ratingallocate::DISTRIBUTION_STATUS_RATING_IN_PROGRESS; $starturl = new moodle_url($this->page->url, array('action' => ACTION_START_DISTRIBUTION)); + $deleteurl = new moodle_url($this->page->url, array('id' => $coursemoduleid, 'action' => ACTION_DELETE_ALL_RATINGS)); // Get description dependent on status $descriptionbaseid = 'modify_allocation_group_desc_'; @@ -318,6 +319,14 @@ public function modify_allocation_group($ratingallocateid, $coursemoduleid, $sta 'action' => ACTION_MANUAL_ALLOCATION)), get_string('manual_allocation_form', RATINGALLOCATE_MOD_NAME), 'get', array('disabled' => !$ratingover)); + // Add delete all ratings button + $deletebutton = new single_button($deleteurl, get_string('delete_all_ratings', ratingallocate_MOD_NAME, 'get')); + $deletebutton->disabled = $ratingover; // Only allow deletion if new submission is possible. + $deletebutton->tooltip = get_string('delete_all_ratings_explanation', ratingallocate_MOD_NAME); + $deletebutton->add_action(new confirm_action(get_string('confirm_delete_all_ratings', ratingallocate_MOD_NAME))); + + $output .= $this->render($deletebutton); + $output .= $this->box_end(); return $output; } From e2d304aadbeb8813c5078f0fa187caf8db1a208d Mon Sep 17 00:00:00 2001 From: Justus Dieckmann Date: Wed, 23 Nov 2022 21:07:15 +0100 Subject: [PATCH 02/26] Codestyle fixes --- lang/en/ratingallocate.php | 1 - renderer.php | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/en/ratingallocate.php b/lang/en/ratingallocate.php index b1d8d77e..cff69913 100644 --- a/lang/en/ratingallocate.php +++ b/lang/en/ratingallocate.php @@ -408,7 +408,6 @@ $string['log_all_ratings_deleted'] = 'All ratings of a Fair Allocation instance were deleted'; $string['log_all_ratings_deleted_description'] = 'The user with id "{$a->userid}" has deleted all ratings for the Fair Allocation with id "{$a->ratingallocateid}".'; - $string['no_id_or_m_error'] = 'You must specify a course_module ID or an instance ID'; // Language strings for Privacy API diff --git a/renderer.php b/renderer.php index c8c2115d..277a919f 100644 --- a/renderer.php +++ b/renderer.php @@ -414,6 +414,7 @@ public function ratingallocate_show_choices_table(ratingallocate $ratingallocate )); // Set up the table. + echo $this->output->single_button($starturl->out(), get_string('newchoice', 'mod_ratingallocate'), 'get'); $table = new \flexible_table('show_ratingallocate_options'); $table->define_baseurl($this->page->url); if ($choicesmodifiably) { From 3fd7dc9109d2baeec15b36492b7a5bb0a6a27bda Mon Sep 17 00:00:00 2001 From: Irina Hoppe Date: Tue, 9 May 2023 10:19:53 +0200 Subject: [PATCH 03/26] allocations that are associated with the ratings also get deleted in database --- lang/en/ratingallocate.php | 3 ++- locallib.php | 3 +++ version.php | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lang/en/ratingallocate.php b/lang/en/ratingallocate.php index cff69913..df1130c5 100644 --- a/lang/en/ratingallocate.php +++ b/lang/en/ratingallocate.php @@ -104,7 +104,8 @@ $string['confirm_start_distribution'] = 'Running the algorithm will delete all existing allocations, if any. Are you sure to continue?'; $string['delete_all_ratings'] = 'Delete all student ratings'; -$string['delete_all_ratings_explanation'] = 'Deletes all ratings that students have submitted so far. Use with caution.'; +$string['delete_all_ratings_explanation'] = 'Deletes all ratings that students have submitted so far + and all allocations that may have been created based on these ratings. Use with caution.'; $string['confirm_delete_all_ratings'] = 'Are you sure you want to delete all ratings students have submitted so far?'; $string['error_deleting_all_insufficient_permission'] = 'You don\'t have the permission to do that'; $string['error_deleting_all_no_rating_possible'] = 'You can\'t delete the ratings when the rating phase is already over'; diff --git a/locallib.php b/locallib.php index 7bdb6486..cde86db7 100644 --- a/locallib.php +++ b/locallib.php @@ -1315,6 +1315,9 @@ public function delete_all_ratings() { 'choiceid' => $id ); + //Delete the allocations associated with this rating. + $DB->delete_records('ratingallocate_allocations', $data); + // Actually delete the rating. $DB->delete_records('ratingallocate_ratings', $data); } diff --git a/version.php b/version.php index 8e05082f..cf10dca1 100644 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2022120100; // The current module version (Date: YYYYMMDDXX) +$plugin->version = 2023050501; // The current module version (Date: YYYYMMDDXX) $plugin->requires = 2020061500; // Requires Moodle 3.9+. $plugin->maturity = MATURITY_STABLE; $plugin->release = 'v4.0-r1'; From b4ff474c9cd3c96c711d157bc8dc334413000bd9 Mon Sep 17 00:00:00 2001 From: Irina Hoppe Date: Tue, 9 May 2023 10:55:37 +0200 Subject: [PATCH 04/26] some codestyle fixes --- lang/en/ratingallocate.php | 2 +- locallib.php | 2 +- mod_form.php | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lang/en/ratingallocate.php b/lang/en/ratingallocate.php index df1130c5..404013cc 100644 --- a/lang/en/ratingallocate.php +++ b/lang/en/ratingallocate.php @@ -104,7 +104,7 @@ $string['confirm_start_distribution'] = 'Running the algorithm will delete all existing allocations, if any. Are you sure to continue?'; $string['delete_all_ratings'] = 'Delete all student ratings'; -$string['delete_all_ratings_explanation'] = 'Deletes all ratings that students have submitted so far +$string['delete_all_ratings_explanation'] = 'Deletes all ratings that students have submitted so far and all allocations that may have been created based on these ratings. Use with caution.'; $string['confirm_delete_all_ratings'] = 'Are you sure you want to delete all ratings students have submitted so far?'; $string['error_deleting_all_insufficient_permission'] = 'You don\'t have the permission to do that'; diff --git a/locallib.php b/locallib.php index cde86db7..f493a1f6 100644 --- a/locallib.php +++ b/locallib.php @@ -1315,7 +1315,7 @@ public function delete_all_ratings() { 'choiceid' => $id ); - //Delete the allocations associated with this rating. + // Delete the allocations associated with this rating. $DB->delete_records('ratingallocate_allocations', $data); // Actually delete the rating. diff --git a/mod_form.php b/mod_form.php index 751f2f3c..34542a5b 100644 --- a/mod_form.php +++ b/mod_form.php @@ -66,7 +66,7 @@ public function definition() { global $CFG, $PAGE; $mform = $this->_form; - $disable_strategy = $this->get_disable_strategy(); + $disablestrategy = $this->get_disable_strategy(); // Adding the "general" fieldset, where all the common settings are showed. $mform->addElement('header', 'general', get_string('general', 'form')); @@ -95,9 +95,9 @@ public function definition() { $selectoptions[$strategy] = get_string($strategy . '_name', self::MOD_NAME); } $mform->addElement('select', $elementname, get_string('select_strategy', self::MOD_NAME), $selectoptions, - $disable_strategy? ['disabled' => ''] : null); + $disablestrategy ? ['disabled' => ''] : null); $mform->addHelpButton($elementname, 'select_strategy', self::MOD_NAME); - if (!$disable_strategy) { + if (!$disablestrategy) { // disabled elements don't get posted so disable the required rule if strategy selection is disabled. $mform->addRule('strategy', null, 'required', null, 'client'); } @@ -155,17 +155,17 @@ public function get_disable_strategy($includeratingallocate = false) { $ratingallocatedb = $DB->get_record('ratingallocate', array('id' => $cm->instance), '*', MUST_EXIST); $context = context_module::instance($cm->id); $ratingallocate = new ratingallocate($ratingallocatedb, $course, $cm, $context); - $disable_strategy = $ratingallocate->get_number_of_active_raters() > 0; + $disablestrategy = $ratingallocate->get_number_of_active_raters() > 0; } else { $ratingallocate = null; - $disable_strategy = false; + $disablestrategy = false; } if (!$includeratingallocate) { - return $disable_strategy; + return $disablestrategy; } else { return [ 'ratingallocate' => $ratingallocate, - 'disable_strategy' => $disable_strategy + 'disable_strategy' => $disablestrategy ]; } } @@ -264,11 +264,11 @@ public function validation($data, $files) { } $info = $this->get_disable_strategy(true); - $disable_strategy = $info['disable_strategy']; + $disablestrategy = $info['disable_strategy']; $ratingallocate = $info['ratingallocate']; - if ($disable_strategy) { - //If strategy selection is disabled make sure the user didn't change it. + if ($disablestrategy) { + // If strategy selection is disabled make sure the user didn't change it. if ($ratingallocate->ratingallocate->dbrecord->strategy !== $data['strategy']) { $errors['strategy'] = get_string('strategy_altered_after_preferences', self::MOD_NAME); } From 27ca1689c9902bfec36d2cf7a9b5009da17d34f7 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 13 Jul 2021 15:05:13 +1200 Subject: [PATCH 05/26] WIP form setup for CSV import processing. --- lang/en/ratingallocate.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lang/en/ratingallocate.php b/lang/en/ratingallocate.php index 404013cc..3edaf574 100644 --- a/lang/en/ratingallocate.php +++ b/lang/en/ratingallocate.php @@ -212,6 +212,12 @@ $string['saveandnext'] = 'Save and add next'; $string['choice_added_notification'] = 'Choice saved.'; +$string['upload_choices'] = 'Upload choices via CSV'; +$string['upload_choices_required_fields'] = 'Required Fields'; +$string['upload_choices_fields_desc'] = 'CSV files uploaded through this form are expected to include the following fields:
{$a}
'; +$string['csvfailed'] = 'Unable to read the raw choice data from the CSV file'; +$string['csvupload'] = 'Upload CSV'; +$string['csvupload_explanation'] = 'Bulk upload choices via a CSV file'; // // $string['upload_choices'] = 'Upload choices via CSV'; From 087c54af9d95fe7c2e89bd4b98f77fa677d8578a Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 15 Jul 2021 11:04:22 +1200 Subject: [PATCH 06/26] renderer: Only show CSV upload button if rating has not already started. --- renderer.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/renderer.php b/renderer.php index 277a919f..65c07e96 100644 --- a/renderer.php +++ b/renderer.php @@ -408,10 +408,13 @@ public function ratingallocate_show_choices_table(ratingallocate $ratingallocate $starturl = new moodle_url($this->page->url, array('action' => ACTION_EDIT_CHOICE)); echo $this->output->single_button($starturl, get_string('newchoice', 'mod_ratingallocate'), 'get'); - $uploadcsvurl = new moodle_url($this->page->url, array('action' => ACTION_UPLOAD_CHOICES)); - echo $this->output->single_button($uploadcsvurl, get_string('csvupload', 'ratingallocate'), 'get', array( - 'tooltip' => get_string('csvupload_explanation', 'ratingallocate') - )); + // Only show CSV upload button if rating has not started. + if ($ratingallocate->get_status() === ratingallocate::DISTRIBUTION_STATUS_TOO_EARLY) { + $uploadcsvurl = new moodle_url($this->page->url, array('action' => ACTION_UPLOAD_CHOICES)); + echo $this->output->single_button($uploadcsvurl, get_string('csvupload', 'ratingallocate'), 'get', array( + 'tooltip' => get_string('csvupload_explanation', 'ratingallocate') + )); + } // Set up the table. echo $this->output->single_button($starturl->out(), get_string('newchoice', 'mod_ratingallocate'), 'get'); From 14d5e8f0fd217acec62342ef7cdb4df95c66c086 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 15 Jul 2021 18:11:01 +1200 Subject: [PATCH 07/26] WIP choice_importer class and associated handling in locallib. 'test import' option in CSV upload form. --- lang/en/ratingallocate.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lang/en/ratingallocate.php b/lang/en/ratingallocate.php index 3edaf574..8a7310b6 100644 --- a/lang/en/ratingallocate.php +++ b/lang/en/ratingallocate.php @@ -214,10 +214,18 @@ $string['upload_choices'] = 'Upload choices via CSV'; $string['upload_choices_required_fields'] = 'Required Fields'; -$string['upload_choices_fields_desc'] = 'CSV files uploaded through this form are expected to include the following fields:
{$a}
'; -$string['csvfailed'] = 'Unable to read the raw choice data from the CSV file'; +$string['upload_choices_fields_desc'] = 'CSV files uploaded through this form are expected to be UTF-8 encoded, and include the following choice fields:
{$a}'; +$string['csvempty'] = 'CSV file is empty.'; $string['csvupload'] = 'Upload CSV'; $string['csvupload_explanation'] = 'Bulk upload choices via a CSV file'; +$string['csvupload_missing_fields'] = 'Columns missing from CSV import: {$a}'; +$string['csvupload_missing_groups'] = 'Line {$a->row}: group(s) not available in course: [{$a->invalidgroups}]'; +$string['csvupload_live_problems'] = 'Problems found in CSV import: {$a}'; +$string['csvupload_live_success'] = 'CSV import successful. {$a->importcount} choices imported.'; +$string['csvupload_test_problems'] = 'Problems found in CSV import test: {$a}'; +$string['csvupload_test_success'] = 'CSV import test successful. {$a->importcount} choices can be imported.'; +$string['csvupload_test_upload'] = 'Test upload'; +$string['csvupload_test_upload_help'] = 'When checked: test the uploaded CSV file for data problems, but do not commit to the database.'; //
// $string['upload_choices'] = 'Upload choices via CSV'; From 40f5708b1b8d7db3d3331aa1306443ae0ac209c3 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 15 Jul 2021 18:25:11 +1200 Subject: [PATCH 08/26] Editor fold for CSV upload form in lang strings. --- lang/en/ratingallocate.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lang/en/ratingallocate.php b/lang/en/ratingallocate.php index 8a7310b6..4145b751 100644 --- a/lang/en/ratingallocate.php +++ b/lang/en/ratingallocate.php @@ -212,6 +212,8 @@ $string['saveandnext'] = 'Save and add next'; $string['choice_added_notification'] = 'Choice saved.'; +// +// $string['upload_choices'] = 'Upload choices via CSV'; $string['upload_choices_required_fields'] = 'Required Fields'; $string['upload_choices_fields_desc'] = 'CSV files uploaded through this form are expected to be UTF-8 encoded, and include the following choice fields:
{$a}'; From 508d437a9a73a05428e5b15d103d3712885089b0 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 19 Jul 2021 14:16:35 +1200 Subject: [PATCH 09/26] Import problem and fatal error notifications. --- lang/en/ratingallocate.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lang/en/ratingallocate.php b/lang/en/ratingallocate.php index 4145b751..8ea3a913 100644 --- a/lang/en/ratingallocate.php +++ b/lang/en/ratingallocate.php @@ -219,6 +219,7 @@ $string['upload_choices_fields_desc'] = 'CSV files uploaded through this form are expected to be UTF-8 encoded, and include the following choice fields:
{$a}'; $string['csvempty'] = 'CSV file is empty.'; $string['csvupload'] = 'Upload CSV'; +$string['csvupload_further_problems'] = '{$a} further problems found but not displayed.'; $string['csvupload_explanation'] = 'Bulk upload choices via a CSV file'; $string['csvupload_missing_fields'] = 'Columns missing from CSV import: {$a}'; $string['csvupload_missing_groups'] = 'Line {$a->row}: group(s) not available in course: [{$a->invalidgroups}]'; From 3ff5010b77d8cacaddb29e7c5756860344de42f2 Mon Sep 17 00:00:00 2001 From: Philipp Memmel Date: Sat, 1 Apr 2023 12:12:45 +0200 Subject: [PATCH 10/26] Improve description of requirements of csv upload file --- lang/en/ratingallocate.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lang/en/ratingallocate.php b/lang/en/ratingallocate.php index 8ea3a913..d092b092 100644 --- a/lang/en/ratingallocate.php +++ b/lang/en/ratingallocate.php @@ -216,7 +216,14 @@ // $string['upload_choices'] = 'Upload choices via CSV'; $string['upload_choices_required_fields'] = 'Required Fields'; -$string['upload_choices_fields_desc'] = 'CSV files uploaded through this form are expected to be UTF-8 encoded, and include the following choice fields:
{$a}'; +$string['upload_choices_fields_desc'] = 'CSV files uploaded through this form are expected to be UTF-8 encoded, and include the following choice fields:
{$a}
+The file is required to contain a header line. Multiple groups should be separated by a semicolon. The "active" column should contain 1 or 0 to make the choice enabled or disabled.
+Example file content: +
+title,explanation,maxsize,active,groups
+First Choice,This is the description of the first choice,15,1,Group A;Group B;Group C
+Second Choice,This is the description of the second choice,12,0,Group A;Group D
+
'; $string['csvempty'] = 'CSV file is empty.'; $string['csvupload'] = 'Upload CSV'; $string['csvupload_further_problems'] = '{$a} further problems found but not displayed.'; From 8a12597d16d1852fc602ae872f22a3bf82f59ad0 Mon Sep 17 00:00:00 2001 From: Philipp Memmel Date: Thu, 6 Apr 2023 08:34:28 +0200 Subject: [PATCH 11/26] Remove restriction for showing csv upload button --- renderer.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/renderer.php b/renderer.php index 65c07e96..277a919f 100644 --- a/renderer.php +++ b/renderer.php @@ -408,13 +408,10 @@ public function ratingallocate_show_choices_table(ratingallocate $ratingallocate $starturl = new moodle_url($this->page->url, array('action' => ACTION_EDIT_CHOICE)); echo $this->output->single_button($starturl, get_string('newchoice', 'mod_ratingallocate'), 'get'); - // Only show CSV upload button if rating has not started. - if ($ratingallocate->get_status() === ratingallocate::DISTRIBUTION_STATUS_TOO_EARLY) { - $uploadcsvurl = new moodle_url($this->page->url, array('action' => ACTION_UPLOAD_CHOICES)); - echo $this->output->single_button($uploadcsvurl, get_string('csvupload', 'ratingallocate'), 'get', array( - 'tooltip' => get_string('csvupload_explanation', 'ratingallocate') - )); - } + $uploadcsvurl = new moodle_url($this->page->url, array('action' => ACTION_UPLOAD_CHOICES)); + echo $this->output->single_button($uploadcsvurl, get_string('csvupload', 'ratingallocate'), 'get', array( + 'tooltip' => get_string('csvupload_explanation', 'ratingallocate') + )); // Set up the table. echo $this->output->single_button($starturl->out(), get_string('newchoice', 'mod_ratingallocate'), 'get'); From 81cd938f705c337bb489828bd8387ffb60e16938 Mon Sep 17 00:00:00 2001 From: Laur0r Date: Fri, 28 Apr 2023 09:20:01 +0200 Subject: [PATCH 12/26] remove duplicate button --- renderer.php | 1 - 1 file changed, 1 deletion(-) diff --git a/renderer.php b/renderer.php index 277a919f..c8c2115d 100644 --- a/renderer.php +++ b/renderer.php @@ -414,7 +414,6 @@ public function ratingallocate_show_choices_table(ratingallocate $ratingallocate )); // Set up the table. - echo $this->output->single_button($starturl->out(), get_string('newchoice', 'mod_ratingallocate'), 'get'); $table = new \flexible_table('show_ratingallocate_options'); $table->define_baseurl($this->page->url); if ($choicesmodifiably) { From 7c1dcca8f75c0884d5023e41647bd32c5d332ddd Mon Sep 17 00:00:00 2001 From: Irina Hoppe Date: Tue, 9 May 2023 11:32:03 +0200 Subject: [PATCH 13/26] some codestyle fixes --- lang/en/ratingallocate.php | 4 ++-- locallib.php | 1 - mod_form.php | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lang/en/ratingallocate.php b/lang/en/ratingallocate.php index d092b092..3aaeacd2 100644 --- a/lang/en/ratingallocate.php +++ b/lang/en/ratingallocate.php @@ -104,8 +104,8 @@ $string['confirm_start_distribution'] = 'Running the algorithm will delete all existing allocations, if any. Are you sure to continue?'; $string['delete_all_ratings'] = 'Delete all student ratings'; -$string['delete_all_ratings_explanation'] = 'Deletes all ratings that students have submitted so far - and all allocations that may have been created based on these ratings. Use with caution.'; +$string['delete_all_ratings_explanation'] = 'Deletes all ratings that students have submitted so far and all allocations + that may have been created based on these ratings. Use with caution.'; $string['confirm_delete_all_ratings'] = 'Are you sure you want to delete all ratings students have submitted so far?'; $string['error_deleting_all_insufficient_permission'] = 'You don\'t have the permission to do that'; $string['error_deleting_all_no_rating_possible'] = 'You can\'t delete the ratings when the rating phase is already over'; diff --git a/locallib.php b/locallib.php index f493a1f6..f26a9396 100644 --- a/locallib.php +++ b/locallib.php @@ -193,7 +193,6 @@ public function get_group_candidates() { foreach ($groupcandidates as $group) { $options[$group->id] = $group->name; } - return $options; } diff --git a/mod_form.php b/mod_form.php index 34542a5b..e6a2ec82 100644 --- a/mod_form.php +++ b/mod_form.php @@ -299,5 +299,4 @@ public function validation($data, $files) { private function get_settingsfield_identifier($strategy, $key) { return self::STRATEGY_OPTIONS . '[' . $strategy . '][' . $key . ']'; } - } From 7ed0d1b98322c26184601528720a452d15f310d1 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 13 Jul 2021 15:05:13 +1200 Subject: [PATCH 14/26] WIP form setup for CSV import processing. --- lang/en/ratingallocate.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lang/en/ratingallocate.php b/lang/en/ratingallocate.php index 3aaeacd2..322dc6b9 100644 --- a/lang/en/ratingallocate.php +++ b/lang/en/ratingallocate.php @@ -212,6 +212,12 @@ $string['saveandnext'] = 'Save and add next'; $string['choice_added_notification'] = 'Choice saved.'; +$string['upload_choices'] = 'Upload choices via CSV'; +$string['upload_choices_required_fields'] = 'Required Fields'; +$string['upload_choices_fields_desc'] = 'CSV files uploaded through this form are expected to include the following fields:
{$a}
'; +$string['csvfailed'] = 'Unable to read the raw choice data from the CSV file'; +$string['csvupload'] = 'Upload CSV'; +$string['csvupload_explanation'] = 'Bulk upload choices via a CSV file'; //
// $string['upload_choices'] = 'Upload choices via CSV'; From 5ce0c589ddc7353e29d1098ed820bfe5a2c84394 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 15 Jul 2021 11:04:22 +1200 Subject: [PATCH 15/26] renderer: Only show CSV upload button if rating has not already started. --- renderer.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/renderer.php b/renderer.php index c8c2115d..76fd3b2c 100644 --- a/renderer.php +++ b/renderer.php @@ -408,10 +408,13 @@ public function ratingallocate_show_choices_table(ratingallocate $ratingallocate $starturl = new moodle_url($this->page->url, array('action' => ACTION_EDIT_CHOICE)); echo $this->output->single_button($starturl, get_string('newchoice', 'mod_ratingallocate'), 'get'); - $uploadcsvurl = new moodle_url($this->page->url, array('action' => ACTION_UPLOAD_CHOICES)); - echo $this->output->single_button($uploadcsvurl, get_string('csvupload', 'ratingallocate'), 'get', array( - 'tooltip' => get_string('csvupload_explanation', 'ratingallocate') - )); + // Only show CSV upload button if rating has not started. + if ($ratingallocate->get_status() === ratingallocate::DISTRIBUTION_STATUS_TOO_EARLY) { + $uploadcsvurl = new moodle_url($this->page->url, array('action' => ACTION_UPLOAD_CHOICES)); + echo $this->output->single_button($uploadcsvurl, get_string('csvupload', 'ratingallocate'), 'get', array( + 'tooltip' => get_string('csvupload_explanation', 'ratingallocate') + )); + } // Set up the table. $table = new \flexible_table('show_ratingallocate_options'); From f0a4a8384b38b9f893e8f01b4883a90949da570e Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 15 Jul 2021 18:11:01 +1200 Subject: [PATCH 16/26] WIP choice_importer class and associated handling in locallib. 'test import' option in CSV upload form. --- lang/en/ratingallocate.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lang/en/ratingallocate.php b/lang/en/ratingallocate.php index 322dc6b9..732ad7a2 100644 --- a/lang/en/ratingallocate.php +++ b/lang/en/ratingallocate.php @@ -214,10 +214,18 @@ $string['upload_choices'] = 'Upload choices via CSV'; $string['upload_choices_required_fields'] = 'Required Fields'; -$string['upload_choices_fields_desc'] = 'CSV files uploaded through this form are expected to include the following fields:
{$a}
'; -$string['csvfailed'] = 'Unable to read the raw choice data from the CSV file'; +$string['upload_choices_fields_desc'] = 'CSV files uploaded through this form are expected to be UTF-8 encoded, and include the following choice fields:
{$a}'; +$string['csvempty'] = 'CSV file is empty.'; $string['csvupload'] = 'Upload CSV'; $string['csvupload_explanation'] = 'Bulk upload choices via a CSV file'; +$string['csvupload_missing_fields'] = 'Columns missing from CSV import: {$a}'; +$string['csvupload_missing_groups'] = 'Line {$a->row}: group(s) not available in course: [{$a->invalidgroups}]'; +$string['csvupload_live_problems'] = 'Problems found in CSV import: {$a}'; +$string['csvupload_live_success'] = 'CSV import successful. {$a->importcount} choices imported.'; +$string['csvupload_test_problems'] = 'Problems found in CSV import test: {$a}'; +$string['csvupload_test_success'] = 'CSV import test successful. {$a->importcount} choices can be imported.'; +$string['csvupload_test_upload'] = 'Test upload'; +$string['csvupload_test_upload_help'] = 'When checked: test the uploaded CSV file for data problems, but do not commit to the database.'; //
// $string['upload_choices'] = 'Upload choices via CSV'; From 130b238d0bcea3e910e1c2e84feb9cdb9454546d Mon Sep 17 00:00:00 2001 From: David Thompson Date: Thu, 15 Jul 2021 18:25:11 +1200 Subject: [PATCH 17/26] Editor fold for CSV upload form in lang strings. --- lang/en/ratingallocate.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lang/en/ratingallocate.php b/lang/en/ratingallocate.php index 732ad7a2..261a2cc9 100644 --- a/lang/en/ratingallocate.php +++ b/lang/en/ratingallocate.php @@ -212,6 +212,8 @@ $string['saveandnext'] = 'Save and add next'; $string['choice_added_notification'] = 'Choice saved.'; +// +// $string['upload_choices'] = 'Upload choices via CSV'; $string['upload_choices_required_fields'] = 'Required Fields'; $string['upload_choices_fields_desc'] = 'CSV files uploaded through this form are expected to be UTF-8 encoded, and include the following choice fields:
{$a}'; From 9b7cc12a4cbbbc3c79754c237ce3a4541482321f Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 19 Jul 2021 14:16:35 +1200 Subject: [PATCH 18/26] Import problem and fatal error notifications. --- lang/en/ratingallocate.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lang/en/ratingallocate.php b/lang/en/ratingallocate.php index 261a2cc9..b791b7b1 100644 --- a/lang/en/ratingallocate.php +++ b/lang/en/ratingallocate.php @@ -219,6 +219,7 @@ $string['upload_choices_fields_desc'] = 'CSV files uploaded through this form are expected to be UTF-8 encoded, and include the following choice fields:
{$a}'; $string['csvempty'] = 'CSV file is empty.'; $string['csvupload'] = 'Upload CSV'; +$string['csvupload_further_problems'] = '{$a} further problems found but not displayed.'; $string['csvupload_explanation'] = 'Bulk upload choices via a CSV file'; $string['csvupload_missing_fields'] = 'Columns missing from CSV import: {$a}'; $string['csvupload_missing_groups'] = 'Line {$a->row}: group(s) not available in course: [{$a->invalidgroups}]'; From ef30ed6628643e9300d35f91f25b9ba9cf1fdc40 Mon Sep 17 00:00:00 2001 From: Philipp Memmel Date: Sat, 1 Apr 2023 12:12:45 +0200 Subject: [PATCH 19/26] Improve description of requirements of csv upload file --- lang/en/ratingallocate.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lang/en/ratingallocate.php b/lang/en/ratingallocate.php index b791b7b1..7fd19b26 100644 --- a/lang/en/ratingallocate.php +++ b/lang/en/ratingallocate.php @@ -216,7 +216,14 @@ // $string['upload_choices'] = 'Upload choices via CSV'; $string['upload_choices_required_fields'] = 'Required Fields'; -$string['upload_choices_fields_desc'] = 'CSV files uploaded through this form are expected to be UTF-8 encoded, and include the following choice fields:
{$a}'; +$string['upload_choices_fields_desc'] = 'CSV files uploaded through this form are expected to be UTF-8 encoded, and include the following choice fields:
{$a}
+The file is required to contain a header line. Multiple groups should be separated by a semicolon. The "active" column should contain 1 or 0 to make the choice enabled or disabled.
+Example file content: +
+title,explanation,maxsize,active,groups
+First Choice,This is the description of the first choice,15,1,Group A;Group B;Group C
+Second Choice,This is the description of the second choice,12,0,Group A;Group D
+
'; $string['csvempty'] = 'CSV file is empty.'; $string['csvupload'] = 'Upload CSV'; $string['csvupload_further_problems'] = '{$a} further problems found but not displayed.'; From a6756e76c25c285743e725c826517518a7be197a Mon Sep 17 00:00:00 2001 From: Philipp Memmel Date: Thu, 6 Apr 2023 08:34:28 +0200 Subject: [PATCH 20/26] Remove restriction for showing csv upload button --- renderer.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/renderer.php b/renderer.php index 76fd3b2c..c8c2115d 100644 --- a/renderer.php +++ b/renderer.php @@ -408,13 +408,10 @@ public function ratingallocate_show_choices_table(ratingallocate $ratingallocate $starturl = new moodle_url($this->page->url, array('action' => ACTION_EDIT_CHOICE)); echo $this->output->single_button($starturl, get_string('newchoice', 'mod_ratingallocate'), 'get'); - // Only show CSV upload button if rating has not started. - if ($ratingallocate->get_status() === ratingallocate::DISTRIBUTION_STATUS_TOO_EARLY) { - $uploadcsvurl = new moodle_url($this->page->url, array('action' => ACTION_UPLOAD_CHOICES)); - echo $this->output->single_button($uploadcsvurl, get_string('csvupload', 'ratingallocate'), 'get', array( - 'tooltip' => get_string('csvupload_explanation', 'ratingallocate') - )); - } + $uploadcsvurl = new moodle_url($this->page->url, array('action' => ACTION_UPLOAD_CHOICES)); + echo $this->output->single_button($uploadcsvurl, get_string('csvupload', 'ratingallocate'), 'get', array( + 'tooltip' => get_string('csvupload_explanation', 'ratingallocate') + )); // Set up the table. $table = new \flexible_table('show_ratingallocate_options'); From 2d521ea06e0f7f01dbae5af081f546d0f5455963 Mon Sep 17 00:00:00 2001 From: Justus Dieckmann Date: Wed, 23 Nov 2022 21:07:15 +0100 Subject: [PATCH 21/26] Codestyle fixes --- renderer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/renderer.php b/renderer.php index c8c2115d..277a919f 100644 --- a/renderer.php +++ b/renderer.php @@ -414,6 +414,7 @@ public function ratingallocate_show_choices_table(ratingallocate $ratingallocate )); // Set up the table. + echo $this->output->single_button($starturl->out(), get_string('newchoice', 'mod_ratingallocate'), 'get'); $table = new \flexible_table('show_ratingallocate_options'); $table->define_baseurl($this->page->url); if ($choicesmodifiably) { From b72b278acd16b79b52aaab610ddb14a843fb3e2c Mon Sep 17 00:00:00 2001 From: Laur0r Date: Fri, 28 Apr 2023 09:20:01 +0200 Subject: [PATCH 22/26] remove duplicate button --- renderer.php | 1 - 1 file changed, 1 deletion(-) diff --git a/renderer.php b/renderer.php index 277a919f..c8c2115d 100644 --- a/renderer.php +++ b/renderer.php @@ -414,7 +414,6 @@ public function ratingallocate_show_choices_table(ratingallocate $ratingallocate )); // Set up the table. - echo $this->output->single_button($starturl->out(), get_string('newchoice', 'mod_ratingallocate'), 'get'); $table = new \flexible_table('show_ratingallocate_options'); $table->define_baseurl($this->page->url); if ($choicesmodifiably) { From 01a2b13d8fba9ac17b6d0f10d70e7200fd522cf9 Mon Sep 17 00:00:00 2001 From: Irina Hoppe Date: Tue, 9 May 2023 11:47:13 +0200 Subject: [PATCH 23/26] some codestyle fixes --- mod_form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod_form.php b/mod_form.php index e6a2ec82..b39a92a2 100644 --- a/mod_form.php +++ b/mod_form.php @@ -147,7 +147,7 @@ public function definition() { public function get_disable_strategy($includeratingallocate = false) { $update = $this->optional_param('update', 0, PARAM_INT); - if($update != 0) { + if ($update != 0) { global $DB; $courseid = $update; $cm = get_coursemodule_from_id('ratingallocate', $courseid, 0, false, MUST_EXIST); From 9f755477d397e81954cfa937fd92556ac542550e Mon Sep 17 00:00:00 2001 From: Irina Hoppe Date: Fri, 12 May 2023 10:54:29 +0200 Subject: [PATCH 24/26] renamed ratingallocate_MOD_NAME to RATINGALLOCATE_MOD_NAME in renderer.php --- renderer.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/renderer.php b/renderer.php index c8c2115d..e9215145 100644 --- a/renderer.php +++ b/renderer.php @@ -320,10 +320,10 @@ public function modify_allocation_group($ratingallocateid, $coursemoduleid, $sta array('disabled' => !$ratingover)); // Add delete all ratings button - $deletebutton = new single_button($deleteurl, get_string('delete_all_ratings', ratingallocate_MOD_NAME, 'get')); + $deletebutton = new single_button($deleteurl, get_string('delete_all_ratings', RATINGALLOCATE_MOD_NAME, 'get')); $deletebutton->disabled = $ratingover; // Only allow deletion if new submission is possible. - $deletebutton->tooltip = get_string('delete_all_ratings_explanation', ratingallocate_MOD_NAME); - $deletebutton->add_action(new confirm_action(get_string('confirm_delete_all_ratings', ratingallocate_MOD_NAME))); + $deletebutton->tooltip = get_string('delete_all_ratings_explanation', RATINGALLOCATE_MOD_NAME); + $deletebutton->add_action(new confirm_action(get_string('confirm_delete_all_ratings', RATINGALLOCATE_MOD_NAME))); $output .= $this->render($deletebutton); From 7f159a8d377467866207d62831d8829c3b281b42 Mon Sep 17 00:00:00 2001 From: Irina Hoppe Date: Fri, 12 May 2023 12:56:07 +0200 Subject: [PATCH 25/26] removed duplicates in lang/en/ratingallocate --- lang/en/ratingallocate.php | 49 -------------------------------------- 1 file changed, 49 deletions(-) diff --git a/lang/en/ratingallocate.php b/lang/en/ratingallocate.php index 7fd19b26..9d5f59cc 100644 --- a/lang/en/ratingallocate.php +++ b/lang/en/ratingallocate.php @@ -237,55 +237,6 @@ $string['csvupload_test_upload'] = 'Test upload'; $string['csvupload_test_upload_help'] = 'When checked: test the uploaded CSV file for data problems, but do not commit to the database.'; //
-// -$string['upload_choices'] = 'Upload choices via CSV'; -$string['upload_choices_required_fields'] = 'Required Fields'; -$string['upload_choices_fields_desc'] = 'CSV files uploaded through this form are expected to be UTF-8 encoded, and include the following choice fields:
{$a}
-The file is required to contain a header line. Multiple groups should be separated by a semicolon. The "active" column should contain 1 or 0 to make the choice enabled or disabled.
-Example file content: -
-title,explanation,maxsize,active,groups
-First Choice,This is the description of the first choice,15,1,Group A;Group B;Group C
-Second Choice,This is the description of the second choice,12,0,Group A;Group D
-
'; -$string['csvempty'] = 'CSV file is empty.'; -$string['csvupload'] = 'Upload CSV'; -$string['csvupload_further_problems'] = '{$a} further problems found but not displayed.'; -$string['csvupload_explanation'] = 'Bulk upload choices via a CSV file'; -$string['csvupload_missing_fields'] = 'Columns missing from CSV import: {$a}'; -$string['csvupload_missing_groups'] = 'Line {$a->row}: group(s) not available in course: [{$a->invalidgroups}]'; -$string['csvupload_live_problems'] = 'Problems found in CSV import: {$a}'; -$string['csvupload_live_success'] = 'CSV import successful. {$a->importcount} choices imported.'; -$string['csvupload_test_problems'] = 'Problems found in CSV import test: {$a}'; -$string['csvupload_test_success'] = 'CSV import test successful. {$a->importcount} choices can be imported.'; -$string['csvupload_test_upload'] = 'Test upload'; -$string['csvupload_test_upload_help'] = 'When checked: test the uploaded CSV file for data problems, but do not commit to the database.'; -//
-// -$string['upload_choices'] = 'Upload choices via CSV'; -$string['upload_choices_required_fields'] = 'Required Fields'; -$string['upload_choices_fields_desc'] = 'CSV files uploaded through this form are expected to be UTF-8 encoded, and include the following choice fields:
{$a}
-The file is required to contain a header line. Multiple groups should be separated by a semicolon. The "active" column should contain 1 or 0 to make the choice enabled or disabled.
-Example file content: -
-title,explanation,maxsize,active,groups
-First Choice,This is the description of the first choice,15,1,Group A;Group B;Group C
-Second Choice,This is the description of the second choice,12,0,Group A;Group D
-
'; -$string['csvempty'] = 'CSV file is empty.'; -$string['csvupload'] = 'Upload CSV'; -$string['csvupload_further_problems'] = '{$a} further problems found but not displayed.'; -$string['csvupload_explanation'] = 'Bulk upload choices via a CSV file'; -$string['csvupload_missing_fields'] = 'Columns missing from CSV import: {$a}'; -$string['csvupload_missing_groups'] = 'Line {$a->row}: group(s) not available in course: [{$a->invalidgroups}]'; -$string['csvupload_live_problems'] = 'Problems found in CSV import: {$a}'; -$string['csvupload_live_success'] = 'CSV import successful. {$a->importcount} choices imported.'; -$string['csvupload_test_problems'] = 'Problems found in CSV import test: {$a}'; -$string['csvupload_test_success'] = 'CSV import test successful. {$a->importcount} choices can be imported.'; -$string['csvupload_test_upload'] = 'Test upload'; -$string['csvupload_test_upload_help'] = 'When checked: test the uploaded CSV file for data problems, but do not commit to the database.'; -//
- // $string['choice_active'] = 'Choice is active'; $string['choice_active_help'] = 'Only active choices are displayed to the user. Inactive choices are not displayed.'; From fe1babbbbfc598308dd6c771b5d3914442666351 Mon Sep 17 00:00:00 2001 From: Laur0r Date: Fri, 12 May 2023 14:00:16 +0200 Subject: [PATCH 26/26] Fix naming error in locallib.php --- locallib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locallib.php b/locallib.php index 5db91480..edcd0a74 100644 --- a/locallib.php +++ b/locallib.php @@ -266,19 +266,19 @@ private function delete_all_student_ratings() { // Disallow to delete ratings for students and tutors. if (!has_capability('mod/ratingallocate:start_distribution', $this->context, null, false)) { redirect(new moodle_url('/mod/ratingallocate/view.php', array('id' => $this->coursemodule->id)), - get_string('error_deleting_all_insufficient_permission', ratingallocate_MOD_NAME)); + get_string('error_deleting_all_insufficient_permission', RATINGALLOCATE_MOD_NAME)); return; } // Disallow deletion when there can't be new ratings submitted $status = $this->get_status(); if ($status !== self::DISTRIBUTION_STATUS_RATING_IN_PROGRESS and $status !== self::DISTRIBUTION_STATUS_TOO_EARLY) { redirect(new moodle_url('/mod/ratingallocate/view.php', array('id' => $this->coursemodule->id)), - get_string('error_deleting_all_no_rating_possible', ratingallocate_MOD_NAME)); + get_string('error_deleting_all_no_rating_possible', RATINGALLOCATE_MOD_NAME)); return; } $this->delete_all_ratings(); redirect(new moodle_url('/mod/ratingallocate/view.php', array('id' => $this->coursemodule->id)), - get_string('success_deleting_all', ratingallocate_MOD_NAME)); + get_string('success_deleting_all', RATINGALLOCATE_MOD_NAME)); } private function process_action_give_rating() {