Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
lib.php File Reference

Functions

object choice_add_instance ($choice)
 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.
 
 choice_can_view_results ($choice, $current=null, $choiceopen=null)
 Return true if we are allowd to view the choice results.
 
 choice_check_updates_since (cm_info $cm, $from, $filter=array())
 Check if the module has any update that affects the current user since a given time.
 
object choice_delete_instance ($id)
 Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it.
 
object choice_delete_responses ($attemptids, $choice, $cm, $course)
 
 choice_extend_settings_navigation (settings_navigation $settings, navigation_node $choicenode)
 Adds module specific settings to the settings block.
 
 choice_get_all_responses ($choice)
 Get all the responses on a given choice.
 
 choice_get_availability_status ($choice)
 Check if a choice is available for the current user.
 
object choice_get_choice ($choiceid)
 Gets a full choice record.
 
 choice_get_coursemodule_info ($coursemodule)
 Add a get_coursemodule_info function in case any choice type wants to add 'extra' information for the course (see resource).
 
 choice_get_my_response ($choice)
 Get my responses on a given choice.
 
object choice_get_option_text ($choice, $id)
 Returns text string which is the answer that matches the id.
 
 choice_get_post_actions ()
 List the actions that correspond to a post of this module.
 
object choice_get_response_data ($choice, $cm, $groupmode, $onlyactive)
 @global object @global object @uses CONTEXT_MODULE
 
 choice_get_user_response ($choice, $userid)
 Get responses of a given user on a given choice.
 
 choice_get_view_actions ()
 List the actions that correspond to a view of this module.
 
 choice_modify_responses ($userids, $answerids, $newoptionid, $choice, $cm, $course)
 Modifies responses of other users adding the option $newoptionid to them.
 
 choice_page_type_list ($pagetype, $parentcontext, $currentcontext)
 Return a list of page types.
 
object choice_prepare_options ($choice, $user, $coursemodule, $allresponses)
 
 choice_print_overview ()
 
 choice_refresh_events ($courseid=0, $instance=null, $cm=null)
 This standard function will check all instances of this module and make sure there are up-to-date events created for each of them.
 
 choice_reset_course_form_defaults ($course)
 Course reset form defaults.
 
 choice_reset_course_form_definition (&$mform)
 Implementation of the function for printing the form elements that control whether the course reset functionality affects the choice.
 
object choice_reset_userdata ($data)
 Actual implementation of the reset course functionality, delete all the choice responses for course $data->courseid.
 
 choice_show_reportlink ($user, $cm)
 
 choice_supports ($feature)
 @uses FEATURE_GROUPS @uses FEATURE_GROUPINGS @uses FEATURE_MOD_INTRO @uses FEATURE_COMPLETION_TRACKS_VIEWS @uses FEATURE_GRADE_HAS_GRADE @uses FEATURE_GRADE_OUTCOMES
 
object choice_update_instance ($choice)
 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.
 
 choice_user_complete ($course, $user, $mod, $choice)
 Callback for the "Complete" report - prints the activity summary for the given user.
 
object choice_user_outline ($course, $user, $mod, $choice)
 Standard functions /////////////////////////////////////////////////////////.
 
 choice_user_submit_response ($formanswer, $choice, $userid, $course, $cm)
 Process user submitted answers for a choice, and either updating them or saving new answers.
 
 choice_view ($choice, $course, $cm, $context)
 Mark the activity completed (if required) and trigger the course_module_viewed event.
 
 mod_choice_core_calendar_event_timestart_updated (\calendar_event $event, stdClass $choice)
 This function will update the choice module according to the event that has been modified.
 
 mod_choice_core_calendar_get_event_action_string (string $eventtype)
 Callback to fetch the activity event type lang string.
 
 mod_choice_core_calendar_get_valid_event_timestart_range (\calendar_event $event, stdClass $choice)
 This function calculates the minimum and maximum cutoff values for the timestart of the given event.
 
 mod_choice_core_calendar_provide_event_action (calendar_event $event, core_calendar\action_factory $factory, int $userid=0)
 This function receives a calendar event and returns the action associated with it, or null if there is none.
 
 mod_choice_get_completion_active_rule_descriptions ($cm)
 Callback which returns human-readable strings describing the active completion custom rules for the module instance.
 
 mod_choice_get_fontawesome_icon_map ()
 Get icon mapping for font-awesome.
 
object prepare_choice_show_results ($choice, $course, $cm, $allresponses)
 

Variables

global int $CHOICE_COLUMN_HEIGHT = 300
 $CHOICE_COLUMN_HEIGHT
 
global int $CHOICE_COLUMN_WIDTH = 300
 $CHOICE_COLUMN_WIDTH
 
global array $CHOICE_DISPLAY
 $CHOICE_DISPLAY
 
global array $CHOICE_PUBLISH
 $CHOICE_PUBLISH
 
global array $CHOICE_SHOWRESULTS
 $CHOICE_SHOWRESULTS
 
const CHOICE_DISPLAY_HORIZONTAL '0'
 
const CHOICE_DISPLAY_VERTICAL '1'
 
const CHOICE_EVENT_TYPE_CLOSE 'close'
 
const CHOICE_EVENT_TYPE_OPEN 'open'
 
const CHOICE_PUBLISH_ANONYMOUS '0'
 
const CHOICE_PUBLISH_NAMES '1'
 
const CHOICE_SHOWRESULTS_AFTER_ANSWER '1'
 
const CHOICE_SHOWRESULTS_AFTER_CLOSE '2'
 
const CHOICE_SHOWRESULTS_ALWAYS '3'
 
const CHOICE_SHOWRESULTS_NOT '0'