Skip to content

Commit

Permalink
Adding the fixes from pull request #734 for Moodle 4.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaboesch committed Dec 20, 2024
1 parent 4933ab5 commit f2ff401
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 243 deletions.
7 changes: 4 additions & 3 deletions classes/forms/turnitin_setupform.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ public function definition() {
'plagiarism_turnitin'));
$mform->setDefault('plagiarism_turnitin_enablepeermark', 1);

$mform->addElement('select', 'plagiarism_turnitin_useanon', get_string('turnitinuseanon', 'plagiarism_turnitin'), $ynoptions);
$mform->addElement('static', 'plagiarism_turnitin_useanon_desc', null, get_string('turnitinuseanon_desc', 'plagiarism_turnitin'));
$mform->addElement('select', 'plagiarism_turnitin_useanon', get_string('turnitinuseanon', 'plagiarism_turnitin'),
$ynoptions);
$mform->addElement('static', 'plagiarism_turnitin_useanon_desc', null,
get_string('turnitinuseanon_desc', 'plagiarism_turnitin'));

$mform->addElement('select', 'plagiarism_turnitin_useerater', get_string('turnitinuseerater',
'plagiarism_turnitin'), $ynoptions);
Expand All @@ -148,7 +150,6 @@ public function definition() {
'plagiarism_turnitin'), $ynoptions);
$mform->addElement('static', 'plagiarism_turnitin_useanon_desc', null, get_string('turnitinuseanon_desc',
'plagiarism_turnitin'));

$mform->setDefault('plagiarism_turnitin_useanon', 0);

$mform->addElement('select', 'plagiarism_turnitin_transmatch', get_string('transmatch',
Expand Down
58 changes: 3 additions & 55 deletions classes/turnitin_view.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function add_elements_to_settings_form($mform, $course, $location = "acti
$genparams = $plagiarismturnitin->plagiarism_get_report_gen_speed_params();
$genoptions = [0 => get_string('reportgen_immediate_add_immediate', 'plagiarism_turnitin'),
1 => get_string('reportgen_immediate_add_duedate', 'plagiarism_turnitin'),
2 => get_string('reportgen_duedate_add_duedate', 'plagiarism_turnitin')];
2 => get_string('reportgen_duedate_add_duedate', 'plagiarism_turnitin'), ];
$excludetypeoptions = [0 => get_string('no'), 1 => get_string('excludewords', 'plagiarism_turnitin'),
2 => get_string('excludepercent', 'plagiarism_turnitin'), ];

Expand All @@ -155,7 +155,8 @@ public function add_elements_to_settings_form($mform, $course, $location = "acti
$PAGE->requires->js_call_amd('plagiarism_turnitin/new_quickmark', 'newQuickmarkLaunch');
$PAGE->requires->js_call_amd('plagiarism_turnitin/new_rubric', 'newRubric');
} else {
// TODO: We can remove these when we no longer have to support Moodle versions 4.3 and below
// phpcs:disable moodle.Commenting.TodoComment
// TODO: We can remove these when we no longer have to support Moodle versions 4.3 and below.
$PAGE->requires->js_call_amd('plagiarism_turnitin/peermark', 'peermarkLaunch');
$PAGE->requires->js_call_amd('plagiarism_turnitin/quickmark', 'quickmarkLaunch');
$PAGE->requires->js_call_amd('plagiarism_turnitin/rubric', 'rubric');
Expand Down Expand Up @@ -380,59 +381,6 @@ public function add_elements_to_settings_form($mform, $course, $location = "acti
$mform->setType('plagiarism_rubric', PARAM_RAW);
}

<<<<<<< HEAD
=======
if (!empty($config->plagiarism_turnitin_useerater)) {
$handbookoptions = [
1 => get_string('erater_handbook_advanced', 'plagiarism_turnitin'),
2 => get_string('erater_handbook_highschool', 'plagiarism_turnitin'),
3 => get_string('erater_handbook_middleschool', 'plagiarism_turnitin'),
4 => get_string('erater_handbook_elementary', 'plagiarism_turnitin'),
5 => get_string('erater_handbook_learners', 'plagiarism_turnitin'),
];

$dictionaryoptions = [
'en_US' => get_string('erater_dictionary_enus', 'plagiarism_turnitin'),
'en_GB' => get_string('erater_dictionary_engb', 'plagiarism_turnitin'),
'en' => get_string('erater_dictionary_en', 'plagiarism_turnitin'),
];
$mform->addElement('select', 'plagiarism_erater', get_string('erater', 'plagiarism_turnitin'), $options);
$mform->setDefault('plagiarism_erater', 0);

$mform->addElement('select', 'plagiarism_erater_handbook', get_string('erater_handbook',
'plagiarism_turnitin'),
$handbookoptions);
$mform->setDefault('plagiarism_erater_handbook', 2);
$mform->disabledIf('plagiarism_erater_handbook', 'plagiarism_erater', 'eq', 0);

$mform->addElement('select', 'plagiarism_erater_dictionary', get_string('erater_dictionary',
'plagiarism_turnitin'),
$dictionaryoptions);
$mform->setDefault('plagiarism_erater_dictionary', 'en_US');
$mform->disabledIf('plagiarism_erater_dictionary', 'plagiarism_erater', 'eq', 0);

$mform->addElement('checkbox', 'plagiarism_erater_spelling', get_string('erater_categories',
'plagiarism_turnitin'),
" ".get_string('erater_spelling', 'plagiarism_turnitin'));
$mform->disabledIf('plagiarism_erater_spelling', 'plagiarism_erater', 'eq', 0);

$mform->addElement('checkbox', 'plagiarism_erater_grammar', '', " ".get_string('erater_grammar',
'plagiarism_turnitin'));
$mform->disabledIf('plagiarism_erater_grammar', 'plagiarism_erater', 'eq', 0);

$mform->addElement('checkbox', 'plagiarism_erater_usage', '', " ".get_string('erater_usage',
'plagiarism_turnitin'));
$mform->disabledIf('plagiarism_erater_usage', 'plagiarism_erater', 'eq', 0);

$mform->addElement('checkbox', 'plagiarism_erater_mechanics', '', " ".
get_string('erater_mechanics', 'plagiarism_turnitin'));
$mform->disabledIf('plagiarism_erater_mechanics', 'plagiarism_erater', 'eq', 0);

$mform->addElement('checkbox', 'plagiarism_erater_style', '', " ".get_string('erater_style',
'plagiarism_turnitin'));
$mform->disabledIf('plagiarism_erater_style', 'plagiarism_erater', 'eq', 0);
}

$mform->addElement('html', html_writer::tag('div', get_string('anonblindmarkingnote', 'plagiarism_turnitin'),
['class' => 'tii_anonblindmarkingnote']));

Expand Down
2 changes: 1 addition & 1 deletion db/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
],
[
'eventname' => '\mod_assign\event\submission_removed',
'callback' => 'plagiarism_turnitin_observer::assignsubmission_removed'
'callback' => 'plagiarism_turnitin_observer::assignsubmission_removed',
],
[
'eventname' => '\mod_coursework\event\assessable_uploaded',
Expand Down
Loading

0 comments on commit f2ff401

Please sign in to comment.