[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/mod/lesson/ -> lib.php (summary)

Standard library of functions and constants for lesson

Copyright: 1999 onwards Martin Dougiamas {@link http://moodle.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1022 lines (34 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 29 functions

  lesson_add_instance()
  lesson_update_instance()
  lesson_delete_instance()
  lesson_delete_course()
  lesson_user_outline()
  lesson_user_complete()
  lesson_print_overview()
  lesson_cron()
  lesson_get_user_grades()
  lesson_update_grades()
  lesson_grade_item_update()
  lesson_grade_item_delete()
  lesson_get_view_actions()
  lesson_get_post_actions()
  lesson_process_pre_save()
  lesson_process_post_save()
  lesson_reset_course_form_definition()
  lesson_reset_course_form_defaults()
  lesson_reset_gradebook()
  lesson_reset_userdata()
  lesson_get_extra_capabilities()
  lesson_supports()
  lesson_extend_settings_navigation()
  lesson_get_import_export_formats()
  lesson_pluginfile()
  lesson_get_file_areas()
  lesson_get_file_info()
  lesson_page_type_list()
  lesson_update_media_file()

Functions
Functions that are not part of a class:

lesson_add_instance($data, $mform)   X-Ref
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.

param: object $lesson Lesson post data from the form
return: int

lesson_update_instance($data, $mform)   X-Ref
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.

param: object $lesson Lesson post data from the form
return: boolean

lesson_delete_instance($id)   X-Ref
Given an ID of an instance of this module,
this function will permanently delete the instance
and any data that depends on it.

param: int $id
return: bool

lesson_delete_course($course, $feedback=true)   X-Ref
Given a course object, this function will clean up anything that
would be leftover after all the instances were deleted

param: object $course an object representing the course that is being deleted
param: boolean $feedback to specify if the process must output a summary of its work
return: boolean

lesson_user_outline($course, $user, $mod, $lesson)   X-Ref
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

param: object $course
param: object $user
param: object $mod
param: object $lesson
return: object

lesson_user_complete($course, $user, $mod, $lesson)   X-Ref
Print a detailed representation of what a  user has done with
a given particular instance of this module, for user activity reports.

param: object $course
param: object $user
param: object $mod
param: object $lesson
return: bool

lesson_print_overview($courses, &$htmlarray)   X-Ref
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.

param: array $courses An array of course objects to get lesson instances from
param: array $htmlarray Store overview output array( course ID => 'lesson' => HTML output )
return: void

lesson_cron()   X-Ref
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 ...

return: bool true

lesson_get_user_grades($lesson, $userid=0)   X-Ref
Return grade for given user or all users.

param: int $lessonid id of lesson
param: int $userid optional user id, 0 means all users
return: array array of grades, false if none

lesson_update_grades($lesson, $userid=0, $nullifnone=true)   X-Ref
Update grades in central gradebook

param: object $lesson
param: int $userid specific user only, 0 means all
param: bool $nullifnone

lesson_grade_item_update($lesson, $grades=null)   X-Ref
Create grade item for given lesson

param: object $lesson object with extra cmidnumber
param: array|object $grades optional array/object of grade(s); 'reset' means reset grades in gradebook
return: int 0 if ok, error code otherwise

lesson_grade_item_delete($lesson)   X-Ref
Delete grade item for given lesson

param: object $lesson object
return: object lesson

lesson_get_view_actions()   X-Ref
List the actions that correspond to a view of this module.
This is used by the participation report.

Note: This is not used by new logging system. Event with
crud = 'r' and edulevel = LEVEL_PARTICIPATING will
be considered as view action.

return: array

lesson_get_post_actions()   X-Ref
List the actions that correspond to a post of this module.
This is used by the participation report.

Note: This is not used by new logging system. Event with
crud = ('c' || 'u' || 'd') and edulevel = LEVEL_PARTICIPATING
will be considered as post action.

return: array

lesson_process_pre_save(&$lesson)   X-Ref
Runs any processes that must run before
a lesson insert/update

param: object $lesson Lesson form data
return: void

lesson_process_post_save(&$lesson)   X-Ref
Runs any processes that must be run
after a lesson insert/update

param: object $lesson Lesson form data
return: void

lesson_reset_course_form_definition(&$mform)   X-Ref
Implementation of the function for printing the form elements that control
whether the course reset functionality affects the lesson.

param: $mform form passed by reference

lesson_reset_course_form_defaults($course)   X-Ref
Course reset form defaults.

param: object $course
return: array

lesson_reset_gradebook($courseid, $type='')   X-Ref
Removes all grades from gradebook

param: int $courseid
param: string optional type

lesson_reset_userdata($data)   X-Ref
Actual implementation of the reset course functionality, delete all the
lesson attempts for course $data->courseid.

param: object $data the data submitted from the reset course.
return: array status array

lesson_get_extra_capabilities()   X-Ref
Returns all other caps used in module

return: array

lesson_supports($feature)   X-Ref

param: string $feature FEATURE_xx constant for requested feature
return: mixed True if module supports feature, false if not, null if doesn't know

lesson_extend_settings_navigation($settings, $lessonnode)   X-Ref
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

param: settings_navigation $settings
param: navigation_node $lessonnode

lesson_get_import_export_formats($type)   X-Ref
Get list of available import or export formats

Copied and modified from lib/questionlib.php

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

lesson_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()   X-Ref
Serves the lesson attachments. Implements needed access control ;-)

param: stdClass $course course object
param: stdClass $cm course module object
param: stdClass $context context object
param: string $filearea file area
param: array $args extra arguments
param: bool $forcedownload whether or not force download
param: array $options additional options affecting the file serving
return: bool false if file not found, does not return if found - justsend the file

lesson_get_file_areas()   X-Ref
Returns an array of file areas

return: array a list of available file areas

lesson_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename)   X-Ref
Returns a file_info_stored object for the file being requested here

param: file_browse $browser file browser instance
param: array $areas file areas
param: stdClass $course course object
param: stdClass $cm course module object
param: stdClass $context context object
param: string $filearea file area
param: int $itemid item ID
param: string $filepath file path
param: string $filename file name
return: file_info_stored

lesson_page_type_list($pagetype, $parentcontext, $currentcontext)   X-Ref
Return a list of page types

param: string $pagetype current page type
param: stdClass $parentcontext Block's parent context
param: stdClass $currentcontext Current context of block

lesson_update_media_file($lessonid, $context, $draftitemid)   X-Ref
Update the lesson activity to include any file
that was uploaded, or if there is none, set the
mediafile field to blank.

param: int $lessonid the lesson id
param: stdClass $context the context
param: int $draftitemid the draft item



Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1