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

Public Member Functions

 has_view ()
 get_url ()
 get_content ()
 get_extra_classes ()
 get_on_click ()
 get_custom_data ()
 get_after_link ()
 get_after_edit_icons ()
 get_icon_url ($output=null)
 get_modinfo ()
 get_course ()
 set_content ($content)
 set_extra_classes ($extraclasses)
 set_icon_url (moodle_url $iconurl)
 set_on_click ($onclick)
 set_after_link ($afterlink)
 set_after_edit_icons ($afterediticons)
 set_name ($name)
 set_no_view_link ()
 set_user_visible ($uservisible)
 set_available ($available, $showavailability=0, $availableinfo='')
 __construct (course_modinfo $modinfo, $course, $mod, $info)
 obtain_dynamic_data ()

Data Fields

const STATE_BASIC = 0
const STATE_DYNAMIC = 1
const STATE_VIEW = 2
 $id
 $instance
 $course
 $idnumber
 $added
 $score
 $visible
 $visibleold
 $groupmode
 $groupingid
 $groupmembersonly
 $indent
 $completion
 $completiongradeitemnumber
 $completionview
 $completionexpected
 $availablefrom
 $availableuntil
 $showavailability
 $showdescription
 $extra
 $icon
 $iconcomponent
 $modname
 $module
 $name
 $sectionnum
 $section
 $conditionscompletion
 $conditionsgrade
 $modplural
 $available
 $availableinfo
 $uservisible
 $context

Detailed Description

Data about a single module on a course. This contains most of the fields in the course_modules table, plus additional data when required.

This object has many public fields; code should treat all these fields as read-only and set data only using the supplied set functions. Setting the fields directly is not supported and may cause problems later.

Definition at line 286 of file modinfolib.php.


Constructor & Destructor Documentation

__construct ( course_modinfo modinfo,
course,
mod,
info 
)

Constructor should not be called directly; use get_fast_modinfo.

Parameters:
course_modinfo$modinfoParent object
object$courseCourse row
object$modModule object from the modinfo field of course table
object$infoEntire object from modinfo field of course table

Definition at line 863 of file modinfolib.php.

Here is the call graph for this function:


Member Function Documentation

Note: Will collect view data, if not already obtained.

Returns:
string Extra HTML code to display after editing icons (e.g. more icons)

Definition at line 669 of file modinfolib.php.

Note: Will collect view data, if not already obtained.

Returns:
string Extra HTML code to display after link

Definition at line 660 of file modinfolib.php.

Obtains content to display on main (view) page. Note: Will collect view data, if not already obtained.

Returns:
string Content to display on main page below link, or empty string if none

Definition at line 627 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 717 of file modinfolib.php.

Here is the caller graph for this function:

Returns:
mixed Optional custom data stored in modinfo cache for this activity, or null if none

Definition at line 652 of file modinfolib.php.

Note: Will collect view data, if not already obtained.

Returns:
string Extra CSS classes to add to html output for this activity on main page

Definition at line 636 of file modinfolib.php.

get_icon_url ( output = null)
Parameters:
moodle_core_renderer$outputOutput render to use, or null for default (global)
Returns:
moodle_url Icon URL for a suitable icon to put beside this cm

Definition at line 678 of file modinfolib.php.

Returns:
course_modinfo Modinfo object that this came from

Definition at line 710 of file modinfolib.php.

Here is the caller graph for this function:

Returns:
string Content of HTML on-click attribute. This string will be used literally as a string so should be pre-escaped.

Definition at line 645 of file modinfolib.php.

get_url ( )
Returns:
moodle_url URL to link to for this module, or null if it doesn't have a view page

Definition at line 618 of file modinfolib.php.

Here is the caller graph for this function:

has_view ( )
Returns:
bool True if this module has a 'view' page that should be linked to in navigation etc (note: modules may still have a view.php file, but return false if this is not intended to be linked to from 'normal' parts of the interface; this is what label does).

Definition at line 611 of file modinfolib.php.

If dynamic data for this course-module is not yet available, gets it.

This function is automatically called when constructing course_modinfo, so users don't need to call it.

Dynamic data is data which does not come directly from the cache but is calculated at runtime based on the current user. Primarily this concerns whether the user can access the module or not.

As part of this function, the module's _cm_info_dynamic function from its lib.php will be called (if it exists).

Returns:
void

Definition at line 959 of file modinfolib.php.

set_after_edit_icons ( afterediticons)

Sets HTML that displays after edit icons on course view page.

Parameters:
string$afterediticonsHTML string (empty string if none)
Returns:
void

Definition at line 780 of file modinfolib.php.

set_after_link ( afterlink)

Sets HTML that displays after link on course view page.

Parameters:
string$afterlinkHTML string (empty string if none)
Returns:
void

Definition at line 771 of file modinfolib.php.

Here is the caller graph for this function:

set_available ( available,
showavailability = 0,
availableinfo = '' 
)

Sets the 'available' flag and related details. This flag is normally used to make course modules unavailable until a certain date or condition is met. (When a course module is unavailable, it is still visible to users who have viewhiddenactivities permission.)

When this is function is called, user-visible status is recalculated automatically.

Note: May not be called from _cm_info_view (only _cm_info_dynamic).

Parameters:
bool$availableFalse if this item is not 'available'
int$showavailability0 = do not show this item at all if it's not available, 1 = show this item greyed out with the following message
string$availableinfoInformation about why this is not available which displays to those who have viewhiddenactivities, and to everyone if showavailability is set; note that this function replaces the existing data (if any)
Returns:
void

Definition at line 834 of file modinfolib.php.

set_content ( content)

Sets content to display on course view page below link (if present).

Parameters:
string$contentNew content as HTML string (empty string if none)
Returns:
void

Definition at line 729 of file modinfolib.php.

set_extra_classes ( extraclasses)

Sets extra classes to include in CSS.

Parameters:
string$extraclassesExtra classes (empty string if none)
Returns:
void

Definition at line 738 of file modinfolib.php.

set_icon_url ( moodle_url iconurl)

Sets the external full url that points to the icon being used by the activity. Useful for external-tool modules (lti...) If set, takes precedence over $icon and $iconcomponent

Parameters:
moodle_url$iconurlfull external url pointing to icon image for activity
Returns:
void

Definition at line 750 of file modinfolib.php.

set_name ( name)

Changes the name (text of link) for this module instance. Note: May not be called from _cm_info_view (only _cm_info_dynamic).

Parameters:
string$nameName of activity / link text
Returns:
void

Definition at line 790 of file modinfolib.php.

Turns off the view link for this module instance. Note: May not be called from _cm_info_view (only _cm_info_dynamic).

Returns:
void

Definition at line 800 of file modinfolib.php.

set_on_click ( onclick)

Sets value of on-click attribute for JavaScript. Note: May not be called from _cm_info_view (only _cm_info_dynamic).

Parameters:
string$onclickNew onclick attribute which should be HTML-escaped (empty string if none)
Returns:
void

Definition at line 761 of file modinfolib.php.

set_user_visible ( uservisible)

Sets the 'uservisible' flag. This can be used (by setting false) to prevent access and display of this module link for the current user. Note: May not be called from _cm_info_view (only _cm_info_dynamic).

Parameters:
bool$uservisible
Returns:
void

Definition at line 812 of file modinfolib.php.


Field Documentation

$added

Definition at line 346 of file modinfolib.php.

$available

Definition at line 537 of file modinfolib.php.

$availablefrom

Definition at line 431 of file modinfolib.php.

$availableinfo

Definition at line 545 of file modinfolib.php.

$availableuntil

Definition at line 438 of file modinfolib.php.

$completion

Definition at line 403 of file modinfolib.php.

$completionexpected

Definition at line 424 of file modinfolib.php.

$completiongradeitemnumber

Definition at line 411 of file modinfolib.php.

$completionview

Definition at line 417 of file modinfolib.php.

$conditionscompletion

Definition at line 515 of file modinfolib.php.

$conditionsgrade

Definition at line 522 of file modinfolib.php.

Definition at line 560 of file modinfolib.php.

Definition at line 333 of file modinfolib.php.

$extra

Definition at line 462 of file modinfolib.php.

$groupingid

Definition at line 382 of file modinfolib.php.

$groupmembersonly

Definition at line 390 of file modinfolib.php.

Definition at line 376 of file modinfolib.php.

$icon

Definition at line 468 of file modinfolib.php.

$iconcomponent

Definition at line 474 of file modinfolib.php.

$id

Definition at line 321 of file modinfolib.php.

Definition at line 340 of file modinfolib.php.

$indent

Definition at line 396 of file modinfolib.php.

Definition at line 327 of file modinfolib.php.

Definition at line 481 of file modinfolib.php.

$modplural

Definition at line 530 of file modinfolib.php.

$module

Definition at line 487 of file modinfolib.php.

$name

Definition at line 494 of file modinfolib.php.

Definition at line 355 of file modinfolib.php.

$section

Definition at line 507 of file modinfolib.php.

$sectionnum

Definition at line 501 of file modinfolib.php.

$showavailability

Definition at line 446 of file modinfolib.php.

$showdescription

Definition at line 454 of file modinfolib.php.

$uservisible

Definition at line 553 of file modinfolib.php.

$visible

Definition at line 362 of file modinfolib.php.

$visibleold

Definition at line 369 of file modinfolib.php.

const STATE_BASIC = 0

State: Only basic data from modinfo cache is available.

Definition at line 290 of file modinfolib.php.

const STATE_DYNAMIC = 1

State: Dynamic data is available too.

Definition at line 295 of file modinfolib.php.

const STATE_VIEW = 2

State: View data (for course page) is available.

Definition at line 300 of file modinfolib.php.


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