| Línea 171... |
Línea 171... |
| 171 |
* @param \course_modinfo $modinfo Usually leave as null for default. Specify when
|
171 |
* @param \course_modinfo $modinfo Usually leave as null for default. Specify when
|
| 172 |
* calling recursively from inside get_fast_modinfo()
|
172 |
* calling recursively from inside get_fast_modinfo()
|
| 173 |
* @return bool True if this item is available to the user, false otherwise
|
173 |
* @return bool True if this item is available to the user, false otherwise
|
| 174 |
*/
|
174 |
*/
|
| 175 |
public function is_available(&$information, $grabthelot = false, $userid = 0,
|
175 |
public function is_available(&$information, $grabthelot = false, $userid = 0,
|
| 176 |
\course_modinfo $modinfo = null) {
|
176 |
?\course_modinfo $modinfo = null) {
|
| 177 |
global $USER;
|
177 |
global $USER;
|
| Línea 178... |
Línea 178... |
| 178 |
|
178 |
|
| 179 |
// Default to no information.
|
179 |
// Default to no information.
|
| Línea 260... |
Línea 260... |
| 260 |
*
|
260 |
*
|
| 261 |
* @param \course_modinfo $modinfo Usually leave as null for default
|
261 |
* @param \course_modinfo $modinfo Usually leave as null for default
|
| 262 |
* @return string Information string (for admin) about all restrictions on
|
262 |
* @return string Information string (for admin) about all restrictions on
|
| 263 |
* this item
|
263 |
* this item
|
| 264 |
*/
|
264 |
*/
|
| 265 |
public function get_full_information(\course_modinfo $modinfo = null) {
|
265 |
public function get_full_information(?\course_modinfo $modinfo = null) {
|
| 266 |
// Do nothing if there are no availability restrictions.
|
266 |
// Do nothing if there are no availability restrictions.
|
| 267 |
if (is_null($this->availability)) {
|
267 |
if (is_null($this->availability)) {
|
| 268 |
return '';
|
268 |
return '';
|
| 269 |
}
|
269 |
}
|
| Línea 790... |
Línea 790... |
| 790 |
// Access all plugins. Normally only the completion plugin is going
|
790 |
// Access all plugins. Normally only the completion plugin is going
|
| 791 |
// to affect this value, but it's potentially possible that some other
|
791 |
// to affect this value, but it's potentially possible that some other
|
| 792 |
// plugin could also rely on the completion plugin.
|
792 |
// plugin could also rely on the completion plugin.
|
| 793 |
$pluginmanager = \core_plugin_manager::instance();
|
793 |
$pluginmanager = \core_plugin_manager::instance();
|
| 794 |
$enabled = $pluginmanager->get_enabled_plugins('availability');
|
794 |
$enabled = $pluginmanager->get_enabled_plugins('availability');
|
| 795 |
$componentparams = new \stdClass();
|
- |
|
| 796 |
foreach ($enabled as $plugin => $info) {
|
795 |
foreach ($enabled as $plugin => $info) {
|
| 797 |
// Use the static method.
|
796 |
/** @var \core_availability\condition $class */
|
| 798 |
$class = '\availability_' . $plugin . '\condition';
|
797 |
$class = '\availability_' . $plugin . '\condition';
|
| 799 |
if ($class::completion_value_used($course, $cmid)) {
|
798 |
if (class_exists($class) && $class::completion_value_used($course, $cmid)) {
|
| 800 |
return true;
|
799 |
return true;
|
| 801 |
}
|
800 |
}
|
| 802 |
}
|
801 |
}
|
| 803 |
return false;
|
802 |
return false;
|
| 804 |
}
|
803 |
}
|