Class SloodleModuleChoice

Description

The Sloodle choice module class.

Located in /lib/modules/module_choice.php (line 26)

SloodleModule
   |
   --SloodleModuleChoice
Variable Summary
Method Summary
 SloodleModuleChoice SloodleModuleChoice ( &$_session)
 bool allow_update ()
 mixed get_course_id ()
 string get_intro ()
 string get_name ()
 string get_type ()
 string get_type_full ()
 bool is_early ([int $timestamp = null])
 bool is_late ([int $timestamp = null])
 bool is_open ([int $timestamp = null])
 bool load (mixed $id)
 integer|false select_option (mixed $optionid, [mixed $user = null])
Variables
object $cm = null (line 36)

Internal for Moodle only - course module instance.

Corresponds to one record from the Moodle 'course_modules' table.

  • access: private
object $moodle_choice_instance = null (line 44)

Internal only - Moodle choice module instance database object.

Corresponds to one record from the Moodle 'choice' table.

  • access: private
int $numunanswered = 0 (line 51)

The number of (non-admin) users on the course who have not yet answered this choice.

  • access: private
array $options = array() (line 58)

The options available for this choice, as an associative array of IDs to SloodleChoiceOption objects.

  • access: public

Inherited Variables

Inherited from SloodleModule

SloodleModule::$_session
Methods
Constructor SloodleModuleChoice (line 66)

Constructor

SloodleModuleChoice SloodleModuleChoice ( &$_session)
  • &$_session
allow_update (line 342)

Checks if users are allowed to re-select their answer in this choice.

bool allow_update ()
can_show_results (line 352)

Checks if results are to be shown.

(Some choices only allow results after the choice is closed).

bool can_show_results ()
get_closing_time (line 286)

Gets the time at which this choice closes.

  • return: Timestamp. 0 if choice has no closing time.
int get_closing_time ()
get_course_id (line 230)

Gets the identifier of the course this controller belongs to.

  • return: Course identifier. Type depends on VLE. (In Moodle, it will be an integer).
mixed get_course_id ()

Redefinition of:
SloodleModule::get_course_id()
Gets the identifier of the course this controller belongs to.
get_creation_time (line 239)

Gets the time at which this instance was created, or 0 if unknown.

  • return: Timestamp
int get_creation_time ()

Redefinition of:
SloodleModule::get_creation_time()
Gets the time at which this instance was created, or 0 if unknown.
get_intro (line 221)

Gets the intro description of this module instance, if available.

  • return: The intro description of this controller
string get_intro ()

Redefinition of:
SloodleModule::get_intro()
Gets the intro description of this module instance, if available.
get_modification_time (line 248)

Gets the time at which this instance was last modified, or 0 if unknown.

  • return: Timestamp
int get_modification_time ()

Redefinition of:
SloodleModule::get_modification_time()
Gets the time at which this instance was last modified, or 0 if unknown.
get_name (line 212)

Gets the name of this module instance.

  • return: The name of this controller
string get_name ()

Redefinition of:
SloodleModule::get_name()
Gets the name of this module instance.
get_num_unanswered (line 364)

Gets the number of people who have not yet answered the choice.

Counts all users on the course, including students and teachers.

int get_num_unanswered ()
get_opening_time (line 277)

Gets the time at which this choice opens.

  • return: Timestamp. 0 if choice has no opening time.
int get_opening_time ()
get_type (line 258)

Gets the short type name of this instance.

string get_type ()

Redefinition of:
SloodleModule::get_type()
Gets the short type name of this instance.
get_type_full (line 268)

Gets the full type name of this instance, according to the current language pack, if available.

Note: should be overridden by sub-classes.

  • return: Full type name if possible, or the short name otherwise.
string get_type_full ()

Redefinition of:
SloodleModule::get_type_full()
Gets the full type name of this instance, according to the current language pack, if available.
is_early (line 313)

Determines if the choice has not opened yet.

bool is_early ([int $timestamp = null])
  • int $timestamp: The time to test. Uses the current time if none is given.
is_late (line 328)

Determines if the choice has already closed.

bool is_late ([int $timestamp = null])
  • int $timestamp: The time to test. Uses the current time if none is given.
is_open (line 296)

Determines if the choice is currently open.

bool is_open ([int $timestamp = null])
  • int $timestamp: The time to test. Uses the current time if none is given.
load (line 78)

Loads data from the database.

Note: even if the function fails, it may still have overwritten some or all existing data in the object.

  • return: True if successful, or false otherwise
bool load (mixed $id)
  • mixed $id: The site-wide unique identifier for all modules. Type depends on VLE. On Moodle, it is an integer course module identifier ('id' field of 'course_modules' table)

Redefinition of:
SloodleModule::load()
Loads data from the database.
select_option (line 143)

Selects an option in this choice on behalf of the specified user.

Logs the user in to the VLE if necessary. If a general error occurs, FALSE will be returned. Otherwise, an integer status code will be returned. The following status codes are typical responses: * 10011 = added new choice selection * 10012 = updated existing choice selection * 10013 = user previously selected same option * -10011 = User already made a selection, and re-selection is not allowed * -10012 = max number of selections for this option already made * -10013 = choice is not yet open * -10014 = choice is already closed

integer|false select_option (mixed $optionid, [mixed $user = null])
  • mixed $optionid: The unique site-wide identifier of the option to be selected
  • mixed $user: A SloodleUser identifying the current user; if omitted, the current SloodleSession will be used.

Inherited Methods

Inherited From SloodleModule

 SloodleModule::SloodleModule()
 SloodleModule::get_course_id()
 SloodleModule::get_creation_time()
 SloodleModule::get_intro()
 SloodleModule::get_modification_time()
 SloodleModule::get_name()
 SloodleModule::get_type()
 SloodleModule::get_type_full()
 SloodleModule::load()

Documentation generated on Mon, 07 Jul 2008 12:32:55 +0100 by phpDocumentor 1.4.0