Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
|
Namespaces | |
namespace | core_course\analytics\indicator |
| |
namespace | core_course\analytics\target |
| |
namespace | core_course\customfield |
| |
namespace | core_course\external |
| |
namespace | core_course\hook |
| |
namespace | core_course\local\factory |
| |
namespace | core_course\management |
| |
namespace | core_course\output |
| |
namespace | core_course\output\recommendations |
| |
namespace | core_course\privacy |
| |
namespace | core_course\reportbuilder\datasource |
| |
namespace | core_course\reportbuilder\local\entities |
| |
namespace | core_course\reportbuilder\local\formatters |
| |
namespace | core_course\search |
| |
namespace | core_course\task |
| |
namespace | core_courseformat |
| |
namespace | core_courseformat\external |
| |
namespace | core_courseformat\output\local\state |
| |
Functions | |
actions_menu_should_be_open ($activityname) | |
Checks that the specified activity's action menu is open. | |
actions_menu_should_have_item ($activityname, $menuitem) | |
Checks that the specified activity's action menu contains an item. | |
actions_menu_should_not_have_item ($activityname, $menuitem) | |
Checks that the specified activity's action menu does not contains an item. | |
activity_date_in_activity_should_contain_text (string $activityname, string $text) | |
Checks the presence of the given text in the activity's displayed dates. | |
activity_dates_information_in_activity_should_exist (string $activityname) | |
Checks the presence of activity dates information in the activity information output component. | |
activity_dates_information_in_activity_should_not_exist (string $activityname) | |
Checks the absence of activity dates information in the activity information output component. | |
activity_should_be_available_but_hidden_from_course_page ($activityname) | |
Checks that the specified activity is visible. | |
activity_should_be_hidden ($activityname) | |
Checks that the specified activity is hidden. | |
activity_should_be_visible ($activityname) | |
Checks that the specified activity is visible. | |
add_course_module ($mod) | |
MODULE FUNCTIONS /////////////////////////////////////////////////////////////////. | |
add_moduleinfo ($moduleinfo, $course, $mform=null) | |
Add course module. | |
average_number_of_courses_modules () | |
Average number of course modules. | |
average_number_of_participants (bool $onlyactive=false, int $lastloginsince=null) | |
Calculate the average number of enrolled participants per course. | |
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, $sectionnum) | |
Check that the user can add a module. | |
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. | |
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. | |
can_edit_in_category ($categoryid=0) | |
Does the user have permission to edit things in this category? | |
can_update_moduleinfo ($cm) | |
Check if user is allowed to update module info and returns related item/data to the module. | |
category_actions_menu_should_have_item ($name, $menuitem) | |
Checks that the specified category actions menu contains an item. | |
category_actions_menu_should_not_have_item ($name, $menuitem) | |
Checks that the specified category actions menu does not contain an item. | |
category_in_management_listing_should_be_dimmed ($idnumber) | |
Checks that a category within the management interface is dimmed. | |
category_in_management_listing_should_be_visible ($idnumber) | |
Checks that a category within the management interface is visible. | |
clean_param_if_not_null ($param, string $type=PARAM_RAW) | |
Cleans the given param, unless it is null. | |
compare_activities_by_time_asc ($a, $b) | |
Compare two objects to find out their correct order based on timestamp (to be used by usort). | |
compare_activities_by_time_desc ($a, $b) | |
Compare two objects to find out their correct order based on timestamp (to be used by usort). | |
contract_value (array &$dest, array $source, array $option, string $optionname) | |
'Converts' a value from what is stored in the database into what is used by edit forms. | |
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. | |
core_course_drawer () | |
Render the message drawer to be included in the top of the body of each page. | |
core_course_inplace_editable ($itemtype, $itemid, $newvalue) | |
Implements callback inplace_editable() allowing to edit values in-place. | |
core_courseformat_output_fragment_cmitem ($args) | |
Course-module fragment renderer method. | |
core_courseformat_output_fragment_section ($args) | |
Section fragment renderer method. | |
course_add_cm_to_section ($courseorid, $cmid, $sectionnum, $beforemod=null) | |
Adds an existing module to the section. | |
course_ajax_enabled ($course) | |
Determine whether course ajax should be enabled for the specified course. | |
course_allowed_module ($course, $modname, stdClass $user=null) | |
Is the user 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). | |
course_can_view_participants ($context) | |
Returns true if the user can view the participant page, false otherwise,. | |
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. | |
course_change_sortorder_by_one ($course, $up) | |
Changes the course sortorder by one, moving it up or down one in respect to sort order. | |
course_change_visibility ($courseid, $show=true) | |
Changes the visibility of a course. | |
course_check_module_updates_since ($cm, $from, $fileareas=array(), $filter=array()) | |
Check module updates since a given time. | |
course_check_updates ($course, $tocheck, $filter=array()) | |
Check for course updates in the given context level instances (only modules supported right Now) | |
course_classify_courses_for_timeline (array $courses) | |
Group a list of courses into either past, future, or in progress. | |
course_classify_end_date ($course) | |
This function calculates the end date to use for display classification purposes, incorporating the grace period, if any. | |
course_classify_for_timeline ($course, $user=null, $completioninfo=null) | |
This function classifies a course as past, in progress or future. | |
course_classify_start_date ($course) | |
This function calculates the start date to use for display classification purposes, incorporating the grace period, if any. | |
course_create_section ($courseorid, $position=0, $skipcheck=false) | |
Creates a course section and adds it to the specified position. | |
course_create_sections_if_missing ($courseorid, $sections) | |
Creates missing course section(s) and rebuilds course cache. | |
course_delete_module ($cmid, $async=false) | |
This function will handle the whole deletion process of a module. | |
course_delete_section ($course, $sectionornum, $forcedeleteifnotempty=true, $async=false) | |
This method will delete a course section and may delete all modules inside it. | |
course_delete_section_async ($section, $forcedeleteifnotempty=true) | |
Course section deletion, using an adhoc task for deletion of the modules it contains. | |
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. | |
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. | |
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. | |
course_format_ajax_support ($format) | |
Returns the information about the ajax support in the given source format. | |
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. | |
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. | |
course_get_cm_move (cm_info $mod, $sr=null) | |
Returns the move action. | |
course_get_communication_instance_data (int $courseid) | |
Get course specific data for configuring a communication instance. | |
course_get_course_dates_for_user_id (stdClass $course, int $userid) | |
Calculate the course start date and offset for the given user id. | |
course_get_course_dates_for_user_ids (stdClass $course, array $userids) | |
Calculate the course start date and offset for the given user ids. | |
course_get_courseimage (\stdClass $course) | |
Get the current course image for the given course. | |
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. | |
course_get_enrolled_courses_for_logged_in_user_from_search (int $limit=0, int $offset=0, string $sort=null, string $fields=null, int $dbquerylimit=COURSE_DB_QUERY_LIMIT, array $searchcriteria=[], array $options=[]) | |
Get the list of enrolled courses the current user searched for. | |
course_get_format ($courseorid) | |
Returns an instance of format class (extending course_format) for given course. | |
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. | |
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. | |
course_get_tagged_courses ($tag, $exclusivemode=false, $fromctx=0, $ctx=0, $rec=1, $page=0) | |
Returns courses tagged with a specified tag. | |
course_get_url ($courseorid, $section=null, $options=array()) | |
The URL to use for the specified course (with section) | |
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. | |
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. | |
course_in_management_listing_should_be_dimmed ($idnumber) | |
Checks that a course within the management interface is dimmed. | |
course_in_management_listing_should_be_visible ($idnumber) | |
Checks that a course within the management interface is visible. | |
course_integrity_check ($courseid, $rawmods=null, $sections=null, $fullcheck=false, $checkonly=false) | |
Checks the integrity of the course data. | |
course_module_bulk_update_calendar_events ($modulename, $courseid=0) | |
Update all instances through out the site or in a course. | |
course_module_calendar_event_update_process ($instance, $cm) | |
Calendar events for a module instance are updated. | |
course_module_flag_for_async_deletion ($cmid) | |
Schedule a course module for deletion in the background using an adhoc task. | |
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. | |
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. | |
course_modules_pending_deletion (int $courseid, bool $onlygradable=false) | |
Checks whether the given course has any course modules scheduled for adhoc deletion. | |
course_output_fragment_new_base_form ($args) | |
Renders the course copy form for the modal on the course management screen. | |
course_overviewfiles_options ($course) | |
Returns options to use in course overviewfiles filemanager. | |
course_page_type_list ($pagetype, $parentcontext, $currentcontext) | |
Return a list of page types. | |
course_require_view_participants ($context) | |
Checks if a user can view the participant page, if not throws an exception. | |
course_section_view (context_course $context, int $sectionid) | |
Trigger course section viewed event. | |
course_set_marker ($courseid, $marker) | |
Set highlighted section. | |
course_update_communication_instance_data (stdClass $data) | |
Update a course using communication configuration data. | |
course_update_section ($courseorid, $section, $data) | |
Updates the course section. | |
course_validate_dates ($coursedata) | |
Validates course start and end dates. | |
course_view ($context, $sectionnumber=0) | |
Trigger course viewed event. | |
create_course ($data, $editoroptions=NULL) | |
Create a course and either return a $course object. | |
create_module ($moduleinfo) | |
Create a module. | |
delete_mod_from_section ($modid, $sectionid) | |
duplicate_module ($course, $cm, int $sectionid=null, bool $changename=true) | |
Api to duplicate a module. | |
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. | |
expand_value (array &$dest, array $source, array $option, string $optionname) | |
'Converts' a value from what is used in edit forms into a value(s) to be stored in the database. | |
get_activity_action_menu_node ($activityname) | |
Returns the DOM node of the activity action menu. | |
get_activity_element ($element, $selectortype, $activityname) | |
Clicks on the specified element inside the activity container. | |
get_activity_name ($activitynode) | |
Gets the activity instance name from the activity node. | |
get_activity_node ($activityname) | |
Returns the DOM node of the activity from . | |
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. | |
get_course_format () | |
Gets the current course format. | |
get_hidden_courses_on_timeline ($user=null) | |
Get a list of hidden courses. | |
get_management_category_listing_node_by_idnumber ($idnumber) | |
Returns the category node from within the listing on the management page. | |
get_management_category_listing_node_by_name ($name, $link=false) | |
Returns a category node from within the management interface. | |
get_management_course_listing_node_by_idnumber ($idnumber) | |
Returns the course node from within the listing on the management page. | |
get_management_course_listing_node_by_name ($name, $link=false) | |
Returns a course node from within the management interface. | |
get_module_types_names ($plural=false, $resetcache=false) | |
Returns an array where the key is the module name (component name without 'mod_') and the value is a lang_string object with a human-readable string. | |
get_moduleinfo_data ($cm, $course) | |
Get module information data required for updating the module. | |
get_section_activities ($sectionxpath) | |
Gets the section's activites DOM nodes. | |
get_section_and_course_by_id (string $courseidentifier, string $sectionidentifier) | |
Get the section id from an identifier. | |
get_section_and_course_by_sectionnum (string $courseidentifier, int $sectionnum) | |
Get the section id from a courseid and a sectionnum. | |
get_section_name ($courseorid, $section) | |
Returns the display name of the given section that the course prefers. | |
get_sorted_course_formats ($enabledonly=false) | |
Returns the sorted list of available course formats, filtered by enabled if necessary. | |
hide_section_link_exists ($sectionnumber) | |
Returns the hide section icon link if it exists or throws exception. | |
i_add_to_section_and_i_fill_the_form_with ($activity, $section, TableNode $data) | |
Adds the selected activity/resource filling the form data with the specified field/value pairs. | |
i_change_activity_name_to ($activityname, $newactivityname) | |
Edits the activity name through the edit activity; this step only works with Javascript enabled. | |
i_click_on_action_for_item_in_management_category_listing ($action, $name) | |
Locates a category in the course category management interface and then triggers an action for it. | |
i_click_on_action_for_item_in_management_course_listing ($action, $name) | |
Locates a course in the course category management interface and then triggers an action for it. | |
i_click_on_category_in_the_management_category_listing ($name) | |
Clicks on a category in the management interface. | |
i_click_on_category_in_the_management_interface ($name) | |
Clicks on a category in the management interface. | |
i_click_on_course_in_the_management_interface ($name) | |
Clicks on a course in the management interface. | |
i_click_on_in_the_activity ($element, $selectortype, $activityname) | |
Clicks on the specified element of the activity. | |
i_click_to_expand_category_in_the_management_interface ($idnumber) | |
Click to expand a category revealing its sub categories within the management UI. | |
i_click_to_move_category_by_one ($idnumber, $direction) | |
Moves a category displayed in the management interface up or down one place. | |
i_click_to_move_course_by_one ($idnumber, $direction) | |
Moves a course displayed in the management interface up or down one place. | |
i_close_actions_menu ($activityname) | |
Closes an activity actions menu if it is not already closed. | |
i_delete_activity ($activityname) | |
Deletes the activity or resource specified by it's name. | |
i_delete_section ($sectionnumber) | |
Deletes course section. | |
i_duplicate_activity ($activityname) | |
Duplicates the activity or resource specified by it's name. | |
i_duplicate_activity_editing_the_new_copy_with ($activityname, TableNode $data) | |
Duplicates the activity or resource and modifies the new activity with the provided data. | |
i_edit_the_section ($sectionnumber) | |
Go to editing section page for specified section number. | |
i_edit_the_section_and_i_fill_the_form_with ($sectionnumber, TableNode $data) | |
Edit specified section and fill the form data with the specified field/value pairs. | |
i_hide_section ($sectionnumber) | |
Hides the specified visible section. | |
i_indent_left_activity ($activityname) | |
Indents to the left the activity or resource specified by it's name. | |
i_indent_right_activity ($activityname) | |
Indents to the right the activity or resource specified by it's name. | |
i_move_activity_to_section ($activityname, $sectionnumber) | |
Moves the specified activity to the first slot of a section. | |
i_move_activity_to_section_yui ($activityname, $sectionnumber) | |
Moves the specified activity to the first slot of a section using the YUI course format. | |
i_move_category_to_top_level_in_the_management_interface ($name) | |
Move selected categories to top level in the management interface. | |
i_move_down_section ($sectionnumber) | |
Moves down the specified section, this step only works with Javascript disabled. | |
i_move_up_section ($sectionnumber) | |
Moves up the specified section, this step only works with Javascript disabled. | |
i_navigate_to_course_participants () | |
Go to the course participants. | |
i_open_actions_menu ($activityname) | |
Opens an activity actions menu if it is not already opened. | |
i_open_section_edit_menu ($sectionnumber) | |
Opens a section edit menu if it is not already opened. | |
i_open_the_action_menu_for_item_in_management_category_listing ($name) | |
Locates a category in the course category management interface and then opens action menu for it. | |
i_open_the_activity_chooser () | |
Open the activity chooser in a course. | |
i_select_category_in_the_management_interface ($name) | |
Clicks on a category checkbox in the management interface, if not checked. | |
i_select_course_in_the_management_interface ($name) | |
Clicks course checkbox in the management interface, if not checked. | |
i_should_not_see_category_as_subcategory_of_in_the_management_interface ($subcatidnumber, $catidnumber) | |
Checks that a category is not a subcategory of specific category. | |
i_should_not_see_teacher_after ($fteacher, $pteacher) | |
Check that one teacher oes not appears after another in the course contacts. | |
i_should_see_category_as_subcategory_of_in_the_management_interface ($subcatidnumber, $catidnumber) | |
Checks that a category is a subcategory of specific category. | |
i_should_see_category_listing_before ($preceedingcategory, $followingcategory) | |
Check that one category appears before another in the course category management listings. | |
i_should_see_course_listing_before ($preceedingcourse, $followingcourse) | |
Check that one course appears before another in the course category management listings. | |
i_should_see_teacher_before ($pteacher, $fteacher) | |
Check that one teacher appears before another in the course contacts. | |
i_should_see_the_courses_management_page ($mode) | |
Checks that we are on the course management page that we expect to be on and that no course has been selected. | |
i_should_see_the_courses_management_page_with_a_course_selected ($mode) | |
Checks that we are on the course management page that we expect to be on and that a course has been selected. | |
i_show_section ($sectionnumber) | |
Shows the specified hidden section. | |
i_toggle_category_children_visibility_in_frontpage ($categoryname) | |
Clicks to expand or collapse a category displayed on the frontpage. | |
i_toggle_visibility_of_category_in_management_listing ($idnumber) | |
Toggles the visibility of a category in the management UI. | |
i_toggle_visibility_of_course_in_management_listing ($idnumber) | |
Toggles the visibility of a course in the management UI. | |
i_turn_section_highlighting_off ($sectionnumber) | |
Turns course section highlighting off. | |
i_turn_section_highlighting_on ($sectionnumber) | |
Turns course section highlighting on. | |
i_unselect_category_in_the_management_interface ($name) | |
Clicks on a category checkbox in the management interface, if checked. | |
i_unselect_course_in_the_management_interface ($name) | |
Clicks course checkbox in the management interface, if checked. | |
i_wait_until_section_is_available ($sectionnumber) | |
Waits until the section is available to interact with it. | |
include_course_ajax ($course, $usedmodules=array(), $enabledmodules=null, $config=null) | |
Include the relevant javascript and language strings for the resource toolbox YUI module. | |
include_course_editor (course_format $format) | |
Include and configure the course editor modules. | |
include_modulelib ($modulename) | |
Include once the module lib file. | |
is_course_editor () | |
Returns whether the user can edit the course contents or not. | |
is_editing_on () | |
Returns whether the user can edit the course contents and the editing mode is on. | |
label_should_be_hidden ($activityname) | |
Checks that the specified label is hidden from students. | |
listing_is_highlighted ($self, $selector) | |
Used by spin to determine the callback has been highlighted. | |
make_log_url ($module, $url) | |
mod_duplicate_activity ($course, $cm, $sr=null) | |
Duplicate a module on the course for ajax. | |
move_courses ($courseids, $categoryid) | |
Efficiently moves many courses around while maintaining sortorder in order. | |
move_section_to ($course, $section, $destination, $ignorenumsections=false) | |
Moves a section within a course, from a position to another. | |
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. | |
plugin_extend_coursemodule_edit_post_actions ($moduleinfo, $course) | |
Hook for plugins to take action when a module is created or updated. | |
prepare_new_moduleinfo_data ($course, $modulename, $section, string $suffix='') | |
Prepare the standard module information for a new module instance. | |
print_course_request_buttons ($context) | |
Print the buttons relating to course requests. | |
reorder_sections ($sections, $origin_position, $target_position) | |
Reordering algorithm for course sections. | |
save_local_role_names ($courseid, $data) | |
Save the Your name for 'Some role' strings. | |
section_activities_should_be_hidden ($sectionnumber) | |
Checks that all actiities in the specified section are hidden. | |
section_exists ($sectionnumber) | |
Checks if the course section exists. | |
section_should_be_hidden ($sectionnumber) | |
Checks that the specified section is visible. | |
section_should_be_highlighted ($sectionnumber) | |
Checks if the specified course section hightlighting is turned on. | |
section_should_be_visible ($sectionnumber) | |
Checks that the specified section is visible. | |
section_should_not_be_highlighted ($sectionnumber) | |
Checks if the specified course section highlighting is turned off. | |
set_coursemodule_groupmode ($id, $groupmode) | |
Change the group mode of a course module. | |
set_coursemodule_idnumber ($id, $idnumber) | |
set_coursemodule_name ($cmid, $name) | |
Changes the course module name. | |
set_coursemodule_visible ($id, $visible, $visibleoncoursepage=1, bool $rebuildcache=true) | |
Set the visibility of a module and inherent properties. | |
set_downloadcontent (int $id, bool $downloadcontent) | |
Set downloadcontent value to course module. | |
set_moduleinfo_defaults ($moduleinfo) | |
Set module info default values for the unset module attributs. | |
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. | |
show_section_link_exists ($sectionnumber) | |
Returns the show section icon or throws an exception. | |
update_course ($data, $editoroptions=NULL) | |
Update a course. | |
update_module ($moduleinfo) | |
Update a module. | |
update_moduleinfo ($cm, $moduleinfo, $course, $mform=null) | |
Update the module info. | |
user_clicks_on_management_listing_action ($listingtype, $listingnode, $action) | |
Finds the node to use for a management listitem action and clicks it. | |
user_moves_listing_by_one ($listingtype, $listingnode, $direction, $highlight=true) | |
Moves a course or category listing within the management interface up or down by one. | |
Variables | |
const | COURSE_CHOOSER_FOOTER_NONE 'hidden' |
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. | |
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 | COURSE_TIMELINE_SEARCH 'search' |
const | DOWNLOAD_COURSE_CONTENT_DISABLED 0 |
const | DOWNLOAD_COURSE_CONTENT_ENABLED 1 |
const | DOWNLOAD_COURSE_CONTENT_SITE_DEFAULT 2 |
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 |
actions_menu_should_be_open | ( | $activityname | ) |
Checks that the specified activity's action menu is open.
@Then /^"(?P<activity_name_string>(?:[^"]|::")*)" actions menu should be open$/
DriverException | The step is not available when Javascript is disabled |
string | $activityname |
actions_menu_should_have_item | ( | $activityname, | |
$menuitem ) |
Checks that the specified activity's action menu contains an item.
@Then /^"(?P<activity_name_string>(?:[^"]|::")*)" actions menu should have "(?P<menu_item_string>(?:[^"]|")*)" item$/
DriverException | The step is not available when Javascript is disabled |
string | $activityname | |
string | $menuitem |
actions_menu_should_not_have_item | ( | $activityname, | |
$menuitem ) |
Checks that the specified activity's action menu does not contains an item.
@Then /^"(?P<activity_name_string>(?:[^"]|::")*)" actions menu should not have "(?P<menu_item_string>(?:[^"]|")*)" item$/
DriverException | The step is not available when Javascript is disabled |
string | $activityname | |
string | $menuitem |
activity_date_in_activity_should_contain_text | ( | string | $activityname, |
string | $text ) |
Checks the presence of the given text in the activity's displayed dates.
@Given /^the activity date in "(?P<activityname>(?:[^"]|::")*)" should contain "(?P<text>(?:[^"]|")*)"$/
string | $activityname | The activity name. |
string | $text | The text to be searched in the activity date. |
activity_dates_information_in_activity_should_exist | ( | string | $activityname | ) |
Checks the presence of activity dates information in the activity information output component.
@Given /^the activity date information in "(?P<activityname>(?:[^"]|::")*)" should exist$/
string | $activityname | The activity name. |
activity_dates_information_in_activity_should_not_exist | ( | string | $activityname | ) |
Checks the absence of activity dates information in the activity information output component.
@Given /^the activity date information in "(?P<activityname>(?:[^"]|::")*)" should not exist$/
string | $activityname | The activity name. |
activity_should_be_available_but_hidden_from_course_page | ( | $activityname | ) |
Checks that the specified activity is visible.
You need to be in the course page. It can be used being logged as a student and as a teacher on editing mode.
@Then /^"(?P<activity_or_resource_string>(?:[^"]|::")*)" activity should be available but hidden from course page$/
string | $activityname |
ExpectationException |
activity_should_be_hidden | ( | $activityname | ) |
Checks that the specified activity is hidden.
You need to be in the course page. It can be used being logged as a student and as a teacher on editing mode.
@Then /^"(?P<activity_or_resource_string>(?:[^"]|::")*)" activity should be hidden$/
string | $activityname |
ExpectationException |
activity_should_be_visible | ( | $activityname | ) |
Checks that the specified activity is visible.
You need to be in the course page. It can be used being logged as a student and as a teacher on editing mode.
@Then /^"(?P<activity_or_resource_string>(?:[^"]|::")*)" activity should be visible$/
string | $activityname |
ExpectationException |
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 | ( | bool | $onlyactive = false, |
int | $lastloginsince = null ) |
Calculate the average number of enrolled participants per course.
This is intended for statistics purposes during the site registration. Only visible courses are taken into account. Front page enrolments are excluded.
bool | $onlyactive | Consider only active enrolments in enabled plugins and obey the enrolment time restrictions. |
int | $lastloginsince | If specified, count only users who logged in after this timestamp. |
float |
can_add_moduleinfo | ( | $course, | |
$modulename, | |||
$sectionnum ) |
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.
stdClass | $course | the course of the module |
string | $modulename | the module name |
int | $sectionnum | 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 |
category_actions_menu_should_have_item | ( | $name, | |
$menuitem ) |
Checks that the specified category actions menu contains an item.
@Then /^"(?P<name_string>(?:[^"]|::")*)" category actions menu should have "(?P<menu_item_string>(?:[^"]|")*)" item$/
string | $name | |
string | $menuitem |
Behat\Mink\Exception\ExpectationException |
category_actions_menu_should_not_have_item | ( | $name, | |
$menuitem ) |
Checks that the specified category actions menu does not contain an item.
@Then /^"(?P<name_string>(?:[^"]|::")*)" category actions menu should not have "(?P<menu_item_string>(?:[^"]|")*)" item$/
string | $name | |
string | $menuitem |
Behat\Mink\Exception\ExpectationException |
category_in_management_listing_should_be_dimmed | ( | $idnumber | ) |
Checks that a category within the management interface is dimmed.
@Given /^category in management listing should be dimmed "(?P<idnumber_string>(?:[^"]|::")*)"$/
string | $idnumber |
category_in_management_listing_should_be_visible | ( | $idnumber | ) |
Checks that a category within the management interface is visible.
@Given /^category in management listing should be visible "(?P<idnumber_string>(?:[^"]|::")*)"$/
string | $idnumber |
clean_param_if_not_null | ( | $param, | |
string | $type = PARAM_RAW ) |
Cleans the given param, unless it is null.
mixed | $param | The variable we are cleaning. |
string | $type | Expected format of param after cleaning. |
mixed | Null if $param is null, otherwise the cleaned value. |
coding_exception |
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 |
contract_value | ( | array & | $dest, |
array | $source, | ||
array | $option, | ||
string | $optionname ) |
'Converts' a value from what is stored in the database into what is used by edit forms.
array | $dest | The destination array |
array | $source | The source array |
array | $option | The definition structure of the option. |
string | $optionname | The name of the option, as provided in the definition. |
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_drawer | ( | ) |
Render the message drawer to be included in the top of the body of each page.
string | HTML |
core_course_inplace_editable | ( | $itemtype, | |
$itemid, | |||
$newvalue ) |
Implements callback inplace_editable() allowing to edit values in-place.
string | $itemtype | |
int | $itemid | |
mixed | $newvalue |
?\core\output\inplace_editable |
core_courseformat_output_fragment_cmitem | ( | $args | ) |
Course-module fragment renderer method.
The fragment arguments are id and sr (section return).
array | $args | The fragment arguments. |
string | The rendered cm item. |
require_login_exception |
core_courseformat_output_fragment_section | ( | $args | ) |
Section fragment renderer method.
The fragment arguments are courseid, section id and sr (section return).
array | $args | The fragment arguments. |
string | The rendered section. |
require_login_exception |
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, | |||
stdClass | $user = null ) |
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'. |
stdClass | $user | the user to check, defaults to the global user if not provided. |
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, | |
$sectionornum, | |||
$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 | $sectionornum | |
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_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) |
string | The markup for the move action, or an empty string if not available. |
course_get_communication_instance_data | ( | int | $courseid | ) |
Get course specific data for configuring a communication instance.
integer | $courseid | The course id. |
array | Returns course data, context and heading. |
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_courseimage | ( | \stdClass | $course | ) |
Get the current course image for the given course.
stdClass | $course |
null|stored_file |
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_enrolled_courses_for_logged_in_user_from_search | ( | int | $limit = 0, |
int | $offset = 0, | ||
string | $sort = null, | ||
string | $fields = null, | ||
int | $dbquerylimit = COURSE_DB_QUERY_LIMIT, | ||
array | $searchcriteria = [], | ||
array | $options = [] ) |
Get the list of enrolled courses the current user searched for.
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 | $searchcriteria | contains search criteria |
array | $options | display options, same as in get_courses() except 'recursive' is ignored - search is always category-independent |
Generator |
course_get_format | ( | $courseorid | ) |
Returns an instance of format class (extending course_format) for given course.
int | stdClass | $courseorid | either course id or an object that has the property 'format' and may contain property 'id' |
course_format |
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\output\tagindex |
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\output\tagindex |
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_in_management_listing_should_be_dimmed | ( | $idnumber | ) |
Checks that a course within the management interface is dimmed.
@Given /^course in management listing should be dimmed "(?P<idnumber_string>(?:[^"]|::")*)"$/
string | $idnumber |
course_in_management_listing_should_be_visible | ( | $idnumber | ) |
Checks that a course within the management interface is visible.
@Given /^course in management listing should be visible "(?P<idnumber_string>(?:[^"]|::")*)"$/
string | $idnumber |
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|false | 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_output_fragment_new_base_form | ( | $args | ) |
Renders the course copy form for the modal on the course management screen.
array | $args |
string\$o | Form HTML. |
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_section_view | ( | context_course | $context, |
int | $sectionid ) |
Trigger course section viewed event.
context_course | $context | course context object |
int | $sectionid | section number |
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_communication_instance_data | ( | stdClass | $data | ) |
Update a course using communication configuration data.
stdClass | $data | The data to update the course with. |
course_update_section | ( | $courseorid, | |
$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 | $courseorid | |
stdClass | section_info | $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, | |||
int | $sectionid = null, | ||
bool | $changename = true ) |
Api to duplicate a module.
object | $course | course object. |
object | $cm | course module object to be duplicated. |
int | $sectionid | section ID new course module will be placed in. |
bool | $changename | updates module name with text from duplicatedmodule lang string. |
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 |
expand_value | ( | array & | $dest, |
array | $source, | ||
array | $option, | ||
string | $optionname ) |
'Converts' a value from what is used in edit forms into a value(s) to be stored in the database.
array | $dest | The destination array |
array | $source | The source array |
array | $option | The definition structure of the option. |
string | $optionname | The name of the option, as provided in the definition. |
|
protected |
Returns the DOM node of the activity action menu.
ElementNotFoundException | Thrown by behat_base\find |
string | $activityname | The activity name |
Behat\Mink\Element\NodeElement |
|
protected |
Clicks on the specified element inside the activity container.
ElementNotFoundException |
string | $element | |
string | $selectortype | |
string | $activityname |
NodeElement |
|
protected |
Gets the activity instance name from the activity node.
ElementNotFoundException |
NodeElement | $activitynode |
string |
|
protected |
Returns the DOM node of the activity from .
ElementNotFoundException | Thrown by behat_base\find |
string | $activityname | The activity name |
NodeElement |
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 |
|
protected |
Gets the current course format.
ExpectationException | If we are not in the course view page. |
string | The course format in a frankenstyled name. |
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 |
|
protected |
Returns the category node from within the listing on the management page.
string | $idnumber |
Behat\Mink\Element\NodeElement |
|
protected |
Returns a category node from within the management interface.
string | $name | The name of the category. |
bool | $link | If set to true we'll resolve to the link rather than just the node. |
Behat\Mink\Element\NodeElement |
|
protected |
Returns the course node from within the listing on the management page.
string | $idnumber |
Behat\Mink\Element\NodeElement |
|
protected |
Returns a course node from within the management interface.
string | $name | The name of the course. |
bool | $link | If set to true we'll resolve to the link rather than just the node. |
Behat\Mink\Element\NodeElement |
get_module_types_names | ( | $plural = false, | |
$resetcache = false ) |
Returns an array where the key is the module name (component name without 'mod_') and the value is a lang_string object with a human-readable string.
bool | $plural | If true, the function returns the plural forms of the names. |
bool | $resetcache | If true, the static cache will be reset |
lang_string[] | Localised human-readable names of all used modules. |
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 |
|
protected |
Gets the section's activites DOM nodes.
string | $sectionxpath |
array | NodeElement instances |
|
protected |
Get the section id from an identifier.
The section name and summary are checked.
string | $courseidentifier | |
string | $sectionidentifier |
section_info|null | section info or null if not found. |
|
protected |
Get the section id from a courseid and a sectionnum.
string | $courseidentifier | Course identifier. |
int | $sectionnum | Section number |
section_info|null | section info or null if not found. |
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 |
|
protected |
Returns the hide section icon link if it exists or throws exception.
ElementNotFoundException | Thrown by behat_base\find |
int | $sectionnumber |
NodeElement |
i_add_to_section_and_i_fill_the_form_with | ( | $activity, | |
$section, | |||
TableNode | $data ) |
Adds the selected activity/resource filling the form data with the specified field/value pairs.
Sections 0 and 1 are also allowed on frontpage.
@When /^I add a "(?P<activity_or_resource_name_string>(?:[^"]|::")*)" to section "(?P<section_number>\d+)" and I fill the form with:$/
string | $activity | The activity name |
int | $section | The section number |
TableNode | $data | The activity field/value data |
i_change_activity_name_to | ( | $activityname, | |
$newactivityname ) |
Edits the activity name through the edit activity; this step only works with Javascript enabled.
Editing mode should be on.
@Given /^I change "(?P<activity_name_string>(?:[^"]|::")*)" activity name to "(?P<new_name_string>(?:[^"]|")*)"$/
DriverException | Step not available when Javascript is disabled |
string | $activityname | |
string | $newactivityname |
i_click_on_action_for_item_in_management_category_listing | ( | $action, | |
$name ) |
Locates a category in the course category management interface and then triggers an action for it.
@Given /^I click on "(?P<action_string>(?:[^"]|::")*)" action for "(?P<name_string>(?:[^"]|")*)" in management category listing$/
string | $action | The action to take. One of |
string | $name | The name of the category as it is displayed in the management interface. |
i_click_on_action_for_item_in_management_course_listing | ( | $action, | |
$name ) |
Locates a course in the course category management interface and then triggers an action for it.
@Given /^I click on "(?P<action_string>(?:[^"]|::")*)" action for "(?P<name_string>(?:[^"]|")*)" in management course listing$/
string | $action | The action to take. One of |
string | $name | The name of the course as it is displayed in the management interface. |
i_click_on_category_in_the_management_category_listing | ( | $name | ) |
Clicks on a category in the management interface.
@Given /^I click on "(?P<categoryname_string>(?:[^"]|::")*)" category in the management category listing$/
string | $name | The name of the category to click. |
i_click_on_category_in_the_management_interface | ( | $name | ) |
Clicks on a category in the management interface.
@Given /^I click on category "(?P<name_string>(?:[^"]|::")*)" in the management interface$/
string | $name |
i_click_on_course_in_the_management_interface | ( | $name | ) |
Clicks on a course in the management interface.
@Given /^I click on course "(?P<name_string>(?:[^"]|::")*)" in the management interface$/
string | $name |
i_click_on_in_the_activity | ( | $element, | |
$selectortype, | |||
$activityname ) |
Clicks on the specified element of the activity.
You should be in the course page with editing mode turned on.
@Given /^I click on "(?P<element_string>(?:[^"]|::")*)" "(?P<selector_string>(?:[^"]|")*)" in the "(?P<activity_name_string>(?:[^"]|::")*)" activity$/
string | $element | |
string | $selectortype | |
string | $activityname |
i_click_to_expand_category_in_the_management_interface | ( | $idnumber | ) |
Click to expand a category revealing its sub categories within the management UI.
@Given /^I click to expand category "(?P<idnumber_string>(?:[^"]|::")*)" in the management interface$/
string | $idnumber |
i_click_to_move_category_by_one | ( | $idnumber, | |
$direction ) |
Moves a category displayed in the management interface up or down one place.
@Given /^I click to move category "(?P<idnumber_string>(?:[^"]|::")*)" (?P<direction>up|down) one$/
string | $idnumber | The category idnumber |
string | $direction | The direction to move in, either up or down |
i_click_to_move_course_by_one | ( | $idnumber, | |
$direction ) |
Moves a course displayed in the management interface up or down one place.
@Given /^I click to move course "(?P<idnumber_string>(?:[^"]|::")*)" (?P<direction>up|down) one$/
string | $idnumber | The course idnumber |
string | $direction | The direction to move in, either up or down |
i_close_actions_menu | ( | $activityname | ) |
Closes an activity actions menu if it is not already closed.
@Given /^I close "(?P<activity_name_string>(?:[^"]|::")*)" actions menu$/
DriverException | The step is not available when Javascript is disabled |
string | $activityname |
i_delete_activity | ( | $activityname | ) |
Deletes the activity or resource specified by it's name.
This step is experimental when using it in Javascript tests. You should be in the course page with editing mode on.
@Given /^I delete "(?P<activity_name_string>(?:[^"]|::")*)" activity$/
string | $activityname |
i_delete_section | ( | $sectionnumber | ) |
Deletes course section.
@Given /^I delete section "(?P<section_number>::d+)"$/
int | $sectionnumber | The section number |
i_duplicate_activity | ( | $activityname | ) |
Duplicates the activity or resource specified by it's name.
You should be in the course page with editing mode on.
@Given /^I duplicate "(?P<activity_name_string>(?:[^"]|::")*)" activity$/
string | $activityname |
i_duplicate_activity_editing_the_new_copy_with | ( | $activityname, | |
TableNode | $data ) |
Duplicates the activity or resource and modifies the new activity with the provided data.
You should be in the course page with editing mode on.
@Given /^I duplicate "(?P<activity_name_string>(?:[^"]|::")*)" activity editing the new copy with:$/
string | $activityname | |
TableNode | $data |
i_edit_the_section | ( | $sectionnumber | ) |
Go to editing section page for specified section number.
You need to be in the course page and on editing mode.
@Given /^I edit the section "(?P<section_number>::d+)"$/
int | $sectionnumber |
i_edit_the_section_and_i_fill_the_form_with | ( | $sectionnumber, | |
TableNode | $data ) |
Edit specified section and fill the form data with the specified field/value pairs.
@When /^I edit the section "(?P<section_number>::d+)" and I fill the form with:$/
int | $sectionnumber | The section number |
TableNode | $data | The activity field/value data |
i_hide_section | ( | $sectionnumber | ) |
Hides the specified visible section.
You need to be in the course page and on editing mode.
@Given /^I hide section "(?P<section_number>::d+)"$/
int | $sectionnumber |
i_indent_left_activity | ( | $activityname | ) |
Indents to the left the activity or resource specified by it's name.
Editing mode should be on.
@Given /^I indent left "(?P<activity_name_string>(?:[^"]|::")*)" activity$/
string | $activityname |
i_indent_right_activity | ( | $activityname | ) |
Indents to the right the activity or resource specified by it's name.
Editing mode should be on.
@Given /^I indent right "(?P<activity_name_string>(?:[^"]|::")*)" activity$/
string | $activityname |
i_move_activity_to_section | ( | $activityname, | |
$sectionnumber ) |
Moves the specified activity to the first slot of a section.
Editing mode should be on.
@Given /^I move "(?P<activity_name_string>(?:[^"]|::")*)" activity to section "(?P<section_number>\d+)"$/
string | $activityname | The activity name |
int | $sectionnumber | The number of section |
i_move_activity_to_section_yui | ( | $activityname, | |
$sectionnumber ) |
Moves the specified activity to the first slot of a section using the YUI course format.
This step is experimental when using it in Javascript tests. Editing mode should be on.
string | $activityname | The activity name |
int | $sectionnumber | The number of section |
i_move_category_to_top_level_in_the_management_interface | ( | $name | ) |
Move selected categories to top level in the management interface.
@Given /^I move category "(?P<name_string>(?:[^"]|::")*)" to top level in the management interface$/
string | $name |
i_move_down_section | ( | $sectionnumber | ) |
Moves down the specified section, this step only works with Javascript disabled.
Editing mode should be on.
@Given /^I move down section "(?P<section_number>::d+)"$/
DriverException | Step not available when Javascript is enabled |
int | $sectionnumber |
i_move_up_section | ( | $sectionnumber | ) |
Moves up the specified section, this step only works with Javascript disabled.
Editing mode should be on.
@Given /^I move up section "(?P<section_number>::d+)"$/
DriverException | Step not available when Javascript is enabled |
int | $sectionnumber |
i_navigate_to_course_participants | ( | ) |
Go to the course participants.
@Given /^I navigate to course participants$/
i_open_actions_menu | ( | $activityname | ) |
Opens an activity actions menu if it is not already opened.
@Given /^I open "(?P<activity_name_string>(?:[^"]|::")*)" actions menu$/
DriverException | The step is not available when Javascript is disabled |
string | $activityname |
i_open_section_edit_menu | ( | $sectionnumber | ) |
Opens a section edit menu if it is not already opened.
@Given /^I open section "(?P<section_number>::d+)" edit menu$/
DriverException | The step is not available when Javascript is disabled |
string | $sectionnumber |
i_open_the_action_menu_for_item_in_management_category_listing | ( | $name | ) |
Locates a category in the course category management interface and then opens action menu for it.
@Given /^I open the action menu for "(?P<name_string>(?:[^"]|::")*)" in management category listing$/
string | $name | The name of the category as it is displayed in the management interface. |
i_open_the_activity_chooser | ( | ) |
Open the activity chooser in a course.
@Given /^I open the activity chooser$/
i_select_category_in_the_management_interface | ( | $name | ) |
Clicks on a category checkbox in the management interface, if not checked.
@Given /^I select category "(?P<name_string>(?:[^"]|::")*)" in the management interface$/
string | $name |
i_select_course_in_the_management_interface | ( | $name | ) |
Clicks course checkbox in the management interface, if not checked.
@Given /^I select course "(?P<name_string>(?:[^"]|::")*)" in the management interface$/
string | $name |
i_should_not_see_category_as_subcategory_of_in_the_management_interface | ( | $subcatidnumber, | |
$catidnumber ) |
Checks that a category is not a subcategory of specific category.
@Given /^I should not see category "(?P<subcatidnumber_string>(?:[^"]|::")*)" as subcategory of "(?P<catidnumber_string>(?:[^"]|")*)" in the management interface$/
ExpectationException |
string | $subcatidnumber | |
string | $catidnumber |
i_should_not_see_teacher_after | ( | $fteacher, | |
$pteacher ) |
Check that one teacher oes not appears after another in the course contacts.
@Given /^I should not see teacher "(?P<fteacher_string>(?:[^"]|::")*)" after "(?P<pteacher_string>(?:[^"]|")*)" in the course contact listing$/
string | $fteacher | The teacher that should not be found (after the other teacher) |
string | $pteacher | The teacher after who the other should not be found (this teacher must be found!) |
ExpectationException |
i_should_see_category_as_subcategory_of_in_the_management_interface | ( | $subcatidnumber, | |
$catidnumber ) |
Checks that a category is a subcategory of specific category.
@Given /^I should see category "(?P<subcatidnumber_string>(?:[^"]|::")*)" as subcategory of "(?P<catidnumber_string>(?:[^"]|")*)" in the management interface$/
ExpectationException |
string | $subcatidnumber | |
string | $catidnumber |
i_should_see_category_listing_before | ( | $preceedingcategory, | |
$followingcategory ) |
Check that one category appears before another in the course category management listings.
@Given /^I should see category listing "(?P<preceedingcategory_string>(?:[^"]|::")*)" before "(?P<followingcategory_string>(?:[^"]|")*)"$/
string | $preceedingcategory | The first category to find |
string | $followingcategory | The second category to find (should be after the first category) |
ExpectationException |
i_should_see_course_listing_before | ( | $preceedingcourse, | |
$followingcourse ) |
Check that one course appears before another in the course category management listings.
@Given /^I should see course listing "(?P<preceedingcourse_string>(?:[^"]|::")*)" before "(?P<followingcourse_string>(?:[^"]|")*)"$/
string | $preceedingcourse | The first course to find |
string | $followingcourse | The second course to find (should be AFTER the first course) |
ExpectationException |
i_should_see_teacher_before | ( | $pteacher, | |
$fteacher ) |
Check that one teacher appears before another in the course contacts.
@Given /^I should see teacher "(?P<pteacher_string>(?:[^"]|::")*)" before "(?P<fteacher_string>(?:[^"]|")*)" in the course contact listing$/
string | $pteacher | The first teacher to find |
string | $fteacher | The second teacher to find (should be after the first teacher) |
ExpectationException |
i_should_see_the_courses_management_page | ( | $mode | ) |
Checks that we are on the course management page that we expect to be on and that no course has been selected.
@Given /^I should see the "(?P<mode_string>(?:[^"]|::")*)" management page$/
string | $mode | The mode to expected. One of 'Courses', 'Course categories' or 'Course categories and courses' |
i_should_see_the_courses_management_page_with_a_course_selected | ( | $mode | ) |
Checks that we are on the course management page that we expect to be on and that a course has been selected.
@Given /^I should see the "(?P<mode_string>(?:[^"]|::")*)" management page with a course selected$/
string | $mode | The mode to expected. One of 'Courses', 'Course categories' or 'Course categories and courses' |
i_show_section | ( | $sectionnumber | ) |
Shows the specified hidden section.
You need to be in the course page and on editing mode.
@Given /^I show section "(?P<section_number>::d+)"$/
int | $sectionnumber |
i_toggle_category_children_visibility_in_frontpage | ( | $categoryname | ) |
Clicks to expand or collapse a category displayed on the frontpage.
@Given /^I toggle "(?P<categoryname_string>(?:[^"]|::")*)" category children visibility in frontpage$/
ExpectationException |
string | $categoryname |
i_toggle_visibility_of_category_in_management_listing | ( | $idnumber | ) |
Toggles the visibility of a category in the management UI.
If it was visible it will be hidden. If it is hidden it will be made visible.
@Given /^I toggle visibility of category "(?P<idnumber_string>(?:[^"]|::")*)" in management listing$/
i_toggle_visibility_of_course_in_management_listing | ( | $idnumber | ) |
Toggles the visibility of a course in the management UI.
If it was visible it will be hidden. If it is hidden it will be made visible.
@Given /^I toggle visibility of course "(?P<idnumber_string>(?:[^"]|::")*)" in management listing$/
string | $idnumber |
i_turn_section_highlighting_off | ( | $sectionnumber | ) |
Turns course section highlighting off.
@Given /^I turn section "(?P<section_number>::d+)" highlighting off$/
int | $sectionnumber | The section number |
i_turn_section_highlighting_on | ( | $sectionnumber | ) |
Turns course section highlighting on.
@Given /^I turn section "(?P<section_number>::d+)" highlighting on$/
int | $sectionnumber | The section number |
i_unselect_category_in_the_management_interface | ( | $name | ) |
Clicks on a category checkbox in the management interface, if checked.
@Given /^I unselect category "(?P<name_string>(?:[^"]|::")*)" in the management interface$/
string | $name |
i_unselect_course_in_the_management_interface | ( | $name | ) |
Clicks course checkbox in the management interface, if checked.
@Given /^I unselect course "(?P<name_string>(?:[^"]|::")*)" in the management interface$/
string | $name |
i_wait_until_section_is_available | ( | $sectionnumber | ) |
Waits until the section is available to interact with it.
Useful when the section is performing an action and the section is overlayed with a loading layout.
Using the protected method as this method will be usually called by other methods which are not returning a set of steps and performs the actions directly, so it would not be executed if it returns another step.
Hopefully we would not require test writers to use this step and we will manage it from other step definitions.
@Given /^I wait until section "(?P<section_number>::d+)" is available$/
int | $sectionnumber |
void |
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_course_editor | ( | course_format | $format | ) |
Include and configure the course editor modules.
course_format | $format | the course format instance. |
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 |
|
protected |
Returns whether the user can edit the course contents or not.
bool |
|
protected |
Returns whether the user can edit the course contents and the editing mode is on.
bool |
label_should_be_hidden | ( | $activityname | ) |
Checks that the specified label is hidden from students.
You need to be in the course page.
@Then /^"(?P<activity_or_resource_string>(?:[^"]|::")*)" label should be hidden$/
string | $activityname |
ExpectationException |
|
protected |
Used by spin to determine the callback has been highlighted.
behat_course | $self | A self reference (default first arg from a spin callback) |
Behat\Mink\Element\NodeElement | $selector |
bool |
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 |
stdClass | 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, | |||
string | $suffix = '' ) |
Prepare the standard module information for a new module instance.
stdClass | $course | course object |
string | $modulename | module name |
int | $section | section number |
string | $suffix | the suffix to add to the name of the completion rules. |
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|false |
save_local_role_names | ( | $courseid, | |
$data ) |
Save the Your name for 'Some role' strings.
integer | $courseid | the id of this course. |
array | stdClass | $data | the data that came from the course settings form. |
section_activities_should_be_hidden | ( | $sectionnumber | ) |
Checks that all actiities in the specified section are hidden.
You need to be in the course page. It can be used being logged as a student and as a teacher on editing mode.
@Then /^all activities in section "(?P<section_number>::d+)" should be hidden$/
ExpectationException | |
ElementNotFoundException | Thrown by behat_base\find |
int | $sectionnumber |
|
protected |
Checks if the course section exists.
ElementNotFoundException | Thrown by behat_base\find |
int | $sectionnumber |
string | The xpath of the section. |
section_should_be_hidden | ( | $sectionnumber | ) |
Checks that the specified section is visible.
You need to be in the course page. It can be used being logged as a student and as a teacher on editing mode.
@Then /^section "(?P<section_number>::d+)" should be hidden$/
ExpectationException | |
ElementNotFoundException | Thrown by behat_base\find |
int | $sectionnumber |
section_should_be_highlighted | ( | $sectionnumber | ) |
Checks if the specified course section hightlighting is turned on.
You need to be in the course page on editing mode.
@Then /^section "(?P<section_number>::d+)" should be highlighted$/
ExpectationException |
int | $sectionnumber | The section number |
section_should_be_visible | ( | $sectionnumber | ) |
Checks that the specified section is visible.
You need to be in the course page. It can be used being logged as a student and as a teacher on editing mode.
@Then /^section "(?P<section_number>::d+)" should be visible$/
ExpectationException |
int | $sectionnumber |
section_should_not_be_highlighted | ( | $sectionnumber | ) |
Checks if the specified course section highlighting is turned off.
You need to be in the course page on editing mode.
@Then /^section "(?P<section_number>::d+)" should not be highlighted$/
ExpectationException |
int | $sectionnumber | The section number |
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 core::event::course_module_updated::create_from_cm().
int | $id | course module ID. |
int | $groupmode | the new groupmode value. |
bool | True if the $groupmode was updated. |
set_coursemodule_name | ( | $cmid, | |
$name ) |
Changes the course module name.
int | $cmid | course module id |
string | $name | new value for a name |
bool | whether a change was made |
set_coursemodule_visible | ( | $id, | |
$visible, | |||
$visibleoncoursepage = 1, | |||
bool | $rebuildcache = true ) |
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 core::event::course_module_updated::create_from_cm().
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.
If $rebuildcache is set to false, the calling code is responsible for ensuring the cache is purged and rebuilt as appropriate. Consider using this if set_coursemodule_visible is called multiple times (e.g. in a loop).
int | $id | of the module |
int | $visible | state of the module |
int | $visibleoncoursepage | state of the module on the course page |
bool | $rebuildcache | If true (default), perform a partial cache purge and rebuild. |
bool | false when the module was not found, true otherwise |
set_downloadcontent | ( | int | $id, |
bool | $downloadcontent ) |
Set downloadcontent value to course module.
int | $id | The id of the module. |
bool | $downloadcontent | Whether the module can be downloaded when download course content is enabled. |
bool | True if downloadcontent has been updated, false 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 |
|
protected |
Returns the show section icon or throws an exception.
ElementNotFoundException | Thrown by behat_base\find |
int | $sectionnumber |
NodeElement |
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. |
|
protected |
Finds the node to use for a management listitem action and clicks it.
string | $listingtype | Either course or category. |
Behat\Mink\Element\NodeElement | $listingnode | |
string | $action | The action being taken |
Behat\Mink\Exception\ExpectationException |
|
protected |
Moves a course or category listing within the management interface up or down by one.
string | $listingtype | One of course or category |
Behat\Mink\Element\NodeElement | $listingnode | |
string | $direction | One of up or down. |
bool | $highlight | If set to false we don't check the node has been highlighted. |
const COURSE_MAX_SUMMARIES_PER_PAGE 10 |
Number of courses to display when summaries are included.