Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/lesson/lib.php File Reference

Go to the source code of this file.

Namespaces

namespace  mod
 

Local Library of functions for module scorm.


Functions

 lesson_add_instance ($data, $mform)
 lesson_update_instance ($data, $mform)
 lesson_delete_instance ($id)
 lesson_delete_course ($course, $feedback=true)
 lesson_user_outline ($course, $user, $mod, $lesson)
 lesson_user_complete ($course, $user, $mod, $lesson)
 lesson_print_overview ($courses, &$htmlarray)
 lesson_cron ()
 lesson_get_user_grades ($lesson, $userid=0)
 lesson_update_grades ($lesson, $userid=0, $nullifnone=true)
 lesson_upgrade_grades ()
 lesson_grade_item_update ($lesson, $grades=NULL)
 lesson_grade_item_delete ($lesson)
 lesson_get_participants ($lessonid)
 lesson_get_view_actions ()
 lesson_get_post_actions ()
 lesson_process_pre_save (&$lesson)
 lesson_process_post_save (&$lesson)
 lesson_reset_course_form_definition (&$mform)
 lesson_reset_course_form_defaults ($course)
 lesson_reset_gradebook ($courseid, $type='')
 lesson_reset_userdata ($data)
 lesson_get_extra_capabilities ()
 lesson_supports ($feature)
 lesson_extend_navigation ($navigation, $course, $module, $cm)
 lesson_extend_settings_navigation ($settings, $lessonnode)
 lesson_get_import_export_formats ($type)
 lesson_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload)
 lesson_get_file_areas ()
 lesson_get_file_info ($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename)
 lesson_page_type_list ($pagetype, $parentcontext, $currentcontext)

Function Documentation

lesson_add_instance ( data,
mform 
)

Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will create a new instance and return the id number of the new instance.

object object

Parameters:
object$lessonLesson post data from the form
Returns:
int

Definition at line 42 of file lib.php.

Here is the call graph for this function:

Function to be run periodically according to the moodle cron This function searches for things that need to be done, such as sending out mail, toggling flags etc ... stdClass

Returns:
bool true

Definition at line 328 of file lib.php.

lesson_delete_course ( course,
feedback = true 
)

Given a course object, this function will clean up anything that would be leftover after all the instances were deleted

object

Parameters:
object$coursean object representing the course that is being deleted
boolean$feedbackto specify if the process must output a summary of its work
Returns:
boolean

Definition at line 139 of file lib.php.

Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it.

object

Parameters:
int$id
Returns:
bool

Definition at line 121 of file lib.php.

lesson_extend_navigation ( navigation,
course,
module,
cm 
)

This function extends the global navigation for the site. It is important to note that you should not rely on PAGE objects within this body of code as there is no guarantee that during an AJAX request they are available

Parameters:
navigation_node$navigationThe lesson node within the global navigation
stdClass$courseThe course object returned from the DB
stdClass$moduleThe module object returned from the DB
stdClass$cmThe course module instance returned from the DB

This is currently just a stub so that it can be easily expanded upon. When expanding just remove this comment and the line below and then add you content.

Definition at line 803 of file lib.php.

lesson_extend_settings_navigation ( settings,
lessonnode 
)

This function extends the settings navigation block for the site.

It is safe to rely on PAGE here as we will only ever be within the module context when this is called

Parameters:
settings_navigation$settings
navigation_node$lessonnode

Definition at line 821 of file lib.php.

Here is the call graph for this function:

Returns all other caps used in module

Returns:
array

Definition at line 763 of file lib.php.

Returns an array of file areas

Returns:
array

Definition at line 946 of file lib.php.

Here is the caller graph for this function:

lesson_get_file_info ( browser,
areas,
course,
cm,
context,
filearea,
itemid,
filepath,
filename 
)

Returns a file_info_stored object for the file being requested here

<type> $CFG

Parameters:
file_browse$browser
array$areas
object$course
object$cm
object$context
string$filearea
int$itemid
string$filepath
string$filename
Returns:
file_info_stored

Definition at line 969 of file lib.php.

Here is the call graph for this function:

Get list of available import or export formats

Copied and modified from lib/questionlib.php

Parameters:
string$type'import' if import list, otherwise export list assumed
Returns:
array sorted list of import/export formats available

Definition at line 861 of file lib.php.

Here is the call graph for this function:

lesson_get_participants ( lessonid)

Must return an array of user records (all data) who are participants for a given instance of lesson. Must include every user involved in the instance, independent of his role (student, teacher, admin...)

Todo:
: deprecated - to be deleted in 2.2
Parameters:
int$lessonid
Returns:
array

Definition at line 536 of file lib.php.

Returns:
array

Definition at line 561 of file lib.php.

lesson_get_user_grades ( lesson,
userid = 0 
)

Return grade for given user or all users.

stdClass object

Parameters:
int$lessonidid of lesson
int$useridoptional user id, 0 means all users
Returns:
array array of grades, false if none

Definition at line 343 of file lib.php.

Here is the caller graph for this function:

Returns:
array

Definition at line 554 of file lib.php.

lesson_grade_item_delete ( lesson)

Delete grade item for given lesson

stdClass

Parameters:
object$lessonobject
Returns:
object lesson

Definition at line 520 of file lib.php.

lesson_grade_item_update ( lesson,
grades = NULL 
)

Create grade item for given lesson

stdClass GRADE_TYPE_VALUE GRADE_TYPE_NONE

Parameters:
object$lessonobject with extra cmidnumber
array | object$gradesoptional array/object of grade(s); 'reset' means reset grades in gradebook
Returns:
int 0 if ok, error code otherwise

Definition at line 463 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

lesson_page_type_list ( pagetype,
parentcontext,
currentcontext 
)

Return a list of page types

Parameters:
string$pagetypecurrent page type
stdClass$parentcontextBlock's parent context
stdClass$currentcontextCurrent context of block

Definition at line 993 of file lib.php.

lesson_pluginfile ( course,
cm,
context,
filearea,
args,
forcedownload 
)

Serves the lesson attachments. Implements needed access control ;-)

Parameters:
object$course
object$cm
object$context
string$filearea
array$args
bool$forcedownload
Returns:
bool false if file not found, does not return if found - justsend the file

Definition at line 900 of file lib.php.

Here is the call graph for this function:

lesson_print_overview ( courses,
&$  htmlarray 
)

Prints lesson summaries on MyMoodle Page

Prints lesson name, due date and attempt information on lessons that have a deadline that has not already passed and it is available for taking.

object stdClass object CONTEXT_MODULE

Parameters:
array$coursesAn array of course objects to get lesson instances from
array$htmlarrayStore overview output array( course ID => 'lesson' => HTML output )
Returns:
void

Get Necessary Strings

Definition at line 267 of file lib.php.

Here is the call graph for this function:

lesson_process_post_save ( &$  lesson)

Runs any processes that must be run after a lesson insert/update

object

Parameters:
object$lessonLesson form data
Returns:
void

Definition at line 626 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

lesson_process_pre_save ( &$  lesson)

Runs any processes that must run before a lesson insert/update

object

Parameters:
object$lessonLesson form data
Returns:
void

Definition at line 573 of file lib.php.

Here is the caller graph for this function:

Course reset form defaults.

Parameters:
object$course
Returns:
array

Definition at line 690 of file lib.php.

Implementation of the function for printing the form elements that control whether the course reset functionality affects the lesson.

Parameters:
$mformform passed by reference

Definition at line 680 of file lib.php.

lesson_reset_gradebook ( courseid,
type = '' 
)

Removes all grades from gradebook

stdClass object

Parameters:
int$courseid
stringoptional type

Definition at line 702 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

lesson_reset_userdata ( data)

Actual implementation of the reset course functionality, delete all the lesson attempts for course $data->courseid.

stdClass object

Parameters:
object$datathe data submitted from the reset course.
Returns:
array status array

updating dates - shift may be negative too

Definition at line 725 of file lib.php.

Here is the call graph for this function:

lesson_supports ( feature)

FEATURE_GROUPS FEATURE_GROUPINGS FEATURE_GROUPMEMBERSONLY FEATURE_MOD_INTRO FEATURE_COMPLETION_TRACKS_VIEWS FEATURE_GRADE_HAS_GRADE FEATURE_GRADE_OUTCOMES

Parameters:
string$featureFEATURE_xx constant for requested feature
Returns:
mixed True if module supports feature, false if not, null if doesn't know

Definition at line 778 of file lib.php.

lesson_update_grades ( lesson,
userid = 0,
nullifnone = true 
)

Update grades in central gradebook

stdclass object

Parameters:
object$lesson
int$useridspecific user only, 0 means all
bool$nullifnone

Definition at line 402 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

lesson_update_instance ( data,
mform 
)

Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will update an existing instance with new data.

object

Parameters:
object$lessonLesson post data from the form
Returns:
boolean

Definition at line 78 of file lib.php.

Here is the call graph for this function:

Update all grades in gradebook.

object

Definition at line 428 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

lesson_user_complete ( course,
user,
mod,
lesson 
)

Print a detailed representation of what a user has done with a given particular instance of this module, for user activity reports.

object

Parameters:
object$course
object$user
object$mod
object$lesson
Returns:
bool

Definition at line 193 of file lib.php.

Here is the call graph for this function:

lesson_user_outline ( course,
user,
mod,
lesson 
)

Return a small object with summary information about what a user has done with a given particular instance of this module Used for user activity reports. $return->time = the time they did it $return->info = a short text description

object

Parameters:
object$course
object$user
object$mod
object$lesson
Returns:
object

Definition at line 157 of file lib.php.

Here is the call graph for this function:

 All Data Structures Namespaces Files Functions Variables Enumerations