File/sloodle/lib.php

Description

Sloodle module core library functionality.

This script is required by Moodle to contain certain key functionality for the module.

Includes
 require_once ($CFG->dirroot.'/mod/sloodle/sl_config.php') (line 16)
 require_once (SLOODLE_LIBROOT.'/general.php') (line 17)
Functions
sloodle_add_instance (line 42)

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

  • return: The id of the newly inserted sloodle record
int sloodle_add_instance ( $sloodle, object $instance)
  • object $instance: An object from the form in mod.html
  • $sloodle
sloodle_cron (line 275)

Function to be run periodically according to the Moodle cron.

Clears out expired pending user entries, session keys, etc.

  • todo: Delete expired user entries
  • todo: Use a custom delay for expiries of users/objects
boolean sloodle_cron ()
sloodle_delete_instance (line 195)

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

  • return: Success/Failure
boolean sloodle_delete_instance (int $id)
  • int $id: Id of the module instance
sloodle_get_participants (line 343)

Must return an array of user records (all data) who are participants for a given instance of sloodle. Must include every user involved in the instance, independient of his role (student, teacher, admin...) See other modules as example.

  • return: boolean/array of students
  • todo: Possibly make it return a list of users registered via the Sloodle instance?
mixed sloodle_get_participants (int $sloodleid)
  • int $sloodleid: ID of an instance of this module
sloodle_get_types (line 369)

Gets the different sub-types of Sloodle module available as a list for the "Add Activity..." menu.

$return array Entries for the "Add Activity..." sub-menu for Sloodle

void sloodle_get_types ()
sloodle_grades (line 329)

Must return an array of grades for a given instance of this module, indexed by user. It also returns a maximum allowed grade.

Example: $return->grades = array of grades; $return->maxgrade = maximum allowed grade;

return $return;

  • return: Null or object with an array of grades and with the maximum grade
mixed sloodle_grades (int $sloodleid)
  • int $sloodleid: ID of an instance of this module
sloodle_print_recent_activity (line 261)

Given a course and a time, this module should find recent activity that has occurred in sloodle activities and print it out.

Return true if there was output, or false is there was none.

  • todo: Figure out if we need this function to do anything!
  • uses: $CFG
boolean sloodle_print_recent_activity ( $course,  $isteacher,  $timestart)
  • $course
  • $isteacher
  • $timestart
sloodle_process_options (line 28)

Processes the module configuration options prior to saving them.

Only used when the "config.html" file is used for module configuration. Moodle 1.9 now prefers the "settings.php" file.

void sloodle_process_options (object &$config)
  • object &$config: Reference to an object containing the configuration settings (can be edited)
sloodle_scale_used (line 356)

This function returns if a scale is being used by one sloodle it it has support for grading and scales. Commented code should be modified if necessary. See forum, glossary or journal modules as reference.

mixed sloodle_scale_used (int $sloodleid,  $scaleid)
  • int $sloodleid: ID of an instance of this module
  • $scaleid
sloodle_update_instance (line 123)

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

  • return: Success/Fail
boolean sloodle_update_instance ( $sloodle, object $instance)
  • object $instance: An object from the form in mod.html
  • $sloodle
sloodle_user_complete (line 248)

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

  • todo: Do we need this function to do anything?
boolean sloodle_user_complete ( $course,  $user,  $mod,  $sloodle)
  • $course
  • $user
  • $mod
  • $sloodle
sloodle_user_outline (line 237)

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

  • todo: Do we need this function to do anything?
null sloodle_user_outline ( $course,  $user,  $mod,  $sloodle)
  • $course
  • $user
  • $mod
  • $sloodle

Documentation generated on Mon, 16 Jun 2008 15:56:28 +0100 by phpDocumentor 1.4.0