Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .kateproject
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"settings": {
"intelephense": {
"environment": {
"phpVersion": "7.4.0"
"phpVersion": "8.0.0"
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion lbplanner/classes/helpers/course_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace local_lbplanner\helpers;

use context_course;
use core\context\course as context_course;
use dml_exception;

use local_lbplanner\model\course;
Expand Down Expand Up @@ -143,6 +143,9 @@ public static function get_all_lbplanner_courses(): array {
*/
public static function check_access(int $courseid, int $userid): bool {
$context = context_course::instance($courseid);
if ($context === false) {
return false;
}
return is_enrolled($context, $userid, '', true);
}

Expand Down
3 changes: 1 addition & 2 deletions lbplanner/classes/helpers/invite_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

namespace local_lbplanner\helpers;

use external_single_structure;
use external_value;
use core_external\{external_single_structure, external_value};

/**
* Helper class for plan invites
Expand Down
5 changes: 1 addition & 4 deletions lbplanner/classes/helpers/modules_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@

namespace local_lbplanner\helpers;

use block_accessreview\external\get_module_data;
use external_function_parameters;
use external_single_structure;
use external_value;
use core_external\{external_single_structure, external_value};
use moodle_url;
use local_lbplanner\enums\{MODULE_STATUS, MODULE_GRADE, MODULE_TYPE};

Expand Down
3 changes: 1 addition & 2 deletions lbplanner/classes/helpers/notifications_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@

namespace local_lbplanner\helpers;

use external_single_structure;
use external_value;
use core_external\{external_single_structure, external_value};
use local_lbplanner\enums\{NOTIF_STATUS, NOTIF_TRIGGER};

/**
Expand Down
4 changes: 1 addition & 3 deletions lbplanner/classes/helpers/plan_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@

namespace local_lbplanner\helpers;

use external_single_structure;
use external_value;
use external_multiple_structure;
use core_external\{external_value, external_single_structure, external_multiple_structure};
use local_lbplanner\enums\PLAN_ACCESS_TYPE;

/**
Expand Down
2 changes: 1 addition & 1 deletion lbplanner/classes/helpers/user_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace local_lbplanner\helpers;

use context_system;
use core\context\system as context_system;
use dml_exception;
use moodle_exception;
use stdClass;
Expand Down
3 changes: 1 addition & 2 deletions lbplanner/classes/model/course.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@

namespace local_lbplanner\model;

use external_single_structure;
use external_value;
use core_external\{external_single_structure, external_value};
use local_lbplanner\helpers\course_helper;

/**
Expand Down
3 changes: 1 addition & 2 deletions lbplanner/classes/model/reservation.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@

use DateTimeImmutable;

use external_single_structure;
use external_value;
use core_external\{external_single_structure, external_value};

use local_lbplanner\model\slot;
use local_lbplanner\helpers\slot_helper;
Expand Down
4 changes: 1 addition & 3 deletions lbplanner/classes/model/slot.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
use local_lbplanner\enums\WEEKDAY;
use local_lbplanner\helpers\slot_helper;

use external_multiple_structure;
use external_single_structure;
use external_value;
use core_external\{external_multiple_structure, external_single_structure, external_value};
use moodle_exception;

/**
Expand Down
3 changes: 1 addition & 2 deletions lbplanner/classes/model/slot_filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@

namespace local_lbplanner\model;

use external_single_structure;
use external_value;
use core_external\{external_single_structure, external_value};

/**
* Model class for a filter for slots
Expand Down
10 changes: 5 additions & 5 deletions lbplanner/classes/model/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
namespace local_lbplanner\model;

use coding_exception;
use context_system;
use external_single_structure;
use external_value;
use core\context\system as context_system;
use core_external\{external_single_structure, external_value};
use user_picture;

use local_lbplanner\enums\CAPABILITY;
use local_lbplanner\enums\CAPABILITY_FLAG;
use local_lbplanner\helpers\plan_helper;
use local_lbplanner\helpers\user_helper;
use user_picture;

/**
* Model class for course
Expand Down Expand Up @@ -306,7 +306,7 @@ public function prepare_for_api_short(): array {
'profileimageurl' => $this->get_pfp(),
];

if ($capabilitybm & CAPABILITY_FLAG::STUDENT) {
if ($capabilitybm & CAPABILITY_FLAG::STUDENT && strlen($mdluser->address) > 0) {
$data['vintage'] = $mdluser->address;
}

Expand Down
5 changes: 1 addition & 4 deletions lbplanner/services/config/get_version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_single_structure;
use external_value;
use core_external\{external_api, external_function_parameters, external_single_structure, external_value};

/**
* Get version service.
Expand Down
6 changes: 2 additions & 4 deletions lbplanner/services/courses/get_all_courses.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_multiple_structure;
use core_external\{external_function_parameters, external_multiple_structure};

use local_lbplanner\helpers\course_helper;
use local_lbplanner\model\course;
Expand All @@ -31,7 +29,7 @@
* @copyright 2024 necodeIT
* @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC-BY-NC-SA 4.0 International or later
*/
class courses_get_all_courses extends external_api {
class courses_get_all_courses extends \core_external\external_api {

/**
* Has no Parameters
Expand Down
6 changes: 1 addition & 5 deletions lbplanner/services/courses/update_course.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@

namespace local_lbplanner_services;

use dml_exception;
use external_api;
use external_function_parameters;
use external_value;
use invalid_parameter_exception;
use core_external\{external_api, external_function_parameters, external_value};
use local_lbplanner\helpers\course_helper;
use moodle_exception;

Expand Down
5 changes: 1 addition & 4 deletions lbplanner/services/modules/get_all_course_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_multiple_structure;
use external_value;
use core_external\{external_api, external_function_parameters, external_multiple_structure, external_value};
use local_lbplanner\helpers\modules_helper;

/**
Expand Down
4 changes: 1 addition & 3 deletions lbplanner/services/modules/get_all_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_multiple_structure;
use core_external\{external_api, external_function_parameters, external_multiple_structure};
use local_lbplanner\helpers\course_helper;
use local_lbplanner\helpers\modules_helper;
use local_lbplanner\helpers\plan_helper;
Expand Down
6 changes: 1 addition & 5 deletions lbplanner/services/modules/get_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_single_structure;
use external_value;
use core_external\{external_api, external_function_parameters, external_single_structure, external_value};
use local_lbplanner\helpers\modules_helper;
use local_lbplanner\helpers\plan_helper;
use local_lbplanner\helpers\user_helper;

/**
Expand Down
4 changes: 1 addition & 3 deletions lbplanner/services/notifications/get_all_notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_multiple_structure;
use core_external\{external_api, external_function_parameters, external_multiple_structure};
use local_lbplanner\helpers\notifications_helper;

/**
Expand Down
4 changes: 1 addition & 3 deletions lbplanner/services/notifications/update_notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_value;
use core_external\{external_api, external_function_parameters, external_value};
use local_lbplanner\enums\NOTIF_STATUS;
use local_lbplanner\helpers\notifications_helper;

Expand Down
4 changes: 1 addition & 3 deletions lbplanner/services/plan/accept_invite.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_value;
use core_external\{external_api, external_function_parameters, external_value};
use local_lbplanner\helpers\plan_helper;
use local_lbplanner\helpers\notifications_helper;
use local_lbplanner\enums\{PLAN_ACCESS_TYPE, PLAN_INVITE_STATE, NOTIF_TRIGGER};
Expand Down
3 changes: 1 addition & 2 deletions lbplanner/services/plan/clear_plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use core_external\{external_api, external_function_parameters};
use local_lbplanner\helpers\plan_helper;

/**
Expand Down
4 changes: 1 addition & 3 deletions lbplanner/services/plan/decline_invite.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_value;
use core_external\{external_api, external_function_parameters, external_value};
use local_lbplanner\helpers\plan_helper;
use local_lbplanner\helpers\notifications_helper;
use local_lbplanner\enums\{NOTIF_TRIGGER, PLAN_INVITE_STATE};
Expand Down
4 changes: 1 addition & 3 deletions lbplanner/services/plan/delete_deadline.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_value;
use core_external\{external_api, external_function_parameters, external_value};
use local_lbplanner\helpers\plan_helper;

/**
Expand Down
4 changes: 1 addition & 3 deletions lbplanner/services/plan/get_invites.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_multiple_structure;
use core_external\{external_api, external_function_parameters, external_multiple_structure};
use local_lbplanner\helpers\invite_helper;
use local_lbplanner\helpers\plan_helper;

Expand Down
6 changes: 2 additions & 4 deletions lbplanner/services/plan/get_plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_single_structure;
use core_external\{external_function_parameters, external_single_structure};
use local_lbplanner\helpers\plan_helper;

/**
Expand All @@ -29,7 +27,7 @@
* @copyright 2024 necodeIT
* @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC-BY-NC-SA 4.0 International or later
*/
class plan_get_plan extends external_api {
class plan_get_plan extends \core_external\external_api {
/**
* Parameters for get_plan.
* @return external_function_parameters
Expand Down
5 changes: 1 addition & 4 deletions lbplanner/services/plan/invite_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_single_structure;
use external_value;
use core_external\{external_api, external_function_parameters, external_single_structure, external_value};
use local_lbplanner\helpers\invite_helper;
use local_lbplanner\helpers\plan_helper;
use local_lbplanner\helpers\notifications_helper;
Expand Down
3 changes: 1 addition & 2 deletions lbplanner/services/plan/leave_plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use core_external\{external_api, external_function_parameters};
use local_lbplanner\helpers\plan_helper;
use local_lbplanner\helpers\notifications_helper;
use local_lbplanner\enums\{NOTIF_TRIGGER, PLAN_ACCESS_TYPE, PLAN_INVITE_STATE};
Expand Down
4 changes: 1 addition & 3 deletions lbplanner/services/plan/remove_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_value;
use core_external\{external_api, external_function_parameters, external_value};
use local_lbplanner\helpers\plan_helper;

/**
Expand Down
4 changes: 1 addition & 3 deletions lbplanner/services/plan/set_deadline.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_value;
use core_external\{external_api, external_function_parameters, external_value};
use local_lbplanner\helpers\plan_helper;

/**
Expand Down
4 changes: 1 addition & 3 deletions lbplanner/services/plan/update_access.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_value;
use core_external\{external_api, external_function_parameters, external_value};
use local_lbplanner\enums\PLAN_ACCESS_TYPE;
use local_lbplanner\helpers\plan_helper;

Expand Down
4 changes: 1 addition & 3 deletions lbplanner/services/plan/update_plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

namespace local_lbplanner_services;

use external_api;
use external_function_parameters;
use external_value;
use core_external\{external_api, external_function_parameters, external_value};
use local_lbplanner\helpers\plan_helper;

/**
Expand Down
Loading
Loading