Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ibernhardf committed Nov 20, 2024
1 parent d7352bf commit 95deec9
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions classes/sports.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class sports {

/**
* Generate a list of all Sports.
*
Expand Down Expand Up @@ -73,7 +72,8 @@ public static function return_courseid() {
AND m.name = 'page'
GROUP BY cm.course
ORDER BY count(cm.course) DESC
) s1 LIMIT 1");
) s1 LIMIT 1"
);

return $courseid;
}
Expand Down Expand Up @@ -103,7 +103,6 @@ public static function get_all_sportsdivisions_data(int $courseid, $print = true

// Iterate through sport categories.
foreach ($sections as $section) {

if (empty($section->name)) {
continue;
}
Expand All @@ -114,7 +113,7 @@ public static function get_all_sportsdivisions_data(int $courseid, $print = true
'name' => $section->name,
'categoryid' => $section->id,
'summary' => $section->summary,
'sports' => []
'sports' => [],
];

// For performance.
Expand All @@ -133,7 +132,7 @@ public static function get_all_sportsdivisions_data(int $courseid, $print = true
}

if (!empty($teachersarr)) {
list($inorequal, $params) = $DB->get_in_or_equal($teachersarr);
[$inorequal, $params] = $DB->get_in_or_equal($teachersarr);
$sql = "SELECT id, firstname, lastname, email, phone1, phone2 FROM {user} WHERE id $inorequal";
$teacherrecords = $DB->get_records_sql($sql, $params);
} else {
Expand All @@ -143,9 +142,8 @@ public static function get_all_sportsdivisions_data(int $courseid, $print = true
// Sports.
foreach ($cmids as $cmid) {
if (isset($pages[$cmid])) {

// If the page is hidden, we do not want to add it.
list($course, $cm) = get_course_and_cm_from_cmid($cmid);
[$course, $cm] = get_course_and_cm_from_cmid($cmid);
if (empty($cm->visible)) {
continue;
}
Expand Down Expand Up @@ -187,7 +185,7 @@ public static function get_all_sportsdivisions_data(int $courseid, $print = true
}
}
// Now sort the teachers by last name.
usort($substitutionteachers, function($a, $b) {
usort($substitutionteachers, function ($a, $b) {
return $a['lastname'] <=> $b['lastname'];
});
}
Expand Down Expand Up @@ -252,17 +250,30 @@ private static function generate_mailstring(array $substitutionteachers): array
if (!empty($emailstring)) {
$emailstring = trim($emailstring, ';');
$loggedinuseremail = $USER->email;
$mailtolink = str_replace(' ', '%20', htmlspecialchars("mailto:$loggedinuseremail?bcc=$emailstring",
ENT_QUOTES));
$mailtolink = str_replace(
' ',
'%20',
htmlspecialchars(
"mailto:$loggedinuseremail?bcc=$emailstring",
ENT_QUOTES
)
);
}
}
return [
'mailtolink' => $mailtolink ?? null,
'emailstring' => $emailstring ?? null
'emailstring' => $emailstring ?? null,
];

}

/**
* Get an array of booking option ids for a provided sport name, e.g. "Basketball".
*
* @param string $sportname e.g. "Basketball"
* @param int $bookingid optional
* @return array an array of booking option ids for the provided sport
* @throws dml_exception
*/
public static function return_list_of_boids_with_sport(string $sportname, $bookingid = 0) {

global $DB;
Expand Down

0 comments on commit 95deec9

Please sign in to comment.