File/mod/choice/sl_choice_lib.php

Description

Sloodle choice local library functions.

Allows easier access to the Moodle choice data.

Includes
 require_once ($CFG->dirroot.'/mod/choice/lib.php') (line 18)
Functions
sloodle_get_choice (line 89)

Gets a complete record of a particular choice instance.

If successful, returns a database record of the choice, with the following items added:

  • option[] - associates option IDs with option texts
  • maxanswers[] - associates option IDs with the maximum allowable number of answers for each one
  • selections[] - associates option IDs with the number of times each one has already been selected

mixed sloodle_get_choice (object $course_module_instance)
  • object $course_module_instance: A course module instance database record
sloodle_get_num_users_not_answered_choice (line 125)

Gets the number of users on the course who have not yet answered the specified choice.

Note: the count includes students and teachers.

  • return: If successful, a positive integer. Otherwise, a string error message.
mixed sloodle_get_num_users_not_answered_choice (object $choice)
  • object $choice: A choice object from the {@link:sloodle_get_choice()} function
sloodle_get_visible_choices_in_course (line 32)

Gets an array of available choices in the specified course.

Choices which are hidden, or which are in a hidden section of the course, are ignored.

mixed sloodle_get_visible_choices_in_course (int $course_id)
  • int $course_id: Integer ID of a Moodle course
sloodle_select_choice_option (line 170)

Select an option from a choice.

The return will either be an integer or a string. If an integer, then it is a status code. The following status codes are typical responses:

  • 10011 = added new choice selection
  • 10012 = updated existing choice selection
  • -10011 = User already made a selection, and re-selection is not allowed
  • -10012 = max number of selections for this choice already made
  • -10013 = choice is not yet open
  • -10014 = choice is already closed
If a string, then it is an error message reporting that something went wrong.

  • return: If successful, a positive integer. Otherwise, a string error message.
mixed sloodle_select_choice_option (object $choice, int $optionid, int $moodle_user_id)
  • object $choice: A choice object from the {@link:sloodle_get_choice()} function
  • int $optionid: The integer ID of an option (note: these are unique across an entire site)
  • int $moodle_user_id: The integer ID of the Moodle user making the selection

Documentation generated on Tue, 04 Mar 2008 15:08:36 +0000 by phpDocumentor 1.4.0