Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/choice/lib.php File Reference

Go to the source code of this file.

Namespaces

namespace  mod
 

Local Library of functions for module scorm.


Enumerations

enum  CHOICE_PUBLISH_ANONYMOUS
enum  CHOICE_PUBLISH_NAMES
enum  CHOICE_SHOWRESULTS_NOT
enum  CHOICE_SHOWRESULTS_AFTER_ANSWER
enum  CHOICE_SHOWRESULTS_AFTER_CLOSE
enum  CHOICE_SHOWRESULTS_ALWAYS
enum  CHOICE_DISPLAY_HORIZONTAL
enum  CHOICE_DISPLAY_VERTICAL

Functions

 choice_user_outline ($course, $user, $mod, $choice)
 Standard functions /////////////////////////////////////////////////////////.
 choice_user_complete ($course, $user, $mod, $choice)
 choice_add_instance ($choice)
 choice_update_instance ($choice)
 choice_prepare_options ($choice, $user, $coursemodule, $allresponses)
 choice_user_submit_response ($formanswer, $choice, $userid, $course, $cm)
 choice_show_reportlink ($user, $cm)
 prepare_choice_show_results ($choice, $course, $cm, $allresponses, $forcepublish=false)
 choice_delete_responses ($attemptids, $choice, $cm, $course)
 choice_delete_instance ($id)
 choice_get_participants ($choiceid)
 choice_get_option_text ($choice, $id)
 choice_get_choice ($choiceid)
 choice_get_view_actions ()
 choice_get_post_actions ()
 choice_reset_course_form_definition (&$mform)
 choice_reset_course_form_defaults ($course)
 choice_reset_userdata ($data)
 choice_get_response_data ($choice, $cm, $groupmode)
 choice_get_extra_capabilities ()
 choice_supports ($feature)
 choice_extend_settings_navigation (settings_navigation $settings, navigation_node $choicenode)
 choice_get_completion_state ($course, $cm, $userid, $type)
 choice_page_type_list ($pagetype, $parentcontext, $currentcontext)

Variables

global $CHOICE_COLUMN_HEIGHT = 300
global $CHOICE_COLUMN_WIDTH = 300
global $CHOICE_PUBLISH
global $CHOICE_SHOWRESULTS
global $CHOICE_DISPLAY

Enumeration Type Documentation

Definition at line 40 of file lib.php.

Definition at line 41 of file lib.php.

Definition at line 32 of file lib.php.

Definition at line 33 of file lib.php.

Definition at line 36 of file lib.php.

Definition at line 37 of file lib.php.

Definition at line 38 of file lib.php.

Definition at line 35 of file lib.php.


Function Documentation

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.

object

Parameters:
object$choice
Returns:
int

Definition at line 111 of file lib.php.

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

object

Parameters:
int$id
Returns:
bool

Definition at line 566 of file lib.php.

choice_delete_responses ( attemptids,
choice,
cm,
course 
)

object

Parameters:
array$attemptids
object$choiceChoice main table row
object$cmCourse-module object
object$courseCourse object
Returns:
bool

Definition at line 529 of file lib.php.

Adds module specific settings to the settings block

Parameters:
settings_navigation$settingsThe settings navigation object
navigation_node$choicenodeThe node to add module settings to

Definition at line 810 of file lib.php.

Here is the call graph for this function:

choice_get_choice ( choiceid)

Gets a full choice record

object

Parameters:
int$choiceid
Returns:
object|bool The choice or false

Definition at line 638 of file lib.php.

choice_get_completion_state ( course,
cm,
userid,
type 
)

Obtains the automatic completion state for this choice based on any conditions in forum settings.

Parameters:
object$courseCourse
object$cmCourse-module
int$useridUser ID
bool$typeType of comparison (or/and; can be used as return value if no conditions)
Returns:
bool True if completed, false if not, $type if conditions not set.

Definition at line 844 of file lib.php.

Returns all other caps used in module

Returns:
array

Definition at line 772 of file lib.php.

choice_get_option_text ( choice,
id 
)

Returns text string which is the answer that matches the id

object

Parameters:
object$choice
int$id
Returns:
string

Definition at line 621 of file lib.php.

Here is the caller graph for this function:

choice_get_participants ( choiceid)

Returns the users with data in one choice (users with records in choice_responses, students)

Todo:
: deprecated - to be deleted in 2.2
Parameters:
int$choiceid
Returns:
array

Definition at line 599 of file lib.php.

Returns:
array

Definition at line 663 of file lib.php.

choice_get_response_data ( choice,
cm,
groupmode 
)

object object object CONTEXT_MODULE

Parameters:
object$choice
object$cm
int$groupmode
Returns:
array

Get the current group

Initialise the returned array, which is a matrix: $allresponses[responseid][userid] = responseobject

First get all the users who have access here To start with we assume they are all "unanswered" then move them later

Get all the recorded responses for this choice

Use the responses to move users into the correct column

Definition at line 731 of file lib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
array

Definition at line 656 of file lib.php.

choice_page_type_list ( pagetype,
parentcontext,
currentcontext 
)

Return a list of page types

Parameters:
string$pagetypecurrent page type
stdClass$parentcontextBlock's parent context
stdClass$currentcontextCurrent context of block

Definition at line 867 of file lib.php.

choice_prepare_options ( choice,
user,
coursemodule,
allresponses 
)

object

Parameters:
object$choice
object$user
object$coursemodule
array$allresponses
Returns:
array

Definition at line 197 of file lib.php.

Here is the call graph for this function:

Course reset form defaults.

Returns:
array

Definition at line 684 of file lib.php.

Implementation of the function for printing the form elements that control whether the course reset functionality affects the choice.

Parameters:
object$mformform passed by reference

Definition at line 674 of file lib.php.

choice_reset_userdata ( data)

Actual implementation of the reset course functionality, delete all the choice responses for course $data->courseid.

object object

Parameters:
object$datathe data submitted from the reset course.
Returns:
array status array

updating dates - shift may be negative too

Definition at line 697 of file lib.php.

Here is the call graph for this function:

choice_show_reportlink ( user,
cm 
)
Parameters:
array$user
object$cm
Returns:
void Output is echo'd

Definition at line 324 of file lib.php.

choice_supports ( feature)

FEATURE_GROUPS FEATURE_GROUPINGS FEATURE_GROUPMEMBERSONLY FEATURE_MOD_INTRO FEATURE_COMPLETION_TRACKS_VIEWS FEATURE_GRADE_HAS_GRADE FEATURE_GRADE_OUTCOMES

Parameters:
string$featureFEATURE_xx constant for requested feature
Returns:
mixed True if module supports feature, null if doesn't know

Definition at line 787 of file lib.php.

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.

object

Parameters:
object$choice
Returns:
bool

Definition at line 149 of file lib.php.

choice_user_complete ( course,
user,
mod,
choice 
)

object

Parameters:
object$course
object$user
object$mod
object$choice
Returns:
string|void

Definition at line 89 of file lib.php.

Here is the call graph for this function:

choice_user_outline ( course,
user,
mod,
choice 
)

Standard functions /////////////////////////////////////////////////////////.

object

Parameters:
object$course
object$user
object$mod
object$choice
Returns:
object|null

Definition at line 70 of file lib.php.

Here is the call graph for this function:

choice_user_submit_response ( formanswer,
choice,
userid,
course,
cm 
)

object

Parameters:
int$formanswer
object$choice
int$userid
object$courseCourse object
object$cm

Definition at line 246 of file lib.php.

Here is the call graph for this function:

prepare_choice_show_results ( choice,
course,
cm,
allresponses,
forcepublish = false 
)

object

Parameters:
object$choice
object$course
object$coursemodule
array$allresponses*
bool$allresponses
Returns:
object

Print "Select all" etc.

Definition at line 347 of file lib.php.

Here is the call graph for this function:


Variable Documentation

$CHOICE_COLUMN_HEIGHT = 300

int $CHOICE_COLUMN_HEIGHT

Definition at line 25 of file lib.php.

$CHOICE_COLUMN_WIDTH = 300

int $CHOICE_COLUMN_WIDTH

Definition at line 29 of file lib.php.

$CHOICE_DISPLAY
Initial value:
 array (CHOICE_DISPLAY_HORIZONTAL   => get_string('displayhorizontal', 'choice'),
                         CHOICE_DISPLAY_VERTICAL     => get_string('displayvertical','choice'))

array $CHOICE_DISPLAY

Definition at line 56 of file lib.php.

$CHOICE_PUBLISH
Initial value:
 array (CHOICE_PUBLISH_ANONYMOUS  => get_string('publishanonymous', 'choice'),
                         CHOICE_PUBLISH_NAMES      => get_string('publishnames', 'choice'))

array $CHOICE_PUBLISH

Definition at line 44 of file lib.php.

$CHOICE_SHOWRESULTS
Initial value:
 array (CHOICE_SHOWRESULTS_NOT          => get_string('publishnot', 'choice'),
                         CHOICE_SHOWRESULTS_AFTER_ANSWER => get_string('publishafteranswer', 'choice'),
                         CHOICE_SHOWRESULTS_AFTER_CLOSE  => get_string('publishafterclose', 'choice'),
                         CHOICE_SHOWRESULTS_ALWAYS       => get_string('publishalways', 'choice'))

array $CHOICE_SHOWRESULTS

Definition at line 49 of file lib.php.

 All Data Structures Namespaces Files Functions Variables Enumerations