|
Moodle
2.2.1
http://www.collinsharper.com
|


Public Member Functions | |
| delete () | |
| get_attempts ($retries, $correct=false, $pageid=null, $userid=null) | |
| get_lastpageid () | |
| get_next_page ($nextpageid) | |
| add_message ($message, $class="notifyproblem", $align='center') | |
| is_accessible () | |
| start_timer () | |
| update_timer ($restart=false, $continue=false) | |
| stop_timer () | |
| has_pages () | |
| link_for_activitylink () | |
| load_page ($pageid) | |
| load_all_pages () | |
| jumpto_is_correct ($pageid, $jumpto) | |
| time_remaining ($starttime) | |
| cluster_jump ($pageid, $userid=null) | |
| get_sub_pages_of ($pageid, array $ends) | |
| is_sub_page_of_type ($pageid, array $types, array $ends) | |
Static Public Member Functions | |
| static | create ($properties) |
| static | load ($lessonid) |
Protected Member Functions | |
| get_messages () | |
| get_firstpage () | |
| get_lastpage () | |
| get_firstpageid () | |
Protected Attributes | |
| $firstpageid = null | |
| $lastpageid = null | |
| $pages = array() | |
| $loadedallpages = false | |
Definition at line 902 of file locallib.php.
| add_message | ( | $ | message, |
| $ | class = "notifyproblem", |
||
| $ | align = 'center' |
||
| ) |
Sets a message against the session for this lesson that will displayed next time the lesson processes messages
| string | $message | |
| string | $class | |
| string | $align |
Definition at line 1175 of file locallib.php.


| cluster_jump | ( | $ | pageid, |
| $ | userid = null |
||
| ) |
Interprets LESSON_CLUSTERJUMP jumpto value.
This will select a page randomly and the page selected will be inbetween a cluster page and end of clutter or end of lesson and the page selected will be a page that has not been viewed already and if any pages are within a branch table or end of branch then only 1 page within the branch table or end of branch will be randomly selected (sub clustering).
| int | $pageid | Id of the current page from which we are jumping from. |
| int | $userid | Id of the user. |
Definition at line 1403 of file locallib.php.


| static create | ( | $ | properties | ) | [static] |
Simply generates a lesson object given an array/object of properties Overrides {
| object | array | $properties |
Definition at line 939 of file locallib.php.
| delete | ( | ) |
Deletes this lesson from the database
Definition at line 961 of file locallib.php.

| get_attempts | ( | $ | retries, |
| $ | correct = false, |
||
| $ | pageid = null, |
||
| $ | userid = null |
||
| ) |
Get all of the attempts for the current user.
| int | $retries | |
| bool | $correct | Optional: only fetch correct attempts |
| int | $pageid | Optional: only fetch attempts at the given page |
| int | $userid | Optional: defaults to the current user if not set |
Definition at line 1017 of file locallib.php.


| get_firstpage | ( | ) | [protected] |
Returns the first page for the lesson or false if there isn't one.
This method should be called via the magic method __get(); $firstpage = $lesson->firstpage;
Definition at line 1042 of file locallib.php.


| get_firstpageid | ( | ) | [protected] |
Returns the id of the first page of this lesson. (prevpageid = 0)
Definition at line 1080 of file locallib.php.

| get_lastpage | ( | ) | [protected] |
Returns the last page for the lesson or false if there isn't one.
This method should be called via the magic method __get(); $lastpage = $lesson->lastpage;
Definition at line 1064 of file locallib.php.


| get_lastpageid | ( | ) |
Returns the id of the last page of this lesson. (nextpageid = 0)
Definition at line 1101 of file locallib.php.

| get_messages | ( | ) | [protected] |
Fetches messages from the session that may have been set in previous page actions.
// Do not call this method directly instead use $lesson->messages;
Definition at line 996 of file locallib.php.

| get_next_page | ( | $ | nextpageid | ) |
Gets the next page id to display after the one that is provided.
| int | $nextpageid |
Definition at line 1124 of file locallib.php.


| get_sub_pages_of | ( | $ | pageid, |
| array $ | ends | ||
| ) |
Finds all pages that appear to be a subtype of the provided pageid until an end point specified within $ends is encountered or no more pages exist
| int | $pageid | |
| array | $ends | An array of LESSON_PAGE_* types that signify an end of the subtype |
Definition at line 1503 of file locallib.php.


| has_pages | ( | ) |
Checks to see if the lesson has pages
Definition at line 1264 of file locallib.php.


| is_accessible | ( | ) |
Check if the lesson is accessible at the present time
Definition at line 1194 of file locallib.php.

| is_sub_page_of_type | ( | $ | pageid, |
| array $ | types, | ||
| array $ | ends | ||
| ) |
Checks to see if the specified page[id] is a subpage of a type specified in the $types array, until either there are no more pages of we find a type corresponding to that of a type specified in $ends
| int | $pageid | The id of the page to check |
| array | $types | An array of types that would signify this page was a subpage |
| array | $ends | An array of types that mean this is not a subpage |
Definition at line 1529 of file locallib.php.


| jumpto_is_correct | ( | $ | pageid, |
| $ | jumpto | ||
| ) |
Determines if a jumpto value is correct or not.
returns true if jumpto page is (logically) after the pageid page or if the jumpto value is a special value. Returns false in all other cases.
| int | $pageid | Id of the page from which you are jumping from. |
| int | $jumpto | The jumpto number. |
Definition at line 1334 of file locallib.php.


Returns the link for the related activity
Definition at line 1274 of file locallib.php.

| static load | ( | $ | lessonid | ) | [static] |
Generates a lesson object from the database given its id
| int | $lessonid |
Definition at line 949 of file locallib.php.

| load_all_pages | ( | ) |
Loads ALL of the pages for this lesson
Definition at line 1315 of file locallib.php.


| load_page | ( | $ | pageid | ) |
Loads the requested page.
This function will return the requested page id as either a specialised lesson_page object OR as a generic lesson_page. If the page has been loaded previously it will be returned from the pages array, otherwise it will be loaded from the database first
| int | $pageid |
Definition at line 1302 of file locallib.php.


| start_timer | ( | ) |
Starts the lesson time for the current user
Definition at line 1204 of file locallib.php.

| stop_timer | ( | ) |
Updates the timer to the current time then stops it by unsetting the user var
Definition at line 1255 of file locallib.php.

| time_remaining | ( | $ | starttime | ) |
Returns the time a user has remaining on this lesson
| int | $starttime | Starttime timestamp |
Definition at line 1369 of file locallib.php.
| update_timer | ( | $ | restart = false, |
| $ | continue = false |
||
| ) |
Updates the timer to the current time and returns the new timer object
| bool | $restart | If set to true the timer is restarted |
| bool | $continue | If set to true AND $restart=true then the timer will continue from a previous attempt |
Definition at line 1226 of file locallib.php.


$firstpageid = null [protected] |
Definition at line 909 of file locallib.php.
$lastpageid = null [protected] |
Definition at line 915 of file locallib.php.
$loadedallpages = false [protected] |
Definition at line 930 of file locallib.php.
$pages = array() [protected] |
Definition at line 924 of file locallib.php.