1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
// GNU General Public License for more details.
|
|
|
13 |
//
|
|
|
14 |
// You should have received a copy of the GNU General Public License
|
|
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
namespace mod_bigbluebuttonbn\local\extension;
|
|
|
17 |
|
|
|
18 |
use cm_info;
|
|
|
19 |
|
|
|
20 |
/**
|
|
|
21 |
* A class to deal with completion rules addons in a subplugin
|
|
|
22 |
*
|
|
|
23 |
* @package mod_bigbluebuttonbn
|
|
|
24 |
* @copyright 2023 onwards, Blindside Networks Inc
|
|
|
25 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
26 |
* @author Laurent David (laurent@call-learning.fr)
|
|
|
27 |
*/
|
|
|
28 |
abstract class custom_completion_addons {
|
|
|
29 |
/** @var cm_info The course module information object. */
|
|
|
30 |
protected $cm;
|
|
|
31 |
|
|
|
32 |
/** @var int The user's ID. */
|
|
|
33 |
protected $userid;
|
|
|
34 |
|
|
|
35 |
/** @var array The current state of core completion */
|
|
|
36 |
protected $completionstate;
|
|
|
37 |
|
|
|
38 |
/**
|
|
|
39 |
* activity_custom_completion constructor.
|
|
|
40 |
*
|
|
|
41 |
* @param cm_info $cm
|
|
|
42 |
* @param int $userid
|
|
|
43 |
* @param array|null $completionstate The current state of the core completion criteria
|
|
|
44 |
*/
|
|
|
45 |
public function __construct(cm_info $cm, int $userid, ?array $completionstate = null) {
|
|
|
46 |
$this->cm = $cm;
|
|
|
47 |
$this->userid = $userid;
|
|
|
48 |
$this->completionstate = $completionstate;
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
/**
|
|
|
52 |
* Fetches the completion state for a given completion rule.
|
|
|
53 |
*
|
|
|
54 |
* @param string $rule The completion rule.
|
|
|
55 |
* @return int The completion state.
|
|
|
56 |
*/
|
|
|
57 |
abstract public function get_state(string $rule): int;
|
|
|
58 |
|
|
|
59 |
/**
|
|
|
60 |
* Fetch the list of custom completion rules that this module defines.
|
|
|
61 |
*
|
|
|
62 |
* @return array
|
|
|
63 |
*/
|
|
|
64 |
abstract public static function get_defined_custom_rules(): array;
|
|
|
65 |
|
|
|
66 |
/**
|
|
|
67 |
* Returns an associative array of the descriptions of custom completion rules.
|
|
|
68 |
*
|
|
|
69 |
* @return array
|
|
|
70 |
*/
|
|
|
71 |
abstract public function get_custom_rule_descriptions(): array;
|
|
|
72 |
|
|
|
73 |
/**
|
|
|
74 |
* Returns an array of all completion rules, in the order they should be displayed to users.
|
|
|
75 |
*
|
|
|
76 |
* @return array
|
|
|
77 |
*/
|
|
|
78 |
abstract public function get_sort_order(): array;
|
|
|
79 |
}
|