Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
Namespaces | |
namespace | mod_survey\analytics\indicator |
| |
namespace | mod_survey\completion |
| |
namespace | mod_survey\event |
| |
namespace | mod_survey\output |
| |
namespace | mod_survey\privacy |
| |
namespace | mod_survey\search |
| |
Classes | |
class | backup_survey_activity_structure_step |
Define all the backup steps that will be used by the backup_survey_activity_task. More... | |
class | backup_survey_activity_task |
Provides all the settings and steps to perform one complete backup of the activity. More... | |
class | mod_survey\analytics\indicator\activity_base |
Activity base class. More... | |
class | mod_survey\analytics\indicator\cognitive_depth |
Cognitive depth indicator - survey. More... | |
class | mod_survey\analytics\indicator\social_breadth |
Social breadth indicator - survey. More... | |
class | mod_survey\completion\custom_completion |
class | mod_survey\event\course_module_instance_list_viewed |
The mod_survey instance list viewed event class. More... | |
class | mod_survey\event\course_module_viewed |
class | mod_survey\event\report_viewed |
class | mod_survey\output\actionbar |
class | mod_survey\privacy\provider |
Data provider class. More... | |
class | mod_survey\search\activity |
Search area for mod_survey activities. More... | |
class | mod_survey_external |
Survey external functions. More... | |
class | mod_survey_generator |
mod_survey data generator class. More... | |
class | mod_survey_renderer |
Renderer for the mod_survey tertiary nav. More... | |
class | moodle1_mod_survey_handler |
Survey conversion handler. More... | |
class | restore_survey_activity_structure_step |
Define all the restore steps that will be used by the restore_survey_activity_task. More... | |
class | restore_survey_activity_task |
survey restore task that provides all the settings and steps to perform one complete restore of the activity More... | |
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. | |
mod_survey_get_completion_active_rule_descriptions ($cm) | |
Callback which returns human-readable strings describing the active completion custom rules for the module instance. | |
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. | |
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. | |
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. | |
survey_extend_settings_navigation (settings_navigation $settings, navigation_node $surveynode) | |
This function extends the settings navigation block for the site. | |
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. | |
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). | |
survey_get_post_actions () | |
List the actions that correspond to a post of this module. | |
survey_get_questions ($survey) | |
Returns the questions for a survey (ordered). | |
object | survey_get_responses ($surveyid, $groupid, $groupingid) |
survey_get_subquestions ($question) | |
Returns subquestions for a given question (ordered). | |
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. | |
object | survey_log_info ($log) |
survey_order_questions ($questions, $questionorder) | |
Helper function for ordering a set of questions by the given ids. | |
survey_page_type_list ($pagetype, $parentcontext, $currentcontext) | |
Return a list of page types. | |
survey_print_all_responses ($cmid, $results, $courseid) | |
object | survey_print_graph ($url) |
@global int @global int | |
object | survey_print_multi ($question) |
stdClass | survey_print_recent_activity ($course, $viewfullnames, $timestart) |
@global object | |
object | survey_print_single ($question) |
@global int | |
survey_question_rowclass ($qnum) | |
survey_reset_course_form_defaults ($course) | |
Course reset form defaults. | |
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 | survey_reset_userdata ($data) |
Actual implementation of the reset course functionality, delete all the survey responses for course $data->courseid. | |
survey_save_answers ($survey, $answersrawdata, $course, $context) | |
Save the answer for the given survey. | |
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 | |
survey_translate_question ($question) | |
Translate the question texts and options. | |
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. | |
stdObject | survey_user_complete ($course, $user, $mod, $survey) |
@global object @uses SURVEY_CIQ | |
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. | |
Variables | |
$capabilities | |
$functions | |
$logs | |
$plugin = 2023041800 | |
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. | |
$plugin | component = 'mod_survey' |
$plugin | cron = 0 |
const | SURVEY_ATTLS "4" |
const | SURVEY_CIQ "5" |
const | SURVEY_COLLES_ACTUAL "1" |
const | SURVEY_COLLES_PREFERRED "2" |
const | SURVEY_COLLES_PREFERRED_ACTUAL "3" |
const | SURVEY_QLENGTH_WRAP "80" |
$plugin | version = 2023042400 |
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\local\event\entities\action_interface|null |
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_navigation | $settings, |
navigation_node | $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
settings_navigation | $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.
stdClass | $course | Course |
cm_info | stdClass | $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 |
stdClass|false |
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.
MoodleQuickForm | $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 or string for the module purpose. |
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.