Skip to content

Commit

Permalink
adapt external class for moodle 401
Browse files Browse the repository at this point in the history
  • Loading branch information
TamaroWalter committed May 17, 2024
1 parent 8fdd5c0 commit f657fe5
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions classes/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,18 @@ public static function record_usersettings_returns(): external_value {
*/
public static function record_usersettings($userid, $timefilterpast, $timefilterfuture,
$basicletter, $completionletter, $postletter): bool {
global $DB;
global $DB, $CFG;

// Parameter validation.
$params = self::validate_parameters(self::record_usersettings_parameters(), [
'userid' => $userid,
'timefilterpast' => $timefilterpast,
'timefilterfuture' => $timefilterfuture,
'basicletter' => $basicletter,
'completionletter' => $completionletter,
'postletter' => $postletter,
]);
if ($CFG->branch >= 402) {
$params = self::validate_parameters(self::record_usersettings_parameters(), [
'userid' => $userid, 'timefilterpast' => $timefilterpast, 'timefilterfuture' => $timefilterfuture,
'basicletter' => $basicletter, 'completionletter' => $completionletter, 'postletter' => $postletter,
]);
} else {
$params = ['userid' => $userid, 'timefilterpast' => $timefilterpast, 'timefilterfuture' => $timefilterfuture,
'basicletter' => $basicletter, 'completionletter' => $completionletter, 'postletter' => $postletter, ];
}

// Check if the user already has a record in the database.
if ($records = $DB->get_records('block_townsquare_preferences', ['userid' => $userid])) {
Expand Down

0 comments on commit f657fe5

Please sign in to comment.