Skip to content

Commit

Permalink
Make codechecker happy again
Browse files Browse the repository at this point in the history
  • Loading branch information
abias committed Oct 14, 2023
1 parent 8af9c69 commit ed8dd2e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 31 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changes

### Unreleased

* 2023-10-14 - Make codechecker happy again
* 2023-10-10 - Updated Moodle Plugin CI to latest upstream recommendations
* 2023-04-30 - Tests: Updated Moodle Plugin CI to use PHP 8.1 and Postgres 13 from Moodle 4.1 on.

Expand Down
34 changes: 17 additions & 17 deletions block_people.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function init() {
* @return array
*/
public function applicable_formats() {
return array('course-view' => true, 'site' => true);
return ['course-view' => true, 'site' => true];
}

/**
Expand Down Expand Up @@ -112,7 +112,7 @@ public function get_content() {
u.lastnamephonetic, u.middlename, u.alternatename, u.picture, u.imagealt, u.email, u.suspended',
'r.sortorder ASC, u.lastname ASC, u.firstname ASC');
} else {
$teachers = array();
$teachers = [];
}

// Get role names / aliases in course context.
Expand All @@ -122,11 +122,11 @@ public function get_content() {
$multipleroles = get_config('block_people', 'multipleroles');

// Start teachers list.
$this->content->text .= html_writer::start_tag('div', array('class' => 'teachers'));
$this->content->text .= html_writer::start_tag('div', ['class' => 'teachers']);

// Initialize running variables.
$teacherrole = null;
$displayedteachers = array();
$displayedteachers = [];

// Check every teacher.
foreach ($teachers as $teacher) {
Expand Down Expand Up @@ -184,33 +184,33 @@ public function get_content() {
$user->email = $teacher->email;

// Teacher image.
$this->content->text .= html_writer::start_tag('div', array('class' => 'image'));
$this->content->text .= html_writer::start_tag('div', ['class' => 'image']);
if (get_config('block_people', 'linkavatar') == 1 && has_capability('moodle/user:viewdetails', $currentcontext)) {
$this->content->text .= $OUTPUT->user_picture($user,
array('size' => 35, 'link' => true, 'courseid' => $COURSE->id, 'includefullname' => false));
['size' => 35, 'link' => true, 'courseid' => $COURSE->id, 'includefullname' => false]);
} else {
$this->content->text .= $OUTPUT->user_picture($user,
array('size' => 35, 'link' => false, 'courseid' => $COURSE->id, 'includefullname' => false));
['size' => 35, 'link' => false, 'courseid' => $COURSE->id, 'includefullname' => false]);
}
$this->content->text .= html_writer::end_tag('div');

// Teacher details.
$this->content->text .= html_writer::start_tag('div', array('class' => 'details'));
$this->content->text .= html_writer::start_tag('div', array('class' => 'name'));
$this->content->text .= html_writer::start_tag('div', ['class' => 'details']);
$this->content->text .= html_writer::start_tag('div', ['class' => 'name']);
if (get_config('block_people', 'linkname') == 1 && has_capability('moodle/user:viewdetails', $currentcontext)) {
$linkurl = new moodle_url('/user/view.php', array('id' => $teacher->id, 'course' => $COURSE->id));
$linkurl = new moodle_url('/user/view.php', ['id' => $teacher->id, 'course' => $COURSE->id]);
$this->content->text .= html_writer::link($linkurl, fullname($teacher));
} else {
$this->content->text .= fullname($teacher);
}
$this->content->text .= html_writer::end_tag('div');
$this->content->text .= html_writer::start_tag('div', array('class' => 'icons'));
$this->content->text .= html_writer::start_tag('div', ['class' => 'icons']);
if (get_config('block_people', 'linkmessaging') == 1 &&
$CFG->messaging && has_capability('moodle/site:sendmessage', $currentcontext) && $teacher->id != $USER->id &&
\core_message\api::can_send_message($teacher->id, $USER->id)) {
$this->content->text .= html_writer::start_tag('a',
array('href' => new moodle_url('/message/index.php', array('id' => $teacher->id)),
'title' => get_string('sendmessageto', 'core_message', fullname($teacher))));
['href' => new moodle_url('/message/index.php', ['id' => $teacher->id]),
'title' => get_string('sendmessageto', 'core_message', fullname($teacher)), ]);
$this->content->text .= $OUTPUT->pix_icon('t/message',
get_string('sendmessageto', 'core_message', fullname($teacher)), 'moodle');
$this->content->text .= html_writer::end_tag('a');
Expand All @@ -233,20 +233,20 @@ public function get_content() {

// Output participants list if the setting linkparticipantspage is enabled.
if ((get_config('block_people', 'linkparticipantspage')) != 0) {
$this->content->text .= html_writer::start_tag('div', array('class' => 'participants'));
$this->content->text .= html_writer::start_tag('div', ['class' => 'participants']);
$this->content->text .= html_writer::tag('h6', get_string('participants'));

// Only if user is allow to see participants list.
if (course_can_view_participants($currentcontext)) {
$this->content->text .= html_writer::start_tag('a',
array('href' => new moodle_url('/user/index.php', array('contextid' => $currentcontext->id)),
'title' => get_string('participants')));
['href' => new moodle_url('/user/index.php', ['contextid' => $currentcontext->id]),
'title' => get_string('participants'), ]);
$this->content->text .= $OUTPUT->pix_icon('i/users',
get_string('participants', 'core'), 'moodle');
$this->content->text .= get_string('participantslist', 'block_people');
$this->content->text .= html_writer::end_tag('a');
} else {
$this->content->text .= html_writer::start_tag('span', array('class' => 'hint'));
$this->content->text .= html_writer::start_tag('span', ['class' => 'hint']);
$this->content->text .= get_string('noparticipantslist', 'block_people');
$this->content->text .= html_writer::end_tag('span');
}
Expand Down
22 changes: 11 additions & 11 deletions db/access.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@

defined('MOODLE_INTERNAL') || die();

$capabilities = array(
'block/people:myaddinstance' => array(
$capabilities = [
'block/people:myaddinstance' => [
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM
),
'block/people:addinstance' => array(
'contextlevel' => CONTEXT_SYSTEM,
],
'block/people:addinstance' => [
'riskbitmask' => RISK_SPAM | RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_BLOCK,
'archetypes' => array(
'archetypes' => [
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/site:manageblocks'
),
);
'manager' => CAP_ALLOW,
],
'clonepermissionsfrom' => 'moodle/site:manageblocks',
],
];
2 changes: 1 addition & 1 deletion settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
$name = 'block_people/roles';
$title = get_string('setting_roles', 'block_people', null, true);
$description = get_string('setting_roles_desc', 'block_people', null, true);
$default = array('editingteacher');
$default = ['editingteacher'];
$settings->add(new admin_setting_pickroles($name, $title, $description, $default));

// Setting to show multiple roles within the block.
Expand Down
4 changes: 2 additions & 2 deletions tests/behat/behat_block_people.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function user_should_be_listed_in_role_section($username, $rolename) {

// Check if the element exists.
$this->execute("behat_general::should_exist",
array($elementxpath, "xpath_element"));
[$elementxpath, "xpath_element"]);
}

// @codingStandardsIgnoreStart
Expand All @@ -86,7 +86,7 @@ public function user_should_not_be_listed_in_role_section($username, $rolename)

// Check if the element exists.
$this->execute("behat_general::should_not_exist",
array($elementxpath, "xpath_element"));
[$elementxpath, "xpath_element"]);
}

}

0 comments on commit ed8dd2e

Please sign in to comment.