Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Files | |
file | activity_navigation.php |
File containing the class activity navigation renderable. | |
file | behat_course.php |
Behat course-related steps definitions. | |
file | bulk_activity_completion_renderer.php |
Contains renderers for the bulk activity completion stuff. | |
file | completion_enabled.php |
Completion enabled set indicator. | |
file | course.php |
Search area for Moodle courses. | |
file | course_competencies.php |
Course competencies achievement target. | |
file | course_completion.php |
Course completion target. | |
file | course_delete_modules.php |
Adhoc task handling course module deletion. | |
file | course_dropout.php |
Drop out course target. | |
file | course_enrolments.php |
Base class for targets whose analysable is a course using user enrolments as samples. | |
file | course_gradetopass.php |
Getting the minimum grade to pass target. | |
file | course_handler.php |
Course handler for custom fields. | |
file | course_module_name.php |
Contains class core_tag\output\course_module_name. | |
file | course_module_summary_exporter.php |
Class for exporting a course module summary from an stdClass. | |
file | course_summary_exporter.php |
Class for exporting a course summary from an stdClass. | |
file | customfield.php |
Search area for course custom fields. | |
file | deletecategory_form.php |
Delete category form. | |
file | editcategory_form.php |
Edit category form. | |
file | externallib.php |
External course API. | |
file | formatlegacy.php |
Course format class to allow plugins developed for Moodle 2.3 to work in the new API. | |
file | helper.php |
Course and category management helper class. | |
file | lib.php |
Library of useful functions. | |
file | lib.php |
Base class for course format plugins. | |
file | management_renderer.php |
Contains renderers for the course management pages. | |
file | modchooser.php |
The modchooser renderable. | |
file | modchooser_item.php |
The modchooser_item renderable. | |
file | modlib.php |
Library of functions specific to course/modedit.php and course API functions. | |
file | moodleform_mod.php |
Moodleform. | |
file | no_access_since_course_start.php |
No accesses since the start of the course. | |
file | no_recent_accesses.php |
No recent accesses. | |
file | no_student.php |
No student indicator. | |
file | no_teacher.php |
No teacher indicator. | |
file | no_teaching.php |
No teaching target. | |
file | potential_cognitive_depth.php |
Potential cognitive depth indicator. | |
file | potential_social_breadth.php |
Potential social breadth indicator. | |
file | section.php |
Search area for course sections (title and summary). | |
file | switchrole_form.php |
Switch roles form. | |
file | tags_form.php |
Edit course tags form. | |
Classes | |
class | behat_course |
class | core_course\analytics\indicator\completion_enabled |
Completion enabled set indicator. More... | |
class | core_course\analytics\indicator\no_student |
No student indicator. More... | |
class | core_course\analytics\indicator\no_teacher |
No teacher indicator. More... | |
class | core_course\analytics\indicator\potential_cognitive_depth |
Potential cognitive depth indicator. More... | |
class | core_course\analytics\indicator\potential_social_breadth |
Potential social breadth indicator. More... | |
class | core_course\analytics\target\course_competencies |
Course competencies achievement target. More... | |
class | core_course\analytics\target\course_completion |
Course completion target. More... | |
class | core_course\analytics\target\course_dropout |
Drop out course target. More... | |
class | core_course\analytics\target\course_enrolments |
Base class for targets whose analysable is a course using user enrolments as samples. More... | |
class | core_course\analytics\target\course_gradetopass |
Getting the minimum grade to pass target. More... | |
class | core_course\analytics\target\no_access_since_course_start |
No accesses since the start of the course. More... | |
class | core_course\analytics\target\no_recent_accesses |
No recent accesses. More... | |
class | core_course\analytics\target\no_teaching |
No teaching target. More... | |
class | core_course\customfield\course_handler |
Course handler for custom fields. More... | |
class | core_course\external\course_module_summary_exporter |
Class for exporting a course module summary from a cm_info class. More... | |
class | core_course\external\course_summary_exporter |
Class for exporting a course summary from an stdClass. More... | |
class | core_course\management\helper |
Course and category management interface helper class. More... | |
class | core_course\output\activity_navigation |
The class activity navigation renderable. More... | |
class | core_course\output\course_module_name |
Class to prepare a course module name for display and in-place editing. More... | |
class | core_course\output\modchooser |
The modchooser renderable class. More... | |
class | core_course\output\modchooser_item |
The modchooser_item renderable class. More... | |
class | core_course\privacy\provider |
Privacy class for requesting user data. More... | |
class | core_course\search\course |
Search area for Moodle courses. More... | |
class | core_course\search\customfield |
Search area for course custom fields. More... | |
class | core_course\search\section |
Search area for course sections (title and summary). More... | |
class | core_course\task\course_delete_modules |
Class handling course module deletion. More... | |
class | core_course_bulk_activity_completion_renderer |
Main renderer for the bulk activity completion stuff. More... | |
class | core_course_deletecategory_form |
Delete category moodleform. More... | |
class | core_course_editcategory_form |
Edit category form. More... | |
class | core_course_external |
class | core_course_management_renderer |
Main renderer for the course management pages. More... | |
class | course_request |
class | coursetags_form |
Edit course tags form. More... | |
class | format_base |
Base class for course formats. More... | |
class | format_legacy |
Course format class to allow plugins developed for Moodle 2.3 to work in the new API. More... | |
class | format_site |
Pseudo course format used for the site main page. More... | |
class | moodleform_mod |
This class adds extra methods to form wrapper specific to be used for module add / update forms mod/{modname}/mod_form.php replaced deprecated mod/{modname}/mod.html Moodleform. More... | |
class | switchrole_form |
Defines the course completion settings form. More... | |
Functions | |
add_course_module ($mod) | |
MODULE FUNCTIONS /////////////////////////////////////////////////////////////////. | |
add_moduleinfo ($moduleinfo, $course, $mform=null) | |
Add course module. More... | |
average_number_of_courses_modules () | |
Average number of course modules. More... | |
average_number_of_participants () | |
Average number of participants. More... | |
build_mnet_logs_array ($hostid, $course, $user=0, $date=0, $order="l.time ASC", $limitfrom='', $limitnum='', $modname="", $modid=0, $modaction="", $groupid=0) | |
can_add_moduleinfo ($course, $modulename, $section) | |
Check that the user can add a module. More... | |
can_delete_course ($courseid) | |
Can the current user delete this course? Course creators have exception, 1 day after the creation they can sill delete the course. More... | |
can_download_from_backup_filearea ($filearea, context $context, stdClass $user=null) | |
Return whether the user can download from the specified backup file area in the given context. More... | |
can_edit_in_category ($categoryid=0) | |
Does the user have permission to edit things in this category? More... | |
can_update_moduleinfo ($cm) | |
Check if user is allowed to update module info and returns related item/data to the module. More... | |
compare_activities_by_time_asc ($a, $b) | |
Compare two objects to find out their correct order based on timestamp (to be used by usort). More... | |
compare_activities_by_time_desc ($a, $b) | |
Compare two objects to find out their correct order based on timestamp (to be used by usort). More... | |
core_course_core_calendar_get_valid_event_timestart_range (\calendar_event $event, $course) | |
This function calculates the minimum and maximum cutoff values for the timestart of the given event. More... | |
core_course_inplace_editable ($itemtype, $itemid, $newvalue) | |
Implements callback inplace_editable() allowing to edit values in-place. More... | |
course_add_cm_to_section ($courseorid, $cmid, $sectionnum, $beforemod=null) | |
Adds an existing module to the section. More... | |
course_ajax_enabled ($course) | |
Determine whether course ajax should be enabled for the specified course. More... | |
course_allowed_module ($course, $modname) | |
Is the user allowed to add this type of module to this course? More... | |
course_can_delete_section ($course, $section) | |
Checks if the current user can delete a section (if course format allows it and user has proper permissions). More... | |
course_can_view_participants ($context) | |
Returns true if the user can view the participant page, false otherwise,. More... | |
course_change_sortorder_after_course ($courseorid, $moveaftercourseid) | |
Changes the sort order of courses in a category so that the first course appears after the second. More... | |
course_change_sortorder_by_one ($course, $up) | |
Changes the course sortorder by one, moving it up or down one in respect to sort order. More... | |
course_change_visibility ($courseid, $show=true) | |
Changes the visibility of a course. More... | |
course_check_module_updates_since ($cm, $from, $fileareas=array(), $filter=array()) | |
Check module updates since a given time. More... | |
course_check_updates ($course, $tocheck, $filter=array()) | |
Check for course updates in the given context level instances (only modules supported right Now) More... | |
course_classify_courses_for_timeline (array $courses) | |
Group a list of courses into either past, future, or in progress. More... | |
course_classify_end_date ($course) | |
This function calculates the end date to use for display classification purposes, incorporating the grace period, if any. More... | |
course_classify_for_timeline ($course, $user=null, $completioninfo=null) | |
This function classifies a course as past, in progress or future. More... | |
course_classify_start_date ($course) | |
This function calculates the start date to use for display classification purposes, incorporating the grace period, if any. More... | |
course_create_section ($courseorid, $position=0, $skipcheck=false) | |
Creates a course section and adds it to the specified position. More... | |
course_create_sections_if_missing ($courseorid, $sections) | |
Creates missing course section(s) and rebuilds course cache. More... | |
course_delete_module ($cmid, $async=false) | |
This function will handle the whole deletion process of a module. More... | |
course_delete_section ($course, $section, $forcedeleteifnotempty=true, $async=false) | |
This method will delete a course section and may delete all modules inside it. More... | |
course_delete_section_async ($section, $forcedeleteifnotempty=true) | |
Course section deletion, using an adhoc task for deletion of the modules it contains. More... | |
course_filter_courses_by_customfield ( $courses, $customfieldname, $customfieldvalue, int $limit=0) | |
Search the given $courses for any that have a $customfieldname value that matches the given $customfieldvalue, up to the specified $limit. More... | |
course_filter_courses_by_favourites ( $courses, $favouritecourseids, int $limit=0) | |
Search the given $courses for any that match the given $classification up to the specified $limit. More... | |
course_filter_courses_by_timeline_classification ( $courses, string $classification, int $limit=0) | |
Search the given $courses for any that match the given $classification up to the specified $limit. More... | |
course_format_ajax_support ($format) | |
Returns the information about the ajax support in the given source format. More... | |
course_format_name ($course, $max=100) | |
given a course object with shortname & fullname, this function will truncate the the number of chars allowed and add ... More... | |
course_format_uses_sections ($format) | |
Tells if current course format uses sections. More... | |
course_get_cm_edit_actions (cm_info $mod, $indent=-1, $sr=null) | |
Returns the list of all editing actions that current user can perform on the module. More... | |
course_get_cm_move (cm_info $mod, $sr=null) | |
Returns the move action. More... | |
course_get_course_dates_for_user_id (stdClass $course, int $userid) | |
Calculate the course start date and offset for the given user id. More... | |
course_get_course_dates_for_user_ids (stdClass $course, array $userids) | |
Calculate the course start date and offset for the given user ids. More... | |
course_get_enrolled_courses_for_logged_in_user (int $limit=0, int $offset=0, string $sort=null, string $fields=null, int $dbquerylimit=COURSE_DB_QUERY_LIMIT, array $includecourses=[], array $hiddencourses=[]) | |
Get the list of enrolled courses for the current user. More... | |
course_get_format ($courseorid) | |
Returns an instance of format class (extending format_base) for given course. More... | |
course_get_recent_courses (int $userid=null, int $limit=0, int $offset=0, string $sort=null) | |
Returns a list of the most recently courses accessed by a user. More... | |
course_get_tagged_course_modules ($tag, $exclusivemode=false, $fromcontextid=0, $contextid=0, $recursivecontext=1, $page=0) | |
Returns course modules tagged with a specified tag ready for output on tag/index.php page. More... | |
course_get_tagged_courses ($tag, $exclusivemode=false, $fromctx=0, $ctx=0, $rec=1, $page=0) | |
Returns courses tagged with a specified tag. More... | |
course_get_url ($courseorid, $section=null, $options=array()) | |
The URL to use for the specified course (with section) More... | |
course_get_user_administration_options ($course, $context) | |
Return an object with the list of administration options in a course that are available or not for the current user. More... | |
course_get_user_navigation_options ($context, $course=null) | |
Return an object with the list of navigation options in a course that are avaialable or not for the current user. More... | |
course_integrity_check ($courseid, $rawmods=null, $sections=null, $fullcheck=false, $checkonly=false) | |
Checks the integrity of the course data. More... | |
course_module_bulk_update_calendar_events ($modulename, $courseid=0) | |
Update all instances through out the site or in a course. More... | |
course_module_calendar_event_update_process ($instance, $cm) | |
Calendar events for a module instance are updated. More... | |
course_module_flag_for_async_deletion ($cmid) | |
Schedule a course module for deletion in the background using an adhoc task. More... | |
course_module_instance_pending_deletion ($courseid, $modulename, $instanceid) | |
Checks whether the course module, as defined by modulename and instanceid, is scheduled for deletion within the given course. More... | |
course_module_update_calendar_events ($modulename, $instance=null, $cm=null) | |
This function updates the calendar events from the information stored in the module table and the course module table. More... | |
course_modules_pending_deletion (int $courseid, bool $onlygradable=false) | |
Checks whether the given course has any course modules scheduled for adhoc deletion. More... | |
course_overviewfiles_options ($course) | |
Returns options to use in course overviewfiles filemanager. More... | |
course_page_type_list ($pagetype, $parentcontext, $currentcontext) | |
Return a list of page types. More... | |
course_require_view_participants ($context) | |
Checks if a user can view the participant page, if not throws an exception. More... | |
course_set_marker ($courseid, $marker) | |
Set highlighted section. More... | |
course_update_section ($course, $section, $data) | |
Updates the course section. More... | |
course_validate_dates ($coursedata) | |
Validates course start and end dates. More... | |
course_view ($context, $sectionnumber=0) | |
Trigger course viewed event. More... | |
create_course ($data, $editoroptions=NULL) | |
Create a course and either return a $course object. More... | |
create_module ($moduleinfo) | |
Create a module. More... | |
delete_mod_from_section ($modid, $sectionid) | |
duplicate_module ($course, $cm) | |
Api to duplicate a module. More... | |
edit_module_post_actions ($moduleinfo, $course) | |
Common create/update module module actions that need to be processed as soon as a module is created/updaded. More... | |
get_array_of_activities ($courseid) | |
For a given course, returns an array of course activity objects Each item in the array contains he following properties: | |
get_category_or_system_context ($categoryid) | |
Return the course category context for the category with id $categoryid, except that if $categoryid is 0, return the system context. More... | |
get_hidden_courses_on_timeline ($user=null) | |
Get a list of hidden courses. More... | |
get_module_metadata ($course, $modnames, $sectionreturn=null) | |
Retrieve all metadata for the requested modules. More... | |
get_module_types_names ($plural=false) | |
Returns the localised human-readable names of all used modules. More... | |
get_moduleinfo_data ($cm, $course) | |
Get module information data required for updating the module. More... | |
get_section_name ($courseorid, $section) | |
Returns the display name of the given section that the course prefers. More... | |
get_sorted_course_formats ($enabledonly=false) | |
Returns the sorted list of available course formats, filtered by enabled if necessary. More... | |
include_course_ajax ($course, $usedmodules=array(), $enabledmodules=null, $config=null) | |
Include the relevant javascript and language strings for the resource toolbox YUI module. More... | |
include_modulelib ($modulename) | |
Include once the module lib file. More... | |
make_categories_options () | |
Returns the list of full course categories to be used in html_writer::select() More... | |
make_log_url ($module, $url) | |
mod_duplicate_activity ($course, $cm, $sr=null) | |
Duplicate a module on the course for ajax. More... | |
move_courses ($courseids, $categoryid) | |
Efficiently moves many courses around while maintaining sortorder in order. More... | |
move_section_to ($course, $section, $destination, $ignorenumsections=false) | |
Moves a section within a course, from a position to another. More... | |
moveto_module ($mod, $section, $beforemod=NULL) | |
Move the module object $mod to the specified $section If $beforemod exists then that is the module before which $modid should be inserted. More... | |
plugin_extend_coursemodule_edit_post_actions ($moduleinfo, $course) | |
Hook for plugins to take action when a module is created or updated. More... | |
prepare_new_moduleinfo_data ($course, $modulename, $section) | |
Prepare the standard module information for a new module instance. More... | |
print_course_request_buttons ($context) | |
Print the buttons relating to course requests. More... | |
reorder_sections ($sections, $origin_position, $target_position) | |
Reordering algorithm for course sections. More... | |
save_local_role_names ($courseid, $data) | |
Save the Your name for 'Some role' strings. More... | |
set_coursemodule_groupmode ($id, $groupmode) | |
Change the group mode of a course module. More... | |
set_coursemodule_idnumber ($id, $idnumber) | |
set_coursemodule_name ($id, $name) | |
Changes the course module name. More... | |
set_coursemodule_visible ($id, $visible, $visibleoncoursepage=1) | |
Set the visibility of a module and inherent properties. More... | |
set_moduleinfo_defaults ($moduleinfo) | |
Set module info default values for the unset module attributs. More... | |
set_section_visible ($courseid, $sectionnumber, $visibility) | |
For a given course section, marks it visible or hidden, and does the same for every activity in that section. More... | |
update_course ($data, $editoroptions=NULL) | |
Update a course. More... | |
update_module ($moduleinfo) | |
Update a module. More... | |
update_moduleinfo ($cm, $moduleinfo, $course, $mform=null) | |
Update the module info. More... | |
Variables | |
const | COURSE_CUSTOMFIELD 'customfield' |
const | COURSE_CUSTOMFIELD_EMPTY -1 |
Searching for all courses that have no value for the specified custom field. | |
const | COURSE_DB_QUERY_LIMIT 1000 |
const | COURSE_FAVOURITES 'favourites' |
const | COURSE_MAX_COURSES_PER_DROPDOWN 1000 |
const | COURSE_MAX_LOGS_PER_PAGE 1000 |
const | COURSE_MAX_RECENT_PERIOD 172800 |
const | COURSE_MAX_SUMMARIES_PER_PAGE 10 |
Number of courses to display when summaries are included. More... | |
const | COURSE_MAX_USERS_PER_DROPDOWN 1000 |
const | COURSE_TIMELINE_ALL 'all' |
const | COURSE_TIMELINE_ALLINCLUDINGHIDDEN 'allincludinghidden' |
const | COURSE_TIMELINE_FUTURE 'future' |
const | COURSE_TIMELINE_HIDDEN 'hidden' |
const | COURSE_TIMELINE_INPROGRESS 'inprogress' |
const | COURSE_TIMELINE_PAST 'past' |
const | EXCELROWS 65535 |
const | FIRSTUSEDEXCELROW 3 |
const | FRONTPAGEALLCOURSELIST '6' |
const | FRONTPAGECATEGORYCOMBO '4' |
const | FRONTPAGECATEGORYNAMES '2' |
const | FRONTPAGECOURSESEARCH '7' |
const | FRONTPAGEENROLLEDCOURSELIST '5' |
const | FRONTPAGENEWS '0' |
const | MOD_CLASS_ACTIVITY 0 |
const | MOD_CLASS_RESOURCE 1 |
add_moduleinfo | ( | $moduleinfo, | |
$course, | |||
$mform = null |
|||
) |
Add course module.
The function does not check user capabilities. The function creates course module, module instance, add the module to the correct section. It also trigger common action that need to be done after adding/updating a module.
object | $moduleinfo | the moudle data |
object | $course | the course of the module |
object | $mform | this is required by an existing hack to deal with files during MODULENAME_add_instance() |
object | the updated module info |
average_number_of_courses_modules | ( | ) |
Average number of course modules.
integer |
average_number_of_participants | ( | ) |
Average number of participants.
integer |
can_add_moduleinfo | ( | $course, | |
$modulename, | |||
$section | |||
) |
Check that the user can add a module.
Also returns some information like the module, context and course section info. The fucntion create the course section if it doesn't exist.
object | $course | the course of the module |
object | $modulename | the module name |
object | $section | the section of the module |
array | list containing module, context, course section. |
moodle_exception | if user is not allowed to perform the action or module is not allowed in this course |
can_delete_course | ( | $courseid | ) |
Can the current user delete this course? Course creators have exception, 1 day after the creation they can sill delete the course.
int | $courseid |
boolean |
can_download_from_backup_filearea | ( | $filearea, | |
context | $context, | ||
stdClass | $user = null |
||
) |
Return whether the user can download from the specified backup file area in the given context.
string | $filearea | the backup file area. E.g. 'course', 'backup' or 'automated'. |
context | $context | |
stdClass | $user | the user object. If not provided, the current user will be checked. |
bool | true if the user is allowed to download in the context, false otherwise. |
can_edit_in_category | ( | $categoryid = 0 | ) |
Does the user have permission to edit things in this category?
integer | $categoryid | The id of the category we are showing, or 0 for system context. |
boolean | has_any_capability(array(...), ...); in the appropriate context. |
can_update_moduleinfo | ( | $cm | ) |
Check if user is allowed to update module info and returns related item/data to the module.
object | $cm | course module |
array | - list of course module, context, module, moduleinfo, and course section. |
moodle_exception | if user is not allowed to perform the action |
compare_activities_by_time_asc | ( | $a, | |
$b | |||
) |
Compare two objects to find out their correct order based on timestamp (to be used by usort).
Sorts by ascending order of time.
stdClass | $a | First object |
stdClass | $b | Second object |
int | 0,1,-1 representing the order |
compare_activities_by_time_desc | ( | $a, | |
$b | |||
) |
Compare two objects to find out their correct order based on timestamp (to be used by usort).
Sorts by descending order of time.
stdClass | $a | First object |
stdClass | $b | Second object |
int | 0,1,-1 representing the order |
core_course_core_calendar_get_valid_event_timestart_range | ( | \calendar_event | $event, |
$course | |||
) |
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 date must be after this date'], [1506741172, 'The date must be before this date'] ]
calendar_event | $event | The calendar event to get the time range for |
stdClass | $course | The course object to get the range from |
array | Returns an array with min and max date. |
core_course_inplace_editable | ( | $itemtype, | |
$itemid, | |||
$newvalue | |||
) |
Implements callback inplace_editable() allowing to edit values in-place.
string | $itemtype | |
int | $itemid | |
mixed | $newvalue |
core |
course_add_cm_to_section | ( | $courseorid, | |
$cmid, | |||
$sectionnum, | |||
$beforemod = null |
|||
) |
Adds an existing module to the section.
Updates both tables {course_sections} and {course_modules}
Note: This function does not use modinfo PROVIDED that the section you are adding the module to already exists. If the section does not exist, it will build modinfo if necessary and create the section.
int | stdClass | $courseorid | course id or course object |
int | $cmid | id of the module already existing in course_modules table |
int | $sectionnum | relative number of the section (field course_sections.section) If section does not exist it will be created |
int | stdClass | $beforemod | id or object with field id corresponding to the module before which the module needs to be included. Null for inserting in the end of the section |
int | The course_sections ID where the module is inserted |
course_ajax_enabled | ( | $course | ) |
Determine whether course ajax should be enabled for the specified course.
stdClass | $course | The course to test against |
boolean | Whether course ajax is enabled or note |
course_allowed_module | ( | $course, | |
$modname | |||
) |
Is the user allowed to add this type of module to this course?
object | $course | the course settings. Only $course->id is used. |
string | $modname | the module name. E.g. 'forum' or 'quiz'. |
bool | whether the current user is allowed to add this type of module to this course. |
course_can_delete_section | ( | $course, | |
$section | |||
) |
Checks if the current user can delete a section (if course format allows it and user has proper permissions).
int | stdClass | $course | |
int | stdClass | section_info | $section |
bool |
course_can_view_participants | ( | $context | ) |
Returns true if the user can view the participant page, false otherwise,.
context | $context | The context we are checking. |
bool |
course_change_sortorder_after_course | ( | $courseorid, | |
$moveaftercourseid | |||
) |
Changes the sort order of courses in a category so that the first course appears after the second.
int | stdClass | $courseorid | The course to focus on. |
int | $moveaftercourseid | The course to shifter after or 0 if you want it to be the first course in the category. |
bool |
course_change_sortorder_by_one | ( | $course, | |
$up | |||
) |
Changes the course sortorder by one, moving it up or down one in respect to sort order.
stdClass | core_course_list_element | $course | |
bool | $up | If set to true the course will be moved up one. Otherwise down one. |
bool |
course_change_visibility | ( | $courseid, | |
$show = true |
|||
) |
Changes the visibility of a course.
int | $courseid | The course to change. |
bool | $show | True to make it visible, false otherwise. |
bool |
course_check_module_updates_since | ( | $cm, | |
$from, | |||
$fileareas = array() , |
|||
$filter = array() |
|||
) |
Check module updates since a given time.
This function checks for updates in the module config, file areas, completion, grades, comments and ratings.
cm_info | $cm | course module data |
int | $from | the time to check |
array | $fileareas | additional file ares to check |
array | $filter | if we need to filter and return only selected updates |
stdClass | object with the different updates |
course_check_updates | ( | $course, | |
$tocheck, | |||
$filter = array() |
|||
) |
Check for course updates in the given context level instances (only modules supported right Now)
stdClass | $course | course object |
array | $tocheck | instances to check for updates |
array | $filter | check only for updates in these areas |
array | list of warnings and instances with updates information |
course_classify_courses_for_timeline | ( | array | $courses | ) |
Group a list of courses into either past, future, or in progress.
The return value will be an array indexed by the COURSE_TIMELINE_* constants with each value being an array of courses in that group. E.g. [ COURSE_TIMELINE_PAST => [... list of past courses ...], COURSE_TIMELINE_FUTURE => [], COURSE_TIMELINE_INPROGRESS => [] ]
array | $courses | List of courses to be grouped. |
array |
course_classify_end_date | ( | $course | ) |
This function calculates the end date to use for display classification purposes, incorporating the grace period, if any.
stdClass | $course | The course record. |
int | The new enddate. |
course_classify_for_timeline | ( | $course, | |
$user = null , |
|||
$completioninfo = null |
|||
) |
This function classifies a course as past, in progress or future.
This function may incur a DB hit to calculate course completion.
stdClass | $course | Course record |
stdClass | $user | User record (optional - defaults to $USER). |
completion_info | $completioninfo | Completion record for the user (optional - will be fetched if required). |
string | (one of COURSE_TIMELINE_FUTURE, COURSE_TIMELINE_INPROGRESS or COURSE_TIMELINE_PAST) |
course_classify_start_date | ( | $course | ) |
This function calculates the start date to use for display classification purposes, incorporating the grace period, if any.
stdClass | $course | The course record. |
int | The new startdate. |
course_create_section | ( | $courseorid, | |
$position = 0 , |
|||
$skipcheck = false |
|||
) |
Creates a course section and adds it to the specified position.
int | stdClass | $courseorid | course id or course object |
int | $position | position to add to, 0 means to the end. If position is greater than number of existing secitons, the section is added to the end. This will become sectionnum of the new section. All existing sections at this or bigger position will be shifted down. |
bool | $skipcheck | the check has already been made and we know that the section with this position does not exist |
stdClass | created section object |
course_create_sections_if_missing | ( | $courseorid, | |
$sections | |||
) |
Creates missing course section(s) and rebuilds course cache.
int | stdClass | $courseorid | course id or course object |
int | array | $sections | list of relative section numbers to create |
bool | if there were any sections created |
course_delete_module | ( | $cmid, | |
$async = false |
|||
) |
This function will handle the whole deletion process of a module.
This includes calling the modules delete_instance function, deleting files, events, grades, conditional data, the data in the course_module and course_sections table and adding a module deletion event to the DB.
int | $cmid | the course module id |
bool | $async | whether or not to try to delete the module using an adhoc task. Async also depends on a plugin hook. |
moodle_exception |
course_delete_section | ( | $course, | |
$section, | |||
$forcedeleteifnotempty = true , |
|||
$async = false |
|||
) |
This method will delete a course section and may delete all modules inside it.
No permissions are checked here, use course_can_delete_section() to check if section can actually be deleted.
int | stdClass | $course | |
int | stdClass | section_info | $section | |
bool | $forcedeleteifnotempty | if set to false section will not be deleted if it has modules in it. |
bool | $async | whether or not to try to delete the section using an adhoc task. Async also depends on a plugin hook. |
bool | whether section was deleted |
course_delete_section_async | ( | $section, | |
$forcedeleteifnotempty = true |
|||
) |
Course section deletion, using an adhoc task for deletion of the modules it contains.
stdClass | $section | the section to schedule for deletion. |
bool | $forcedeleteifnotempty | whether to force section deletion if it contains modules. |
bool | true if the section was scheduled for deletion, false otherwise. |
course_filter_courses_by_customfield | ( | $courses, | |
$customfieldname, | |||
$customfieldvalue, | |||
int | $limit = 0 |
||
) |
Search the given $courses for any that have a $customfieldname value that matches the given $customfieldvalue, up to the specified $limit.
This function will return the subset of courses that matches the value as well as the number of courses it had to process to build that subset.
It is recommended that for larger sets of courses this function is given a Generator that loads the courses from the database in chunks.
array | Traversable | $courses | List of courses to process |
string | $customfieldname | the shortname of the custom field to match against |
string | $customfieldvalue | the value this custom field needs to match |
int | $limit | Limit the number of results to this amount |
array | First value is the filtered courses, second value is the number of courses processed |
course_filter_courses_by_favourites | ( | $courses, | |
$favouritecourseids, | |||
int | $limit = 0 |
||
) |
Search the given $courses for any that match the given $classification up to the specified $limit.
This function will return the subset of courses that are favourites as well as the number of courses it had to process to build that subset.
It is recommended that for larger sets of courses this function is given a Generator that loads the courses from the database in chunks.
array | Traversable | $courses | List of courses to process |
array | $favouritecourseids | Array of favourite courses. |
int | $limit | Limit the number of results to this amount |
array | First value is the filtered courses, second value is the number of courses processed |
course_filter_courses_by_timeline_classification | ( | $courses, | |
string | $classification, | ||
int | $limit = 0 |
||
) |
Search the given $courses for any that match the given $classification up to the specified $limit.
This function will return the subset of courses that match the classification as well as the number of courses it had to process to build that subset.
It is recommended that for larger sets of courses this function is given a Generator that loads the courses from the database in chunks.
array | Traversable | $courses | List of courses to process |
string | $classification | One of the COURSE_TIMELINE_* constants |
int | $limit | Limit the number of results to this amount |
array | First value is the filtered courses, second value is the number of courses processed |
course_format_ajax_support | ( | $format | ) |
Returns the information about the ajax support in the given source format.
The returned object's property (boolean)capable indicates that the course format supports Moodle course ajax features.
string | $format |
stdClass |
course_format_name | ( | $course, | |
$max = 100 |
|||
) |
given a course object with shortname & fullname, this function will truncate the the number of chars allowed and add ...
if it was too long
course_format_uses_sections | ( | $format | ) |
Tells if current course format uses sections.
string | $format | Course format ID e.g. 'weeks' $course->format |
bool |
course_get_cm_edit_actions | ( | cm_info | $mod, |
$indent = -1 , |
|||
$sr = null |
|||
) |
Returns the list of all editing actions that current user can perform on the module.
cm_info | $mod | The module to produce editing buttons for |
int | $indent | The current indenting (default -1 means no move left-right actions) |
int | $sr | The section to link back to (used for creating the links) |
array | array of action_link or pix_icon objects |
course_get_cm_move | ( | cm_info | $mod, |
$sr = null |
|||
) |
Returns the move action.
cm_info | $mod | The module to produce a move button for |
int | $sr | The section to link back to (used for creating the links) |
The | markup for the move action, or an empty string if not available. |
course_get_course_dates_for_user_id | ( | stdClass | $course, |
int | $userid | ||
) |
Calculate the course start date and offset for the given user id.
If the course is a fixed date course then the course start date will be returned. If the course is a relative date course then the course date will be calculated and and offset provided.
The return array contains the start date and start offset values for the user.
If the user is not enrolled in the course then the course start date will be returned.
If we have a course which starts on 1563244000. If a user's enrolment starts on 1563244693 then the return would be: [ 'start' => 1563244693, 'startoffset' => 693 ]
If the use was not enrolled then the return would be: [ 'start' => 1563244000, 'startoffset' => 0 ]
stdClass | $course | The course to fetch dates for. |
int | $userid | The user id to get dates for. |
array |
course_get_course_dates_for_user_ids | ( | stdClass | $course, |
array | $userids | ||
) |
Calculate the course start date and offset for the given user ids.
If the course is a fixed date course then the course start date will be returned. If the course is a relative date course then the course date will be calculated and and offset provided.
The dates are returned as an array with the index being the user id. The array contains the start date and start offset values for the user.
If the user is not enrolled in the course then the course start date will be returned.
If we have a course which starts on 1563244000 and 2 users, id 123 and 456, where the former is enrolled in the course at 1563244693 and the latter is not enrolled then the return value would look like: [ '123' => [ 'start' => 1563244693, 'startoffset' => 693 ], '456' => [ 'start' => 1563244000, 'startoffset' => 0 ] ]
stdClass | $course | The course to fetch dates for. |
array | $userids | The list of user ids to get dates for. |
array |
course_get_enrolled_courses_for_logged_in_user | ( | int | $limit = 0 , |
int | $offset = 0 , |
||
string | $sort = null , |
||
string | $fields = null , |
||
int | $dbquerylimit = COURSE_DB_QUERY_LIMIT , |
||
array | $includecourses = [] , |
||
array | $hiddencourses = [] |
||
) |
Get the list of enrolled courses for the current user.
This function returns a Generator. The courses will be loaded from the database in chunks rather than a single query.
int | $limit | Restrict result set to this amount |
int | $offset | Skip this number of records from the start of the result set |
string | null | $sort | SQL string for sorting |
string | null | $fields | SQL string for fields to be returned |
int | $dbquerylimit | The number of records to load per DB request |
array | $includecourses | courses ids to be restricted |
array | $hiddencourses | courses ids to be excluded |
Generator |
course_get_format | ( | $courseorid | ) |
Returns an instance of format class (extending format_base) for given course.
int | stdClass | $courseorid | either course id or an object that has the property 'format' and may contain property 'id' |
format_base |
course_get_recent_courses | ( | int | $userid = null , |
int | $limit = 0 , |
||
int | $offset = 0 , |
||
string | $sort = null |
||
) |
Returns a list of the most recently courses accessed by a user.
int | $userid | User id from which the courses will be obtained |
int | $limit | Restrict result set to this amount |
int | $offset | Skip this number of records from the start of the result set |
string | null | $sort | SQL string for sorting |
array |
course_get_tagged_course_modules | ( | $tag, | |
$exclusivemode = false , |
|||
$fromcontextid = 0 , |
|||
$contextid = 0 , |
|||
$recursivecontext = 1 , |
|||
$page = 0 |
|||
) |
Returns course modules tagged with a specified tag ready for output on tag/index.php page.
This is a callback used by the tag area core/course_modules to search for course modules tagged with a specific tag.
core_tag_tag | $tag | |
bool | $exclusivemode | if set to true it means that no other entities tagged with this tag are displayed on the page and the per-page limit may be bigger |
int | $fromcontextid | context id where the link was displayed, may be used by callbacks to display items in the same context first |
int | $contextid | context id where to search for records |
bool | $recursivecontext | search in subcontexts as well |
int | $page | 0-based number of page being displayed |
core_tag |
course_get_tagged_courses | ( | $tag, | |
$exclusivemode = false , |
|||
$fromctx = 0 , |
|||
$ctx = 0 , |
|||
$rec = 1 , |
|||
$page = 0 |
|||
) |
Returns courses tagged with a specified tag.
core_tag_tag | $tag | |
bool | $exclusivemode | if set to true it means that no other entities tagged with this tag are displayed on the page and the per-page limit may be bigger |
int | $fromctx | context id where the link was displayed, may be used by callbacks to display items in the same context first |
int | $ctx | context id where to search for records |
bool | $rec | search in subcontexts as well |
int | $page | 0-based number of page being displayed |
core_tag |
course_get_url | ( | $courseorid, | |
$section = null , |
|||
$options = array() |
|||
) |
The URL to use for the specified course (with section)
int | stdClass | $courseorid | The course to get the section name for (either object or just course id) |
int | stdClass | $section | Section object from database or just field course_sections.section if omitted the course view page is returned |
array | $options | options for view URL. At the moment core uses: 'navigation' (bool) if true and section has no separate page, the function returns null 'sr' (int) used by multipage formats to specify to which section to return |
moodle_url | The url of course |
course_get_user_administration_options | ( | $course, | |
$context | |||
) |
Return an object with the list of administration options in a course that are available or not for the current user.
This function also handles the frontpage settings.
stdClass | $course | course object (for frontpage it should be a clone of $SITE) |
stdClass | $context | context object (course context) |
stdClass | the administration options in a course and their availability status |
course_get_user_navigation_options | ( | $context, | |
$course = null |
|||
) |
Return an object with the list of navigation options in a course that are avaialable or not for the current user.
This function also handles the frontpage course.
stdClass | $context | context object (it can be a course context or the system context for frontpage settings) |
stdClass | $course | the course where the settings are being rendered |
stdClass | the navigation options in a course and their availability status |
course_integrity_check | ( | $courseid, | |
$rawmods = null , |
|||
$sections = null , |
|||
$fullcheck = false , |
|||
$checkonly = false |
|||
) |
Checks the integrity of the course data.
In summary - compares course_sections.sequence and course_modules.section.
More detailed, checks that:
If there are any mismatches, the changes are made and records are updated in DB.
Course cache is NOT rebuilt if there are any errors!
This function is used each time when course cache is being rebuilt with $fullcheck = false and in CLI script admin/cli/fix_course_sequence.php with $fullcheck = true
int | $courseid | id of the course |
array | $rawmods | result of funciton get_course_mods() - containst the list of enabled course modules in the course. Retrieved from DB if not specified. Argument ignored in cashe of $fullcheck, the list is retrieved form DB anyway. |
array | $sections | records from course_sections table for this course. Retrieved from DB if not specified |
bool | $fullcheck | Will add orphaned modules to their sections and remove non-existing course modules from sequences. Only to be used in site maintenance mode when we are sure that another user is not in the middle of the process of moving/removing a module. |
bool | $checkonly | Only performs the check without updating DB, outputs all errors as debug messages. |
array | array of messages with found problems. Empty output means everything is ok |
course_module_bulk_update_calendar_events | ( | $modulename, | |
$courseid = 0 |
|||
) |
Update all instances through out the site or in a course.
string | $modulename | Module type to update. |
integer | $courseid | Course id to update events. 0 for the whole site. |
bool | Returns True if the update was successful. |
course_module_calendar_event_update_process | ( | $instance, | |
$cm | |||
) |
Calendar events for a module instance are updated.
stdClass | $instance | Module instance object. |
stdClass | $cm | Course Module object. |
course_module_flag_for_async_deletion | ( | $cmid | ) |
Schedule a course module for deletion in the background using an adhoc task.
This method should not be called directly. Instead, please use course_delete_module($cmid, true), to denote async deletion. The real deletion of the module is handled by the task, which calls 'course_delete_module($cmid)'.
int | $cmid | the course module id. |
bool | whether the module was successfully scheduled for deletion. |
moodle_exception |
course_module_instance_pending_deletion | ( | $courseid, | |
$modulename, | |||
$instanceid | |||
) |
Checks whether the course module, as defined by modulename and instanceid, is scheduled for deletion within the given course.
int | $courseid | the course id. |
string | $modulename | the module name. E.g. 'assign', 'book', etc. |
int | $instanceid | the module instance id. |
bool | true if the course module is pending deletion, false otherwise. |
course_module_update_calendar_events | ( | $modulename, | |
$instance = null , |
|||
$cm = null |
|||
) |
This function updates the calendar events from the information stored in the module table and the course module table.
string | $modulename | Module name |
stdClass | $instance | Module object. Either the $instance or the $cm must be supplied. |
stdClass | $cm | Course module object. Either the $instance or the $cm must be supplied. |
bool | Returns true if calendar events are updated. |
course_modules_pending_deletion | ( | int | $courseid, |
bool | $onlygradable = false |
||
) |
Checks whether the given course has any course modules scheduled for adhoc deletion.
int | $courseid | the id of the course. |
bool | $onlygradable | whether to check only gradable modules or all modules. |
bool | true if the course contains any modules pending deletion, false otherwise. |
course_overviewfiles_options | ( | $course | ) |
Returns options to use in course overviewfiles filemanager.
null | stdClass | core_course_list_element | int | $course | either object that has 'id' property or just the course id; may be empty if course does not exist yet (course create form) |
array|null | array of options such as maxfiles, maxbytes, accepted_types, etc. or null if overviewfiles are disabled |
course_page_type_list | ( | $pagetype, | |
$parentcontext, | |||
$currentcontext | |||
) |
Return a list of page types.
string | $pagetype | current page type |
context | $parentcontext | Block's parent context |
context | $currentcontext | Current context of block |
array | array of page types |
course_require_view_participants | ( | $context | ) |
Checks if a user can view the participant page, if not throws an exception.
context | $context | The context we are checking. |
required_capability_exception |
course_set_marker | ( | $courseid, | |
$marker | |||
) |
Set highlighted section.
Only one section can be highlighted at the time.
int | $courseid | course id |
int | $marker | highlight section with this number, 0 means remove higlightin |
void |
course_update_section | ( | $course, | |
$section, | |||
$data | |||
) |
Updates the course section.
This function does not check permissions or clean values - this has to be done prior to calling it.
int | stdClass | $course | |
stdClass | $section | record from course_sections table - it will be updated with the new values |
array | stdClass | $data |
course_validate_dates | ( | $coursedata | ) |
Validates course start and end dates.
Checks that the end course date is not greater than the start course date.
$coursedata['startdate'] or $coursedata['enddate'] may not be set, it depends on the form and user input.
array | $coursedata | May contain startdate and enddate timestamps, depends on the user input. |
mixed | False if everything alright, error codes otherwise. |
course_view | ( | $context, | |
$sectionnumber = 0 |
|||
) |
Trigger course viewed event.
This API function is used when course view actions happens, usually in course/view.php but also in external functions.
stdClass | $context | course context object |
int | $sectionnumber | section number |
create_course | ( | $data, | |
$editoroptions = NULL |
|||
) |
Create a course and either return a $course object.
Please note this functions does not verify any access control, the calling code is responsible for all validation (usually it is the form definition).
array | $editoroptions | course description editor options |
object | $data | - all the data needed for an entry in the 'course' table |
object | new course instance |
create_module | ( | $moduleinfo | ) |
Create a module.
It includes:
object | $module |
object | the created module info |
moodle_exception | if user is not allowed to perform the action or module is not allowed in this course |
duplicate_module | ( | $course, | |
$cm | |||
) |
Api to duplicate a module.
object | $course | course object. |
object | $cm | course module object to be duplicated. |
Exception | |
coding_exception | |
moodle_exception | |
restore_controller_exception |
cm_info|null | cminfo object if we sucessfully duplicated the mod and found the new cm. |
edit_module_post_actions | ( | $moduleinfo, | |
$course | |||
) |
Common create/update module module actions that need to be processed as soon as a module is created/updaded.
For example:create grade parent category, add outcomes, rebuild caches, regrade, save plagiarism settings... Please note this api does not trigger events as of MOODLE 2.6. Please trigger events before calling this api.
object | $moduleinfo | the module info |
object | $course | the course of the module |
object | moduleinfo update with grading management info |
get_category_or_system_context | ( | $categoryid | ) |
Return the course category context for the category with id $categoryid, except that if $categoryid is 0, return the system context.
integer | $categoryid | a category id or 0. |
context | the corresponding context |
get_hidden_courses_on_timeline | ( | $user = null | ) |
Get a list of hidden courses.
int | object | null | $user | User override to get the filter from. Defaults to current user |
array::$ids | List of hidden courses |
coding_exception |
get_module_metadata | ( | $course, | |
$modnames, | |||
$sectionreturn = null |
|||
) |
Retrieve all metadata for the requested modules.
object | $course | The Course |
array | $modnames | An array containing the list of modules and their names |
int | $sectionreturn | The section to return to |
array | A list of stdClass objects containing metadata about each module |
get_module_types_names | ( | $plural = false | ) |
Returns the localised human-readable names of all used modules.
bool | $plural | if true returns the plural forms of the names |
array | where key is the module name (component name without 'mod_') and the value is the human-readable string. Array sorted alphabetically by value |
get_moduleinfo_data | ( | $cm, | |
$course | |||
) |
Get module information data required for updating the module.
stdClass | $cm | course module object |
stdClass | $course | course object |
array | required data for updating a module |
get_section_name | ( | $courseorid, | |
$section | |||
) |
Returns the display name of the given section that the course prefers.
Implementation of this function is provided by course format
int | stdClass | $courseorid | The course to get the section name for (object or just course id) |
int | stdClass | $section | Section object from database or just field course_sections.section |
string | Display name that the course format prefers, e.g. "Week 2" |
get_sorted_course_formats | ( | $enabledonly = false | ) |
Returns the sorted list of available course formats, filtered by enabled if necessary.
bool | $enabledonly | return only formats that are enabled |
array | array of sorted format names |
include_course_ajax | ( | $course, | |
$usedmodules = array() , |
|||
$enabledmodules = null , |
|||
$config = null |
|||
) |
Include the relevant javascript and language strings for the resource toolbox YUI module.
integer | $id | The ID of the course being applied to |
array | $usedmodules | An array containing the names of the modules in use on the page |
array | $enabledmodules | An array containing the names of the enabled (visible) modules on this site |
stdClass | $config | An object containing configuration parameters for ajax modules including:
|
bool |
include_modulelib | ( | $modulename | ) |
Include once the module lib file.
string | $modulename | module name of the lib to include |
moodle_exception | if lib.php file for the module does not exist |
make_categories_options | ( | ) |
Returns the list of full course categories to be used in html_writer::select()
Calls {
array | array mapping course category id to the display name |
mod_duplicate_activity | ( | $course, | |
$cm, | |||
$sr = null |
|||
) |
Duplicate a module on the course for ajax.
object | $course | The course |
object | $cm | The course module to duplicate |
int | $sr | The section to link back to (used for creating the links) |
moodle_exception | if the plugin doesn't support duplication |
Object | containing:
|
move_courses | ( | $courseids, | |
$categoryid | |||
) |
Efficiently moves many courses around while maintaining sortorder in order.
array | $courseids | is an array of course ids |
int | $categoryid |
bool | success |
move_section_to | ( | $course, | |
$section, | |||
$destination, | |||
$ignorenumsections = false |
|||
) |
Moves a section within a course, from a position to another.
Be very careful: $section and $destination refer to section number, not id!.
object | $course | |
int | $section | Section number (not id!!!) |
int | $destination | |
bool | $ignorenumsections |
boolean | Result |
moveto_module | ( | $mod, | |
$section, | |||
$beforemod = NULL |
|||
) |
Move the module object $mod to the specified $section If $beforemod exists then that is the module before which $modid should be inserted.
stdClass | cm_info | $mod | |
stdClass | section_info | $section | |
int | stdClass | $beforemod | id or object with field id corresponding to the module before which the module needs to be included. Null for inserting in the end of the section |
int | new value for module visibility (0 or 1) |
plugin_extend_coursemodule_edit_post_actions | ( | $moduleinfo, | |
$course | |||
) |
Hook for plugins to take action when a module is created or updated.
stdClass | $moduleinfo | the module info |
stdClass | $course | the course of the module |
stdClass | moduleinfo updated by plugins. |
prepare_new_moduleinfo_data | ( | $course, | |
$modulename, | |||
$section | |||
) |
Prepare the standard module information for a new module instance.
stdClass | $course | course object |
string | $modulename | module name |
int | $section | section number |
array | module information about other required data |
print_course_request_buttons | ( | $context | ) |
Print the buttons relating to course requests.
context | $context | current page context. |
reorder_sections | ( | $sections, | |
$origin_position, | |||
$target_position | |||
) |
Reordering algorithm for course sections.
Given an array of section->section indexed by section->id, an original position number and a target position number, rebuilds the array so that the move is made without any duplication of section positions. Note: The target_position is the position AFTER WHICH the moved section will be inserted. If you want to insert a section before the first one, you must give 0 as the target (section 0 can never be moved).
array | $sections | |
int | $origin_position | |
int | $target_position |
array |
save_local_role_names | ( | $courseid, | |
$data | |||
) |
Save the Your name for 'Some role' strings.
integer | $courseid | the id of this course. |
array | $data | the data that came from the course settings form. |
set_coursemodule_groupmode | ( | $id, | |
$groupmode | |||
) |
Change the group mode of a course module.
Note: Do not forget to trigger the event core\event\course_module_updated as it needs to be triggered manually, refer to ().
int | $id | course module ID. |
int | $groupmode | the new groupmode value. |
bool | True if the $groupmode was updated. |
set_coursemodule_name | ( | $id, | |
$name | |||
) |
Changes the course module name.
int | $id | course module id |
string | $name | new value for a name |
bool | whether a change was made |
set_coursemodule_visible | ( | $id, | |
$visible, | |||
$visibleoncoursepage = 1 |
|||
) |
Set the visibility of a module and inherent properties.
Note: Do not forget to trigger the event core\event\course_module_updated as it needs to be triggered manually, refer to ().
From 2.4 the parameter $prevstateoverrides has been removed, the logic it triggered has been moved to set_section_visible() which was the only place from which the parameter was used.
int | $id | of the module |
int | $visible | state of the module |
int | $visibleoncoursepage | state of the module on the course page |
bool | false when the module was not found, true otherwise |
set_moduleinfo_defaults | ( | $moduleinfo | ) |
Set module info default values for the unset module attributs.
object | $moduleinfo | the current known data of the module |
object | the completed module info |
set_section_visible | ( | $courseid, | |
$sectionnumber, | |||
$visibility | |||
) |
For a given course section, marks it visible or hidden, and does the same for every activity in that section.
int | $courseid | course id |
int | $sectionnumber | The section number to adjust |
int | $visibility | The new visibility |
array | A list of resources which were hidden in the section |
update_course | ( | $data, | |
$editoroptions = NULL |
|||
) |
Update a course.
Please note this functions does not verify any access control, the calling code is responsible for all validation (usually it is the form definition).
object | $data | - all the data needed for an entry in the 'course' table |
array | $editoroptions | course description editor options |
void |
update_module | ( | $moduleinfo | ) |
Update a module.
It includes:
object | $module |
object | the updated module info |
moodle_exception | if current user is not allowed to update the module |
update_moduleinfo | ( | $cm, | |
$moduleinfo, | |||
$course, | |||
$mform = null |
|||
) |
Update the module info.
This function doesn't check the user capabilities. It updates the course module and the module instance. Then execute common action to create/update module process (trigger event, rebuild cache, save plagiarism settings...).
object | $cm | course module |
object | $moduleinfo | module info |
object | $course | course of the module |
object | $mform | - the mform is required by some specific module in the function MODULE_update_instance(). This is due to a hack in this function. |
array | list of course module and module info. |
const COURSE_MAX_SUMMARIES_PER_PAGE 10 |
Number of courses to display when summaries are included.