(no description)
File Size: | 484 lines (16 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
context_helper:: (20 methods):
reset_levels()
init_levels()
parse_external_level()
resolve_behat_reference()
get_class_for_level()
get_all_levels()
get_child_levels()
get_compatible_levels()
cleanup_instances()
create_instances()
build_all_paths()
reset_caches()
get_preload_record_columns()
get_preload_record_columns_sql()
preload_from_record()
preload_contexts_by_id()
preload_course()
delete_instance()
get_level_name()
get_navigation_filter_context()
Class: context_helper - X-Ref
Context maintenance and helper methods.reset_levels() X-Ref |
Reset internal context levels array. |
init_levels() X-Ref |
Initialise context levels, call before using self::$alllevels. |
parse_external_level($extlevel) X-Ref |
Converts legacy context_* class name to new class name. NOTE: this is needed for external API which uses short context names. param: int|string $extlevel return: string|null context class name or null if not found |
resolve_behat_reference(string $level, string $reference) X-Ref |
Resolve reference to context used in behat feature files. param: string $level param: string $reference return: context|null |
get_class_for_level(int $contextlevel) X-Ref |
Returns a class name of the context level class param: int $contextlevel (CONTEXT_SYSTEM, etc.) return: string class name of the context class |
get_all_levels() X-Ref |
Returns a list of all context levels return: array int=>string (level=>level class name) |
get_child_levels(int $parentlevel) X-Ref |
Get list of possible child levels for given level. param: int $parentlevel return: int[] list of context levels that my be children of given context level. |
get_compatible_levels(string $archetype) X-Ref |
Returns context levels that compatible with role archetype assignments. param: string $archetype return: array |
cleanup_instances() X-Ref |
Remove stale contexts that belonged to deleted instances. Ideally all code should cleanup contexts properly, unfortunately accidents happen... return: void |
create_instances($contextlevel = null, $buildpaths = true) X-Ref |
Create all context instances at the given level and above. param: int $contextlevel null means all levels param: bool $buildpaths return: void |
build_all_paths($force = false) X-Ref |
Rebuild paths and depths in all context levels. param: bool $force false means add missing only return: void |
reset_caches() X-Ref |
Resets the cache to remove all data. |
get_preload_record_columns($tablealias) X-Ref |
Returns all fields necessary for context preloading from user $rec. This helps with performance when dealing with hundreds of contexts. param: string $tablealias context table alias in the query return: array (table.column=>alias, ...) |
get_preload_record_columns_sql($tablealias) X-Ref |
Returns all fields necessary for context preloading from user $rec. This helps with performance when dealing with hundreds of contexts. param: string $tablealias context table alias in the query return: string |
preload_from_record(stdClass $rec) X-Ref |
Preloads context cache with information from db record and strips the cached info. The db request has to contain all columns from context_helper::get_preload_record_columns(). param: stdClass $rec return: void This is intentional. See MDL-37115. You will need to get the context |
preload_contexts_by_id(array $contextids) X-Ref |
Preload a set of contexts using their contextid. param: array $contextids |
preload_course($courseid) X-Ref |
Preload all contexts instances from course. To be used if you expect multiple queries for course activities... param: int $courseid |
delete_instance($contextlevel, $instanceid) X-Ref |
Delete context instance param: int $contextlevel param: int $instanceid return: void |
get_level_name($contextlevel) X-Ref |
Returns the name of specified context level param: int $contextlevel return: string name of the context level |
get_navigation_filter_context(?context $context) X-Ref |
Gets the current context to be used for navigation tree filtering. param: context|null $context The current context to be checked against. return: context|null the context that navigation tree filtering should use. |