Skip to content

Commit

Permalink
Merge branch 'moodle_4_dev'
Browse files Browse the repository at this point in the history
# Conflicts:
#	version.php
  • Loading branch information
my-curiosity committed Dec 19, 2023
2 parents 48dec8c + ae6e953 commit a94b33c
Show file tree
Hide file tree
Showing 15 changed files with 661 additions and 395 deletions.
579 changes: 331 additions & 248 deletions classes/external.php

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions classes/output/course_detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_detail implements renderable, templatable {

/**
* Export this data so it can be used as the context for a mustache template.
*
Expand All @@ -47,7 +46,7 @@ class course_detail implements renderable, templatable {
* @return stdClass array with Moodle-Root
*/
public function export_for_template(renderer_base $output) {
$data = array();
$data = [];

return $data;
}
Expand Down
4 changes: 1 addition & 3 deletions classes/output/course_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class course_table implements renderable, templatable {


/**
* Export this data so it can be used as the context for a mustache template.
*
Expand All @@ -50,7 +48,7 @@ public function export_for_template(renderer_base $output) {
$labels = get_config('tool_supporter', 'level_labels');
$count = 1; // Root is level 0, so we begin at 1.
foreach (explode(';', $labels) as $label) {
$data['label_level_'.$count] = format_string($label);
$data['label_level_' . $count] = format_string($label);
// Each label will be available with {{label_level_0}}, {{label_level_1}}, etc.
$count++;
}
Expand Down
5 changes: 2 additions & 3 deletions classes/output/create_new_course.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class create_new_course implements renderable, templatable {

/**
* Export this data so it can be used as the context for a mustache template.
*
Expand All @@ -59,10 +58,10 @@ public function export_for_template(renderer_base $output) {
}
$data['categories'] = $categories;

$data['config'] = array (
$data['config'] = [
'startdate' => get_config('tool_supporter', 'new_course_startdate'),
'enddate' => get_config('tool_supporter', 'new_course_enddate'),
);
];

return $data;
}
Expand Down
1 change: 0 additions & 1 deletion classes/output/enrolusersection.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
* Class enrolusersection
*/
class enrolusersection implements renderable, templatable {

/**
* Export this data so it can be used as the context for a mustache template.
*
Expand Down
1 change: 0 additions & 1 deletion classes/output/index_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class index_page implements renderable, templatable {

/**
* Export this data so it can be used as the context for a mustache template.
*
Expand Down
1 change: 0 additions & 1 deletion classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class renderer extends plugin_renderer_base {

/**
* Defer to template.
*
Expand Down
1 change: 0 additions & 1 deletion classes/output/user_detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_detail implements renderable, templatable {

/**
* Standard functions which is needed, but does not get any data
*
Expand Down
1 change: 0 additions & 1 deletion classes/output/user_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class user_table implements renderable, templatable {

/**
* Standard functions which is needed, but does not get any data
*
Expand Down
3 changes: 1 addition & 2 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,13 @@
class provider implements
// This plugin does not store any personal user data.
\core_privacy\local\metadata\null_provider {

/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
public static function get_reason(): string {
return 'privacy:metadata';
}
}
64 changes: 32 additions & 32 deletions db/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,98 +24,98 @@

defined('MOODLE_INTERNAL') || die;

$functions = array(
$functions = [

/* -------- Read-only --------- */
'tool_supporter_get_users' => array(
'tool_supporter_get_users' => [
'classname' => 'tool_supporter\external',
'methodname' => 'get_users',
'classpath' => 'tool/supporter/classes/external.php',
'description' => 'Get overview of all users',
'type' => 'read',
'ajax' => true,
'capabilities' => 'moodle/site:viewparticipants'
),
'tool_supporter_get_user_information' => array(
'capabilities' => 'moodle/site:viewparticipants',
],
'tool_supporter_get_user_information' => [
'classname' => 'tool_supporter\external',
'methodname' => 'get_user_information',
'classpath' => 'tool/supporter/classes/external.php',
'description' => 'Get detailed user information (clicking on a user)',
'type' => 'read',
'ajax' => true,
'capabilities' => 'moodle/user:viewdetails'
),
'tool_supporter_get_courses' => array(
'capabilities' => 'moodle/user:viewdetails',
],
'tool_supporter_get_courses' => [
'classname' => 'tool_supporter\external',
'methodname' => 'get_courses',
'classpath' => 'tool/supporter/classes/external.php',
'description' => 'Get overview of all courses',
'type' => 'read',
'ajax' => true,
'capabilities' => 'moodle/course:viewhiddencourses'
),
'tool_supporter_get_course_info' => array(
'capabilities' => 'moodle/course:viewhiddencourses',
],
'tool_supporter_get_course_info' => [
'classname' => 'tool_supporter\external',
'methodname' => 'get_course_info',
'classpath' => 'tool/supporter/classes/external.php',
'description' => 'Get detailed course information (clicking on a course)',
'type' => 'read',
'ajax' => true,
'capabilities' => 'moodle/course:view'
),
'tool_supporter_get_settings' => array(
'capabilities' => 'moodle/course:view',
],
'tool_supporter_get_settings' => [
'classname' => 'tool_supporter\external',
'methodname' => 'get_settings',
'classpath' => 'tool/supporter/classes/external.php',
'description' => 'Get settings of settings-page',
'type' => 'read',
'ajax' => true,
'capabilities' => '' // Every user can access this page, but not see everything.
),
'capabilities' => '', // Every user can access this page, but not see everything.
],
/* -------- Write-capabilites --------- */
'tool_supporter_create_new_course' => array(
'tool_supporter_create_new_course' => [
'classname' => 'tool_supporter\external',
'methodname' => 'create_new_course',
'classpath' => 'tool/supporter/classes/external.php',
'description' => 'Create a course',
'type' => 'write',
'ajax' => true,
'capabilities' => 'moodle/course:create'
),
'tool_supporter_duplicate_course' => array(
'capabilities' => 'moodle/course:create',
],
'tool_supporter_duplicate_course' => [
'classname' => 'tool_supporter\external',
'methodname' => 'duplicate_course',
'classpath' => 'tool/supporter/classes/external.php',
'description' => 'Duplicates an existing course',
'type' => 'write',
'ajax' => true,
'capabilities' => 'moodle/course:create'
),
'tool_supporter_toggle_course_visibility' => array(
'capabilities' => 'moodle/course:create',
],
'tool_supporter_toggle_course_visibility' => [
'classname' => 'tool_supporter\external',
'methodname' => 'toggle_course_visibility',
'classpath' => 'tool/supporter/classes/external.php',
'description' => 'hide/show the course',
'type' => 'write',
'ajax' => true,
'capabilities' => 'moodle/course:update'
),
'tool_supporter_enrol_user_into_course' => array(
'capabilities' => 'moodle/course:update',
],
'tool_supporter_enrol_user_into_course' => [
'classname' => 'tool_supporter\external',
'methodname' => 'enrol_user_into_course',
'classpath' => 'tool/supporter/classes/external.php',
'description' => 'Get course information',
'type' => 'write',
'ajax' => true,
'capabilities' => 'enrol/manual:enrol'
),
'tool_supporter_get_assignable_roles' => array(
'capabilities' => 'enrol/manual:enrol',
],
'tool_supporter_get_assignable_roles' => [
'classname' => 'tool_supporter\external',
'methodname' => 'get_assignable_roles',
'classpath' => 'tool/supporter/classes/external.php',
'description' => 'Get assignable Roles in the course, e.g. used for enrolling',
'type' => 'read, write',
'ajax' => true,
'capabilities' => 'enrol/manual:enrol'
),
);
'capabilities' => 'enrol/manual:enrol',
],
];
12 changes: 6 additions & 6 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
$PAGE->blocks->show_only_fake_blocks(); // Disable blocks for layouts which do include pre-post blocks.
require_login();

$PAGE->requires->js_call_amd('tool_supporter/datatables', 'useDataTable', array('.datatable', array()));
$PAGE->requires->js_call_amd('tool_supporter/datatables', 'useDataTable', ['.datatable', []]);

// Needed for sorting-arrows and responsive tables without horizontal scrollbars, version 1.10.18.
$PAGE->requires->css('/admin/tool/supporter/style/dataTables.bootstrap4.css');
Expand Down Expand Up @@ -69,30 +69,30 @@
<div class="span6 col-sm-6">
<div class="row">
<div class="span12 col-md-12">
'.$createnewcourse.'
' . $createnewcourse . '
</div>
</div>
<div class="row">
<div class="span12 col-sm-12">
'.$coursedetail.'
' . $coursedetail . '
</div>
</div>
<div class="row">
<div class="span12 col-sm-12">
'.$coursetable.'
' . $coursetable . '
</div>
</div>
</div>
<div class="span6 col-sm-6">
<div class="row">
<div class="span12 col-sm-12">
'.$userdetail.'
' . $userdetail . '
</div>
</div>
<div class="row">
<div class="span12 col-sm-12">
'.$usertable.'
' . $usertable . '
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit a94b33c

Please sign in to comment.