Skip to content

Commit

Permalink
WR422914 CI Updates
Browse files Browse the repository at this point in the history
CI check updates and a few minor changes.
  • Loading branch information
SimonThornett committed Jan 14, 2025
1 parent 0de6d99 commit a38efa6
Show file tree
Hide file tree
Showing 126 changed files with 1,795 additions and 1,422 deletions.
2 changes: 1 addition & 1 deletion amd/build/course_selector.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/course_selector.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/src/course_selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @licensehttp://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

define(['core/ajax', 'core/notification'], function (Ajax, Notification) {
define(['core/ajax'], function(Ajax) {

/**
* Module level variables.
Expand Down
13 changes: 0 additions & 13 deletions ci.yml

This file was deleted.

4 changes: 2 additions & 2 deletions classes/event/event_processed.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected function init() {
*
* @return string
*/
public static function get_name() : string {
public static function get_name(): string {
return get_string('eventeventprocessed', 'local_assessfreq');
}

Expand All @@ -57,7 +57,7 @@ public static function get_name() : string {
*
* @return string
*/
public function get_description() : string {
public function get_description(): string {
return get_string('eventeven_processed_desc', 'local_assessfreq');
}
}
43 changes: 24 additions & 19 deletions classes/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class local_assessfreq_external extends external_api {

/**
* Returns description of method parameters.
*
* @return external_function_parameters
*/
public static function get_courses_parameters() : external_function_parameters {
public static function get_courses_parameters(): external_function_parameters {
return new external_function_parameters([
'query' => new external_value(PARAM_TEXT, 'The query to find'),
]);
Expand All @@ -55,7 +56,7 @@ public static function get_courses_parameters() : external_function_parameters {
* @param string $query The search query.
* @return string JSON response.
*/
public static function get_courses(string $query) : string {
public static function get_courses(string $query): string {
global $DB, $SITE, $COURSE;
manager::write_close(); // Close session early this is a read op.

Expand All @@ -66,22 +67,26 @@ public static function get_courses(string $query) : string {
);

// Execute API call.
$sql = 'SELECT id, fullname, category FROM {course} WHERE ' . $DB->sql_like('fullname', ':fullname', false) . ' AND id <> 1';
$sql = 'SELECT id, fullname, category
FROM {course}
WHERE ' . $DB->sql_like('fullname', ':fullname', false) . '
AND id <> 1';
$params = ['fullname' => '%' . $DB->sql_like_escape($query) . '%'];
$courses = $DB->get_records_sql($sql, $params, 0, 30);

$data = [];
if (has_capability('local/assessfreq:view', context_system::instance())) {
$data[SITEID] = [
"id" => $SITE->id,
"fullname" => external_format_string($SITE->fullname, true, ["escape" => false])
"fullname" => external_format_string($SITE->fullname, true, ["escape" => false]),
];
}
$categories = \core_course_category::make_categories_list();
$categories = core_course_category::make_categories_list();
foreach ($courses as $course) {
$fullname = external_format_string($course->fullname, true, ["escape" => false]);
$data[$course->id] = [
"id" => $course->id,
"fullname" => $categories[$course->category] . ' / ' . external_format_string($course->fullname, true, ["escape" => false])
"fullname" => $categories[$course->category] . ' / ' . $fullname,
];
}

Expand All @@ -96,7 +101,7 @@ public static function get_courses(string $query) : string {
* Returns description of method result value
* @return external_value
*/
public static function get_courses_returns() : external_value {
public static function get_courses_returns(): external_value {
return new external_value(PARAM_RAW, 'Course result JSON');
}

Expand All @@ -105,7 +110,7 @@ public static function get_courses_returns() : external_value {
*
* @return external_function_parameters
*/
public static function get_activities_parameters() : external_function_parameters {
public static function get_activities_parameters(): external_function_parameters {
return new external_function_parameters([
'courseid' => new external_value(PARAM_INT, 'The courseid to find'),
]);
Expand All @@ -114,10 +119,10 @@ public static function get_activities_parameters() : external_function_parameter
/**
* Returns activities in the course that match search data.
*
* @param $courseid
* @param int $courseid The course id we're requesting for.
* @return string JSON response.
*/
public static function get_activities($courseid) : string {
public static function get_activities(int $courseid): string {
global $DB;
manager::write_close(); // Close session early this is a read op.

Expand All @@ -130,7 +135,7 @@ public static function get_activities($courseid) : string {
// Execute API call.
$modules = $DB->get_records('course_modules', ['course' => $courseid]);

$sources = get_sources();
$sources = local_assessfreq_get_sources();

$data = [];
foreach ($modules as $module) {
Expand All @@ -144,7 +149,7 @@ public static function get_activities($courseid) : string {

$data[$module->id] = [
"id" => $module->id,
"name" => $cm->get_module_type_name() . " - " . $cm->get_name()
"name" => $cm->get_module_type_name() . " - " . $cm->get_name(),
];
}

Expand All @@ -157,7 +162,7 @@ public static function get_activities($courseid) : string {
* Returns description of method result value
* @return external_value
*/
public static function get_activities_returns() : external_value {
public static function get_activities_returns(): external_value {
return new external_value(PARAM_RAW, 'Result JSON');
}

Expand All @@ -167,7 +172,7 @@ public static function get_activities_returns() : external_value {
*
* @return external_function_parameters
*/
public static function set_table_preference_parameters() : external_function_parameters {
public static function set_table_preference_parameters(): external_function_parameters {
return new external_function_parameters([
'tableid' => new external_value(PARAM_ALPHANUMEXT, 'The table id to set the preference for'),
'preference' => new external_value(PARAM_ALPHAEXT, 'The table preference to set'),
Expand All @@ -183,7 +188,7 @@ public static function set_table_preference_parameters() : external_function_par
* @param string $values The values to set for the preference, encoded as JSON.
* @return string JSON response.
*/
public static function set_table_preference(string $tableid, string $preference, string $values) : string {
public static function set_table_preference(string $tableid, string $preference, string $values): string {
global $SESSION, $PAGE;

// Parameter validation.
Expand Down Expand Up @@ -233,7 +238,7 @@ public static function set_table_preference_returns() {
*
* @return external_function_parameters
*/
public static function process_override_form_parameters() : external_function_parameters {
public static function process_override_form_parameters(): external_function_parameters {
return new external_function_parameters(
[
'jsonformdata' => new external_value(PARAM_RAW, 'The data from the create copy form, encoded as a json array'),
Expand All @@ -251,7 +256,7 @@ public static function process_override_form_parameters() : external_function_pa
* @param int $activityid The activity id to add an override for.
* @return string
*/
public static function process_override_form(string $jsonformdata, string $activitytype, int $activityid) : string {
public static function process_override_form(string $jsonformdata, string $activitytype, int $activityid): string {
global $DB;

// Release session lock.
Expand All @@ -269,9 +274,9 @@ public static function process_override_form(string $jsonformdata, string $activ
parse_str($formdata, $submitteddata);

$processid = 0;
$sources = get_sources();
$sources = local_assessfreq_get_sources();
$source = $sources[$activitytype];
/* @var $source source_base */
/* @var $source source_base for accessing the source class */
if (method_exists($source, 'process_override_form')) {
$processid = $source->process_override_form($activityid, $submitteddata);
}
Expand Down
Loading

0 comments on commit a38efa6

Please sign in to comment.