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

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

Detailed Description

Definition at line 902 of file locallib.php.


Member Function Documentation

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

Parameters:
string$message
string$class
string$align
Returns:
bool

Definition at line 1175 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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).

Parameters:
int$pageidId of the current page from which we are jumping from.
int$useridId of the user.
Returns:
int The id of the next page.

Definition at line 1403 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static create ( properties) [static]

Simply generates a lesson object given an array/object of properties Overrides {

See also:
lesson_base->create()}
Parameters:
object | array$properties
Returns:
lesson

Definition at line 939 of file locallib.php.

delete ( )

Deletes this lesson from the database

Definition at line 961 of file locallib.php.

Here is the call graph for this function:

get_attempts ( retries,
correct = false,
pageid = null,
userid = null 
)

Get all of the attempts for the current user.

Parameters:
int$retries
bool$correctOptional: only fetch correct attempts
int$pageidOptional: only fetch attempts at the given page
int$useridOptional: defaults to the current user if not set
Returns:
array|false

Definition at line 1017 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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;

Returns:
lesson_page|bool Returns the lesson_page specialised object or false

Definition at line 1042 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_firstpageid ( ) [protected]

Returns the id of the first page of this lesson. (prevpageid = 0)

Returns:
int

Definition at line 1080 of file locallib.php.

Here is the call graph for this function:

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;

Returns:
lesson_page|bool Returns the lesson_page specialised object or false

Definition at line 1064 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the id of the last page of this lesson. (nextpageid = 0)

Returns:
int

Definition at line 1101 of file locallib.php.

Here is the call graph for this function:

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;

Returns:
array

Definition at line 996 of file locallib.php.

Here is the call graph for this function:

get_next_page ( nextpageid)

Gets the next page id to display after the one that is provided.

Parameters:
int$nextpageid
Returns:
bool

Definition at line 1124 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
int$pageid
array$endsAn array of LESSON_PAGE_* types that signify an end of the subtype
Returns:
array An array of specialised lesson_page objects

Definition at line 1503 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

has_pages ( )

Checks to see if the lesson has pages

Definition at line 1264 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Check if the lesson is accessible at the present time

Returns:
bool True if the lesson is accessible, false otherwise

Definition at line 1194 of file locallib.php.

Here is the call graph for this function:

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

Parameters:
int$pageidThe id of the page to check
array$typesAn array of types that would signify this page was a subpage
array$endsAn array of types that mean this is not a subpage
Returns:
bool

Definition at line 1529 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
int$pageidId of the page from which you are jumping from.
int$jumptoThe jumpto number.
Returns:
boolean True or false after a series of tests.

Definition at line 1334 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the link for the related activity

Returns:
array|false

Definition at line 1274 of file locallib.php.

Here is the call graph for this function:

static load ( lessonid) [static]

Generates a lesson object from the database given its id

Parameters:
int$lessonid
Returns:
lesson

Definition at line 949 of file locallib.php.

Here is the call graph for this function:

Loads ALL of the pages for this lesson

Returns:
array An array containing all pages from this lesson

Definition at line 1315 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Parameters:
int$pageid
Returns:
lesson_page A lesson_page object or an object that extends it

Definition at line 1302 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Starts the lesson time for the current user

Returns:
bool Returns true

Definition at line 1204 of file locallib.php.

Here is the call graph for this function:

Updates the timer to the current time then stops it by unsetting the user var

Returns:
bool Returns true

Definition at line 1255 of file locallib.php.

Here is the call graph for this function:

time_remaining ( starttime)

Returns the time a user has remaining on this lesson

Parameters:
int$starttimeStarttime timestamp
Returns:
string

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

Parameters:
bool$restartIf set to true the timer is restarted
bool$continueIf set to true AND $restart=true then the timer will continue from a previous attempt
Returns:
stdClass The new timer

Definition at line 1226 of file locallib.php.

Here is the call graph for this function:

Here is the caller graph for this function:


Field Documentation

$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.


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