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

Public Member Functions

 __construct (moodle_page $page)
 set_userid_for_parent_checks ($userid)
 initialise ()
 load_generic_course_sections (stdClass $course, navigation_node $coursenode, $courseformat='unknown')
 extend_for_user ($user)
 get_extending_users ()
 add_course (stdClass $course, $forcegeneric=false, $ismycourse=false)
 add_course_essentials ($coursenode, stdClass $course)
 add_front_page_course_essentials (navigation_node $coursenode, stdClass $course)
 clear_cache ()
 set_expansion_limit ($type)
 get ($key, $type=null)
 find ($key, $type)

Protected Member Functions

 show_categories ()
 format_display_course_content ($format)
 load_all_courses ($categoryids=null)
 load_all_categories ($categoryid=null, $showbasecategories=false)
 add_category (stdClass $category, navigation_node $parent)
 load_course (stdClass $course)
 load_course_sections (stdClass $course, navigation_node $coursenode)
 generate_sections_and_activities (stdClass $course)
 load_section_activities (navigation_node $sectionnode, $sectionnumber, $activities)
 load_stealth_activity (navigation_node $coursenode, $modinfo)
 load_activity ($cm, stdClass $course, navigation_node $activity)
 load_for_user ($user=null, $forceforcontext=false)

Static Protected Member Functions

static module_extends_navigation ($modname)

Protected Attributes

 $page
 $initialised = false
 $mycourses = array()
 $rootnodes = array()
 $showemptysections = false
 $showcategories = null
 $extendforuser = array()
 $cache
 $addedcourses = array()
 $addedcategories = array()
 $expansionlimit = 0
 $useridtouseforparentchecks = 0

Detailed Description

Definition at line 928 of file navigationlib.php.


Constructor & Destructor Documentation

__construct ( moodle_page page)

Constructs a new global navigation

Parameters:
moodle_page$pageThe page this navigation object belongs to

Reimplemented in exposed_global_navigation.

Definition at line 962 of file navigationlib.php.

Here is the call graph for this function:


Member Function Documentation

add_category ( stdClass $  category,
navigation_node parent 
) [protected]

Adds a structured category to the navigation in the correct order/place

Parameters:
stdClass$category
navigation_node$parent

Definition at line 1534 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

add_course ( stdClass $  course,
forcegeneric = false,
ismycourse = false 
)

Adds the given course to the navigation structure.

Parameters:
stdClass$course
Returns:
navigation_node

Definition at line 2166 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

add_course_essentials ( coursenode,
stdClass $  course 
)

Adds essential course nodes to the navigation for the given course.

This method adds nodes such as reports, blogs and participants

Parameters:
navigation_node$coursenode
stdClass$course
Returns:
bool

Definition at line 2251 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

add_front_page_course_essentials ( navigation_node coursenode,
stdClass $  course 
)

This generates the the structure of the course that won't be generated when the modules and sections are added.

Things such as the reports branch, the participants branch, blogs... get added to the course node by this method.

Parameters:
navigation_node$coursenode
stdClass$course
Returns:
bool True for successfull generation

Definition at line 2319 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Clears the navigation cache

Definition at line 2387 of file navigationlib.php.

extend_for_user ( user)

Extends the navigation for the given user.

Parameters:
stdClass$userA user from the database

Definition at line 2148 of file navigationlib.php.

find ( key,
type 
)

Searches this nodes children and thier children to find a navigation node with the matching key and type.

This method is recursive and searches children so until either a node is found of there are no more nodes to search.

If you know that the node being searched for is a child of this node then use the {

See also:
get()} method instead.

Note: If you are trying to set the active node {

See also:
navigation_node::override_active_url()} may be of more use to you.
Parameters:
string | int$keyThe key of the node you wish to receive.
int$typeOne of navigation_node::TYPE_*
Returns:
navigation_node|false

Reimplemented from navigation_node.

Definition at line 2461 of file navigationlib.php.

format_display_course_content ( format) [protected]

Checks the course format to see whether it wants the navigation to load additional information for the course.

This function utilises a callback that can exist within the course format lib.php file The callback should be a function called: callback_{formatname}_display_content() It doesn't get any arguments and should return true if additional content is desired. If the callback doesn't exist we assume additional content is wanted.

Parameters:
string$formatThe course format
Returns:
bool

Definition at line 1368 of file navigationlib.php.

Here is the caller graph for this function:

generate_sections_and_activities ( stdClass $  course) [protected]

Generates an array of sections and an array of activities for the given course.

This method uses the cache to improve performance and avoid the get_fast_modinfo call

Parameters:
stdClass$course
Returns:
array Array($sections, $activities)

Definition at line 1608 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get ( key,
type = null 
)

Attempts to get the navigation with the given key from this nodes children.

This function only looks at this nodes children, it does NOT look recursivily. If the node can't be found then false is returned.

If you need to search recursivily then use the {

See also:
find()} method.

Note: If you are trying to set the active node {

See also:
navigation_node::override_active_url()} may be of more use to you.
Parameters:
string | int$keyThe key of the node you wish to receive.
int$typeOne of navigation_node::TYPE_*
Returns:
navigation_node|false

Reimplemented from navigation_node.

Definition at line 2437 of file navigationlib.php.

Returns all of the users the navigation is being extended for

Returns:
array

Definition at line 2157 of file navigationlib.php.

Initialises the navigation object.

This causes the navigation object to look at the current state of the page that it is associated with and then load the appropriate content.

This should only occur the first time that the navigation structure is utilised which will normally be either when the navbar is called to be displayed or when a block makes use of it.

Returns:
bool

Reimplemented in global_navigation_for_ajax.

Definition at line 1021 of file navigationlib.php.

Here is the call graph for this function:

load_activity ( cm,
stdClass $  course,
navigation_node activity 
) [protected]

Loads the navigation structure for the given activity into the activities node.

This method utilises a callback within the modules lib.php file to load the content specific to activity given.

The callback is a method: {modulename}_extend_navigation() Examples: * {

See also:
forum_extend_navigation()} * {
workshop_extend_navigation()}
Parameters:
cm_info | stdClass$cm
stdClass$course
navigation_node$activity
Returns:
bool

Definition at line 1841 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

load_all_categories ( categoryid = null,
showbasecategories = false 
) [protected]

Loads all categories (top level or if an id is specified for that category)

Parameters:
int$categoryidThe category id to load or null/0 to load all base level categories
bool$showbasecategoriesIf set to true all base level categories will be loaded as well as the requested category and any parent categories.
Returns:
void

Definition at line 1435 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

load_all_courses ( categoryids = null) [protected]

Loads of the the courses in Moodle into the navigation.

moodle_database $DB

Parameters:
string | array$categoryidsEither a string or array of category ids to load courses for
Returns:
array An array of navigation_node

Definition at line 1388 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

load_course ( stdClass $  course) [protected]

Loads the given course into the navigation

Parameters:
stdClass$course
Returns:
navigation_node

Definition at line 1558 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

load_course_sections ( stdClass $  course,
navigation_node coursenode 
) [protected]

Loads all of the courses section into the navigation.

This function utilisies a callback that can be implemented within the course formats lib.php file to customise the navigation that is generated at this point for the course.

By default (if not defined) the method {

See also:
load_generic_course_sections} is called instead.
Parameters:
stdClass$courseDatabase record for the course
navigation_node$coursenodeThe course node within the navigation
Returns:
array Array of navigation nodes for the section with key = section id

Definition at line 1582 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

load_for_user ( user = null,
forceforcontext = false 
) [protected]

Loads user specific information into the navigation in the appropriate place.

If no user is provided the current user is assumed.

Parameters:
stdClass$user
bool$forceforcontextprobably force something to be loaded somewhere (ask SamH if not sure what this means)
Returns:
bool

Definition at line 1882 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

load_generic_course_sections ( stdClass $  course,
navigation_node coursenode,
courseformat = 'unknown' 
)

Generically loads the course sections into the course's navigation.

Parameters:
stdClass$course
navigation_node$coursenode
string$courseformatThe course format
Returns:
array An array of course section nodes

Definition at line 1672 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

load_section_activities ( navigation_node sectionnode,
sectionnumber,
activities 
) [protected]

Loads all of the activities for a section into the navigation structure.

Todo:
2.2 - $activities should always be an array and we should no longer check for it being a course_modinfo object
Parameters:
navigation_node$sectionnode
int$sectionnumber
course_modinfo$modinfoObject returned from {
See also:
get_fast_modinfo()}
Returns:
array Array of activity nodes

Definition at line 1738 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

load_stealth_activity ( navigation_node coursenode,
modinfo 
) [protected]

Loads a stealth module from unavailable section

Parameters:
navigation_node$coursenode
stdClass$modinfo
Returns:
navigation_node or null if not accessible

Definition at line 1800 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static module_extends_navigation ( modname) [static, protected]

This method simply checks to see if a given module can extend the navigation.

TODO: A shared caching solution should be used to save details on what extends navigation

Parameters:
string$modname
Returns:
bool

Definition at line 2129 of file navigationlib.php.

set_expansion_limit ( type)

Sets an expansion limit for the navigation

The expansion limit is used to prevent the display of content that has a type greater than the provided $type.

Can be used to ensure things such as activities or activity content don't get shown on the navigation. They are still generated in order to ensure the navbar still makes sense.

Parameters:
int$typeOne of navigation_node::TYPE_*
Returns:
<type>

Definition at line 2404 of file navigationlib.php.

Mutator to set userid to allow parent to see child's profile page navigation. See MDL-25805 for initial issue. Linked to it is an issue explaining why this is a REALLY UGLY HACK thats not for you to use!

Parameters:
int$useriduserid of profile page that parent wants to navigate around.

Definition at line 1004 of file navigationlib.php.

show_categories ( ) [protected]

Returns true is courses should be shown within categories on the navigation.

Returns:
bool

Definition at line 1347 of file navigationlib.php.

Here is the caller graph for this function:


Field Documentation

$addedcategories = array() [protected]

Definition at line 951 of file navigationlib.php.

$addedcourses = array() [protected]

Definition at line 949 of file navigationlib.php.

$cache [protected]

Definition at line 947 of file navigationlib.php.

$expansionlimit = 0 [protected]

Definition at line 953 of file navigationlib.php.

$extendforuser = array() [protected]

Definition at line 945 of file navigationlib.php.

$initialised = false [protected]

Definition at line 935 of file navigationlib.php.

$mycourses = array() [protected]

Definition at line 937 of file navigationlib.php.

$page [protected]

Definition at line 933 of file navigationlib.php.

$rootnodes = array() [protected]

Definition at line 939 of file navigationlib.php.

$showcategories = null [protected]

Definition at line 943 of file navigationlib.php.

$showemptysections = false [protected]

Definition at line 941 of file navigationlib.php.

$useridtouseforparentchecks = 0 [protected]

Definition at line 955 of file navigationlib.php.


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