Moodle  2.2.1
http://www.collinsharper.com
context_helper Class Reference
Inheritance diagram for context_helper:
Collaboration diagram for context_helper:

Public Member Functions

 get_url ()
 get_capabilities ()

Static Public Member Functions

static get_class_for_level ($contextlevel)
static get_all_levels ()
static cleanup_instances ()
static create_instances ($contextlevel=null, $buildpaths=true)
static build_all_paths ($force=false)
static reset_caches ()
static get_preload_record_columns ($tablealias)
static get_preload_record_columns_sql ($tablealias)
static preload_from_record (stdClass $rec)
static preload_course ($courseid)
static delete_instance ($contextlevel, $instanceid)
static get_level_name ($contextlevel)

Protected Member Functions

 __construct ()

Detailed Description

Context maintenance and helper methods.

This is "extends context" is a bloody hack that tires to work around the deficiencies in the "protected" keyword in PHP, this helps us to hide all the internals of context level implementation from the rest of code, the code completion returns what developers need.

Thank you Tim Hunt for helping me with this nasty trick.

Author:
Petr Skoda
Since:
2.2

Definition at line 5222 of file accesslib.php.


Constructor & Destructor Documentation

__construct ( ) [protected]

Instance does not make sense here, only static use

Definition at line 5236 of file accesslib.php.


Member Function Documentation

static build_all_paths ( force = false) [static]

Rebuild paths and depths in all context levels.

Parameters:
bool$forcefalse means add missing only
Returns:
void

Definition at line 5321 of file accesslib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static cleanup_instances ( ) [static]

Remove stale contexts that belonged to deleted instances. Ideally all code should cleanup contexts properly, unfortunately accidents happen...

Returns:
void

Definition at line 5271 of file accesslib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static create_instances ( contextlevel = null,
buildpaths = true 
) [static]

Create all context instances at the given level and above.

Parameters:
int$contextlevelnull means all levels
bool$buildpaths
Returns:
void

Definition at line 5301 of file accesslib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static delete_instance ( contextlevel,
instanceid 
) [static]

Delete context instance

Parameters:
int$contextlevel
int$instanceid
Returns:
void

Definition at line 5404 of file accesslib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static get_all_levels ( ) [static]

Returns a list of all context levels

Returns:
array int=>string (level=>level class name)

Definition at line 5260 of file accesslib.php.

Here is the caller graph for this function:

not used

Reimplemented from context.

Definition at line 5437 of file accesslib.php.

static get_class_for_level ( contextlevel) [static]

Returns a class name of the context level class

Parameters:
int$contextlevel(CONTEXT_SYSTEM, etc.)
Returns:
string class name of the context class

Definition at line 5246 of file accesslib.php.

Here is the caller graph for this function:

static get_level_name ( contextlevel) [static]

Returns the name of specified context level

Parameters:
int$contextlevel
Returns:
string name of the context level

Definition at line 5423 of file accesslib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static get_preload_record_columns ( tablealias) [static]

Returns all fields necessary for context preloading from user $rec.

This helps with performance when dealing with hundreds of contexts.

Parameters:
string$tablealiascontext table alias in the query
Returns:
array (table.column=>alias, ...)

Definition at line 5347 of file accesslib.php.

Here is the caller graph for this function:

static get_preload_record_columns_sql ( tablealias) [static]

Returns all fields necessary for context preloading from user $rec.

This helps with performance when dealing with hundreds of contexts.

Parameters:
string$tablealiascontext table alias in the query
Returns:
string

Definition at line 5360 of file accesslib.php.

Here is the caller graph for this function:

get_url ( )

not used

Reimplemented from context.

Definition at line 5431 of file accesslib.php.

static preload_course ( courseid) [static]

Preload all contexts instances from course.

To be used if you expect multiple queries for course activities...

Parameters:
$courseid

Definition at line 5385 of file accesslib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static preload_from_record ( stdClass $  rec) [static]

Preloads context information from db record and strips the cached info.

The db request has to contain all columns from context_helper::get_preload_record_columns().

Parameters:
stdClass$rec
Returns:
void (modifies $rec)

Reimplemented from context.

Definition at line 5373 of file accesslib.php.

Here is the caller graph for this function:

static reset_caches ( ) [static]

Resets the cache to remove all data.

Reimplemented from context.

Definition at line 5334 of file accesslib.php.

Here is the caller graph for this function:


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations