1 | <?php |
||
36 | class condition extends \core_availability\condition { |
||
37 | |||
38 | /** |
||
39 | * Constructor. |
||
40 | * |
||
41 | * @param \stdClass $structure Data structure from JSON decode |
||
42 | * @throws \coding_exception If invalid data structure. |
||
43 | */ |
||
44 | public function __construct($structure) { |
||
61 | |||
62 | /** |
||
63 | * Returns info to be saved. |
||
64 | * @return stdClass |
||
65 | */ |
||
66 | public function save() { |
||
85 | |||
86 | /** |
||
87 | * Returns a JSON object which corresponds to a condition of this type. |
||
88 | * |
||
89 | * Intended for unit testing, as normally the JSON values are constructed |
||
90 | * by JavaScript code. |
||
91 | * |
||
92 | * @param string $businessemail The email of paypal to be credited |
||
93 | * @param string $currency The currency to charge the user |
||
94 | * @param string $cost The cost to charge the user |
||
95 | * @return stdClass Object representing condition |
||
96 | */ |
||
97 | public static function get_json($businessemail, $currency, $cost) { |
||
100 | |||
101 | /** |
||
102 | * Returns true if the user can access the context, false otherwise |
||
103 | * |
||
104 | * @param bool $not Set true if we are inverting the condition |
||
105 | * @param info $info Item we're checking |
||
106 | * @param bool $grabthelot Performance hint: if true, caches information |
||
107 | * required for all course-modules, to make the front page and similar |
||
108 | * pages work more quickly (works only for current user) |
||
109 | * @param int $userid User ID to check availability for |
||
110 | * @return bool True if available |
||
111 | */ |
||
112 | public function is_available($not, \core_availability\info $info, $grabthelot, $userid) { |
||
125 | |||
126 | /** |
||
127 | * Shows the description using the different lang strings for the standalone |
||
128 | * version or the full one. |
||
129 | * |
||
130 | * @param bool $full Set true if this is the 'full information' view |
||
131 | * @param bool $not True if NOT is in force |
||
132 | * @param \core_availability\info $info Information about the availability condition and module context |
||
133 | * @return string The string about the condition and it's status |
||
134 | */ |
||
135 | public function get_description($full, $not, \core_availability\info $info) { |
||
138 | /** |
||
139 | * Shows the description using the different lang strings for the standalone |
||
140 | * version or the full one. |
||
141 | * |
||
142 | * @param bool $not True if NOT is in force |
||
143 | * @param bool $standalone True to use standalone lang strings |
||
144 | * @param bool $info Information about the availability condition and module context |
||
145 | * @return string The string about the condition and it's status |
||
146 | */ |
||
147 | protected function get_either_description($not, $standalone, $info) { |
||
156 | |||
157 | /** |
||
158 | * Function used by backup restore |
||
159 | * |
||
160 | * @param int $restoreid |
||
161 | * @param int $courseid |
||
162 | * @param \base_logger $logger |
||
163 | * @param string $name |
||
164 | */ |
||
165 | public function update_after_restore($restoreid, $courseid, \base_logger $logger, $name) { |
||
174 | |||
175 | /** |
||
176 | * Returns a string to debug |
||
177 | * @return string |
||
178 | */ |
||
179 | protected function get_debug_string() { |
||
182 | } |
||
183 |
Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.