From a4a6ed53565af4213242833470226c15d3b0cc94 Mon Sep 17 00:00:00 2001 From: Stefan Hanauska Date: Thu, 25 Jan 2024 07:38:10 +0100 Subject: [PATCH] Coding style --- .../backup_kanban_activity_task.class.php | 1 - backup/moodle2/backup_kanban_stepslib.php | 7 ++-- .../restore_kanban_activity_task.class.php | 1 - backup/moodle2/restore_kanban_stepslib.php | 1 - classes/boardmanager.php | 18 +++++----- classes/completion/custom_completion.php | 6 ++-- classes/external/change_kanban_content.php | 34 +++++++++---------- classes/external/get_kanban_content.php | 11 +++--- classes/form/edit_card_form.php | 1 - classes/helper.php | 4 +-- classes/privacy/provider.php | 27 +++++++-------- classes/task/reminder.php | 5 ++- lib.php | 1 - settings.php | 24 ++++++------- tests/generator/lib.php | 1 - view.php | 2 +- 16 files changed, 68 insertions(+), 76 deletions(-) diff --git a/backup/moodle2/backup_kanban_activity_task.class.php b/backup/moodle2/backup_kanban_activity_task.class.php index d906b737..be680156 100644 --- a/backup/moodle2/backup_kanban_activity_task.class.php +++ b/backup/moodle2/backup_kanban_activity_task.class.php @@ -27,7 +27,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class backup_kanban_activity_task extends backup_activity_task { - /** * No specific settings for this activity */ diff --git a/backup/moodle2/backup_kanban_stepslib.php b/backup/moodle2/backup_kanban_stepslib.php index f2ebe7b6..9cde3566 100644 --- a/backup/moodle2/backup_kanban_stepslib.php +++ b/backup/moodle2/backup_kanban_stepslib.php @@ -140,13 +140,14 @@ protected function define_structure(): backup_nested_element { $historyitem->annotate_ids('kanban_card_id', 'kanban_card'); $historyitem->annotate_ids('kanban_column_id', 'kanban_column'); $historyitem->annotate_ids('kanban_board_id', 'kanban_board'); - } else { - $board->set_source_sql(' + $board->set_source_sql( + ' SELECT * FROM {kanban_board} WHERE kanban_instance = ? AND userid = 0 AND groupid = 0 AND template = 1', - [backup::VAR_PARENTID]); + [backup::VAR_PARENTID] + ); } $column->set_source_table('kanban_column', ['kanban_board' => backup::VAR_PARENTID]); $card->set_source_table('kanban_card', ['kanban_column' => backup::VAR_PARENTID]); diff --git a/backup/moodle2/restore_kanban_activity_task.class.php b/backup/moodle2/restore_kanban_activity_task.class.php index eb15358e..133f1592 100644 --- a/backup/moodle2/restore_kanban_activity_task.class.php +++ b/backup/moodle2/restore_kanban_activity_task.class.php @@ -27,7 +27,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class restore_kanban_activity_task extends restore_activity_task { - /** * No specific settings for this activity * diff --git a/backup/moodle2/restore_kanban_stepslib.php b/backup/moodle2/restore_kanban_stepslib.php index 55ac8fa7..382cd594 100644 --- a/backup/moodle2/restore_kanban_stepslib.php +++ b/backup/moodle2/restore_kanban_stepslib.php @@ -23,7 +23,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class restore_kanban_activity_structure_step extends restore_activity_structure_step { - /** * List of elements that can be restored * diff --git a/classes/boardmanager.php b/classes/boardmanager.php index ed9951e2..c61c98a0 100644 --- a/classes/boardmanager.php +++ b/classes/boardmanager.php @@ -66,7 +66,7 @@ class boardmanager { public function __construct(int $cmid = 0, int $boardid = 0) { $this->cmid = $cmid; if ($cmid) { - list($this->course, $this->cminfo) = get_course_and_cm_from_cmid($cmid); + [$this->course, $this->cminfo] = get_course_and_cm_from_cmid($cmid); $this->load_instance($this->cminfo->instance); } $this->formatter = new updateformatter(); @@ -86,7 +86,7 @@ public function load_instance(int $instance, bool $dontloadcm = false): void { global $DB; $this->kanban = $DB->get_record('kanban', ['id' => $instance], '*', MUST_EXIST); if (!$dontloadcm) { - list ($this->course, $this->cminfo) = get_course_and_cm_from_instance($this->kanban->id, 'kanban'); + [$this->course, $this->cminfo] = get_course_and_cm_from_instance($this->kanban->id, 'kanban'); $this->cmid = $this->cminfo->id; } } @@ -476,7 +476,8 @@ public function add_card(int $columnid, int $aftercard = 0, array $data = []): i $DB->update_record('kanban_column', $update); // Users can always edit cards they created. - $data['canedit'] = $this->can_user_manage_specific_card($data['id']);; + $data['canedit'] = $this->can_user_manage_specific_card($data['id']); + ; $data['columnname'] = clean_param($column->title, PARAM_TEXT); $this->formatter->put('cards', $data); @@ -853,7 +854,7 @@ public function update_card(int $cardid, array $data): void { helper::add_or_update_calendar_event($this->kanban, (object) $carddata, $assignees); if (!empty($todelete)) { helper::remove_calendar_event($this->kanban, (object) $carddata, $todelete); - list($sql, $params) = $DB->get_in_or_equal($todelete, SQL_PARAMS_NAMED); + [$sql, $params] = $DB->get_in_or_equal($todelete, SQL_PARAMS_NAMED); $sql = 'kanban_card = :cardid AND userid ' . $sql; $params['cardid'] = $cardid; $DB->delete_records_select('kanban_assignee', $sql, $params); @@ -882,8 +883,7 @@ public function update_card(int $cardid, array $data): void { 'id' => $user->id, 'fullname' => fullname($user), 'userpicture' => $OUTPUT->user_picture($user, ['link' => false]), - ] - ); + ]); } $DB->insert_records('kanban_assignee', $assignees); helper::send_notification( @@ -1221,8 +1221,10 @@ public function can_user_manage_specific_card(int $cardid, int $userid = 0): boo return true; } - if (has_capability('mod/kanban:manageassignedcards', $context, $userid) && - in_array($userid, $this->get_card_assignees($card->id))) { + if ( + has_capability('mod/kanban:manageassignedcards', $context, $userid) && + in_array($userid, $this->get_card_assignees($card->id)) + ) { return true; } diff --git a/classes/completion/custom_completion.php b/classes/completion/custom_completion.php index dca895bc..2d70403a 100644 --- a/classes/completion/custom_completion.php +++ b/classes/completion/custom_completion.php @@ -40,7 +40,8 @@ public function get_state(string $rule): int { if ($rule == 'completioncreate') { if ($kanban->completioncreate > 0) { - $count = $DB->get_field_sql(' + $count = $DB->get_field_sql( + ' SELECT COUNT(DISTINCT c.id) FROM {kanban_board} b INNER JOIN {kanban_card} c ON b.kanban_instance = :kanbanid AND c.kanban_board = b.id @@ -52,7 +53,8 @@ public function get_state(string $rule): int { } if ($rule == 'completioncomplete') { if ($kanban->completioncomplete > 0) { - $count = $DB->get_field_sql(' + $count = $DB->get_field_sql( + ' SELECT COUNT(DISTINCT c.id) FROM {kanban_board} b INNER JOIN {kanban_card} c ON b.kanban_instance = :kanbanid AND c.kanban_board = b.id AND c.completed != 0 diff --git a/classes/external/change_kanban_content.php b/classes/external/change_kanban_content.php index f1847950..1e9696bf 100644 --- a/classes/external/change_kanban_content.php +++ b/classes/external/change_kanban_content.php @@ -50,7 +50,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class change_kanban_content extends external_api { - /** * Returns description of method parameters for the add_column function. * @@ -108,7 +107,7 @@ public static function add_column(int $cmid, int $boardid, array $data): array { $data['title'] = clean_param($params['data']['title'], PARAM_TEXT); } $aftercol = $params['data']['aftercol']; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); require_capability('mod/kanban:managecolumns', $context); @@ -181,7 +180,7 @@ public static function add_card(int $cmid, int $boardid, array $data): array { $data['title'] = clean_param($params['data']['title'], PARAM_TEXT); } $aftercard = $params['data']['aftercard']; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); require_capability('mod/kanban:addcard', $context); @@ -244,7 +243,7 @@ public static function move_column(int $cmid, int $boardid, array $data): array $boardid = $params['boardid']; $aftercol = $params['data']['aftercol']; $columnid = $params['data']['columnid']; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); require_capability('mod/kanban:managecolumns', $context); @@ -311,7 +310,7 @@ public static function move_card(int $cmid, int $boardid, array $data): array { $aftercard = $params['data']['aftercard']; $columnid = $params['data']['columnid']; $cardid = $params['data']['cardid']; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); $boardmanager = new boardmanager($cmid, $boardid); @@ -375,7 +374,7 @@ public static function delete_card(int $cmid, int $boardid, array $data): array $cmid = $params['cmid']; $boardid = $params['boardid']; $cardid = $params['data']['cardid']; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); @@ -439,7 +438,7 @@ public static function delete_column(int $cmid, int $boardid, array $data): arra $cmid = $params['cmid']; $boardid = $params['boardid']; $columnid = $params['data']['columnid']; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); require_capability('mod/kanban:managecolumns', $context); @@ -502,7 +501,7 @@ public static function assign_user(int $cmid, int $boardid, array $data): array $boardid = $params['boardid']; $cardid = $params['data']['cardid']; $userid = $params['data']['userid']; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); if (empty($userid)) { @@ -573,7 +572,7 @@ public static function unassign_user(int $cmid, int $boardid, array $data): arra if (empty($userid)) { $userid = $USER->id; } - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); if ($userid == $USER->id) { @@ -640,7 +639,7 @@ public static function set_card_complete(int $cmid, int $boardid, array $data): $boardid = $params['boardid']; $state = $params['data']['state']; $cardid = $params['data']['cardid']; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); $boardmanager = new boardmanager($cmid, $boardid); @@ -706,7 +705,7 @@ public static function set_column_locked(int $cmid, int $boardid, array $data): $boardid = $params['boardid']; $state = $params['data']['state']; $columnid = $params['data']['columnid']; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); @@ -770,7 +769,7 @@ public static function set_board_columns_locked(int $cmid, int $boardid, array $ $boardid = $params['boardid']; $state = $params['data']['state']; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); @@ -835,7 +834,7 @@ public static function add_discussion_message(int $cmid, int $boardid, array $da // Additional cleaning most likely not needed, because message is PARAM_TEXT, but let's be extra sure. $message = clean_param($params['data']['message'], PARAM_TEXT); - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); @@ -848,7 +847,6 @@ public static function add_discussion_message(int $cmid, int $boardid, array $da return [ 'update' => $boardmanager->get_formatted_updates(), ]; - } /** @@ -899,7 +897,7 @@ public static function delete_discussion_message(int $cmid, int $boardid, array $boardid = $params['boardid']; $messageid = $params['data']['messageid']; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); @@ -961,7 +959,7 @@ public static function save_as_template(int $cmid, int $boardid): array { ]); $cmid = $params['cmid']; $boardid = $params['boardid']; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); require_capability('mod/kanban:manageboard', $context); @@ -1016,7 +1014,7 @@ public static function delete_board(int $cmid, int $boardid): array { ]); $cmid = $params['cmid']; $boardid = $params['boardid']; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); @@ -1081,7 +1079,7 @@ public static function push_card_copy(int $cmid, int $boardid, array $data): arr $cmid = $params['cmid']; $boardid = $params['boardid']; $cardid = $params['data']['cardid']; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); diff --git a/classes/external/get_kanban_content.php b/classes/external/get_kanban_content.php index f2e17372..59da1772 100644 --- a/classes/external/get_kanban_content.php +++ b/classes/external/get_kanban_content.php @@ -56,7 +56,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class get_kanban_content extends external_api { - /** * Returns description of method parameters for the execute webservice function. * @@ -342,7 +341,7 @@ public static function execute(int $cmid, int $boardid, int $timestamp = 0, bool $cmid = $params['cmid']; $boardid = $params['boardid']; $timestamp = $params['timestamp']; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); require_capability('mod/kanban:view', $context); @@ -429,7 +428,7 @@ public static function execute(int $cmid, int $boardid, int $timestamp = 0, bool } if (!empty($kanbanboard->groupid)) { $members = groups_get_members($kanbanboard->groupid, 'u.id'); - $members = array_map(function($v) { + $members = array_map(function ($v) { return intval($v->id); }, $members); $ismember = in_array($USER->id, $members); @@ -449,7 +448,7 @@ public static function execute(int $cmid, int $boardid, int $timestamp = 0, bool } } - $common = new stdClass; + $common = new stdClass(); $common->timestamp = time(); $common->id = $cmid; $common->userid = $USER->id; @@ -626,7 +625,7 @@ public static function get_discussion_update_returns(): external_single_structur */ public static function get_discussion_update(int $cmid, int $boardid, int $cardid, int $timestamp = 0): array { global $DB, $USER; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); require_capability('mod/kanban:view', $context); @@ -696,7 +695,7 @@ public static function get_history_update_returns(): external_single_structure { */ public static function get_history_update(int $cmid, int $boardid, int $cardid, int $timestamp = 0): array { global $DB; - list($course, $cminfo) = get_course_and_cm_from_cmid($cmid); + [$course, $cminfo] = get_course_and_cm_from_cmid($cmid); $context = context_module::instance($cmid); self::validate_context($context); require_capability('mod/kanban:viewhistory', $context); diff --git a/classes/form/edit_card_form.php b/classes/form/edit_card_form.php index 7484da1f..40ec3ff9 100644 --- a/classes/form/edit_card_form.php +++ b/classes/form/edit_card_form.php @@ -154,7 +154,6 @@ public function process_dynamic_submission(): array { return [ 'update' => $boardmanager->get_formatted_updates(), ]; - } /** diff --git a/classes/helper.php b/classes/helper.php index 6bffc96b..28a20edd 100644 --- a/classes/helper.php +++ b/classes/helper.php @@ -148,7 +148,7 @@ public static function check_permissions_for_user_or_group( } if (!empty($board->groupid)) { $members = groups_get_members($board->groupid, 'u.id'); - $members = array_map(function($v) { + $members = array_map(function ($v) { return intval($v->id); }, $members); $ismember = in_array($USER->id, $members); @@ -302,7 +302,7 @@ public static function add_or_update_calendar_event(stdClass $kanban, stdClass $ public static function remove_calendar_event(stdClass $kanban, stdClass $card, array $users = []) { global $DB; if (!empty($users)) { - list($sql, $params) = $DB->get_in_or_equal($users, SQL_PARAMS_NAMED); + [$sql, $params] = $DB->get_in_or_equal($users, SQL_PARAMS_NAMED); $sql = 'instance = :id AND uuid = :cardid AND userid ' . $sql; $params['cardid'] = $card->id; $params['id'] = $kanban->id; diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index 942131ee..4448ad79 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -42,10 +42,7 @@ * @author Stefan Hanauska * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class provider implements - \core_privacy\local\request\plugin\provider, - \core_privacy\local\request\core_userlist_provider, - \core_privacy\local\metadata\provider { +class provider implements \core_privacy\local\request\core_userlist_provider, \core_privacy\local\request\plugin\provider, \core_privacy\local\metadata\provider { /** * Delete multiple users within a single context. * @@ -75,7 +72,7 @@ public static function delete_data_for_users(approved_userlist $userlist) { 'kanban_instance = :instance', ['instance' => $cm->instance] ); - list($insql, $params) = $DB->get_in_or_equal($boardids); + [$insql, $params] = $DB->get_in_or_equal($boardids); // Delete history. $params['userid'] = $userid; @@ -95,7 +92,7 @@ public static function delete_data_for_users(approved_userlist $userlist) { $cardids = $DB->get_fieldset_sql($sql, $params); if (!empty($cardids)) { - list($insql, $params) = $DB->get_in_or_equal($cardids); + [$insql, $params] = $DB->get_in_or_equal($cardids); $sql = 'userid = :userid AND kanban_card ' . $insql; $params['userid'] = $userid; // Unassign user. @@ -115,7 +112,7 @@ public static function delete_data_for_users(approved_userlist $userlist) { if (!empty($cardids)) { // Unassign all users from private board. - list($insql, $params) = $DB->get_in_or_equal($cardids); + [$insql, $params] = $DB->get_in_or_equal($cardids); $DB->delete_records_select('kanban_assignee', 'kanban_card ' . $insql, $params); // Delete all discussions. $DB->delete_records_select('kanban_discussion_comment', 'kanban_card ' . $insql, $params); @@ -268,7 +265,7 @@ public static function export_user_data(approved_contextlist $contextlist) { $user = $contextlist->get_user(); $userid = $user->id; - list($contextsql, $contextparams) = $DB->get_in_or_equal($contextlist->get_contextids(), SQL_PARAMS_NAMED); + [$contextsql, $contextparams] = $DB->get_in_or_equal($contextlist->get_contextids(), SQL_PARAMS_NAMED); // Get all cards the user is assigned to without private board of the user. $sql = "SELECT cm.id AS cmid, @@ -429,12 +426,12 @@ public static function delete_data_for_all_users_in_context(\context $context) { $boardids = $DB->get_fieldset_select('kanban_board', 'id', 'kanban_instance = :instance', ['instance' => $cm->instance]); if (!empty($boardids)) { - list($insql, $params) = $DB->get_in_or_equal($boardids); + [$insql, $params] = $DB->get_in_or_equal($boardids); $sql = 'SELECT id FROM {kanban_card} WHERE kanban_board ' . $insql; $cardids = $DB->get_fieldset_sql($sql, $params); // Delete all assignees (this needs to be done also for template boards). - list($insql, $params) = $DB->get_in_or_equal($cardids); + [$insql, $params] = $DB->get_in_or_equal($cardids); $DB->delete_records_select('kanban_assignee', 'kanban_card ' . $insql, $params); // Delete discussion. @@ -447,7 +444,7 @@ public static function delete_data_for_all_users_in_context(\context $context) { 'kanban_instance = :instance AND template = 0', ['instance' => $cm->instance] ); - list($insql, $params) = $DB->get_in_or_equal($boardids); + [$insql, $params] = $DB->get_in_or_equal($boardids); $DB->delete_records_select('kanban_column', 'kanban_board ' . $insql, $params); // Delete history. @@ -483,7 +480,7 @@ public static function delete_data_for_user(approved_contextlist $contextlist) { 'kanban_instance = :instance', ['instance' => $cm->instance] ); - list($insql, $params) = $DB->get_in_or_equal($boardids); + [$insql, $params] = $DB->get_in_or_equal($boardids); // Delete history. $params['userid'] = $userid; @@ -503,7 +500,7 @@ public static function delete_data_for_user(approved_contextlist $contextlist) { $cardids = $DB->get_fieldset_sql($sql, $params); if (!empty($cardids)) { - list($insql, $params) = $DB->get_in_or_equal($cardids); + [$insql, $params] = $DB->get_in_or_equal($cardids); $sql = 'userid = :userid AND kanban_card ' . $insql; $params['userid'] = $userid; // Unassign user. @@ -523,7 +520,7 @@ public static function delete_data_for_user(approved_contextlist $contextlist) { if (!empty($cardids)) { // Unassign all users from private board. - list($insql, $params) = $DB->get_in_or_equal($cardids); + [$insql, $params] = $DB->get_in_or_equal($cardids); $DB->delete_records_select('kanban_assignee', 'kanban_card ' . $insql, $params); // Delete all discussions. $DB->delete_records_select('kanban_discussion_comment', 'kanban_card ' . $insql, $params); @@ -542,7 +539,7 @@ public static function delete_data_for_user(approved_contextlist $contextlist) { * @param collection $collection The initialised collection to add items to. * @return collection A listing of user data stored through this system. */ - public static function get_metadata(collection $collection) : collection { + public static function get_metadata(collection $collection): collection { $collection->add_database_table('kanban_board', [ 'userid' => 'privacy:metadata:userid', 'groupid' => 'privacy:metadata:groupid', diff --git a/classes/task/reminder.php b/classes/task/reminder.php index aa73eff8..200664ab 100644 --- a/classes/task/reminder.php +++ b/classes/task/reminder.php @@ -36,7 +36,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class reminder extends \core\task\scheduled_task { - /** * Return the task's name as shown in admin screens. * @@ -66,12 +65,12 @@ public function execute() { ['time' => $time, 'time2' => $time] ); foreach ($kanbancards as $kanbancard) { - list($course, $cminfo) = get_course_and_cm_from_instance($kanbancard->instance, 'kanban'); + [$course, $cminfo] = get_course_and_cm_from_instance($kanbancard->instance, 'kanban'); $user = \core_user::get_user($kanbancard->userid); helper::fix_current_language($user->lang); $kanbancard->duedate = userdate($kanbancard->duedate, get_string('strftimedate', 'langconfig')); helper::send_notification($cminfo, 'due', [$kanbancard->userid], $kanbancard, null, true); - $data = new \stdClass; + $data = new \stdClass(); $data->id = $kanbancard->id; $data->reminder_sent = 1; $DB->update_record('kanban_card', $data); diff --git a/lib.php b/lib.php index 6faf342b..7aa6a305 100644 --- a/lib.php +++ b/lib.php @@ -222,7 +222,6 @@ function kanban_reset_course_form_definition(&$mform): void { $mform->addElement('advcheckbox', 'reset_kanban_personal', get_string('reset_personal', 'mod_kanban')); $mform->addElement('advcheckbox', 'reset_kanban_group', get_string('reset_group', 'mod_kanban')); $mform->addElement('advcheckbox', 'reset_kanban', get_string('reset_kanban', 'mod_kanban')); - } /** diff --git a/settings.php b/settings.php index dacdfd77..45457b3f 100644 --- a/settings.php +++ b/settings.php @@ -27,17 +27,17 @@ if ($ADMIN->fulltree) { $settings->add(new admin_setting_configtext( - 'mod_kanban/liveupdatetime', - get_string('liveupdatetime', 'kanban'), - get_string('liveupdatetimedescription', 'kanban'), - 10, - PARAM_INT) - ); + 'mod_kanban/liveupdatetime', + get_string('liveupdatetime', 'kanban'), + get_string('liveupdatetimedescription', 'kanban'), + 10, + PARAM_INT + )); $settings->add(new admin_setting_configcheckbox( - 'mod_kanban/enablehistory', - get_string('enablehistory', 'kanban'), - get_string('enablehistorydescription', 'kanban'), - true, - PARAM_BOOL) - ); + 'mod_kanban/enablehistory', + get_string('enablehistory', 'kanban'), + get_string('enablehistorydescription', 'kanban'), + true, + PARAM_BOOL + )); } diff --git a/tests/generator/lib.php b/tests/generator/lib.php index b7d96789..1b6d3db6 100644 --- a/tests/generator/lib.php +++ b/tests/generator/lib.php @@ -23,7 +23,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class mod_kanban_generator extends testing_module_generator { - /** * Creates an instance of a kanban. * diff --git a/view.php b/view.php index 6d760343..b8dcd034 100644 --- a/view.php +++ b/view.php @@ -35,7 +35,7 @@ $userid = optional_param('user', 0, PARAM_INT); $group = optional_param('group', -1, PARAM_INT); -list ($course, $cm) = get_course_and_cm_from_cmid($id, 'kanban'); + [$course, $cm] = get_course_and_cm_from_cmid($id, 'kanban'); require_course_login($course, true, $cm); $context = context_module::instance($cm->id);