diff --git a/actions/ajax/datatable/grading.php b/actions/ajax/datatable/grading.php index c1ad9542..f2b25973 100644 --- a/actions/ajax/datatable/grading.php +++ b/actions/ajax/datatable/grading.php @@ -35,7 +35,7 @@ $unallocated = optional_param('unallocated', false, PARAM_BOOL); // Grading report display options. -$report_options = array(); +$report_options = []; if ($unallocated) { $report_options['unallocated'] = true; } diff --git a/actions/allocate.php b/actions/allocate.php index cc4afb5c..e20fbf2c 100644 --- a/actions/allocate.php +++ b/actions/allocate.php @@ -45,7 +45,7 @@ $assessorallocationstrategy = optional_param('assessorallocationstrategy', false, PARAM_TEXT); $moderationruletype = optional_param('addmodsetruletype', 0, PARAM_ALPHAEXT); -$deletemodsetrule = optional_param('delete-mod-set-rule', array(), PARAM_RAW) ; +$deletemodsetrule = optional_param('delete-mod-set-rule', [], PARAM_RAW) ; // options used for pagination // If a session variable holding page preference for the specific coursework is not set, set default value (0). @@ -76,7 +76,7 @@ $options = compact('sortby', 'sorthow', 'perpage', 'page'); // $_POST['allocatables'] comes as array of arrays which is not supported by optional_param_array, however we clean this later in process_data() function -$formdataarray = isset($_POST['allocatables']) ? $_POST['allocatables'] : array(); +$formdataarray = isset($_POST['allocatables']) ? $_POST['allocatables'] : = []; require_login($course, true, $coursemodule); diff --git a/actions/allocationsession.php b/actions/allocationsession.php index e5da9a24..8e29a1b1 100644 --- a/actions/allocationsession.php +++ b/actions/allocationsession.php @@ -26,20 +26,20 @@ $assesorselect = required_param_array('assesorselect', PARAM_RAW); $assesorselectvalue = required_param_array('assesorselectvalue', PARAM_RAW); -$pinnedchk = optional_param_array('pinned', array(), PARAM_RAW); -$pinnedchkval = optional_param_array('pinnedvalue', array(), PARAM_RAW); -$moderatorselect = optional_param_array('moderatorselect', array(), PARAM_RAW); -$moderatorselectvalue = optional_param_array('moderatorselectvalue', array(), PARAM_RAW); -$samplechk = optional_param_array('sample', array(), PARAM_RAW); -$samplechkvalue = optional_param_array('samplevalue', array(), PARAM_RAW); +$pinnedchk = optional_param_array('pinned', [], PARAM_RAW); +$pinnedchkval = optional_param_array('pinnedvalue', [], PARAM_RAW); +$moderatorselect = optional_param_array('moderatorselect', [], PARAM_RAW); +$moderatorselectvalue = optional_param_array('moderatorselectvalue', [], PARAM_RAW); +$samplechk = optional_param_array('sample', [], PARAM_RAW); +$samplechkvalue = optional_param_array('samplevalue', [], PARAM_RAW); $coursemoduleid = required_param('coursemoduleid', PARAM_INT); if (!isset($SESSION->coursework_allocationsessions)) { - $SESSION->coursework_allocationsessions = array(); + $SESSION->coursework_allocationsessions = []; } if (!isset($SESSION->coursework_allocationsessions[$coursemoduleid])) { - $SESSION->coursework_allocationsessions[$coursemoduleid] = array(); + $SESSION->coursework_allocationsessions[$coursemoduleid] = []; } for ($i = 0; $i < count($assesorselect); $i++) { diff --git a/actions/set_personal_deadlines.php b/actions/set_personal_deadlines.php index 042e2fdf..c6d42bf4 100644 --- a/actions/set_personal_deadlines.php +++ b/actions/set_personal_deadlines.php @@ -62,7 +62,7 @@ 'node-base') ); $PAGE->requires->js_init_call('M.mod_coursework.init_personal_deadlines_page', - array(), + [], false, $jsmodule); diff --git a/backup/moodle2/restore_coursework_activity_task.class.php b/backup/moodle2/restore_coursework_activity_task.class.php index 21d954e8..1e98ecdb 100644 --- a/backup/moodle2/restore_coursework_activity_task.class.php +++ b/backup/moodle2/restore_coursework_activity_task.class.php @@ -33,7 +33,7 @@ class restore_coursework_activity_task extends restore_activity_task * @return array of restore_decode_rule */ static public function define_decode_rules() { - $rules = array(); + $rules = []; $rules[] = new restore_decode_rule('COURSEWORKBYID', '/mod/coursework/view.php?id=$1', @@ -53,7 +53,7 @@ static public function define_decode_rules() { * @return array */ static public function define_decode_contents() { - $contents = array(); + $contents = []; $contents[] = new restore_decode_content('coursework', array('intro'), 'assign'); diff --git a/backup/moodle2/restore_coursework_stepslib.php b/backup/moodle2/restore_coursework_stepslib.php index e072e1fe..4dece12d 100644 --- a/backup/moodle2/restore_coursework_stepslib.php +++ b/backup/moodle2/restore_coursework_stepslib.php @@ -39,7 +39,7 @@ static function cheaplog($thing, $append = true) { * @return restore_path_element $structure */ protected function define_structure() { - $paths = array(); + $paths = []; $paths[] = new restore_path_element('coursework', '/activity/coursework'); $paths[] = new restore_path_element('coursework_sample_set_rule', '/activity/coursework/coursework_sample_set_rules/coursework_sample_set_rule'); diff --git a/classes/allocation/manager.php b/classes/allocation/manager.php index 766ba509..ce3f8dce 100644 --- a/classes/allocation/manager.php +++ b/classes/allocation/manager.php @@ -69,7 +69,7 @@ public function __construct(coursework $coursework) { $this->coursework = $coursework; // Instantiate the allocation strategies so we can use them. - $strategytypes = array(); + $strategytypes = []; if (!empty($this->coursework->assessorallocationstrategy)) { $strategytypes[] = coursework::ASSESSOR; } @@ -110,7 +110,7 @@ public static function get_allocation_classnames($type = coursework::ASSESSOR) { $classdir = $CFG->dirroot . '/mod/coursework/classes/allocation/strategy'; $fullclassnames = glob($classdir . '/*.php'); - $options = array(); + $options = []; foreach ($fullclassnames as $fullclassname) { if (strpos($fullclassname, 'base') !== false) { continue; @@ -169,7 +169,7 @@ public function auto_generate_moderation_set() { } // These are the ones we will actually moderate (or which have already been moderated). - $moderation_set = array(); + $moderation_set = []; // Move all the already marked ones into the set. These have to stay in it and ought to // be taken into account so that the other rules just add to them. @@ -289,7 +289,7 @@ public function auto_generate_sample_set() { $sampleplugins = $DB->get_records('coursework_sample_set_plugin', null, 'pluginorder'); $order = 0; - $sample_set = array(); + $sample_set = []; $allocatables = $this->get_coursework()->get_allocatables(); @@ -331,7 +331,7 @@ public function auto_generate_sample_set() { if (!isset($manual_sample_set[$k])) $manual_sample_set[$k] = $v; } - $auto_sample_set = array(); + $auto_sample_set = []; foreach ($sampleplugins as $plugin) { $classname = '\mod_coursework\sample_set_rule\\' . $plugin->rulename; diff --git a/classes/allocation/strategy/base.php b/classes/allocation/strategy/base.php index 1512bd61..4069fa15 100644 --- a/classes/allocation/strategy/base.php +++ b/classes/allocation/strategy/base.php @@ -64,7 +64,7 @@ abstract class base { * * @var array */ - private $settings = array(); + private $settings = []; /** * @var stage_base diff --git a/classes/allocation/strategy/equal.php b/classes/allocation/strategy/equal.php index b1efbf91..114391e4 100644 --- a/classes/allocation/strategy/equal.php +++ b/classes/allocation/strategy/equal.php @@ -86,7 +86,7 @@ public function save_allocation_strategy_options() { * @return mixed */ protected function list_of_allocatable_teachers_and_their_current_number_of_allocations($teachers, $student) { - $teacherids = array(); + $teacherids = []; foreach ($teachers as $id => $teacher) { if ($this->teacher_already_has_an_allocation_for_this_allocatable($student, $teacher)) { diff --git a/classes/allocation/strategy/group_assessor.php b/classes/allocation/strategy/group_assessor.php index 307e2a04..e4550630 100644 --- a/classes/allocation/strategy/group_assessor.php +++ b/classes/allocation/strategy/group_assessor.php @@ -66,6 +66,6 @@ public function save_allocation_strategy_options() { * @return mixed */ protected function list_of_allocatable_teachers_and_their_current_number_of_allocations($teachers, $student) { - return array(); + return = []; } } diff --git a/classes/allocation/strategy/none.php b/classes/allocation/strategy/none.php index 4b4fdfc5..81a2e2ab 100644 --- a/classes/allocation/strategy/none.php +++ b/classes/allocation/strategy/none.php @@ -72,6 +72,6 @@ public function save_allocation_strategy_options() { * @return mixed */ protected function list_of_allocatable_teachers_and_their_current_number_of_allocations($teachers, $student) { - return array(); + return = []; } } diff --git a/classes/allocation/strategy/percentages.php b/classes/allocation/strategy/percentages.php index 3e957be5..a6fc2064 100644 --- a/classes/allocation/strategy/percentages.php +++ b/classes/allocation/strategy/percentages.php @@ -139,7 +139,7 @@ public function save_allocation_strategy_options() { // Get the data from the form. $name = $this->get_name(); - $data = optional_param_array('assessorstrategy'.$name, array(), PARAM_RAW); // Array[teacherid] => value. + $data = optional_param_array('assessorstrategy'.$name, [], PARAM_RAW); // Array[teacherid] => value. if (!is_array($data)) { return true; @@ -244,7 +244,7 @@ private function teacher_already_has_maximum_allocations($teacher) { * @return array */ protected function list_of_allocatable_teachers_and_their_current_number_of_allocations($teachers, $student) { - $teacherids = array(); + $teacherids = []; foreach ($teachers as $teacher) { if ($this->teacher_already_has_an_allocation_for_this_allocatable($student, $teacher)) { diff --git a/classes/allocation/table/builder.php b/classes/allocation/table/builder.php index 38b59c48..f31c9087 100644 --- a/classes/allocation/table/builder.php +++ b/classes/allocation/table/builder.php @@ -69,7 +69,7 @@ public function __construct($coursework, array $options) { public function get_rows() { $allocatables = $this->get_coursework()->get_allocatables(); - $rows = array(); + $rows = []; foreach ($allocatables as $allocatable) { $rows[] = new row_builder($this, $allocatable); } @@ -106,7 +106,7 @@ public function get_table_rows_for_page() { $allocatables = $this->get_coursework()->get_allocatables(); - $rows = array(); + $rows = []; foreach ($allocatables as $allocatable) { $rows[] = new row_builder($this, $allocatable); } diff --git a/classes/allocation/table/cell/builder.php b/classes/allocation/table/cell/builder.php index 6ccc44c8..9061d6f0 100644 --- a/classes/allocation/table/cell/builder.php +++ b/classes/allocation/table/cell/builder.php @@ -58,7 +58,7 @@ class builder { * @param stage_base $stage * @param array $data_array incoming data from the allocation form */ - public function __construct($coursework, $allocatable, $stage, $data_array = array()) { + public function __construct($coursework, $allocatable, $stage, $data_array = []) { $this->coursework = $coursework; $this->allocatable = $allocatable; $this->stage = $stage; diff --git a/classes/allocation/table/cell/data.php b/classes/allocation/table/cell/data.php index 9e24e9a1..e86f01a1 100644 --- a/classes/allocation/table/cell/data.php +++ b/classes/allocation/table/cell/data.php @@ -50,7 +50,7 @@ class data { * @param stage_base $stage * @param array $data */ - public function __construct($stage, $data = array()) { + public function __construct($stage, $data = []) { $this->data = $data; $this->stage = $stage; $this->preprocess_data(); diff --git a/classes/allocation/table/cell/processor.php b/classes/allocation/table/cell/processor.php index 768ac3a0..f009d81a 100644 --- a/classes/allocation/table/cell/processor.php +++ b/classes/allocation/table/cell/processor.php @@ -56,7 +56,7 @@ class processor { * @param stage_base $stage * @param array $data_array incoming data from the allocation form */ - public function __construct($coursework, $allocatable, $stage, $data_array = array()) { + public function __construct($coursework, $allocatable, $stage, $data_array = []) { $this->coursework = $coursework; $this->allocatable = $allocatable; $this->stage = $stage; diff --git a/classes/allocation/table/processor.php b/classes/allocation/table/processor.php index c0a143c9..7b6c5f85 100644 --- a/classes/allocation/table/processor.php +++ b/classes/allocation/table/processor.php @@ -52,7 +52,7 @@ public function __construct($coursework) { /** * @param array $table_data */ - public function process_data($table_data = array()) { + public function process_data($table_data = []) { $clean_data = $this->clean_data($table_data); $allocatables = $this->coursework->get_allocatables(); @@ -60,7 +60,7 @@ public function process_data($table_data = array()) { if (array_key_exists($allocatable->id(), $clean_data)) { $row_data = $clean_data[$allocatable->id()]; } else { - $row_data = array(); + $row_data = []; } $allocatable = $this->get_allocatable_from_id($allocatable->id()); @@ -101,14 +101,14 @@ private function clean_data($raw_data) { // ) // ); - $clean_data = array(); + $clean_data = []; foreach ($raw_data as $allocatable_id => $datarrays) { if (!$this->allocatable_id_is_valid($allocatable_id)) { // Should be the id of a student. continue; } - $clean_data[$allocatable_id] = array(); + $clean_data[$allocatable_id] = []; foreach ($this->coursework->marking_stages() as $stage) { diff --git a/classes/allocation/upload.php b/classes/allocation/upload.php index f201ebc1..125447cc 100644 --- a/classes/allocation/upload.php +++ b/classes/allocation/upload.php @@ -69,7 +69,7 @@ public function validate_csv($content, $encoding, $delimeter) { $csvreader->init(); - $errors = array(); + $errors = []; $s = 0; // find out if this is a group or individual coursework $allocatabletype = $this->coursework->get_allocatable_type(); @@ -79,7 +79,7 @@ public function validate_csv($content, $encoding, $delimeter) { // find all assessors for this coursework $assessors = get_enrolled_users($this->coursework->get_context(), 'mod/coursework:addinitialgrade'); $assessors = array_keys($assessors); // keep only assessors' ids - $allocatablesinfile = array(); + $allocatablesinfile = []; $csv_cells = array('allocatable'); $stages = $this->coursework->get_max_markers(); @@ -90,7 +90,7 @@ public function validate_csv($content, $encoding, $delimeter) { while ($line = $csvreader->next()) { $cells = $csv_cells; - $assessorsinfile = array(); + $assessorsinfile = []; if (sizeof($line) != sizeof($csv_cells)) {$errors = get_string('incorrectfileformat', 'coursework'); break;} foreach ($line as $keynum => $value) { diff --git a/classes/assessor_feedback_table.php b/classes/assessor_feedback_table.php index 67745e8f..2676e3f3 100644 --- a/classes/assessor_feedback_table.php +++ b/classes/assessor_feedback_table.php @@ -78,7 +78,7 @@ public function get_renderable_feedback_rows() { // Makes a new result set every time, so we can modify this array without worrying about // messing up the cache. - $feedbackobjects = array(); + $feedbackobjects = []; foreach ($this->coursework->get_assessor_marking_stages() as $stage) { $renderable_row = new assessor_feedback_row($stage, $this->get_allocatable(), $this->coursework); $feedbackobjects[] = $renderable_row; diff --git a/classes/controllers/feedback_controller.php b/classes/controllers/feedback_controller.php index a6fe97d1..1ac3062c 100644 --- a/classes/controllers/feedback_controller.php +++ b/classes/controllers/feedback_controller.php @@ -117,7 +117,7 @@ protected function new_feedback() { $this->check_stage_permissions($this->params['stage_identifier']); - $urlparams = array(); + $urlparams = []; $urlparams['submissionid'] = $teacherfeedback->submissionid; $urlparams['assessorid'] = $teacherfeedback->assessorid; $urlparams['isfinalgrade'] = $teacherfeedback->isfinalgrade; diff --git a/classes/controllers/moderations_controller.php b/classes/controllers/moderations_controller.php index 16cfdbcf..d80c822c 100644 --- a/classes/controllers/moderations_controller.php +++ b/classes/controllers/moderations_controller.php @@ -74,7 +74,7 @@ protected function new_moderation() { $this->check_stage_permissions($this->params['stage_identifier']); - $urlparams = array(); + $urlparams = []; $urlparams['submissionid'] = $moderator_agreement->submissionid; $urlparams['moderatorid'] = $moderator_agreement->moderatorid; $urlparams['stage_identifier'] = $moderator_agreement->stage_identifier; diff --git a/classes/controllers/plagiarism_flagging_controller.php b/classes/controllers/plagiarism_flagging_controller.php index a5326d87..e73f66c4 100644 --- a/classes/controllers/plagiarism_flagging_controller.php +++ b/classes/controllers/plagiarism_flagging_controller.php @@ -69,7 +69,7 @@ protected function new_plagiarism_flag() { $ability = new ability(user::find($USER), $this->coursework); $ability->require_can('new', $plagiarismflag); - $urlparams = array(); + $urlparams = []; $urlparams['submissionid'] = $plagiarismflag->submissionid; $PAGE->set_url('/mod/coursework/actions/moderations/new.php', $urlparams); diff --git a/classes/cron.php b/classes/cron.php index d5fb181a..6fec6342 100644 --- a/classes/cron.php +++ b/classes/cron.php @@ -74,7 +74,7 @@ private static function send_reminders_to_students() { 'users' => 0 ); - $userswhoneedreminding = array(); + $userswhoneedreminding = []; $raw_courseworks = $DB->get_records('coursework'); foreach ($raw_courseworks as $raw_coursework) { @@ -278,7 +278,7 @@ private static function send_first_reminders_to_admins() { * @global $CFG * @return string */ - public static function coursework_debuggable_query($query, $params = array()) { + public static function coursework_debuggable_query($query, $params = []) { global $CFG; @@ -310,7 +310,7 @@ private static function send_email_reminders_to_students(array $users, array &$c global $DB; $emailcounter = 0; - $usercounter = array(); + $usercounter = []; foreach ($users as $user) { diff --git a/classes/event/assessable_uploaded.php b/classes/event/assessable_uploaded.php index fc777a59..7b3a4cc9 100644 --- a/classes/event/assessable_uploaded.php +++ b/classes/event/assessable_uploaded.php @@ -30,7 +30,7 @@ class assessable_uploaded extends \core\event\assessable_uploaded { * * @var array */ - protected $legacyfiles = array(); + protected $legacyfiles = []; /** * Returns description of what happened. diff --git a/classes/export/csv.php b/classes/export/csv.php index fc7c7949..81d7999b 100644 --- a/classes/export/csv.php +++ b/classes/export/csv.php @@ -78,7 +78,7 @@ public function export() { $this->csvexport = new csv_export_writer(); $this->add_filename($this->filename); - $csv_data = array(); + $csv_data = []; // headers $this->add_headers($this->csv_cells); @@ -111,7 +111,7 @@ public function export() { * @return array */ public function add_cells_to_array($submission, $student, $csv_cells) { - $row = array(); + $row = []; foreach ($csv_cells as $csv_cell) { if (substr($csv_cell, 0, 8) == 'assessor') { $stage_dentifier = 'assessor_'.(substr($csv_cell, -1)); @@ -148,7 +148,7 @@ public function add_cells_to_array($submission, $student, $csv_cells) { * @param $csv_headers */ public function add_headers($csv_headers) { - $headers = array(); + $headers = []; foreach ($csv_headers as $header) { if (substr($header, 0, 8) == 'assessor') { $stage = (substr($header, -1)); @@ -241,7 +241,7 @@ public function get_submissions($groupid = null, $selected_submission_ids = '') */ public function add_csv_data($submission) { - $csv_data = array(); + $csv_data = []; // retrieve all students (even if group coursework) $students = $submission->get_students(); diff --git a/classes/export/csv/cells/agreedfeedback_cell.php b/classes/export/csv/cells/agreedfeedback_cell.php index 0bae12bd..3551f7c7 100644 --- a/classes/export/csv/cells/agreedfeedback_cell.php +++ b/classes/export/csv/cells/agreedfeedback_cell.php @@ -51,7 +51,7 @@ public function get_header($stage) { return get_string('agreedgradefeedback', 'coursework'); } - public function validate_cell($value, $submissionid, $stage_identifier='', $uploadedgradecells = array()) { + public function validate_cell($value, $submissionid, $stage_identifier='', $uploadedgradecells = []) { global $DB, $PAGE, $USER; diff --git a/classes/export/csv/cells/agreedgrade_cell.php b/classes/export/csv/cells/agreedgrade_cell.php index c158425c..51a54d81 100644 --- a/classes/export/csv/cells/agreedgrade_cell.php +++ b/classes/export/csv/cells/agreedgrade_cell.php @@ -42,7 +42,7 @@ public function get_cell($submission, $student, $stage_identifier) { $agreedgrade = $submission->get_agreed_grade(); if ($this->coursework->is_using_rubric() && $this->coursework->finalstagegrading != 1) { - $gradedata = array(); + $gradedata = []; $this->get_rubric_scores_gradedata($agreedgrade, $gradedata); // multiple parts are handled here } else { $gradedata = (!$agreedgrade)? '': $this->get_actual_grade($agreedgrade->grade); @@ -59,7 +59,7 @@ public function get_cell($submission, $student, $stage_identifier) { public function get_header($stage) { if ($this->coursework->is_using_rubric() && $this->coursework->finalstagegrading != 1) { - $strings = array(); + $strings = []; $criterias = $this->coursework->get_rubric_criteria(); foreach ($criterias as $criteria) { // rubrics can have multiple parts, so let's create header for each of it $strings['agreedgrade'.$criteria['id']] = 'Agreed grade - '.$criteria['description']; @@ -72,7 +72,7 @@ public function get_header($stage) { return $strings; } - public function validate_cell($value, $submissionid, $stage_identifier='', $uploadedgradecells = array()) { + public function validate_cell($value, $submissionid, $stage_identifier='', $uploadedgradecells = []) { global $DB, $PAGE, $USER; @@ -236,7 +236,7 @@ function get_rubrics($coursework, $csv_cells) { if ($coursework->is_using_rubric() && $this->coursework->finalstagegrading != 1) { - $rubricheaders = array(); + $rubricheaders = []; $criterias = $coursework->get_rubric_criteria(); diff --git a/classes/export/csv/cells/assessorfeedback_cell.php b/classes/export/csv/cells/assessorfeedback_cell.php index a694a77c..709fe509 100644 --- a/classes/export/csv/cells/assessorfeedback_cell.php +++ b/classes/export/csv/cells/assessorfeedback_cell.php @@ -74,7 +74,7 @@ public function get_header($stage) { return get_string('assessorfeedbackcsv', 'coursework', $stage); } - public function validate_cell($value, $submissionid, $stage_identifier='', $uploadedgradecells = array()) { + public function validate_cell($value, $submissionid, $stage_identifier='', $uploadedgradecells = []) { global $DB, $PAGE, $USER; $agreedgradecap = array('mod/coursework:addagreedgrade', 'mod/coursework:editagreedgrade'); diff --git a/classes/export/csv/cells/assessorgrade_cell.php b/classes/export/csv/cells/assessorgrade_cell.php index 02c0f548..5b7ce118 100644 --- a/classes/export/csv/cells/assessorgrade_cell.php +++ b/classes/export/csv/cells/assessorgrade_cell.php @@ -57,7 +57,7 @@ public function get_cell($submission, $student, $stage_identifier) { if (($submission->get_agreed_grade() || ($feedback && $ability->can('show', $feedback))) || !$submission->any_editable_feedback_exists() || is_siteadmin($USER->id)) { if ($this->coursework->is_using_rubric()) { - $gradedata = array(); + $gradedata = []; $this->get_rubric_scores_gradedata($grade, $gradedata); // multiple parts are handled here } else{ $gradedata = (!$grade)? '': $this->get_actual_grade($grade->grade); @@ -89,7 +89,7 @@ public function get_cell($submission, $student, $stage_identifier) { public function get_header($stage) { if ($this->coursework->is_using_rubric() ) { - $strings = array(); + $strings = []; $criterias = $this->coursework->get_rubric_criteria(); foreach ($criterias as $criteria) { // rubrics can have multiple parts, so let's create header for each of it $strings['assessorgrade'.$stage.'_'.$criteria['id']] = 'Assessor '.$stage.' - '.$criteria['description']; @@ -103,7 +103,7 @@ public function get_header($stage) { } - public function validate_cell($value, $submissionid, $stage_identifier='', $uploadedgradecells = array()) { + public function validate_cell($value, $submissionid, $stage_identifier='', $uploadedgradecells = []) { global $DB, $PAGE, $USER; if (empty($value)) return true; @@ -296,7 +296,7 @@ function get_rubrics($coursework, $csv_cells) { if ($coursework->is_using_rubric()) { - $rubricheaders = array(); + $rubricheaders = []; $criterias = $coursework->get_rubric_criteria(); diff --git a/classes/export/csv/cells/cell_base.php b/classes/export/csv/cells/cell_base.php index 462dacf6..dfd9e4b4 100644 --- a/classes/export/csv/cells/cell_base.php +++ b/classes/export/csv/cells/cell_base.php @@ -250,7 +250,7 @@ public function get_stage_identifier_for_assessor($submission, $student) { * Function to validate cell for the file upload * @return mixed */ - public function validate_cell($value, $submissions, $stage_dentifier='', $uploadedgradecells = array()) { + public function validate_cell($value, $submissions, $stage_dentifier='', $uploadedgradecells = []) { return true; } diff --git a/classes/export/csv/cells/feedbackcomments_cell.php b/classes/export/csv/cells/feedbackcomments_cell.php index 72c8fb78..0d68e21f 100644 --- a/classes/export/csv/cells/feedbackcomments_cell.php +++ b/classes/export/csv/cells/feedbackcomments_cell.php @@ -54,7 +54,7 @@ public function get_header($stage) { return get_string('feedbackcomment', 'coursework'); } - public function validate_cell($value, $submissionid, $stage_identifier='', $uploadedgradecells = array()) { + public function validate_cell($value, $submissionid, $stage_identifier='', $uploadedgradecells = []) { global $PAGE, $DB, $USER; diff --git a/classes/export/csv/cells/moderationagreement_cell.php b/classes/export/csv/cells/moderationagreement_cell.php index 3ada6dfa..a989a1e2 100644 --- a/classes/export/csv/cells/moderationagreement_cell.php +++ b/classes/export/csv/cells/moderationagreement_cell.php @@ -38,7 +38,7 @@ class moderationagreement_cell extends cell_base { public function get_cell($submission, $student, $stage_identifier) { global $DB; - $data = array(); + $data = []; $moderation_agreement = ''; $moderation = ''; @@ -78,7 +78,7 @@ public function get_cell($submission, $student, $stage_identifier) { */ public function get_header($stage) { - $fields = array(); + $fields = []; if ($this->coursework->allocation_enabled()) { $fields['allocatedmoderatorname'] = 'Allocated moderator name'; $fields['allocatedmoderatorusername'] = 'Allocated moderator username'; diff --git a/classes/export/csv/cells/otherassessors_cell.php b/classes/export/csv/cells/otherassessors_cell.php index 7c2ff991..f853cfa6 100644 --- a/classes/export/csv/cells/otherassessors_cell.php +++ b/classes/export/csv/cells/otherassessors_cell.php @@ -57,7 +57,7 @@ public function get_cell($submission, $student, $stage_identifier) { AND stage_identifier <> 'final_agreed_1'"; $feedbacks = $DB->get_records_sql($sql, $params); - $gradedata = array(); + $gradedata = []; // $stage_identifier = ($this->coursework->get_max_markers() == 1) ? "assessor_1" : $this->get_stage_identifier_for_assessor($submission, $student); foreach ($feedbacks as $feedback) { @@ -132,7 +132,7 @@ public function get_cell($submission, $student, $stage_identifier) { */ public function get_header($stage) { - $fields = array(); + $fields = []; for ($i = 1; $i < $this->stages ; $i++) { if ($this->coursework->is_using_rubric()) { diff --git a/classes/export/csv/cells/singlegrade_cell.php b/classes/export/csv/cells/singlegrade_cell.php index ff7e23ff..b190eb5d 100644 --- a/classes/export/csv/cells/singlegrade_cell.php +++ b/classes/export/csv/cells/singlegrade_cell.php @@ -44,7 +44,7 @@ public function get_cell($submission, $student, $stage_identifier) { $grade = $submission->get_assessor_feedback_by_stage($stage_identifier); if ($this->coursework->is_using_rubric()) { - $gradedata = array(); + $gradedata = []; $this->get_rubric_scores_gradedata($grade, $gradedata); // multiple parts are handled here } else { $gradedata = (!$grade)? '': $this->get_actual_grade($grade->grade); @@ -61,7 +61,7 @@ public function get_cell($submission, $student, $stage_identifier) { public function get_header($stage) { if ($this->coursework->is_using_rubric()) { - $strings = array(); + $strings = []; $criterias = $this->coursework->get_rubric_criteria(); foreach ($criterias as $criteria) { // rubrics can have multiple parts, so let's create header for each of it $strings['singlegrade'.$criteria['id']] = $criteria['description']; @@ -73,7 +73,7 @@ public function get_header($stage) { return $strings; } - public function validate_cell($value, $submissionid, $stage_identifier='', $uploadedgradecells = array()) { + public function validate_cell($value, $submissionid, $stage_identifier='', $uploadedgradecells = []) { global $PAGE, $DB, $USER; @@ -241,7 +241,7 @@ function get_rubrics($coursework, $csv_cells) { if ($coursework->is_using_rubric()) { - $rubricheaders = array(); + $rubricheaders = []; $criterias = $coursework->get_rubric_criteria(); diff --git a/classes/export/csv/cells/stages_cell.php b/classes/export/csv/cells/stages_cell.php index 21a4eeec..aa595648 100644 --- a/classes/export/csv/cells/stages_cell.php +++ b/classes/export/csv/cells/stages_cell.php @@ -46,7 +46,7 @@ public function get_cell($submission, $student, $stage_identifier) { $timemodified = $feedback->timemodified; } - $gradedata = array(); + $gradedata = []; // go through each stage and get a grade, if grade not present then put a placeholder for ($i = 1; $i <= $this->stages; $i++) { $stage_identifier = 'assessor_'.$i; @@ -114,7 +114,7 @@ public function get_cell($submission, $student, $stage_identifier) { */ public function get_header($stage) { - $fields = array(); + $fields = []; for ($i = 1; $i <= $this->stages; $i++) { if ($this->coursework->allocation_enabled()) { diff --git a/classes/export/csv/cells/submissionfileid_cell.php b/classes/export/csv/cells/submissionfileid_cell.php index b5278a46..36b014b2 100644 --- a/classes/export/csv/cells/submissionfileid_cell.php +++ b/classes/export/csv/cells/submissionfileid_cell.php @@ -46,7 +46,7 @@ public function get_header($stage) { return get_string('submissionfileid', 'coursework'); } - public function validate_cell($value, $submissionid, $stage_dentifier='', $uploadedgradecells = array()) { + public function validate_cell($value, $submissionid, $stage_dentifier='', $uploadedgradecells = []) { global $DB; if (empty($value)) { diff --git a/classes/export/csv/cells/submissionid_cell.php b/classes/export/csv/cells/submissionid_cell.php index 4f7c1e7f..1b3685c2 100644 --- a/classes/export/csv/cells/submissionid_cell.php +++ b/classes/export/csv/cells/submissionid_cell.php @@ -46,7 +46,7 @@ public function get_header($stage) { return get_string('submissionid', 'coursework'); } - public function validate_cell($value, $submissionid, $stage_dentifier = '', $uploadedgradecells = array()) { + public function validate_cell($value, $submissionid, $stage_dentifier = '', $uploadedgradecells = []) { global $DB; return ($DB->record_exists('coursework_submissions', array('id' => $submissionid, 'courseworkid' => $this->coursework->id()))) ? true: get_string('submissionnotfoundincoursework', 'coursework'); } diff --git a/classes/export/grading_sheet.php b/classes/export/grading_sheet.php index 262daa91..799103b1 100644 --- a/classes/export/grading_sheet.php +++ b/classes/export/grading_sheet.php @@ -56,7 +56,7 @@ public function get_submissions($groupid = null, $selected_submission_ids = '') * @var submission[] $submissions */ foreach ($submissions as $submission) { - $stage_identifiers = array(); + $stage_identifiers = []; // remove all submissions that a user is not supposed to see // double marking not allocated @@ -122,7 +122,7 @@ public function get_submissions($groupid = null, $selected_submission_ids = '') */ public function add_csv_data($submission) { - $csv_data = array(); + $csv_data = []; // groups if ($this->coursework->is_configured_to_have_group_submissions()) { $group = \mod_coursework\models\group::find($submission->allocatableid); diff --git a/classes/export/import.php b/classes/export/import.php index 5e96256c..40a608d2 100644 --- a/classes/export/import.php +++ b/classes/export/import.php @@ -73,7 +73,7 @@ public function validate_csv($content, $encoding, $delimeter, $csv_cells) { $csvreader->init(); - $errors = array(); + $errors = []; $s = 0; $submissions = $this->get_submissions(); @@ -95,7 +95,7 @@ public function validate_csv($content, $encoding, $delimeter, $csv_cells) { $offset = 0; // Holds details on grades that have been successfully uploaded for the current line - $uploadedgradecells = array(); + $uploadedgradecells = []; for ($z = 0; $z < count($line); $z++) { @@ -179,7 +179,7 @@ function rubric_count_correct($csvheader, $linefromimportedcsv) { if (strpos($ch, $type) !== false) { - if (empty($typepositions)) $typepositions = array(); + if (empty($typepositions)) $typepositions = []; $typefound = true; $typepositions[] = $i; @@ -301,7 +301,7 @@ public function process_csv($content, $encoding, $delimiter, $csv_cells, $proces $cells = $csv; $i = 0; - $csvline = array(); + $csvline = []; //if ((!$this->coursework->is_using_rubric() && sizeof($line) != sizeof($cells)) || ($this->coursework->is_using_rubric() && !$this->rubric_count_correct($csv, $line))) { //if (sizeof($line) != sizeof($cells)) { @@ -333,7 +333,7 @@ public function process_csv($content, $encoding, $delimiter, $csv_cells, $proces $coursework = $submission->get_coursework(); - $stages = array(); + $stages = []; if (!$coursework->has_multiple_markers()) { $stages['singlegrade'] = $this->get_stage_identifier($csvline['submissionid'], 'singlegrade'); @@ -400,8 +400,8 @@ public function process_csv($content, $encoding, $delimiter, $csv_cells, $proces if ($coursework->is_using_rubric() && !($stage == 'final_agreed_1' && $this->coursework->finalstagegrading == 1)) { //array that will hold the advanced grade data - $criteriagradedata = array(); - $criteriagradedata['criteria'] = array(); + $criteriagradedata = []; + $criteriagradedata['criteria'] = []; $criterias = $this->coursework->get_rubric_criteria(); @@ -444,7 +444,7 @@ public function process_csv($content, $encoding, $delimiter, $csv_cells, $proces $critidx = 0; // This assumes that the data in the csv is in the correct criteria order.....it should be foreach ($criterias as $c) { - $criteriagrade = array(); + $criteriagrade = []; // We need to get the levelid for the value that the criteria has been given diff --git a/classes/file_importer.php b/classes/file_importer.php index b85d0263..5839e832 100644 --- a/classes/file_importer.php +++ b/classes/file_importer.php @@ -100,11 +100,11 @@ public function import_zip_files($coursework, $feedbackstage, $overwritecurrent) @set_time_limit(ASSIGNFEEDBACK_FILE_MAXFILEUNZIPTIME); - $results = array(); + $results = []; $feedbackfilesupdated = 0; $feedbackfilesadded = 0; - $userswithnewfeedback = array(); + $userswithnewfeedback = []; $contextid = $coursework->get_context_id(); $fs = get_file_storage(); diff --git a/classes/files.php b/classes/files.php index 5c988cdf..d1504677 100644 --- a/classes/files.php +++ b/classes/files.php @@ -44,7 +44,7 @@ abstract class files implements countable { /** * @param array $files */ - public function __construct($files = array()) { + public function __construct($files = []) { $this->files = $files; } diff --git a/classes/forms/advance_plugins_form.php b/classes/forms/advance_plugins_form.php index d52bd57e..9c2d4932 100644 --- a/classes/forms/advance_plugins_form.php +++ b/classes/forms/advance_plugins_form.php @@ -47,7 +47,7 @@ public function definition() { $mform =& $this->_form; - $mform->addElement('editor', 'text_element', get_string('comment', 'mod_coursework'), array()); + $mform->addElement('editor', 'text_element', get_string('comment', 'mod_coursework'), []); $mform->setType('editor', PARAM_RAW); $file_manager_options = array( diff --git a/classes/forms/assessor_feedback_mform.php b/classes/forms/assessor_feedback_mform.php index 29303467..fb419e14 100644 --- a/classes/forms/assessor_feedback_mform.php +++ b/classes/forms/assessor_feedback_mform.php @@ -134,7 +134,7 @@ public function get_grading_controller() { */ public function add_submit_buttons($draftenabled, $feedbackid) { - $button_array = array(); + $button_array = []; if ($draftenabled) { $button_array[] = $this->_form->createElement('submit', 'submitfeedbackbutton', get_string('saveasdraft', 'coursework')); diff --git a/classes/forms/choose_student_for_submission_mform.php b/classes/forms/choose_student_for_submission_mform.php index 44427fb8..78936938 100644 --- a/classes/forms/choose_student_for_submission_mform.php +++ b/classes/forms/choose_student_for_submission_mform.php @@ -54,7 +54,7 @@ protected function definition() { return; } - $options = array(); + $options = []; $allnames = \core_user\fields::get_name_fields(); foreach ($students as $student) { diff --git a/classes/forms/deadline_extension_form.php b/classes/forms/deadline_extension_form.php index 08a16636..b6083172 100644 --- a/classes/forms/deadline_extension_form.php +++ b/classes/forms/deadline_extension_form.php @@ -90,7 +90,7 @@ public function validation($data, $files) { $deadline = $this->get_coursework()->deadline; } - $errors = array(); + $errors = []; if ($data['extended_deadline'] <= $deadline) { $errors['extended_deadline'] = 'The new deadline must be later than the current deadline'; } diff --git a/classes/forms/personal_deadline_form.php b/classes/forms/personal_deadline_form.php index c09d5576..73ef6471 100644 --- a/classes/forms/personal_deadline_form.php +++ b/classes/forms/personal_deadline_form.php @@ -68,7 +68,7 @@ private function get_coursework() { * @return array */ public function validation($data, $files) { - $errors = array(); + $errors = []; if ($data['personal_deadline'] <= time()) { $errors['personal_deadline'] = 'The new deadline you chose has already passed. Please select appropriate deadline'; } diff --git a/classes/forms/publish_form.php b/classes/forms/publish_form.php index dafc95d3..d97383f0 100644 --- a/classes/forms/publish_form.php +++ b/classes/forms/publish_form.php @@ -44,7 +44,7 @@ public function definition() { $this->_form->addElement('hidden', 'id', $this->_customdata['cmid']); $this->_form->setType('id', PARAM_INT); - $attributes = array(); + $attributes = []; $explaintext = false; $should_release = true; diff --git a/classes/forms/student_submission_form.php b/classes/forms/student_submission_form.php index e60d65e7..b37d2dc8 100644 --- a/classes/forms/student_submission_form.php +++ b/classes/forms/student_submission_form.php @@ -299,7 +299,7 @@ protected function add_submit_buttons_to_form() { $ability = new ability(user::find($USER), $this->get_coursework()); - $button_array = array(); + $button_array = []; // If submitting on behalf of someone else, we want to make sure that we don't have people leaving it in a draft // state because the reason for doing submit on behalf of in the first place is that the student cannot use the // interface themselves, so they are unable to come back later to finalise it themselves. @@ -403,7 +403,7 @@ protected function get_file_manager_options() { */ protected function make_plagiarism_instructions() { $plagiarism_helpers = $this->get_coursework()->get_plagiarism_helpers(); - $plagiarism_instructions = array(); + $plagiarism_instructions = []; foreach ($plagiarism_helpers as $helper) { if ($helper->file_submission_instructions()) { $plagiarism_instructions[] = $helper->file_submission_instructions(); diff --git a/classes/forms/upload_feedback_form.php b/classes/forms/upload_feedback_form.php index bde45e63..7f49a791 100644 --- a/classes/forms/upload_feedback_form.php +++ b/classes/forms/upload_feedback_form.php @@ -45,7 +45,7 @@ function definition() { $mform->addElement('hidden', 'cmid', $this->cmid); $mform->setType('cmid', PARAM_RAW); - $options = array(); + $options = []; if ($this->coursework->get_max_markers() > 1) { diff --git a/classes/framework/ability.php b/classes/framework/ability.php index 7712ca3a..de2bc22c 100644 --- a/classes/framework/ability.php +++ b/classes/framework/ability.php @@ -54,7 +54,7 @@ abstract class ability { /** * @var rule[] */ - protected $rules = array(); + protected $rules = []; /** * We use a different instance of the class for each user. This makes it a bit cleaner. @@ -158,7 +158,7 @@ protected function get_rule($action, $type) { * @return array */ protected function classname_mappings() { - return array(); + return = []; } /** diff --git a/classes/framework/table_base.php b/classes/framework/table_base.php index e104fffc..06b93d57 100644 --- a/classes/framework/table_base.php +++ b/classes/framework/table_base.php @@ -113,7 +113,7 @@ public static function find($db_record, $reload = true) { * @return array * @throws \coding_exception */ - public static function find_all($params = array()) { + public static function find_all($params = []) { if (!is_array($params)) { throw new \coding_exception('::all() require an array of parameters'); @@ -182,7 +182,7 @@ protected static function instantiate_objects($params) { global $DB; $raw_records = $DB->get_records(static::get_table_name(), $params); - $objects = array(); + $objects = []; $klass = get_called_class(); foreach ($raw_records as $raw_record) { $objects[$raw_record->id] = new $klass($raw_record); @@ -513,7 +513,7 @@ private function build_data_object_to_save($sneakily = false) { * @param array|table_base $conditions key value pairs of DB columns * @return bool */ - public static function exists($conditions = array()) { + public static function exists($conditions = []) { global $DB; if (is_number($conditions)) { @@ -533,7 +533,7 @@ public static function exists($conditions = array()) { * @param array $conditions * @return int */ - public static function count($conditions = array()) { + public static function count($conditions = []) { global $DB; foreach ($conditions as $colname => $value) { @@ -597,7 +597,7 @@ public function __toString() { * @return array */ public function to_array() { - $data = array(); + $data = []; // Only save the non-null fields. foreach (static::get_column_names() as $column_name) { diff --git a/classes/grading_report.php b/classes/grading_report.php index 4aa19275..b806f21b 100644 --- a/classes/grading_report.php +++ b/classes/grading_report.php @@ -351,7 +351,7 @@ public function get_table_rows_for_page($rowcount = false) { $participants = $this->coursework->get_allocatables(); // Make tablerow objects so we can use the methods to check permissions and set things. - $rows = array(); + $rows = []; $row_class = $this->coursework->has_multiple_markers() ? 'mod_coursework\grading_table_row_multi' : 'mod_coursework\grading_table_row_single'; $ability = new ability(user::find($USER, false), $this->get_coursework()); diff --git a/classes/models/coursework.php b/classes/models/coursework.php index 7e70851e..6712f23f 100644 --- a/classes/models/coursework.php +++ b/classes/models/coursework.php @@ -237,7 +237,7 @@ class coursework extends table_base { /** * @var array */ - protected $stages = array(); + protected $stages = []; /** * @var \context Instance of a moodle context, i.e. that of the coursemodule for this coursework. @@ -611,7 +611,7 @@ public function get_participants($groups = array(0)) { // Fetch the list of ids of all participants - this may get really long so fetch just id. $groups = (array)$groups; - $allusers = array(); + $allusers = []; foreach ($groups as $groupdid) { $allusers = array_merge($allusers, get_enrolled_users($this->get_context(), 'mod/coursework:submit', $groupdid, 'u.id')); } @@ -819,7 +819,7 @@ public function get_allocatable_identifier_hash($allocatable) { */ public function get_plagiarism_helpers() { $enabled_plagiarism_plugins = array_keys(\core_component::get_plugin_list('plagiarism')); - $objects = array(); + $objects = []; foreach ($enabled_plagiarism_plugins as $plugin_name) { $class_name = "\\mod_coursework\\plagiarism_helpers\\{$plugin_name}"; if (class_exists($class_name)) { @@ -950,7 +950,7 @@ public function pack_files() { if (!$submissions) { return false; } - $files_for_zipping = array(); + $files_for_zipping = []; $fs = get_file_storage(); $grading_sheet = new \mod_coursework\export\grading_sheet($this, null, null); @@ -1287,7 +1287,7 @@ public function get_all_submissions() { */ public function get_submissions_needing_grading() { - $needsgrading = array(); + $needsgrading = []; $submissions = $this->get_finalised_submissions(); foreach ($submissions as $submission) { @@ -1314,7 +1314,7 @@ public function get_submissions_needing_grading() { */ public function get_graded_submissions_by_stage($stage_identifier) { - $graded = array(); + $graded = []; $submissions = $this->get_finalised_submissions(); foreach ($submissions as $submission) { @@ -1336,7 +1336,7 @@ public function get_graded_submissions_by_stage($stage_identifier) { public function get_assessor_graded_submissions($assessorid) { global $DB; - $graded = array(); + $graded = []; $params = array('courseworkid' => $this->id, 'assessorid' => $assessorid); $sql = "SELECT cs.id FROM {coursework_feedbacks} cf @@ -1925,7 +1925,7 @@ public function due_to_send_second_reminders($deadline) { * @return user[] */ public function get_students() { - $users = array(); + $users = []; $raw_users = get_enrolled_users($this->get_context(), 'mod/coursework:submit'); // filter students who are restricted from the coursework @@ -1967,7 +1967,7 @@ public function get_students_who_have_not_yet_submitted() { * @return user[] */ public function initial_assessors($student) { - $assessors = array(); + $assessors = []; $stages = $this->get_assessor_marking_stages(); // If allocations, send the allocated teachers. // Otherwise send everyone. @@ -2194,7 +2194,7 @@ public function marking_stages() { * @return stage_base[] */ public function get_assessor_marking_stages() { - $stages = array(); + $stages = []; for ($i = 1; $i <= $this->get_max_markers(); $i++) { $stages[] = new assessor($this, 'assessor_' . $i); @@ -2258,7 +2258,7 @@ public final static function get_image($text, $image_name) { public function get_allocatables() { global $DB; - $allocatables = array(); + $allocatables = []; if ($this->is_configured_to_have_group_submissions()) { if ($this->grouping_id) { @@ -2474,7 +2474,7 @@ public function finalise_all() { public static function extension_reasons() { global $CFG; - $extension_reasons = array(); + $extension_reasons = []; if (!empty($CFG->coursework_extension_reasons_list)) { $extension_reasons = $CFG->coursework_extension_reasons_list; $extension_reasons = explode("\n", $extension_reasons); diff --git a/classes/models/group.php b/classes/models/group.php index 2a639a6d..418d8979 100644 --- a/classes/models/group.php +++ b/classes/models/group.php @@ -86,7 +86,7 @@ public function get_members($context, $cm) { $info = new \core_availability\info_module(\cm_info::create($cm)); $members = $info->filter_user_list($members); - $member_objects = array(); + $member_objects = []; foreach ($members as $member) { // check is member has capability to submit in this coursework (to get rid of assessors if they are placed in the group) if (has_capability('mod/coursework:submit', $context, $member)) { diff --git a/classes/models/null_user.php b/classes/models/null_user.php index f58a6c91..a60bc4c2 100644 --- a/classes/models/null_user.php +++ b/classes/models/null_user.php @@ -84,7 +84,7 @@ public function has_agreed_feedback($coursework) { * @return feedback[] */ public function get_initial_feedbacks($coursework) { - return array(); + return = []; } /** diff --git a/classes/models/outstanding_marking.php b/classes/models/outstanding_marking.php index eeed8442..e39ae6cf 100644 --- a/classes/models/outstanding_marking.php +++ b/classes/models/outstanding_marking.php @@ -40,7 +40,7 @@ public function get_to_grade_initial_count($cwkrecord, $userid) { $coursework = new \mod_coursework\models\coursework($cwkrecord); - $initialsubmissions = array(); + $initialsubmissions = []; if ($this->should_get_to_mark_initial_grade_info($coursework->id, $userid)) { @@ -69,7 +69,7 @@ public function get_to_grade_agreed_count($cwkrecord, $userid) { $coursework = new \mod_coursework\models\coursework($cwkrecord); - $agreedsubmissions = array(); + $agreedsubmissions = []; //AGREED GRADE INFORMATION @@ -94,7 +94,7 @@ private function get_single_marker_initial_grade_submissions_to_mark($coursework global $DB; - $sqlparams = array(); + $sqlparams = []; $sqltable = ""; $sqlextra = ""; @@ -156,7 +156,7 @@ private function get_multiple_to_mark_sampled_initial_grade_submissions($coursew GROUP BY a.allocatableid, a.csid, a.fid, a.id, a.count_feedback, a.courseworkid HAVING (count_feedback < $countsamples )"; - $sqlparams = array(); + $sqlparams = []; $sqlparams['subassessorid'] = $userid; $sqlparams['subcourseworkid'] = $courseworkid; $sqlparams['courseworkid'] = $courseworkid; @@ -175,7 +175,7 @@ private function get_multiple_to_mark_initial_grade_submissions($courseworkid, $ global $DB; - $sqlparams = array(); + $sqlparams = []; $sqltable = ''; $sqlextra = ''; diff --git a/classes/models/submission.php b/classes/models/submission.php index de410876..11599e52 100644 --- a/classes/models/submission.php +++ b/classes/models/submission.php @@ -384,7 +384,7 @@ public function get_submission_files($reset = false) { } if ($this->id < 1 || $this->get_context_id() < 1) { - return new submission_files(array(), $this); + return new submission_files([], $this); } $submission_files = $this->get_files(); @@ -395,7 +395,7 @@ public function get_submission_files($reset = false) { return $this->submission_files; } - $files = new submission_files(array(), $this); + $files = new submission_files([], $this); return $files; } @@ -461,7 +461,7 @@ public function get_first_feedback() { public function get_assessor_feedbacks() { if (!$this->id) { // No submission - empty placeholder. - return array(); + return = []; } if (!isset(feedback::$pool[$this->courseworkid]['submissionid-stage_identifier_index'])) { @@ -519,7 +519,7 @@ public function get_agreed_grade() { if (!$this->id) { // No submission - empty placeholder. - return array(); + return = []; } $params = [ @@ -938,7 +938,7 @@ public function get_allocatable() { * @return user[] */ public function get_students() { - $allocatables = array(); + $allocatables = []; if ($this->get_coursework()->is_configured_to_have_group_submissions() && $this->allocatabletype == 'group') { /** * @var group $group diff --git a/classes/personal_deadline/table/builder.php b/classes/personal_deadline/table/builder.php index 8e783c2a..ec6d52e2 100644 --- a/classes/personal_deadline/table/builder.php +++ b/classes/personal_deadline/table/builder.php @@ -71,7 +71,7 @@ public function __construct($coursework, array $options) { public function get_rows() { $allocatables = $this->get_coursework()->get_allocatables(); - $rows = array(); + $rows = []; foreach ($allocatables as $allocatable) { $rows[] = new row_builder($this, $allocatable); } diff --git a/classes/render_helpers/grading_report/cells/_user_cell.php b/classes/render_helpers/grading_report/cells/_user_cell.php index a87135ed..015e3f2e 100644 --- a/classes/render_helpers/grading_report/cells/_user_cell.php +++ b/classes/render_helpers/grading_report/cells/_user_cell.php @@ -67,7 +67,7 @@ public function get_table_cell($rowobject) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { $viewanonymous = has_capability('mod/coursework:viewanonymous', $this->coursework->get_context()); diff --git a/classes/render_helpers/grading_report/cells/cell_base.php b/classes/render_helpers/grading_report/cells/cell_base.php index 7fb04a8b..7b031e7e 100644 --- a/classes/render_helpers/grading_report/cells/cell_base.php +++ b/classes/render_helpers/grading_report/cells/cell_base.php @@ -39,7 +39,7 @@ abstract class cell_base implements cell_interface { /** * @param array $items */ - public function __construct($items = array()) { + public function __construct($items = []) { $this->coursework = $items['coursework']; $this->after_initialisation($items); } diff --git a/classes/render_helpers/grading_report/cells/cell_interface.php b/classes/render_helpers/grading_report/cells/cell_interface.php index 234589ec..0dd5bb2d 100644 --- a/classes/render_helpers/grading_report/cells/cell_interface.php +++ b/classes/render_helpers/grading_report/cells/cell_interface.php @@ -41,7 +41,7 @@ public function get_table_cell($rowobject); * @param array $options * @return string */ - public function get_table_header($options = array()); + public function get_table_header($options = []); /** * @return string diff --git a/classes/render_helpers/grading_report/cells/email_cell.php b/classes/render_helpers/grading_report/cells/email_cell.php index 34b68aab..2615fceb 100644 --- a/classes/render_helpers/grading_report/cells/email_cell.php +++ b/classes/render_helpers/grading_report/cells/email_cell.php @@ -50,7 +50,7 @@ public function get_table_cell($rowobject) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { return "Email"; } diff --git a/classes/render_helpers/grading_report/cells/first_name_cell.php b/classes/render_helpers/grading_report/cells/first_name_cell.php index 68c41318..3528de99 100644 --- a/classes/render_helpers/grading_report/cells/first_name_cell.php +++ b/classes/render_helpers/grading_report/cells/first_name_cell.php @@ -50,7 +50,7 @@ public function get_table_cell($rowobject) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { return "First Name"; } diff --git a/classes/render_helpers/grading_report/cells/first_name_letter_cell.php b/classes/render_helpers/grading_report/cells/first_name_letter_cell.php index 2403f4ad..b6145057 100644 --- a/classes/render_helpers/grading_report/cells/first_name_letter_cell.php +++ b/classes/render_helpers/grading_report/cells/first_name_letter_cell.php @@ -58,7 +58,7 @@ public function get_table_cell($rowobject) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { return "First Letter - First Name"; } diff --git a/classes/render_helpers/grading_report/cells/grade_for_gradebook_cell.php b/classes/render_helpers/grading_report/cells/grade_for_gradebook_cell.php index 25088b0a..d11947e2 100644 --- a/classes/render_helpers/grading_report/cells/grade_for_gradebook_cell.php +++ b/classes/render_helpers/grading_report/cells/grade_for_gradebook_cell.php @@ -55,7 +55,7 @@ public function get_table_cell($row_object) { * @throws coding_exception * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { return get_string('provisionalgrade', 'mod_coursework'); } diff --git a/classes/render_helpers/grading_report/cells/group_cell.php b/classes/render_helpers/grading_report/cells/group_cell.php index c9ae602b..4a0bfd52 100644 --- a/classes/render_helpers/grading_report/cells/group_cell.php +++ b/classes/render_helpers/grading_report/cells/group_cell.php @@ -70,7 +70,7 @@ public function get_table_cell($row_object) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { //adding this line so that the sortable heading function will make a sortable link unique to the table // If tablename is set diff --git a/classes/render_helpers/grading_report/cells/idnumber_cell.php b/classes/render_helpers/grading_report/cells/idnumber_cell.php index 593d2d66..7043b205 100644 --- a/classes/render_helpers/grading_report/cells/idnumber_cell.php +++ b/classes/render_helpers/grading_report/cells/idnumber_cell.php @@ -47,7 +47,7 @@ public function get_table_cell($rowobject) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { $viewanonymous = has_capability('mod/coursework:viewanonymous', $this->coursework->get_context()); diff --git a/classes/render_helpers/grading_report/cells/last_name_cell.php b/classes/render_helpers/grading_report/cells/last_name_cell.php index 0b498948..d423ab55 100644 --- a/classes/render_helpers/grading_report/cells/last_name_cell.php +++ b/classes/render_helpers/grading_report/cells/last_name_cell.php @@ -50,7 +50,7 @@ public function get_table_cell($rowobject) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { return "Last Name"; } diff --git a/classes/render_helpers/grading_report/cells/last_name_letter_cell.php b/classes/render_helpers/grading_report/cells/last_name_letter_cell.php index 392d79f3..f0e59a40 100644 --- a/classes/render_helpers/grading_report/cells/last_name_letter_cell.php +++ b/classes/render_helpers/grading_report/cells/last_name_letter_cell.php @@ -58,7 +58,7 @@ public function get_table_cell($rowobject) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { return "Last Name Letter"; } diff --git a/classes/render_helpers/grading_report/cells/moderation_agreement_cell.php b/classes/render_helpers/grading_report/cells/moderation_agreement_cell.php index b87398e4..a7d65c7d 100644 --- a/classes/render_helpers/grading_report/cells/moderation_agreement_cell.php +++ b/classes/render_helpers/grading_report/cells/moderation_agreement_cell.php @@ -125,7 +125,7 @@ public function get_table_cell($rowobject) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { return get_string('tableheadmoderationagreement', 'coursework'); } diff --git a/classes/render_helpers/grading_report/cells/moderation_cell.php b/classes/render_helpers/grading_report/cells/moderation_cell.php index eafb4f70..43182223 100644 --- a/classes/render_helpers/grading_report/cells/moderation_cell.php +++ b/classes/render_helpers/grading_report/cells/moderation_cell.php @@ -83,7 +83,7 @@ public function get_table_cell($row_object) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { //adding this line so that the sortable heading function will make a sortable link unique to the table // If tablename is set diff --git a/classes/render_helpers/grading_report/cells/multiple_agreed_grade_cell.php b/classes/render_helpers/grading_report/cells/multiple_agreed_grade_cell.php index b5e50755..3a3d1a2f 100644 --- a/classes/render_helpers/grading_report/cells/multiple_agreed_grade_cell.php +++ b/classes/render_helpers/grading_report/cells/multiple_agreed_grade_cell.php @@ -165,7 +165,7 @@ public function get_content($rowobject) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { //adding this line so that the sortable heading function will make a sortable link unique to the table // If tablename is set diff --git a/classes/render_helpers/grading_report/cells/personal_deadline_cell.php b/classes/render_helpers/grading_report/cells/personal_deadline_cell.php index d56675ff..c4f42b85 100644 --- a/classes/render_helpers/grading_report/cells/personal_deadline_cell.php +++ b/classes/render_helpers/grading_report/cells/personal_deadline_cell.php @@ -81,7 +81,7 @@ public function get_table_cell($row_object) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { $tablename = (!empty($options['tablename'])) ? $options['tablename'] : '' ; diff --git a/classes/render_helpers/grading_report/cells/plagiarism_cell.php b/classes/render_helpers/grading_report/cells/plagiarism_cell.php index 0a13d675..c5040102 100644 --- a/classes/render_helpers/grading_report/cells/plagiarism_cell.php +++ b/classes/render_helpers/grading_report/cells/plagiarism_cell.php @@ -61,7 +61,7 @@ public function get_table_cell($rowobject) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { return get_string('plagiarism', 'mod_coursework'); } diff --git a/classes/render_helpers/grading_report/cells/plagiarism_flag_cell.php b/classes/render_helpers/grading_report/cells/plagiarism_flag_cell.php index 33312b45..170629cf 100644 --- a/classes/render_helpers/grading_report/cells/plagiarism_flag_cell.php +++ b/classes/render_helpers/grading_report/cells/plagiarism_flag_cell.php @@ -82,7 +82,7 @@ public function get_table_cell($rowobject) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { return (get_string('tableheadplagiarismalert', 'coursework')); } diff --git a/classes/render_helpers/grading_report/cells/single_assessor_feedback_cell.php b/classes/render_helpers/grading_report/cells/single_assessor_feedback_cell.php index 79c88627..13b0845d 100644 --- a/classes/render_helpers/grading_report/cells/single_assessor_feedback_cell.php +++ b/classes/render_helpers/grading_report/cells/single_assessor_feedback_cell.php @@ -140,7 +140,7 @@ public function get_content($rowobject) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { return get_string('feedbackandgrading', 'coursework'); } diff --git a/classes/render_helpers/grading_report/cells/status_cell.php b/classes/render_helpers/grading_report/cells/status_cell.php index 898d6941..348ed3e2 100644 --- a/classes/render_helpers/grading_report/cells/status_cell.php +++ b/classes/render_helpers/grading_report/cells/status_cell.php @@ -47,7 +47,7 @@ public function get_table_cell($rowobject) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { return get_string('tableheadstatus', 'coursework'); } diff --git a/classes/render_helpers/grading_report/cells/submission_cell.php b/classes/render_helpers/grading_report/cells/submission_cell.php index 7c467bbb..27589956 100644 --- a/classes/render_helpers/grading_report/cells/submission_cell.php +++ b/classes/render_helpers/grading_report/cells/submission_cell.php @@ -132,7 +132,7 @@ public function get_table_cell($rowobject) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { $tablename = (isset($options['tablename'])) ? $options['tablename'] : '' ; diff --git a/classes/render_helpers/grading_report/cells/time_submitted_cell.php b/classes/render_helpers/grading_report/cells/time_submitted_cell.php index 158559d2..0a071889 100644 --- a/classes/render_helpers/grading_report/cells/time_submitted_cell.php +++ b/classes/render_helpers/grading_report/cells/time_submitted_cell.php @@ -195,7 +195,7 @@ private function standardize_time_for_compare($time) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { //adding this line so that the sortable heading function will make a sortable link unique to the table // If tablename is set diff --git a/classes/render_helpers/grading_report/cells/user_cell.php b/classes/render_helpers/grading_report/cells/user_cell.php index b9b0d95b..a99ad0b5 100644 --- a/classes/render_helpers/grading_report/cells/user_cell.php +++ b/classes/render_helpers/grading_report/cells/user_cell.php @@ -74,7 +74,7 @@ public function get_table_cell($rowobject) { * @param array $options * @return string */ - public function get_table_header($options = array()) { + public function get_table_header($options = []) { $viewanonymous = has_capability('mod/coursework:viewanonymous', $this->coursework->get_context()); diff --git a/classes/router.php b/classes/router.php index 4989ad0a..8077e876 100644 --- a/classes/router.php +++ b/classes/router.php @@ -68,7 +68,7 @@ public static function instance() { * @throws \coding_exception * @return moodle_url|string url */ - public function get_path($path_name, $items = array(), $as_url_object = false, $escaped = true) { + public function get_path($path_name, $items = [], $as_url_object = false, $escaped = true) { global $CFG; @@ -263,7 +263,7 @@ public function get_path($path_name, $items = array(), $as_url_object = false, $ $auto_path = '/mod/coursework/actions/' . $this->pluralise($type) . '/' . $action . '.php'; if (file_exists($CFG->dirroot . $auto_path)) { - $params = array(); + $params = []; if (array_key_exists($type, $items)) { $params[$type.'id'] = $items[$type]->id; } else if (array_key_exists('coursework', $items)) { diff --git a/classes/sample_set_rule/range_sample_type.php b/classes/sample_set_rule/range_sample_type.php index 63e9a3ea..d841c1de 100644 --- a/classes/sample_set_rule/range_sample_type.php +++ b/classes/sample_set_rule/range_sample_type.php @@ -86,13 +86,13 @@ public function add_form_elements($assessor_number=0) { public function range_elements($assessor_number, $sequence, $dbrecord=false) { - $percentage_options = array(); + $percentage_options = []; for ($i = 0;$i < 110; $i = $i + 10) { $percentage_options[$i] = "{$i}"; } - $scale = array(); + $scale = []; if ($this->coursework->grade > 0) { for ($i = 0;$i <= $this->coursework->grade; $i++) { @@ -284,7 +284,7 @@ function change_options(element) { $(samplefromid).find('option').remove(); $(sampletoid).find('option').remove(); - var selectValues = Array(); + var selectValues = []; var type = PERCENT; @@ -399,7 +399,7 @@ private function rationalise($ruletype, $limit1, $limit2) { global $DB; - $limits = array(); + $limits = []; $limits[0] = ($limit1>$limit2) ? $limit2 : $limit1; $limits[1] = ($limit1>$limit2) ? $limit1 : $limit2; diff --git a/classes/sample_set_rule/total_sample_type.php b/classes/sample_set_rule/total_sample_type.php index 726acf8c..aee8e44f 100644 --- a/classes/sample_set_rule/total_sample_type.php +++ b/classes/sample_set_rule/total_sample_type.php @@ -64,7 +64,7 @@ public function add_form_elements($assessor_number=0) { $selected = ($record = $DB->get_record_sql($sql)) ? array($record->upperlimit => $record->upperlimit) : false; $checked = ($selected) ? true : false; - $percentage_options = array(); + $percentage_options = []; for ($i = 5;$i <= 100; $i = $i + 5) { $percentage_options[$i] = "{$i}"; @@ -232,7 +232,7 @@ public function adjust_sample_set($stage_number, &$allocatables, &$manual_sample } } else { - $auto_sample_set = array(); + $auto_sample_set = []; } } diff --git a/classes/sampling_set_widget.php b/classes/sampling_set_widget.php index a31c2947..f1d7bbc2 100644 --- a/classes/sampling_set_widget.php +++ b/classes/sampling_set_widget.php @@ -91,7 +91,7 @@ public function get_potential_rules() { $classes = $this->get_potential_rule_class_names(); - $suffixes = array(); + $suffixes = []; foreach ($classes as $shortname => $classname) { $label = get_string($shortname, 'mod_coursework'); @@ -114,10 +114,10 @@ public function get_potential_rule_class_names() { $dirname = $CFG->dirroot.'/mod/coursework/classes/sample_set_rule/*.php'; $files = glob($dirname); - $classes = array(); + $classes = []; foreach ($files as $file) { - $matches = array(); // In case we have stuff left over. + $matches = []; // In case we have stuff left over. preg_match('/([^\/]+)\.php/', $file, $matches); /* @var models\moderation_set_rule $fullclassname */ $rulename = $matches[1]; diff --git a/classes/stages/base.php b/classes/stages/base.php index 1ca1a8aa..1a701e6c 100644 --- a/classes/stages/base.php +++ b/classes/stages/base.php @@ -300,7 +300,7 @@ public function get_teachers() { // So check again if (empty($serialised_teachers) || empty(unserialize($serialised_teachers))) { $teachers = get_enrolled_users($this->coursework->get_context(), $this->assessor_capability()); - $teacher_users = array(); + $teacher_users = []; foreach ($teachers as $teacher) { $teacher_users[] = user::build($teacher); } @@ -832,7 +832,7 @@ public function potential_moderator_dropdown($allocatable) { */ private function potential_markers_as_options_array() { $potentialmarkers = $this->get_teachers(); - $options = array(); + $options = []; foreach ($potentialmarkers as $marker) { $options[$marker->id] = $marker->name(); } @@ -845,7 +845,7 @@ private function potential_markers_as_options_array() { */ private function potential_moderators_as_options_array() { $potentialmoderators = get_enrolled_users($this->coursework->get_course_context(), 'mod/coursework:moderate'); - $options = array(); + $options = []; foreach ($potentialmoderators as $moderator) { $options[$moderator->id] = fullname($moderator); } diff --git a/db/upgrade.php b/db/upgrade.php index e98d9915..9f7f3b84 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -103,7 +103,7 @@ function xmldb_coursework_upgrade($oldversion) { // Alter the comments and write them to the DB. foreach ($olddata as $datarow) { $oldcomment = unserialize($datarow->feedbackcomment); - $newcomment = array(); + $newcomment = []; if ($oldcomment) { // Some were blank - probably an earlier experiment. foreach ($oldcomment as $componentarray) { $newcomment[] = $componentarray['id']; @@ -126,7 +126,7 @@ function xmldb_coursework_upgrade($oldversion) { // Will have to subtract component values from the string one at a time, recording their // ids if we find the value. foreach ($olddata as $datarow) { - $newcomment = array(); + $newcomment = []; $oldcomment = $datarow->feedbackcomment; // Comma separated, with lots of extra commas. $components = $DB->get_records('coursework_form_component', array('fieldid' => $datarow->fieldid)); @@ -2043,7 +2043,7 @@ function xmldb_coursework_upgrade($oldversion) { 'coursework_sample_set_mbrs'); if ($oldversion < 2015110303) { - $fields = array(); + $fields = []; //Add fields to assist backup annotation $fielduser = new xmldb_field('allocatableuser', XMLDB_TYPE_INTEGER, '10', true, XMLDB_NOTNULL, null, '0', 'allocatabletype'); $fieldgroup = new xmldb_field('allocatablegroup', XMLDB_TYPE_INTEGER, '10', true, XMLDB_NOTNULL, null, '0', 'allocatableuser'); @@ -2066,7 +2066,7 @@ function xmldb_coursework_upgrade($oldversion) { } if ($oldversion < 2015121401) { - $fields = array(); + $fields = []; //Add fields to assist backup annotation $fieldeditingtime = new xmldb_field('gradeeditingtime', XMLDB_TYPE_INTEGER, '10', true, XMLDB_NOTNULL, null, '0', null); @@ -2096,7 +2096,7 @@ function xmldb_coursework_upgrade($oldversion) { } if ($oldversion < 2016110100) { - $fields = array(); + $fields = []; //Add fields to hold marking deadline enabled $upgradefield = new xmldb_field('markingdeadlineenabled', XMLDB_TYPE_INTEGER, '1', true, XMLDB_NOTNULL, null, '0', null); @@ -2112,7 +2112,7 @@ function xmldb_coursework_upgrade($oldversion) { } if ($oldversion < 2016110101) { - $fields = array(); + $fields = []; //Add fields to hold intial marking deadline $upgradefield = new xmldb_field('initialmarkingdeadline', XMLDB_TYPE_INTEGER, '10', true, XMLDB_NOTNULL, null, '0', null); @@ -2139,7 +2139,7 @@ function xmldb_coursework_upgrade($oldversion) { } if ($oldversion < 2016110102) { - $fields = array(); + $fields = []; //Add fields to hold intial marking deadline $upgradefield = new xmldb_field('markingreminderenabled', XMLDB_TYPE_INTEGER, '1', true, XMLDB_NOTNULL, null, '0', null); diff --git a/lib.php b/lib.php index 693c2907..61a948c6 100644 --- a/lib.php +++ b/lib.php @@ -49,7 +49,7 @@ * @return array */ function coursework_get_file_areas($course, $cm, $context) { - $areas = array(); + $areas = []; if (has_capability('mod/coursework:submit', $context)) { $areas['submission'] = get_string('submissionfiles', 'coursework'); @@ -949,7 +949,7 @@ function coursework_get_coursework_ids_from_context_id($contextid) { global $DB; - $courseworkids = array(); + $courseworkids = []; // Is this a coursework? $context = context::instance_by_id($contextid); @@ -999,7 +999,7 @@ function coursework_seconds_to_string($seconds) { get_string('seconds', 'mod_coursework')) ); - $result = array(); + $result = []; foreach ($units as $divisor => $unitame) { $units = intval($seconds / $divisor); if ($units) { @@ -1112,7 +1112,7 @@ function coursework_send_deadline_changed_emails($eventdata) { // - Link to get to the view.php page. // - Change since last time. - $deadlinechangedmessage = array(); + $deadlinechangedmessage = []; $strings = new stdClass(); $strings->courseworkname = $coursework->name; @@ -1170,7 +1170,7 @@ function coursework_plugin_exists($plugintype, $pluginname) { */ function coursework_records_to_menu($records, $field1, $field2) { - $menu = array(); + $menu = []; if (!empty($records)) { foreach ($records as $record) { diff --git a/mod_form.php b/mod_form.php index 8e184b0d..1cd06c71 100644 --- a/mod_form.php +++ b/mod_form.php @@ -54,7 +54,7 @@ public function definition() { 'ajax' )); - $PAGE->requires->js_init_call('M.mod_coursework.init', array(), true, $module); + $PAGE->requires->js_init_call('M.mod_coursework.init', [], true, $module); $this->set_form_attributes(); @@ -189,7 +189,7 @@ public function set_data($default_values) { */ public function validation($data, $files) { - $errors = array(); + $errors = []; if ($data['startdate'] != 0 && !empty($data['deadline']) && $data['startdate'] > $data['deadline']) { $errors['startdate'] = get_string('must_be_before_dealdine', 'mod_coursework'); @@ -368,7 +368,7 @@ protected function add_personal_deadline_field() { $options = array(0 => get_string('no'), 1 => get_string('yes')); $courseworkid = $this->get_coursework_id(); - $disabled = array(); + $disabled = []; if (coursework_personal_deadline_passed($courseworkid)) { $moodle_form->disabledif('personaldeadlineenabled', 'deadline[enabled]', 'notchecked'); $disabled = array('disabled' => true); @@ -656,7 +656,7 @@ protected function add_grouping_field() { $moodle_form =& $this->_form; $groups_options_result = $DB->get_records('groupings', array('courseid' => $COURSE->id), 'name', 'id, name'); - $groups_options = array(); + $groups_options = []; if ($groups_options_result !== false) { foreach ($groups_options_result as $result) { $groups_options[$result->id] = $result->name; @@ -892,7 +892,7 @@ protected function add_assessor_allocation_strategy_field_rdb() { $options = mod_coursework\allocation\manager::get_allocation_classnames(); - $radioarray = array(); + $radioarray = []; $keys = array_keys($options); foreach ($keys as $key) { @@ -1277,7 +1277,7 @@ private function add_submission_notification_field() { $moodle_form =& $this->_form; - $selectableusers = array(); + $selectableusers = []; // capability for user allowed to receive submission notifications $enrolledusers = get_enrolled_users(context_course::instance($COURSE->id), 'mod/coursework:receivesubmissionnotifications'); diff --git a/renderers/grading_report_renderer.php b/renderers/grading_report_renderer.php index bc731ec0..517b3f43 100644 --- a/renderers/grading_report_renderer.php +++ b/renderers/grading_report_renderer.php @@ -193,7 +193,7 @@ protected function make_table_headers($cell_helpers, $options, $is_multiple_mark /** * @return string */ - protected function start_table($options = array()) { + protected function start_table($options = []) { $options['width'] = '100%'; $options['class'] = (!empty($options['class'])) ? $options['class'] : ''; $options['class'] .= ' submissions datatabletest display compact'; @@ -264,7 +264,7 @@ private function make_upper_headers($cell_helpers, $is_multiple_markers) { * @return mixed */ private function upper_header_names_and_colspans($cell_helpers) { - $headers = array(); + $headers = []; foreach ($cell_helpers as $helper) { if (!array_key_exists($helper->header_group(), $headers)) { diff --git a/renderers/object_renderer.php b/renderers/object_renderer.php index 80e6cf04..b74a2592 100644 --- a/renderers/object_renderer.php +++ b/renderers/object_renderer.php @@ -375,7 +375,7 @@ protected function render_mod_coursework_assessor_feedback_row(mod_coursework_as public function render_submission_files(mod_coursework_submission_files $files) { $submission_files = $files->get_files(); - $files_array = array(); + $files_array = []; foreach ($submission_files as $file) { $files_array[] = $this->make_file_link($files, $file); @@ -394,7 +394,7 @@ public function render_submission_files(mod_coursework_submission_files $files) public function render_feedback_files(mod_coursework_feedback_files $files) { - $files_array = array(); + $files_array = []; $submission_files = $files->get_files(); foreach ($submission_files as $file) { $files_array[] = $this->make_file_link($files, $file, 'feedbackfile'); @@ -422,7 +422,7 @@ public function render_submission_files_with_plagiarism_links(mod_coursework_sub $coursework = $files->get_coursework(); $submission_files = $files->get_files(); $submission = $files->get_submission(); - $files_array = array(); + $files_array = []; foreach ($submission_files as $file) { @@ -461,7 +461,7 @@ public function render_plagiarism_links($files) { $coursework = $files->get_coursework(); $submission_files = $files->get_files(); $submission = $files->get_submission(); - $files_array = array(); + $files_array = []; foreach ($submission_files as $file) { @@ -772,7 +772,7 @@ public function render_mod_coursework_sampling_set_widget(mod_coursework_samplin $html .= html_writer::start_tag('div', array('class' => 'sampling-select')); $script = " - var samplingValidateHdl = Array(); + var samplingValidateHdl = []; "; $html .= html_writer::script($script); @@ -781,7 +781,7 @@ public function render_mod_coursework_sampling_set_widget(mod_coursework_samplin $table->attributes['class'] = 'sampling'; $table->head = array(''); - $assessorheaders = array(); + $assessorheaders = []; for ($i = 0; $i < $samplingwidget->get_coursework()->get_max_markers(); $i++) { $assessorheaders[] = get_string('assessorheading', 'mod_coursework', $i+1); @@ -812,7 +812,7 @@ public function render_mod_coursework_sampling_set_widget(mod_coursework_samplin $columndata = array(new html_table_cell($assessor1cell)); - $percentage_options = array(); + $percentage_options = []; for ($i = 0;$i < 110; $i = $i + 10) { $percentage_options[$i] = "{$i}%"; @@ -881,7 +881,7 @@ public function render_mod_coursework_sampling_set_widget(mod_coursework_samplin $('#save_manual_sampling').on('click', function (e) { - validationresults = Array(); + validationresults = []; $.each(samplingValidateHdl, function(i,functionname) { validationresults.push(eval(functionname+'()')); @@ -905,14 +905,14 @@ public function render_mod_coursework_sampling_set_widget(mod_coursework_samplin private function sampling_strategy_column($samplingwidget, $suffix = '') { - $percentage_options = array(); + $percentage_options = []; for ($i = 0;$i < 110; $i = $i + 10) { $percentage_options[$i] = "{$i}%"; } // Hidden input containing scale values - $scale = array(); + $scale = []; $sampling_column = ""; $sampling_column .= html_writer::tag('br', ''); @@ -1141,7 +1141,7 @@ protected function resubmit_to_plagiarism_button($coursework, $submission) { array('type' => 'hidden', 'name' => 'id', 'value' => $coursework->get_coursemodule_id())); - $plagiarism_plugin_names = array(); + $plagiarism_plugin_names = []; foreach ($coursework->get_plagiarism_helpers() as $helper) { $plagiarism_plugin_names[] = $helper->human_readable_name(); } @@ -1382,7 +1382,7 @@ protected function render_mod_coursework_personal_deadlines_table(mod_coursework $table_html .= '