Moodle PHP Documentation 4.1
Moodle 4.1dev (Build: 20220512) (5e5e12e0)
|
Namespaces | |
namespace | mod_assign |
| |
namespace | mod_assign\analytics\indicator |
| |
namespace | mod_assign\cache |
| |
namespace | mod_assign\completion |
| |
namespace | mod_assign\event |
| |
namespace | mod_assign\external |
| |
namespace | mod_assign\grades |
| |
namespace | mod_assign\local\views |
| |
namespace | mod_assign\output |
| |
namespace | mod_assign\plugininfo |
| |
namespace | mod_assign\privacy |
| |
namespace | mod_assign\search |
| |
namespace | mod_assign\task |
| |
Functions | |
assign_add_instance (stdClass $data, mod_assign_mod_form $form=null) | |
Adds an assignment instance. More... | |
assign_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... | |
assign_delete_instance ($id) | |
delete an assignment instance More... | |
assign_extend_settings_navigation (settings_navigation $settings, navigation_node $navref) | |
extend an assigment navigation settings More... | |
assign_get_completion_state ($course, $cm, $userid, $type) | |
Obtains the automatic completion state for this module based on any conditions in assign settings. More... | |
assign_get_coursemodule_info ($coursemodule) | |
Add a get_coursemodule_info function in case any assignment type wants to add 'extra' information for the course (see resource). More... | |
assign_get_extra_capabilities () | |
Returns all other capabilities used by this module. More... | |
assign_get_file_areas ($course, $cm, $context) | |
List the file areas that can be browsed. More... | |
assign_get_file_info ($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) | |
File browsing support for assign module. More... | |
assign_get_grade_details_for_print_overview () | |
assign_get_js_module () | |
Get the information about the standard assign JavaScript module. More... | |
assign_get_mysubmission_details_for_print_overview () | |
assign_get_post_actions () | |
List the actions that correspond to a post of this module. More... | |
assign_get_recent_mod_activity (&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0) | |
Returns all assignments since a given time. More... | |
assign_get_user_grades ($assign, $userid=0) | |
Return grade for given user or all users. More... | |
assign_get_view_actions () | |
List the actions that correspond to a view of this module. More... | |
assign_grade_item_update ($assign, $grades=null) | |
Create grade item for given assignment. More... | |
assign_page_type_list ($pagetype, $parentcontext, $currentcontext) | |
Return a list of page types. More... | |
assign_pluginfile ($course, $cm, context $context, $filearea, $args, $forcedownload, array $options=array()) | |
Serves intro attachment files. More... | |
assign_prepare_update_events ($assign, $course=null, $cm=null) | |
This actually updates the normal and completion calendar events. More... | |
assign_print_overview () | |
assign_print_recent_activity ($course, $viewfullnames, $timestart) | |
Print recent activity from all assignments in a given course. More... | |
assign_print_recent_mod_activity ($activity, $courseid, $detail, $modnames) | |
Print recent activity from all assignments in a given course. More... | |
assign_process_group_deleted_in_course ($courseid, $groupid=null) | |
Logic to happen when a/some group(s) has/have been deleted in a course. More... | |
assign_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. More... | |
assign_rescale_activity_grades ($course, $cm, $oldmin, $oldmax, $newmin, $newmax) | |
Rescale all grades for this activity and push the new grades to the gradebook. More... | |
assign_reset_course_form_defaults ($course) | |
Course reset form defaults. More... | |
assign_reset_course_form_definition (&$mform) | |
Implementation of the function for printing the form elements that control whether the course reset functionality affects the assignment. More... | |
assign_reset_gradebook ($courseid, $type='') | |
Removes all grades from gradebook. More... | |
assign_reset_userdata ($data) | |
This function is used by the reset_course_userdata function in moodlelib. More... | |
assign_scale_used () | |
assign_scale_used_anywhere ($scaleid) | |
Checks if scale is being used by any instance of assignment. More... | |
assign_supports ($feature) | |
Return the list if Moodle features this module supports. More... | |
assign_update_events ($assign, $override=null) | |
This function updates the events associated to the assign. More... | |
assign_update_grades ($assign, $userid=0, $nullifnone=true) | |
Update activity grades. More... | |
assign_update_instance (stdClass $data, $form) | |
Update an assignment instance. More... | |
assign_user_complete ($course, $user, $coursemodule, $assign) | |
Prints the complete info about a user's interaction with an assignment. More... | |
assign_user_outline ($course, $user, $coursemodule, $assignment) | |
Print the grade information for the assignment for this user. More... | |
mod_assign_cm_info_dynamic (cm_info $cm) | |
Sets dynamic information about a course module. More... | |
mod_assign_core_calendar_event_action_shows_item_count (calendar_event $event, $itemcount=0) | |
Callback function that determines whether an action event should be showing its item count based on the event type and the item count. More... | |
mod_assign_core_calendar_event_timestart_updated (\calendar_event $event, stdClass $instance) | |
This function will update the assign module according to the event that has been modified. More... | |
mod_assign_core_calendar_get_event_action_string (string $eventtype) | |
Callback to fetch the activity event type lang string. More... | |
mod_assign_core_calendar_get_valid_event_timestart_range (\calendar_event $event, stdClass $instance) | |
This function calculates the minimum and maximum cutoff values for the timestart of the given event. More... | |
mod_assign_core_calendar_is_event_visible (calendar_event $event, $userid=0) | |
Is the event visible? More... | |
mod_assign_core_calendar_provide_event_action (calendar_event $event, core_calendar\action_factory $factory, $userid=0) | |
This function receives a calendar event and returns the action associated with it, or null if there is none. More... | |
mod_assign_get_completion_active_rule_descriptions ($cm) | |
Callback which returns human-readable strings describing the active completion custom rules for the module instance. More... | |
mod_assign_get_path_from_pluginfile (string $filearea, array $args) | |
Given an array with a file path, it returns the itemid and the filepath for the defined filearea. More... | |
mod_assign_output_fragment_gradingpanel ($args) | |
Serve the grading panel as a fragment. More... | |
mod_assign_user_preferences () | |
Return a list of all the user preferences used by mod_assign. More... | |
move_group_override ($id, $move, $assignid) | |
Change the sort order of an override. More... | |
reorder_group_overrides ($assignid) | |
Reorder the overrides starting at the override at the given startorder. More... | |
xmldb_assign_upgrade ($oldversion) | |
upgrade this assignment instance - this function could be skipped but it will be needed later More... | |
Variables | |
$capabilities | |
global | mod_assign\event::$CFG |
global | mod_assign\external::$CFG |
global | mod_assign::$CFG |
global | $CFG |
$definitions | |
$functions | |
$logs | |
$messageproviders | |
$observers | |
$plugin = 2022041200 | |
$renamedclasses | |
$settings = new admin_settingpage($section, get_string('settings', 'mod_assign'), 'moodle/site:config', $module->is_enabled() === false) | |
$tasks | |
const | ASSIGN_ACTIVITYATTACHMENT_FILEAREA 'activityattachment' |
const | ASSIGN_ATTEMPT_REOPEN_METHOD_MANUAL 'manual' |
const | ASSIGN_ATTEMPT_REOPEN_METHOD_NONE 'none' |
const | ASSIGN_ATTEMPT_REOPEN_METHOD_UNTILPASS 'untilpass' |
const | ASSIGN_EVENT_TYPE_CLOSE 'close' |
const | ASSIGN_EVENT_TYPE_DUE 'due' |
const | ASSIGN_EVENT_TYPE_GRADINGDUE 'gradingdue' |
const | ASSIGN_EVENT_TYPE_OPEN 'open' |
const | ASSIGN_FILTER_DRAFT 'draft' |
const | ASSIGN_FILTER_GRANTED_EXTENSION 'grantedextension' |
const | ASSIGN_FILTER_NONE 'none' |
const | ASSIGN_FILTER_NOT_SUBMITTED 'notsubmitted' |
const | ASSIGN_FILTER_REQUIRE_GRADING 'requiregrading' |
const | ASSIGN_FILTER_SINGLE_USER 'singleuser' |
const | ASSIGN_FILTER_SUBMITTED 'submitted' |
const | ASSIGN_GRADE_NOT_SET -1 |
const | ASSIGN_GRADING_STATUS_GRADED 'graded' |
const | ASSIGN_GRADING_STATUS_NOT_GRADED 'notgraded' |
const | ASSIGN_INTROATTACHMENT_FILEAREA 'introattachment' |
const | ASSIGN_MARKER_FILTER_NO_MARKER -1 |
const | ASSIGN_MARKING_WORKFLOW_STATE_INMARKING 'inmarking' |
const | ASSIGN_MARKING_WORKFLOW_STATE_INREVIEW 'inreview' |
const | ASSIGN_MARKING_WORKFLOW_STATE_NOTMARKED 'notmarked' |
const | ASSIGN_MARKING_WORKFLOW_STATE_READYFORRELEASE 'readyforrelease' |
const | ASSIGN_MARKING_WORKFLOW_STATE_READYFORREVIEW 'readyforreview' |
const | ASSIGN_MARKING_WORKFLOW_STATE_RELEASED 'released' |
const | ASSIGN_MAX_EVENT_LENGTH "432000" |
ASSIGN_MAX_EVENT_LENGTH = 432000 ; 5 days maximum. | |
const | ASSIGN_MAX_UPGRADE_TIME_SECS 300 |
const | ASSIGN_SUBMISSION_STATUS_DRAFT 'draft' |
const | ASSIGN_SUBMISSION_STATUS_NEW 'new' |
const | ASSIGN_SUBMISSION_STATUS_REOPENED 'reopened' |
const | ASSIGN_SUBMISSION_STATUS_SUBMITTED 'submitted' |
const | ASSIGN_UNLIMITED_ATTEMPTS -1 |
$plugin | component = 'mod_assign' |
$plugin | version = 2022041900 |
assign_add_instance | ( | stdClass | $data, |
mod_assign_mod_form | $form = null |
||
) |
Adds an assignment instance.
This is done by calling the add_instance() method of the assignment type class
stdClass | $data | |
mod_assign_mod_form | $form |
int | The instance id of the new assignment |
assign_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 |
assign_delete_instance | ( | $id | ) |
delete an assignment instance
int | $id |
bool |
assign_extend_settings_navigation | ( | settings_navigation | $settings, |
navigation_node | $navref | ||
) |
extend an assigment navigation settings
settings_navigation | $settings | |
navigation_node | $navref |
void |
assign_get_completion_state | ( | $course, | |
$cm, | |||
$userid, | |||
$type | |||
) |
Obtains the automatic completion state for this module based on any conditions in assign 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. |
assign_get_coursemodule_info | ( | $coursemodule | ) |
Add a get_coursemodule_info function in case any assignment 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). |
assign_get_extra_capabilities | ( | ) |
Returns all other capabilities used by this module.
array | Array of capability strings |
assign_get_file_areas | ( | $course, | |
$cm, | |||
$context | |||
) |
List the file areas that can be browsed.
stdClass | $course | |
stdClass | $cm | |
stdClass | $context |
array |
assign_get_file_info | ( | $browser, | |
$areas, | |||
$course, | |||
$cm, | |||
$context, | |||
$filearea, | |||
$itemid, | |||
$filepath, | |||
$filename | |||
) |
File browsing support for assign module.
file_browser | $browser | |
object | $areas | |
object | $course | |
object | $cm | |
object | $context | |
string | $filearea | |
int | $itemid | |
string | $filepath | |
string | $filename |
object | file_info instance or null if not found |
assign_get_grade_details_for_print_overview | ( | ) |
assign_get_js_module | ( | ) |
Get the information about the standard assign JavaScript module.
array | a standard jsmodule structure. |
assign_get_mysubmission_details_for_print_overview | ( | ) |
assign_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 |
assign_get_recent_mod_activity | ( | & | $activities, |
& | $index, | ||
$timestart, | |||
$courseid, | |||
$cmid, | |||
$userid = 0 , |
|||
$groupid = 0 |
|||
) |
Returns all assignments since a given time.
array | $activities | The activity information is returned in this array |
int | $index | The current index in the activities array |
int | $timestart | The earliest activity to show |
int | $courseid | Limit the search to this course |
int | $cmid | The course module id |
int | $userid | Optional user id |
int | $groupid | Optional group id |
void |
assign_get_user_grades | ( | $assign, | |
$userid = 0 |
|||
) |
Return grade for given user or all users.
stdClass | $assign | record of assign with an additional cmidnumber |
int | $userid | optional user id, 0 means all users |
array | array of grades, false if none |
assign_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 |
assign_grade_item_update | ( | $assign, | |
$grades = null |
|||
) |
Create grade item for given assignment.
stdClass | $assign | record with extra cmidnumber |
array | $grades | optional array/object of grade(s); 'reset' means reset grades in gradebook |
int | 0 if ok, error code otherwise |
assign_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 |
assign_pluginfile | ( | $course, | |
$cm, | |||
context | $context, | ||
$filearea, | |||
$args, | |||
$forcedownload, | |||
array | $options = array() |
||
) |
Serves intro attachment files.
mixed | $course | course or id of the course |
mixed | $cm | course module or id of the course module |
context | $context | |
string | $filearea | |
array | $args | |
bool | $forcedownload | |
array | $options | additional options affecting the file serving |
bool | false if file not found, does not return if found - just send the file |
assign_prepare_update_events | ( | $assign, | |
$course = null , |
|||
$cm = null |
|||
) |
This actually updates the normal and completion calendar events.
stdClass | $assign | Assignment object (from DB). |
stdClass | $course | Course object. |
stdClass | $cm | Course module object. |
assign_print_overview | ( | ) |
assign_print_recent_activity | ( | $course, | |
$viewfullnames, | |||
$timestart | |||
) |
Print recent activity from all assignments in a given course.
This is used by the recent activity block
mixed | $course | the course to print activity for |
bool | $viewfullnames | boolean to determine whether to show full names or not |
int | $timestart | the time the rendering started |
bool | true if activity was printed, false otherwise. |
assign_print_recent_mod_activity | ( | $activity, | |
$courseid, | |||
$detail, | |||
$modnames | |||
) |
Print recent activity from all assignments in a given course.
This is used by course/recent.php
stdClass | $activity | |
int | $courseid | |
bool | $detail | |
array | $modnames |
assign_process_group_deleted_in_course | ( | $courseid, | |
$groupid = null |
|||
) |
Logic to happen when a/some group(s) has/have been deleted in a course.
int | $courseid | The course ID. |
int | $groupid | The group id if it is known |
void |
assign_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.
If courseid = 0, then every assignment event in the site is checked, else only assignment events belonging to the course specified are checked.
int | $courseid | |
int | stdClass | $instance | Assign module instance or ID. |
int | stdClass | $cm | Course module object or ID (not used in this module). |
bool |
assign_rescale_activity_grades | ( | $course, | |
$cm, | |||
$oldmin, | |||
$oldmax, | |||
$newmin, | |||
$newmax | |||
) |
Rescale all grades for this activity and push the new grades to the gradebook.
stdClass | $course | Course db record |
stdClass | $cm | Course module db record |
float | $oldmin | |
float | $oldmax | |
float | $newmin | |
float | $newmax |
assign_reset_course_form_defaults | ( | $course | ) |
Course reset form defaults.
object | $course |
array |
assign_reset_course_form_definition | ( | & | $mform | ) |
Implementation of the function for printing the form elements that control whether the course reset functionality affects the assignment.
moodleform | $mform | form passed by reference |
assign_reset_gradebook | ( | $courseid, | |
$type = '' |
|||
) |
Removes all grades from gradebook.
int | $courseid | The ID of the course to reset |
string | $type | Optional type of assignment to limit the reset to a particular assignment type |
assign_reset_userdata | ( | $data | ) |
This function is used by the reset_course_userdata function in moodlelib.
This function will remove all assignment submissions and feedbacks in the database and clean up any related data.
stdClass | $data | the data submitted from the reset course. |
array |
assign_scale_used | ( | ) |
assign_scale_used_anywhere | ( | $scaleid | ) |
Checks if scale is being used by any instance of assignment.
This is used to find out if scale used anywhere
int | $scaleid |
boolean | True if the scale is used by any assignment |
assign_supports | ( | $feature | ) |
Return the list if Moodle features this module supports.
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. |
assign_update_events | ( | $assign, | |
$override = null |
|||
) |
This function updates the events associated to the assign.
If $override is non-zero, then it updates only the events associated with the specified override.
assign | $assign | the assign object. |
object | $override | (optional) limit to a specific override |
assign_update_grades | ( | $assign, | |
$userid = 0 , |
|||
$nullifnone = true |
|||
) |
Update activity grades.
stdClass | $assign | database record |
int | $userid | specific user only, 0 means all |
bool | $nullifnone | - not used |
assign_update_instance | ( | stdClass | $data, |
$form | |||
) |
Update an assignment instance.
This is done by calling the update_instance() method of the assignment type class
stdClass | $data | |
stdClass | $form | - unused |
object |
assign_user_complete | ( | $course, | |
$user, | |||
$coursemodule, | |||
$assign | |||
) |
Prints the complete info about a user's interaction with an assignment.
stdClass | $course | |
stdClass | $user | |
stdClass | $coursemodule | |
stdClass | $assign | the database assign record |
This prints the submission summary and feedback summary for this student.
assign_user_outline | ( | $course, | |
$user, | |||
$coursemodule, | |||
$assignment | |||
) |
Print the grade information for the assignment for this user.
stdClass | $course | |
stdClass | $user | |
stdClass | $coursemodule | |
stdClass | $assignment |
mod_assign_cm_info_dynamic | ( | cm_info | $cm | ) |
mod_assign_core_calendar_event_action_shows_item_count | ( | calendar_event | $event, |
$itemcount = 0 |
|||
) |
Callback function that determines whether an action event should be showing its item count based on the event type and the item count.
calendar_event | $event | The calendar event. |
int | $itemcount | The item count associated with the action event. |
bool |
mod_assign_core_calendar_event_timestart_updated | ( | \calendar_event | $event, |
stdClass | $instance | ||
) |
This function will update the assign module according to the event that has been modified.
moodle_exception |
calendar_event | $event | |
stdClass | $instance | The module instance to get the range from |
mod_assign_core_calendar_get_event_action_string | ( | string | $eventtype | ) |
Callback to fetch the activity event type lang string.
string | $eventtype | The event type. |
lang_string | The event type lang string. |
mod_assign_core_calendar_get_valid_event_timestart_range | ( | \calendar_event | $event, |
stdClass | $instance | ||
) |
This function calculates the minimum and maximum cutoff values for the timestart of the given event.
It will return an array with two values, the first being the minimum cutoff value and the second being the maximum cutoff value. Either or both values can be null, which indicates there is no minimum or maximum, respectively.
If a cutoff is required then the function must return an array containing the cutoff timestamp and error string to display to the user if the cutoff value is violated.
A minimum and maximum cutoff return value will look like: [ [1505704373, 'The due date must be after the sbumission start date'], [1506741172, 'The due date must be before the cutoff date'] ]
If the event does not have a valid timestart range then [false, false] will be returned.
calendar_event | $event | The calendar event to get the time range for |
stdClass | $instance | The module instance to get the range from |
array |
mod_assign_core_calendar_is_event_visible | ( | calendar_event | $event, |
$userid = 0 |
|||
) |
Is the event visible?
This is used to determine global visibility of an event in all places throughout Moodle. For example, the ASSIGN_EVENT_TYPE_GRADINGDUE event will not be shown to students on their calendar.
calendar_event | $event | |
int | $userid | User id to use for all capability checks, etc. Set to 0 for current user (default). |
bool | Returns true if the event is visible to the current user, false otherwise. |
mod_assign_core_calendar_provide_event_action | ( | calendar_event | $event, |
core_calendar\action_factory | $factory, | ||
$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_assign_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. |
mod_assign_get_path_from_pluginfile | ( | string | $filearea, |
array | $args | ||
) |
Given an array with a file path, it returns the itemid and the filepath for the defined filearea.
string | $filearea | The filearea. |
array | $args | The path (the part after the filearea and before the filename). |
array | The itemid and the filepath inside the $args path, for the defined filearea. |
mod_assign_output_fragment_gradingpanel | ( | $args | ) |
Serve the grading panel as a fragment.
array | $args | List of named arguments for the fragment loader. |
string |
mod_assign_user_preferences | ( | ) |
Return a list of all the user preferences used by mod_assign.
array |
move_group_override | ( | $id, | |
$move, | |||
$assignid | |||
) |
Change the sort order of an override.
int | $id | of the override |
string | $move | direction of move |
int | $assignid | of the assignment |
bool | success of operation |
reorder_group_overrides | ( | $assignid | ) |
Reorder the overrides starting at the override at the given startorder.
int | $assignid | of the assigment |
xmldb_assign_upgrade | ( | $oldversion | ) |
upgrade this assignment instance - this function could be skipped but it will be needed later
int | $oldversion | The old version of the assign module |
bool |
$definitions |
$logs |
$messageproviders |
$observers |
$renamedclasses |
$tasks |