Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moodle Plugin CI, and Moodle coding style #728

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix 'Comma after the last array item in a multi-line array.' errors.
  • Loading branch information
lucaboesch committed Dec 20, 2024
commit e0392cef5e0ffebbdd016117bff374542a1887bf
6 changes: 3 additions & 3 deletions ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
turnitin_view::output_lti_form_launch('peermark_manager', 'Instructor', $tiiassignmentid),
[
'class' => 'launch_form',
'style' => 'display:none;'
'style' => 'display:none;',
]
);

Expand All @@ -177,7 +177,7 @@
turnitin_view::output_lti_form_launch('rubric_view', 'Learner', $tiiassignment->value),
[
'class' => 'launch_form',
'style' => 'display:none;'
'style' => 'display:none;',
]
);

Expand All @@ -204,7 +204,7 @@
turnitin_view::output_lti_form_launch('peermark_reviews', $userrole, $tiiassignment->value),
[
'class' => 'launch_form',
'style' => 'display:none;'
'style' => 'display:none;',
]
);

Expand Down
2 changes: 1 addition & 1 deletion backup/moodle2/backup_plagiarism_turnitin_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function define_module_plugin_structure() {
$turnitinfiles = new backup_nested_element('turnitin_files');
$turnitinfile = new backup_nested_element('turnitin_file', ['id'],
['userid', 'identifier', 'externalid', 'externalstatus',
'statuscode', 'similarityscore', 'transmatch', 'lastmodified', 'grade', 'submissiontype']);
'statuscode', 'similarityscore', 'transmatch', 'lastmodified', 'grade', 'submissiontype',]);
$pluginelement->add_child($turnitinfiles);
$turnitinfiles->add_child($turnitinfile);

Expand Down
8 changes: 4 additions & 4 deletions classes/forms/turnitin_setupform.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function definition() {
$options = [
'https://api.turnitin.com' => 'https://api.turnitin.com',
'https://api.turnitinuk.com' => 'https://api.turnitinuk.com',
'https://sandbox.turnitin.com' => 'https://sandbox.turnitin.com'
'https://sandbox.turnitin.com' => 'https://sandbox.turnitin.com',
];

// Set $CFG->turnitinqa and add URLs to $CFG->turnitinqaurls array in config.php file for testing other environments.
Expand All @@ -91,7 +91,7 @@ public function definition() {
$diagnosticoptions = [
0 => get_string('diagnosticoptions_0', 'plagiarism_turnitin'),
1 => get_string('diagnosticoptions_1', 'plagiarism_turnitin'),
2 => get_string('diagnosticoptions_2', 'plagiarism_turnitin')
2 => get_string('diagnosticoptions_2', 'plagiarism_turnitin'),
];

// Debugging and logging settings.
Expand Down Expand Up @@ -125,7 +125,7 @@ public function definition() {
PLAGIARISM_TURNITIN_ADMIN_REPOSITORY_OPTION_EXPANDED => get_string('repositoryoptions_1', 'plagiarism_turnitin'),
PLAGIARISM_TURNITIN_ADMIN_REPOSITORY_OPTION_FORCE_STANDARD => get_string('repositoryoptions_2', 'plagiarism_turnitin'),
PLAGIARISM_TURNITIN_ADMIN_REPOSITORY_OPTION_FORCE_NO => get_string('repositoryoptions_3', 'plagiarism_turnitin'),
PLAGIARISM_TURNITIN_ADMIN_REPOSITORY_OPTION_FORCE_INSTITUTIONAL => get_string('repositoryoptions_4', 'plagiarism_turnitin')
PLAGIARISM_TURNITIN_ADMIN_REPOSITORY_OPTION_FORCE_INSTITUTIONAL => get_string('repositoryoptions_4', 'plagiarism_turnitin'),
];

$mform->addElement('select', 'plagiarism_turnitin_repositoryoption', get_string('turnitinrepositoryoptions', 'plagiarism_turnitin'), $repositoryoptions);
Expand Down Expand Up @@ -239,7 +239,7 @@ public function save($data) {

$properties = ["accountid", "secretkey", "apiurl", "enablediagnostic", "usegrademark", "enablepeermark",
"useanon", "transmatch", "repositoryoption", "agreement", "enablepseudo", "pseudofirstname",
"pseudolastname", "lastnamegen", "pseudosalt", "pseudoemaildomain"];
"pseudolastname", "lastnamegen", "pseudosalt", "pseudoemaildomain",];

foreach ($properties as $property) {
plagiarism_plugin_turnitin::plagiarism_set_config($data, "plagiarism_turnitin_".$property);
Expand Down
2 changes: 1 addition & 1 deletion classes/modules/turnitin_assign.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function is_resubmission_allowed($assignid, $reportgenspeed, $submissiont
$params = ['assignment' => $assignid,
'subtype' => 'assignsubmission',
'plugin' => 'file',
'name' => 'maxfilesubmissions'];
'name' => 'maxfilesubmissions',];

$maxfilesubmissions = 0;
if ($result = $DB->get_record('assign_plugin_config', $params, 'value')) {
Expand Down
2 changes: 1 addition & 1 deletion classes/modules/turnitin_coursework.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct() {

public function is_tutor($context) {
$capabilities = [$this->get_tutor_capability(), 'mod/coursework:addagreedgrade',
'mod/coursework:addallocatedagreedgrade', 'mod/coursework:administergrades'];
'mod/coursework:addallocatedagreedgrade', 'mod/coursework:administergrades',];
return has_any_capability($capabilities, $context);
}

Expand Down
8 changes: 4 additions & 4 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static function _get_metadata(collection $collection) {
'turnitin_uid' => 'privacy:metadata:plagiarism_turnitin_users:turnitin_uid',
'instructor_defaults' => 'privacy:metadata:plagiarism_turnitin_users:instructor_defaults',
'instructor_rubrics' => 'privacy:metadata:plagiarism_turnitin_users:instructor_rubrics',
'user_agreement_accepted' => 'privacy:metadata:plagiarism_turnitin_users:user_agreement_accepted'
'user_agreement_accepted' => 'privacy:metadata:plagiarism_turnitin_users:user_agreement_accepted',
],
'privacy:metadata:plagiarism_turnitin_users'
);
Expand All @@ -108,7 +108,7 @@ public static function _get_contexts_for_userid($userid) {

$params = ['modulename' => 'assign',
'contextlevel' => CONTEXT_MODULE,
'userid' => $userid];
'userid' => $userid,];

$sql = "SELECT ctx.id
FROM {course_modules} cm
Expand Down Expand Up @@ -241,7 +241,7 @@ public static function get_users_in_context(userlist $userlist) {

$params = [
'modname' => 'plagiarism_turnitin',
'cmid' => $context->instanceid
'cmid' => $context->instanceid,
];

$userlist->add_from_sql('userid', $sql, $params);
Expand Down Expand Up @@ -276,7 +276,7 @@ public static function delete_data_for_users(approved_userlist $userlist) {

$params = [
'modname' => 'plagiarism_turnitin',
'cmid' => $context->instanceid
'cmid' => $context->instanceid,
];

$params = array_merge($params, $inparams);
Expand Down
2 changes: 1 addition & 1 deletion classes/turnitin_comms.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ private function get_lang() {
'sv' => 'sv',
'nl' => 'nl',
'fi' => 'fi',
'ar' => 'ar'
'ar' => 'ar',
];
$langcode = (isset($langarray[$langcode])) ? $langarray[$langcode] : 'en_us';
return $langcode;
Expand Down
14 changes: 7 additions & 7 deletions classes/turnitin_submission.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public function recreate_submission_event() {
'userid' => $this->submissiondata->userid,
'other' => [
'content' => '',
'pathnamehashes' => [$this->submissiondata->identifier]
]
'pathnamehashes' => [$this->submissiondata->identifier],
],
];
// Forum attachments need the discussion id to be set.
if ($this->cm->modname == "forum") {
Expand Down Expand Up @@ -93,8 +93,8 @@ public function recreate_submission_event() {
'other' => [
'pathnamehashes' => [],
'content' => trim($onlinetextdata->onlinetext),
'format' => $onlinetextdata->onlineformat
]
'format' => $onlinetextdata->onlineformat,
],
];

$event = $moduleobject->create_text_event($params, $this->cm);
Expand All @@ -115,7 +115,7 @@ public function recreate_submission_event() {
WHERE FD.forum = ? AND FD.course = ?
AND FP.userid = ? AND FP.message LIKE ? ',
[$forum->id, $forum->course,
$this->submissiondata->userid, $this->data['forumpost']]
$this->submissiondata->userid, $this->data['forumpost'],]
);
$discussionid = $discussion->id;
}
Expand All @@ -134,8 +134,8 @@ public function recreate_submission_event() {
'pathnamehashes' => '',
'content' => trim($this->data['forumpost']),
'discussionid' => $discussionid,
'triggeredfrom' => 'turnitin_recreate_submission_event'
]
'triggeredfrom' => 'turnitin_recreate_submission_event',
],
];
$event = \mod_forum\event\assessable_uploaded::create($params);
$event->trigger();
Expand Down
2 changes: 1 addition & 1 deletion classes/turnitin_user.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ public function set_user_values_from_tii() {
"id" => $readuser->getUserId(),
"firstname" => $readuser->getFirstName(),
"lastname" => $readuser->getLastName(),
"email" => $readuser->getEmail()
"email" => $readuser->getEmail(),
];

return $tiiuser;
Expand Down
18 changes: 9 additions & 9 deletions classes/turnitin_view.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function add_elements_to_settings_form($mform, $course, $location = "acti
1 => get_string('reportgen_immediate_add_duedate', 'plagiarism_turnitin'),
2 => get_string('reportgen_duedate_add_duedate', 'plagiarism_turnitin'));
$excludetypeoptions = array( 0 => get_string('no'), 1 => get_string('excludewords', 'plagiarism_turnitin'),
2 => get_string('excludepercent', 'plagiarism_turnitin')];
2 => get_string('excludepercent', 'plagiarism_turnitin'),];

if ($location == "defaults") {
$mform->addElement('header', 'turnitin_plugin_header', get_string('turnitindefaults', 'plagiarism_turnitin'));
Expand Down Expand Up @@ -163,7 +163,7 @@ public function add_elements_to_settings_form($mform, $course, $location = "acti
[
'class' => 'plagiarism_turnitin_refresh_grades',
'tabindex' => 0,
'role' => 'link'
'role' => 'link',
]
);

Expand All @@ -183,7 +183,7 @@ public function add_elements_to_settings_form($mform, $course, $location = "acti
'href' => '#',
'class' => 'plagiarism_turnitin_quickmark_manager_launch',
'id' => 'quickmark_manager_form',
'tabindex' => 0
'tabindex' => 0,
]
);

Expand All @@ -203,7 +203,7 @@ public function add_elements_to_settings_form($mform, $course, $location = "acti
'href' => '#',
'class' => 'peermark_manager_launch',
'id' => 'peermark_manager_form',
'tabindex' => 0
'tabindex' => 0,
]
);
$peermarkmanagerlink = html_writer::tag('div', $peermarkmanagerlink, ['class' => 'row_peermark_manager']);
Expand All @@ -227,7 +227,7 @@ public function add_elements_to_settings_form($mform, $course, $location = "acti

if ($mform->elementExists('submissiondrafts') || $location == 'defaults') {
$tiidraftoptions = [0 => get_string("submitondraft", "plagiarism_turnitin"),
1 => get_string("submitonfinal", "plagiarism_turnitin")];
1 => get_string("submitonfinal", "plagiarism_turnitin"),];

$mform->addElement('select', 'plagiarism_draft_submit', get_string("draftsubmit", "plagiarism_turnitin"), $tiidraftoptions);
$this->lock($mform, $location, $locks);
Expand All @@ -239,7 +239,7 @@ public function add_elements_to_settings_form($mform, $course, $location = "acti
$mform->addHelpButton('plagiarism_allow_non_or_submissions', 'allownonor', 'plagiarism_turnitin');

$suboptions = [0 => get_string('norepository', 'plagiarism_turnitin'),
1 => get_string('standardrepository', 'plagiarism_turnitin')];
1 => get_string('standardrepository', 'plagiarism_turnitin'),];
switch ($config->plagiarism_turnitin_repositoryoption) {
case 0; // Standard options.
$mform->addElement('select', 'plagiarism_submitpapersto', get_string('submitpapersto', 'plagiarism_turnitin'), $suboptions);
Expand Down Expand Up @@ -336,7 +336,7 @@ public function add_elements_to_settings_form($mform, $course, $location = "acti
'title' => get_string('launchrubricmanager', 'plagiarism_turnitin'),
'id' => 'rubric_manager_form',
'role' => 'link',
'tabindex' => '0'
'tabindex' => '0',
]
);

Expand All @@ -362,13 +362,13 @@ public function add_elements_to_settings_form($mform, $course, $location = "acti
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')
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')
'en' => get_string('erater_dictionary_en', 'plagiarism_turnitin'),
];
$mform->addElement('select', 'plagiarism_erater', get_string('erater', 'plagiarism_turnitin'), $options);
$mform->setDefault('plagiarism_erater', 0);
Expand Down
8 changes: 4 additions & 4 deletions db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
'contextlevel' => CONTEXT_COURSE,
'legacy' => [
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
]
'manager' => CAP_ALLOW,
],
],
'plagiarism/turnitin:viewfullreport' => [
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'legacy' => [
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
]
'manager' => CAP_ALLOW,
],
],
];
20 changes: 10 additions & 10 deletions db/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,43 @@
$observers = [
[
'eventname' => '\assignsubmission_file\event\assessable_uploaded',
'callback' => 'plagiarism_turnitin_observer::assignsubmission_file_uploaded'
'callback' => 'plagiarism_turnitin_observer::assignsubmission_file_uploaded',
],
[
'eventname' => '\assignsubmission_onlinetext\event\assessable_uploaded',
'callback' => 'plagiarism_turnitin_observer::assignsubmission_onlinetext_uploaded'
'callback' => 'plagiarism_turnitin_observer::assignsubmission_onlinetext_uploaded',
],
[
'eventname' => '\mod_workshop\event\assessable_uploaded',
'callback' => 'plagiarism_turnitin_observer::workshop_file_uploaded'
'callback' => 'plagiarism_turnitin_observer::workshop_file_uploaded',
],
[
'eventname' => '\mod_forum\event\assessable_uploaded',
'callback' => 'plagiarism_turnitin_observer::forum_file_uploaded'
'callback' => 'plagiarism_turnitin_observer::forum_file_uploaded',
],
[
'eventname' => '\mod_assign\event\assessable_submitted',
'callback' => 'plagiarism_turnitin_observer::assignsubmission_submitted'
'callback' => 'plagiarism_turnitin_observer::assignsubmission_submitted',
],
[
'eventname' => '\mod_assign\event\submission_removed',
'callback' => 'plagiarism_turnitin_observer::assignsubmission_removed'
],
[
'eventname' => '\mod_coursework\event\assessable_uploaded',
'callback' => 'plagiarism_turnitin_observer::coursework_submitted'
'callback' => 'plagiarism_turnitin_observer::coursework_submitted',
],
[
'eventname' => '\mod_quiz\event\attempt_submitted',
'callback' => 'plagiarism_turnitin_observer::quiz_submitted'
'callback' => 'plagiarism_turnitin_observer::quiz_submitted',
],
[
'eventname' => '\core\event\course_module_deleted',
'callback' => 'plagiarism_turnitin_observer::course_module_deleted'
'callback' => 'plagiarism_turnitin_observer::course_module_deleted',
],
[
'eventname' => '\core\event\course_reset_ended',
'callback' => 'plagiarism_plugin_turnitin::course_reset',
'includefile' => 'plagiarism/turnitin/lib.php'
]
'includefile' => 'plagiarism/turnitin/lib.php',
],
];
2 changes: 1 addition & 1 deletion db/messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
$messageproviders = [
// Notify student with their digital receipt.
'submission' => [
]
],
];
4 changes: 2 additions & 2 deletions db/tasks.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
'hour' => '*',
'day' => '*',
'dayofweek' => '*',
'month' => '*'
'month' => '*',
],
[
'classname' => 'plagiarism_turnitin\task\send_submissions',
Expand All @@ -42,6 +42,6 @@
'hour' => '*',
'day' => '*',
'dayofweek' => '*',
'month' => '*'
'month' => '*',
],
];
2 changes: 1 addition & 1 deletion db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ function xmldb_plagiarism_turnitin_upgrade($oldversion) {

$properties = ["accountid", "secretkey", "apiurl", "enablediagnostic", "usegrademark",
"enablepeermark", "transmatch", "repositoryoption", "agreement", "enablepseudo", "pseudofirstname",
"pseudolastname", "lastnamegen", "pseudosalt", "pseudoemaildomain", "useanon"];
"pseudolastname", "lastnamegen", "pseudosalt", "pseudoemaildomain", "useanon",];

foreach ($properties as $property) {
plagiarism_plugin_turnitin::plagiarism_set_config($data, $property);
Expand Down
2 changes: 1 addition & 1 deletion dbexport.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
'plagiarism_turnitin_config',
'plagiarism_turnitin_users',
'plagiarism_turnitin_courses',
'plagiarism_turnitin_peermark'
'plagiarism_turnitin_peermark',
];

// If a table has been passed in then export that table data.
Expand Down
Loading