Skip to content

Commit 2b836a3

Browse files
committed
Refactoring
1 parent 2b45097 commit 2b836a3

163 files changed

Lines changed: 5728 additions & 12953 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,20 @@
11
---
22
name: Bug report
3-
about: Create a report to help us improve
3+
about: Create a report to help us improve CAPQUiz
44
title: ''
55
labels: bug
66
assignees: ''
77

88
---
99

10-
**Describe the bug**
11-
A clear and concise description of what the bug is.
10+
Description:
1211

13-
**To Reproduce**
14-
Steps to reproduce the behavior:
15-
1. Go to '...'
16-
2. Click on '....'
17-
3. Scroll down to '....'
18-
4. See error
1912

20-
**Expected behavior**
21-
A clear and concise description of what you expected to happen.
13+
Reproduction steps:
14+
1. Log in as instructor / student
15+
2. ...
2216

23-
**Screenshots**
24-
If applicable, add screenshots to help explain your problem.
25-
26-
**Desktop (please complete the following information):**
27-
- OS: [e.g. iOS]
28-
- Browser [e.g. chrome, safari]
29-
- Version [e.g. 22]
30-
31-
**Smartphone (please complete the following information):**
32-
- Device: [e.g. iPhone6]
33-
- OS: [e.g. iOS8.1]
34-
- Browser [e.g. stock browser, safari]
35-
- Version [e.g. 22]
36-
37-
**Additional context**
38-
Add any other context about the problem here.
17+
Additional information:
18+
- Operating system:
19+
- Web browser:
20+
- Screenshots:
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
---
22
name: Feature request
3-
about: Suggest an idea for this project
3+
about: Suggest a new feature for CAPQuiz
44
title: ''
55
labels: enhancement
66
assignees: ''
77

88
---
99

10-
**Is your feature request related to a problem? Please describe.**
11-
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
10+
Background:
11+
- Example: I'm always frustrated when ...
1212

13-
**Describe the solution you'd like**
14-
A clear and concise description of what you want to happen.
13+
Suggested solution:
14+
- Example: Add button to do X thing on page Y
1515

16-
**Describe alternatives you've considered**
17-
A clear and concise description of any alternative solutions or features you've considered.
16+
Alternatives considered:
17+
- Example: Change default value for setting X
1818

19-
**Additional context**
20-
Add any other context or screenshots about the feature request here.
19+
Additional information:
20+
- Example: This mockup illustrates button placement

.github/workflows/main.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/moodle-ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ on: [push, pull_request]
44

55
jobs:
66
test:
7-
runs-on: ubuntu-22.04
7+
runs-on: ubuntu-latest
88

99
services:
1010
postgres:
11-
image: postgres:13
11+
image: postgres:15
1212
env:
1313
POSTGRES_USER: 'postgres'
1414
POSTGRES_HOST_AUTH_METHOD: 'trust'
@@ -31,14 +31,14 @@ jobs:
3131
fail-fast: false
3232
matrix:
3333
include:
34-
- php: '8.0'
35-
moodle-branch: 'MOODLE_403_STABLE'
34+
- php: '8.2'
35+
moodle-branch: 'MOODLE_405_STABLE'
3636
database: 'pgsql'
37-
- php: '8.1'
38-
moodle-branch: 'MOODLE_404_STABLE'
37+
- php: '8.2'
38+
moodle-branch: 'MOODLE_500_STABLE'
3939
database: 'pgsql'
40-
- php: '8.1'
41-
moodle-branch: 'MOODLE_404_STABLE'
40+
- php: '8.2'
41+
moodle-branch: 'MOODLE_500_STABLE'
4242
database: 'mariadb'
4343

4444
steps:

TODO

Lines changed: 0 additions & 26 deletions
This file was deleted.

action.php

Lines changed: 0 additions & 46 deletions
This file was deleted.

adminlib.php

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class capquiz_admin_page_manage_capquiz_plugins extends admin_externalpage {
4747
*/
4848
public function __construct(string $subtype) {
4949
$this->subtype = $subtype;
50-
$url = new moodle_url('/mod/capquiz/adminmanageplugins.php', ['subtype' => $subtype]);
50+
$url = new \core\url('/mod/capquiz/adminmanageplugins.php', ['subtype' => $subtype]);
5151
parent::__construct('manage' . $subtype . 'plugins', get_string('manage' . $subtype . 'plugins', 'capquiz'), $url);
5252
}
5353

@@ -70,7 +70,7 @@ public function search($query): array {
7070
}
7171
}
7272
if ($found) {
73-
$result = new stdClass();
73+
$result = new \stdClass();
7474
$result->page = $this;
7575
$result->settings = [];
7676
return [$this->name => $result];
@@ -80,7 +80,6 @@ public function search($query): array {
8080
}
8181
}
8282

83-
8483
/**
8584
* Class that handles the display and configuration of the list of capquiz plugins.
8685
*
@@ -91,8 +90,8 @@ public function search($query): array {
9190
*/
9291
class capquiz_plugin_manager {
9392

94-
/** @var moodle_url the url of the manage capquiz plugin page */
95-
private moodle_url $pageurl;
93+
/** @var \core\url the url of the manage capquiz plugin page */
94+
private \core\url $pageurl;
9695

9796
/** @var string report */
9897
private string $subtype;
@@ -106,7 +105,7 @@ class capquiz_plugin_manager {
106105
* @param string $subtype
107106
*/
108107
public function __construct(string $subtype) {
109-
$this->pageurl = new moodle_url('/mod/capquiz/adminmanageplugins.php', ['subtype' => $subtype]);
108+
$this->pageurl = new \core\url('/mod/capquiz/adminmanageplugins.php', ['subtype' => $subtype]);
110109
$this->subtype = $subtype;
111110
}
112111

@@ -139,8 +138,7 @@ public function execute(string $action = 'view', ?string $plugin = null): void {
139138
*/
140139
private function check_permissions(): void {
141140
require_login();
142-
$systemcontext = context_system::instance();
143-
require_capability('moodle/site:config', $systemcontext);
141+
require_capability('moodle/site:config', \core\context\system::instance());
144142
}
145143

146144
/**
@@ -219,7 +217,7 @@ public function move_plugin(string $plugintomove, string $dir): string {
219217
* @return array The list of plugins
220218
*/
221219
public function get_sorted_plugins_list(): array {
222-
$names = core_component::get_plugin_list($this->subtype);
220+
$names = \core\component::get_plugin_list($this->subtype);
223221
$result = [];
224222
foreach ($names as $name => $path) {
225223
$idx = get_config($this->subtype . '_' . $name, 'sortorder');
@@ -244,7 +242,7 @@ private function view_plugins_table(): void {
244242

245243
// Set up the table.
246244
$this->view_header();
247-
$table = new flexible_table($this->subtype . 'pluginsadminttable');
245+
$table = new \core_table\flexible_table($this->subtype . 'pluginsadminttable');
248246
$table->define_baseurl($this->pageurl);
249247
$table->define_columns(['pluginname', 'version', 'hideshow', 'order', 'settings', 'uninstall']);
250248
$table->define_headers([get_string($this->subtype . 'type', 'capquiz'),
@@ -286,8 +284,8 @@ private function view_plugins_table(): void {
286284

287285
$exists = file_exists($CFG->dirroot . '/mod/capquiz/' . $shortsubtype . '/' . $plugin . '/settings.php');
288286
if ($row[1] !== '' && $exists) {
289-
$url = new moodle_url('/admin/settings.php', ['section' => $this->subtype . '_' . $plugin]);
290-
$row[] = html_writer::link($url, get_string('settings'));
287+
$url = new \core\url('/admin/settings.php', ['section' => $this->subtype . '_' . $plugin]);
288+
$row[] = \core\output\html_writer::link($url, get_string('settings'));
291289
} else {
292290
$row[] = ' ';
293291
}
@@ -324,14 +322,14 @@ private function view_header(): void {
324322
private function format_icon_link(string $action, string $plugin, string $icon, string $alt): string {
325323
global $OUTPUT;
326324
if ($action === 'delete') {
327-
$url = core_plugin_manager::instance()->get_uninstall_url($this->subtype . '_' . $plugin, 'manage');
325+
$url = \core\plugin_manager::instance()->get_uninstall_url($this->subtype . '_' . $plugin, 'manage');
328326
if (!$url) {
329327
return ' ';
330328
}
331-
return html_writer::link($url, get_string('uninstallplugin', 'core_admin'));
329+
return \core\output\html_writer::link($url, get_string('uninstallplugin', 'core_admin'));
332330
}
333-
$url = new moodle_url($this->pageurl, ['action' => $action, 'plugin' => $plugin, 'sesskey' => sesskey()]);
334-
$icon = new pix_icon($icon, $alt, 'moodle', ['title' => $alt]);
331+
$url = new \core\url($this->pageurl, ['action' => $action, 'plugin' => $plugin, 'sesskey' => sesskey()]);
332+
$icon = new \core\output\pix_icon($icon, $alt, 'moodle', ['title' => $alt]);
335333
return $OUTPUT->action_icon($url, $icon, null, ['title' => $alt]) . ' ';
336334
}
337335

adminmanageplugins.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
require_once("../../config.php");
2727

28+
global $CFG, $PAGE;
29+
2830
require_login();
2931

3032
require_once($CFG->dirroot . '/mod/capquiz/adminlib.php');
@@ -37,7 +39,7 @@
3739
require_sesskey();
3840
}
3941

40-
$PAGE->set_context(context_system::instance());
42+
$PAGE->set_context(\core\context\system::instance());
4143

4244
$pluginmanager = new capquiz_plugin_manager($subtype);
4345
$pluginmanager->execute($action, $plugin);

amd/build/attempt.min.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

amd/build/attempt.min.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)