Moodle  2.2.1
http://www.collinsharper.com
course_modinfo Class Reference

Public Member Functions

 get_course ()
 get_course_id ()
 get_user_id ()
 get_sections ()
 get_cms ()
 get_cm ($cmid)
 get_instances ()
 get_instances_of ($modname)
 get_groups ($groupingid=0)
 __construct ($course, $userid)

Data Fields

 $courseid
 $userid
 $sections
 $cms
 $instances
 $groups

Detailed Description

Information about a course that is cached in the course table 'modinfo' field (and then in memory) in order to reduce the need for other database queries.

This includes information about the course-modules and the sections on the course. It can also include dynamic data that has been updated for the current user.

Definition at line 43 of file modinfolib.php.


Constructor & Destructor Documentation

__construct ( course,
userid 
)

Constructs based on course. Note: This constructor should not usually be called directly. Use get_fast_modinfo($course) instead as this maintains a cache.

Parameters:
object$courseMoodle course object, which may include modinfo
int$useridUser ID

Definition at line 199 of file modinfolib.php.

Here is the call graph for this function:


Member Function Documentation

get_cm ( cmid)

Obtains a single course-module object (for a course-module that is on this course).

Parameters:
int$cmidCourse-module ID
Returns:
cm_info Information about that course-module
Exceptions:
moodle_exceptionIf the course-module does not exist

Definition at line 144 of file modinfolib.php.

get_cms ( )
Returns:
array Array from course-module instance to cm_info object within this course, in order of appearance

Definition at line 134 of file modinfolib.php.

Here is the caller graph for this function:

Returns:
object Moodle course object that was used to construct this data

Definition at line 104 of file modinfolib.php.

Returns:
int Course ID

Definition at line 111 of file modinfolib.php.

Here is the caller graph for this function:

get_groups ( groupingid = 0)

Returns groups that the current user belongs to on the course. Note: If not already available, this may make a database query.

Parameters:
int$groupingidGrouping ID or 0 (default) for all groups
Returns:
array Array of int (group id) => int (same group id again); empty array if none

Definition at line 177 of file modinfolib.php.

Here is the call graph for this function:

Obtains all module instances on this course.

Returns:
array Array from module name => array from instance id => cm_info

Definition at line 155 of file modinfolib.php.

get_instances_of ( modname)

Obtains all instances of a particular module on this course.

Parameters:
$modnameName of module (not full frankenstyle) e.g. 'label'
Returns:
array Array from instance id => cm_info for modules on this course; empty if none

Definition at line 164 of file modinfolib.php.

Returns:
array Array from section number (e.g. 0) to array of course-module IDs in that section; this only includes sections that contain at least one course-module

Definition at line 126 of file modinfolib.php.

Returns:
int User ID

Definition at line 118 of file modinfolib.php.


Field Documentation

$cms

Definition at line 80 of file modinfolib.php.

Definition at line 58 of file modinfolib.php.

$groups

Definition at line 96 of file modinfolib.php.

$instances

Definition at line 87 of file modinfolib.php.

$sections

Definition at line 73 of file modinfolib.php.

Definition at line 65 of file modinfolib.php.


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