Differences Between: [Versions 39 and 403]
Class handles conditional availability information for an activity.
Copyright: | 2014 The Open University |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 226 lines (9 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
info_module:: (9 methods):
__construct()
get_thing_name()
set_in_database()
get_course_module()
get_context()
filter_user_list()
get_view_hidden_capability()
get_user_list_sql()
is_user_visible()
Class: info_module - X-Ref
Class handles conditional availability information for an activity.__construct(\cm_info $cm) X-Ref |
Constructs with item details. param: \cm_info $cm Course-module object |
get_thing_name() X-Ref |
No description |
set_in_database($availability) X-Ref |
No description |
get_course_module() X-Ref |
Gets the course-module object. Intended for use by conditions. return: \cm_info Course module |
get_context() X-Ref |
No description |
filter_user_list(array $users) X-Ref |
Tests against a user list. Users who cannot access the activity due to availability restrictions will be removed from the list. Note this only includes availability restrictions (those handled within this API) and not other ways of restricting access. This test ONLY includes conditions which are marked as being applied to user lists. For example, group conditions are included but date conditions are not included. When called on a module, this test DOES also include restrictions on the section (if any). The function operates reasonably efficiently i.e. should not do per-user database queries. It is however likely to be fairly slow. param: array $users Array of userid => object return: array Filtered version of input array |
get_view_hidden_capability() X-Ref |
No description |
get_user_list_sql($onlyactive = true) X-Ref |
No description |
is_user_visible($cmorid, $userid = 0, $checkcourse = true) X-Ref |
Checks if an activity is visible to the given user. Unlike other checks in the availability system, this check includes the $cm->visible flag. It is equivalent to $cm->uservisible. If you have already checked (or do not care whether) the user has access to the course, you can set $checkcourse to false to save it checking course access. When checking for the current user, you should generally not call this function. Instead, use get_fast_modinfo to get a cm_info object, then simply check the $cm->uservisible flag. This function is intended to obtain that information for a separate course-module object that wasn't loaded with get_fast_modinfo, or for a different user. This function has a performance cost unless the availability system is disabled, and you supply a $cm object with necessary fields, and you don't check course access. param: int|\stdClass|\cm_info $cmorid Object or id representing activity param: int $userid User id (0 = current user) param: bool $checkcourse If true, checks whether the user has course access return: bool True if the activity is visible to the specified user |