Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Files | |
file | access.php |
Plugin capabilities. | |
file | activity.php |
Search area for mod_survey activities. | |
file | activity_base.php |
Activity base class. | |
file | backup_survey_activity_task.class.php |
Defines backup_survey_activity_task class. | |
file | backup_survey_stepslib.php |
@subpackage backup-moodle2 | |
file | cognitive_depth.php |
Cognitive depth indicator - survey. | |
file | course_module_instance_list_viewed.php |
The mod_survey instance list viewed event. | |
file | course_module_viewed.php |
The mod_survey course module viewed event. | |
file | external.php |
Survey external API. | |
file | lib.php |
mod_survey data generator. | |
file | lib.php |
file | lib.php |
Provides support for the conversion of moodle1 backup to the moodle2 format. | |
file | log.php |
Definition of log events. | |
file | provider.php |
Data provider. | |
file | report_downloaded.php |
The mod_survey report downloaded event. | |
file | report_viewed.php |
The mod_survey report viewed event. | |
file | response_submitted.php |
The mod_survey response submitted event. | |
file | restore_survey_activity_task.class.php |
@subpackage backup-moodle2 | |
file | restore_survey_stepslib.php |
@subpackage backup-moodle2 | |
file | services.php |
Survey external functions and service definitions. | |
file | social_breadth.php |
Social breadth indicator - survey. | |
file | version.php |
Version information. | |
Namespaces | |
mod_survey\analytics\indicator | |
| |
mod_survey\event | |
| |
mod_survey\privacy | |
| |
mod_survey\search | |
| |
Functions | |
mod_survey_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. More... | |
mod_survey_get_completion_active_rule_descriptions ($cm) | |
Callback which returns human-readable strings describing the active completion custom rules for the module instance. More... | |
object | survey_add_analysis ($survey, $user, $notes) |
object | survey_add_instance ($survey) |
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. More... | |
object | survey_already_done ($survey, $user) |
survey_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. More... | |
survey_count_responses ($surveyid, $groupid, $groupingid) | |
object | survey_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. More... | |
survey_extend_settings_navigation ($settings, $surveynode) | |
This function extends the settings navigation block for the site. More... | |
object | survey_get_analysis ($survey, $user) |
survey_get_completion_state ($course, $cm, $userid, $type) | |
Obtains the automatic completion state for this survey based on the condition in feedback settings. More... | |
survey_get_coursemodule_info ($coursemodule) | |
Add a get_coursemodule_info function in case any survey type wants to add 'extra' information for the course (see resource). More... | |
survey_get_post_actions () | |
List the actions that correspond to a post of this module. More... | |
survey_get_questions ($survey) | |
Returns the questions for a survey (ordered). More... | |
object | survey_get_responses ($surveyid, $groupid, $groupingid) |
survey_get_subquestions ($question) | |
Returns subquestions for a given question (ordered). More... | |
object | survey_get_template_name ($templateid) |
object | survey_get_user_answer ($surveyid, $questionid, $userid) |
object | survey_get_user_answers ($surveyid, $questionid, $groupid, $sort="sa.answer1,sa.answer2 ASC") |
survey_get_view_actions () | |
List the actions that correspond to a view of this module. More... | |
object | survey_log_info ($log) |
survey_order_questions ($questions, $questionorder) | |
Helper function for ordering a set of questions by the given ids. More... | |
survey_page_type_list ($pagetype, $parentcontext, $currentcontext) | |
Return a list of page types. More... | |
survey_print_all_responses ($cmid, $results, $courseid) | |
object | survey_print_graph ($url) |
@global int @global int More... | |
object | survey_print_multi ($question) |
stdClass | survey_print_recent_activity ($course, $viewfullnames, $timestart) |
@global object More... | |
object | survey_print_single ($question) |
@global int More... | |
survey_question_rowclass ($qnum) | |
survey_reset_course_form_defaults ($course) | |
Course reset form defaults. More... | |
survey_reset_course_form_definition (&$mform) | |
Implementation of the function for printing the form elements that control whether the course reset functionality affects the survey. More... | |
object | survey_reset_userdata ($data) |
Actual implementation of the reset course functionality, delete all the survey responses for course $data->courseid. More... | |
survey_save_answers ($survey, $answersrawdata, $course, $context) | |
Save the answer for the given survey. More... | |
survey_shorten_name ($name, $numwords) | |
survey_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 More... | |
survey_translate_question ($question) | |
Translate the question texts and options. More... | |
object | survey_update_analysis ($survey, $user, $notes) |
object | survey_update_instance ($survey) |
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. More... | |
stdObject | survey_user_complete ($course, $user, $mod, $survey) |
@global object @uses SURVEY_CIQ More... | |
object | survey_user_outline ($course, $user, $mod, $survey) |
survey_view ($survey, $course, $cm, $context, $viewed) | |
Mark the activity completed (if required) and trigger the course_module_viewed event. More... | |
Variables | |
$capabilities | |
$functions | |
$logs | |
global int | $SURVEY_GHEIGHT = 500 |
Graph size $SURVEY_GHEIGHT. | |
global int | $SURVEY_GWIDTH = 900 |
Graph size $SURVEY_GWIDTH. | |
global array | $SURVEY_QTYPE |
Question Type $SURVEY_QTYPE. More... | |
$plugin | component = 'mod_survey' |
$plugin | cron = 0 |
$plugin | requires = 2019111200 |
const | SURVEY_ATTLS "4" |
const | SURVEY_CIQ "5" |
const | SURVEY_COLLES_ACTUAL "1" |
const | SURVEY_COLLES_PREFERRED "2" |
const | SURVEY_COLLES_PREFERRED_ACTUAL "3" |
$plugin | version = 2019111800 |
mod_survey_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.
This is used by block_myoverview in order to display the event appropriately. If null is returned then the event is not displayed on the block.
calendar_event | $event | |
core_calendar\action_factory | $factory | |
int | $userid | User id to use for all capability checks, etc. Set to 0 for current user (default). |
core_calendar |
mod_survey_get_completion_active_rule_descriptions | ( | $cm | ) |
Callback which returns human-readable strings describing the active completion custom rules for the module instance.
cm_info | stdClass | $cm | object with fields ->completion and ->customdata['customcompletionrules'] |
array::$descriptions | the array of descriptions for the custom rules. |
object survey_add_analysis | ( | $survey, | |
$user, | |||
$notes | |||
) |
int | $survey | |
int | $user | |
string | $notes |
bool|int |
object survey_add_instance | ( | $survey | ) |
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 | $survey |
int|bool |
object survey_already_done | ( | $survey, | |
$user | |||
) |
int | $survey | |
int | $user |
bool |
survey_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.
cm_info | $cm | course module data |
int | $from | the time to check updates from |
array | $filter | if we need to check only specific updates |
stdClass | an object with the different type of areas indicating if they were updated or not |
survey_count_responses | ( | $surveyid, | |
$groupid, | |||
$groupingid | |||
) |
int | $surveyid | |
int | $groupid | |
int | $groupingid |
int |
object survey_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.
int | $id |
bool |
survey_extend_settings_navigation | ( | $settings, | |
$surveynode | |||
) |
This function extends the settings navigation block for the site.
It is safe to rely on PAGE here as we will only ever be within the module context when this is called
navigation_node | $settings | |
navigation_node | $surveynode |
object survey_get_analysis | ( | $survey, | |
$user | |||
) |
int | $survey | |
int | $user |
array |
survey_get_completion_state | ( | $course, | |
$cm, | |||
$userid, | |||
$type | |||
) |
Obtains the automatic completion state for this survey based on the condition in feedback settings.
object | $course | Course |
object | $cm | Course-module |
int | $userid | User ID |
bool | $type | Type of comparison (or/and; can be used as return value if no conditions) |
bool | True if completed, false if not, $type if conditions not set. |
survey_get_coursemodule_info | ( | $coursemodule | ) |
Add a get_coursemodule_info function in case any survey type wants to add 'extra' information for the course (see resource).
Given a course_module object, this function returns any "extra" information that may be needed when printing this activity in a course listing. See get_array_of_activities() in course/lib.php.
stdClass | $coursemodule | The coursemodule object (record). |
cached_cm_info | An object on information that the courses will know about (most noticeably, an icon). |
survey_get_post_actions | ( | ) |
List the actions that correspond to a post of this module.
This is used by the participation report.
Note: This is not used by new logging system. Event with crud = ('c' || 'u' || 'd') and edulevel = LEVEL_PARTICIPATING will be considered as post action.
array |
survey_get_questions | ( | $survey | ) |
Returns the questions for a survey (ordered).
stdClass | $survey | survey object |
array | list of questions ordered |
moodle_exception |
object survey_get_responses | ( | $surveyid, | |
$groupid, | |||
$groupingid | |||
) |
int | $surveyid | |
int | $groupid | |
int | $groupingid |
array |
survey_get_subquestions | ( | $question | ) |
Returns subquestions for a given question (ordered).
stdClass | $question | questin object |
array | list of subquestions ordered |
object survey_get_template_name | ( | $templateid | ) |
int | $templateid |
string |
object survey_get_user_answer | ( | $surveyid, | |
$questionid, | |||
$userid | |||
) |
int | $surveyid | |
int | $questionid | |
int | $userid |
array |
object survey_get_user_answers | ( | $surveyid, | |
$questionid, | |||
$groupid, | |||
$sort = "sa.answer1,sa.answer2 ASC" |
|||
) |
int | $surveyid | |
int | $groupid | |
string | $sort |
array |
survey_get_view_actions | ( | ) |
List the actions that correspond to a view of this module.
This is used by the participation report.
Note: This is not used by new logging system. Event with crud = 'r' and edulevel = LEVEL_PARTICIPATING will be considered as view action.
array |
object survey_log_info | ( | $log | ) |
sting | $log |
array |
survey_order_questions | ( | $questions, | |
$questionorder | |||
) |
Helper function for ordering a set of questions by the given ids.
array | $questions | array of questions objects |
array | $questionorder | array of questions ids indicating the correct order |
array | list of questions ordered |
survey_page_type_list | ( | $pagetype, | |
$parentcontext, | |||
$currentcontext | |||
) |
Return a list of page types.
string | $pagetype | current page type |
stdClass | $parentcontext | Block's parent context |
stdClass | $currentcontext | Current context of block |
survey_print_all_responses | ( | $cmid, | |
$results, | |||
$courseid | |||
) |
int | $cmid | |
array | $results | |
int | $courseid |
object survey_print_graph | ( | $url | ) |
@global int @global int
string | $url |
object survey_print_multi | ( | $question | ) |
@global object @global int @global void This is never defined @global object This is defined twice?
object | $question |
stdClass survey_print_recent_activity | ( | $course, | |
$viewfullnames, | |||
$timestart | |||
) |
@global object
object | $course | |
mixed | $viewfullnames | |
int | $timestamp |
bool |
object survey_print_single | ( | $question | ) |
@global int
object | $question |
survey_question_rowclass | ( | $qnum | ) |
int | $qnum |
string |
survey_reset_course_form_defaults | ( | $course | ) |
Course reset form defaults.
array |
survey_reset_course_form_definition | ( | & | $mform | ) |
Implementation of the function for printing the form elements that control whether the course reset functionality affects the survey.
object | $mform | form passed by reference |
object survey_reset_userdata | ( | $data | ) |
Actual implementation of the reset course functionality, delete all the survey responses for course $data->courseid.
$data | the data submitted from the reset course. |
array | status array |
survey_save_answers | ( | $survey, | |
$answersrawdata, | |||
$course, | |||
$context | |||
) |
Save the answer for the given survey.
stdClass | $survey | a survey object |
array | $answersrawdata | the answers to be saved |
stdClass | $course | a course object (required for trigger the submitted event) |
stdClass | $context | a context object (required for trigger the submitted event) |
survey_shorten_name | ( | $name, | |
$numwords | |||
) |
string | $name | |
array | $numwords |
string |
survey_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
string | $feature | FEATURE_xx constant for requested feature |
mixed | True if module supports feature, false if not, null if doesn't know |
survey_translate_question | ( | $question | ) |
Translate the question texts and options.
stdClass | $question | question object |
stdClass | question object with all the text fields translated |
object survey_update_analysis | ( | $survey, | |
$user, | |||
$notes | |||
) |
int | $survey | |
int | $user | |
string | $notes |
object survey_update_instance | ( | $survey | ) |
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 | $survey |
bool |
stdObject survey_user_complete | ( | $course, | |
$user, | |||
$mod, | |||
$survey | |||
) |
@global object @uses SURVEY_CIQ
object | $course | |
object | $user | |
object | $mod | |
object | $survey |
object survey_user_outline | ( | $course, | |
$user, | |||
$mod, | |||
$survey | |||
) |
object | $course | |
object | $user | |
object | $mod | |
object | $survey |
$result |
survey_view | ( | $survey, | |
$course, | |||
$cm, | |||
$context, | |||
$viewed | |||
) |
Mark the activity completed (if required) and trigger the course_module_viewed event.
stdClass | $survey | survey object |
stdClass | $course | course object |
stdClass | $cm | course module object |
stdClass | $context | context object |
string | $viewed | which page viewed |
$logs |
$SURVEY_QTYPE |
Question Type $SURVEY_QTYPE.