Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
|
Main class for the singleactivity course format. More...
Public Member Functions | |
activity_has_subtypes () | |
Checks if the activity type has multiple items in the activity chooser. | |
add_section_preference_ids (string $preferencename, array $sectionids,) | |
Add section preference ids. | |
ajax_section_move () | |
Custom action after section has been moved in AJAX mode. | |
allow_stealth_module_visibility ($cm, $section) | |
Returns whether this course format allows the activity to have "triple visibility state" - visible always, hidden on course page but available, hidden. | |
can_delete_section ($section) | |
Whether this format allows to delete sections. | |
can_sections_be_removed_from_navigation () | |
Determines whether section items can be removed from the navigation, just like the breadcrumb feature seen on activity pages. | |
course_content_footer () | |
Course-specific information to be output immediately below content on any course page. | |
course_content_header () | |
Course-specific information to be output immediately above content on any course page. | |
course_footer () | |
Course-specific information to be output on any course page (usually in the beginning of standard footer) | |
course_format_options ($foreditform=false) | |
Definitions of the additional options that this course format uses for course. | |
course_header () | |
Course-specific information to be output on any course page (usually above navigation bar) | |
create_edit_form_elements (&$mform, $forsection=false) | |
Adds format options elements to the course/section edit form. | |
delete_format_data () | |
Course deletion hook. | |
delete_module (cm_info $cm, bool $async=false) | |
Wrapper for course_delete_module method. | |
delete_section ($sectionornum, $forcedeleteifnotempty=false) | |
Deletes a section. | |
duplicate_section (section_info $originalsection) | |
Duplicate a section. | |
edit_form_validation ($data, $files, $errors) | |
Override if you need to perform some extra validation of the format options. | |
editsection_form ($action, $customdata=array()) | |
Return an instance of moodleform to edit a specified section. | |
extend_course_navigation ($navigation, navigation_node $node) | |
Loads all of the course sections into the navigation. | |
get_config_for_external () | |
Return the plugin configs for external functions. | |
get_context () | |
Returns the course context. | |
get_course () | |
Returns a record from course database table plus additional fields that course format defines. | |
get_course_display () | |
Get the course display value for the current course. | |
get_courseid () | |
Returns id of the course (0 if course is not specified) | |
get_default_blocks () | |
Returns the list of blocks to be automatically added for the newly created course. | |
get_default_course_enddate ($mform, $fieldnames=array()) | |
Returns the default end date value based on the start date. | |
get_default_section_name ($section) | |
Returns the default section using course_format's implementation of get_section_name. | |
get_editor_custom_strings () | |
Return custom strings for the course editor. | |
get_format () | |
Returns the format name used by this course. | |
get_format_name () | |
Returns the localised name of this course format plugin. | |
get_format_options ($section=null) | |
Returns the format options stored for this course or course section. | |
get_format_string (string $key, $data=null) | |
Get the proper format plugin string if it exists. | |
get_last_section_number () | |
Method used in the rendered and during backup instead of legacy 'numsections'. | |
get_max_sections () | |
Method used to get the maximum number of sections for this course format. | |
get_modinfo () | |
Return the current course modinfo. | |
get_non_ajax_cm_action_url (string $action, cm_info $cm) | |
Return the old non-ajax activity action url. | |
get_output_classname (string $outputname) | |
Returns instance of output component used by this plugin. | |
get_renderer (moodle_page $page) | |
Returns instance of page renderer used by this plugin. | |
get_required_jsfiles () | |
Get the required javascript files for the course format. | |
get_section ($section, $strictness=IGNORE_MISSING) | |
Returns information about section used in course. | |
get_section_highlighted_name () | |
Returns the name for the highlighted section. | |
get_section_name ($section) | |
Returns the display name of the given section that the course prefers. | |
get_section_number () | |
Set if the current format instance will show multiple sections or an individual one. | |
get_sectionid () | |
Get if the current format instance will show multiple sections or an individual one. | |
get_sectionnum () | |
Get the current section number to display. | |
get_sections () | |
Returns a list of sections used in the course. | |
get_sections_preferences () | |
Return the format section preferences. | |
get_sections_preferences_by_preference () | |
Return the format section preferences. | |
get_view_url ($section, $options=array()) | |
The URL to use for the specified course. | |
has_view_page () | |
Returns true if the course has a front page. | |
inplace_editable_render_section_name ($section, $linkifneeded=true, $editable=null, $edithint=null, $editlabel=null) | |
Prepares the templateable object to display section name. | |
inplace_editable_update_section_name ($section, $itemtype, $newvalue) | |
Updates the value in the database and modifies this object respectively. | |
is_section_current ($section) | |
Returns true if the specified section is current. | |
is_section_visible (section_info $section) | |
Returns if an specific section is visible to the current user. | |
move_section_after (section_info $section, section_info $destination) | |
Moves a section just after the target section. | |
page_set_cm (moodle_page $page) | |
Allows course format to execute code on moodle_page\set_cm() | |
page_set_course (moodle_page $page) | |
Allows course format to execute code on moodle_page\set_course() | |
page_title () | |
Generate the title for this section page. | |
remove_section_preference_ids (string $preferencename, array $sectionids,) | |
Remove section preference ids. | |
reorder_activities () | |
Make sure that current active activity is in section 0. | |
section_action ($section, $action, $sr) | |
Callback used in WS core_course_edit_section when teacher performs an AJAX action on a section (show/hide) | |
section_format_options ($foreditform=false) | |
Definitions of the additional options that this course format uses for section. | |
section_get_available_hook (section_info $section, &$available, &$availableinfo) | |
Allows to specify for modinfo that section is not available even when it is visible and conditionally available. | |
set_section_number (int $singlesection) | |
Set if the current format instance will show multiple sections or an individual one. | |
set_sectionid (?int $sectionid) | |
Set if the current format instance will show multiple sections or an individual one. | |
set_sectionnum (?int $sectionnum) | |
Set the current section number to display. | |
set_sections_preference (string $preferencename, array $sectionids) | |
Return the format section preferences. | |
show_editor (?array $capabilities=['moodle/course:manageactivities']) | |
return true if the course editor must be displayed. | |
show_groupmode (cm_info $cm) | |
Check if the group mode can be displayed. | |
supports_ajax () | |
Returns the information about the ajax support in the given source format. | |
supports_components () | |
Returns true if this course format is compatible with content components. | |
supports_news () | |
Indicates whether the course format supports the creation of the Announcements forum. | |
update_course_format_options ($data, $oldcourse=null) | |
Updates format options for a course. | |
update_section_format_options ($data) | |
Updates format options for a section. | |
uses_course_index () | |
Returns true if this course format uses course index. | |
uses_indentation () | |
Returns true if this course format uses activity indentation. | |
uses_sections () | |
Returns true if this course format uses sections. | |
validate_course_format_options (array $data) | |
Validates format options for the course. | |
Static Public Member Functions | |
static | get_supported_activities () |
Get the activities supported by the format. | |
static | instance ($courseorid) |
Returns an instance of the class. | |
static | reset_course_cache ($courseid=0) |
Resets cache for the course (or all caches) | |
static | session_cache (stdClass $course) |
Return the current user course format cache key. | |
static | session_cache_reset (stdClass $course) |
Reset the current user course format cache. | |
static | session_cache_reset_all () |
Reset the current user for all courses. | |
Protected Member Functions | |
can_add_activity () | |
Checks if the current user can add the activity of the specified type to this course. | |
get_activity () | |
Returns the current activity if exists. | |
get_activitytype () | |
Returns the name of activity type used for this course. | |
get_form_start_date ($mform, $fieldnames) | |
Get the start date value from the course settings page form. | |
get_section_modules_updated (section_info $section) | |
Return an array with all section modules content. | |
navigation_add_activity (navigation_node $node, $cm) | |
Adds a course module to the navigation node. | |
update_format_options ($data, $sectionid=null) | |
Updates format options for a course or section. | |
validate_format_options (array $rawdata, int $sectionid=null) | |
Prepares values of course or section format options before storing them in DB. | |
Static Protected Member Functions | |
static | get_class_name ($format) |
Get class name for the format. | |
static | get_format_or_default ($format) |
Validates that course format exists and enabled and returns either itself or default format. | |
Protected Attributes | |
stdClass | $course = false |
course data for course object, please use course_format\get_course() | |
int | $courseid |
Id of the course in this instance (maybe 0) | |
string | $format |
format used for this course. | |
array | $formatoptions = array() |
caches format options, please use course_format\get_format_options() | |
sectionmanager | $sectionmanager = null |
the format section manager. | |
int null | $singlesection = null |
the section number in single section format, null for multiple section formats. | |
int null | $singlesectionid = null |
the sectionid when a single section is selected, null when multiple sections are displayed. | |
Main class for the singleactivity course format.
format_singleactivity::activity_has_subtypes | ( | ) |
Checks if the activity type has multiple items in the activity chooser.
bool|null | (null if the check is not possible) |
|
inherited |
Add section preference ids.
string | $preferencename | preference name |
array | $sectionids | affected section ids |
|
inherited |
Custom action after section has been moved in AJAX mode.
Used in course/rest.php
?array | This will be passed in ajax respose |
Reimplemented in format_legacy, format_topics, and format_weeks.
|
inherited |
Returns whether this course format allows the activity to have "triple visibility state" - visible always, hidden on course page but available, hidden.
stdClass | cm_info | $cm | course module (may be null if we are displaying a form for adding a module) |
stdClass | section_info | $section | section where this module is located or will be added to |
bool |
Reimplemented in format_site, format_social, format_topics, and format_weeks.
|
protected |
Checks if the current user can add the activity of the specified type to this course.
bool |
|
inherited |
Whether this format allows to delete sections.
If format supports deleting sections it is also recommended to define language string 'deletesection' inside the format.
Do not call this function directly, instead use course_can_delete_section()
int | stdClass | section_info | $section |
bool |
Reimplemented in format_topics, and format_weeks.
|
inherited |
Determines whether section items can be removed from the navigation, just like the breadcrumb feature seen on activity pages.
By default, it returns false but can be overridden by the course format to change the behaviour.
bool | True if sections can be removed, false otherwise. |
|
inherited |
Course-specific information to be output immediately below content on any course page.
See course_format\course_header() for usage
null|renderable | null for no output or object with data for plugin renderer |
|
inherited |
Course-specific information to be output immediately above content on any course page.
See course_format\course_header() for usage
null|renderable | null for no output or object with data for plugin renderer |
|
inherited |
Course-specific information to be output on any course page (usually in the beginning of standard footer)
See course_format\course_header() for usage
null|renderable | null for no output or object with data for plugin renderer |
format_singleactivity::course_format_options | ( | $foreditform = false | ) |
Definitions of the additional options that this course format uses for course.
Singleactivity course format uses one option 'activitytype'
bool | $foreditform |
array | of options |
Reimplemented from core_courseformat\base.
|
inherited |
Course-specific information to be output on any course page (usually above navigation bar)
Example of usage: define class format_FORMATNAME_XXX implements renderable {}
create format renderer in course/format/FORMATNAME/renderer.php, define rendering function: class format_FORMATNAME_renderer extends plugin_renderer_base { protected function render_format_FORMATNAME_XXX(format_FORMATNAME_XXX $xxx) { return html_writer\tag('div', 'This is my header/footer'); } }
Return instance of format_FORMATNAME_XXX in this function, the appropriate method from plugin renderer will be called
null|renderable | null for no output or object with data for plugin renderer |
format_singleactivity::create_edit_form_elements | ( | & | $mform, |
$forsection = false ) |
Adds format options elements to the course/section edit form.
This function is called from course_edit_form::definition_after_data()
Format singleactivity adds a warning when format of the course is about to be changed.
MoodleQuickForm | $mform | form the elements are added to |
bool | $forsection | 'true' if this is a section edit form, 'false' if this is course edit form |
array | array of references to the added form elements |
Reimplemented from core_courseformat\base.
|
inherited |
Course deletion hook.
Format plugins can override this method to clean any format specific data and dependencies.
|
inherited |
Wrapper for course_delete_module method.
Format plugins can override this method to provide their own implementation of course_delete_module.
cm_info | $cm | the course module information |
bool | $async | whether or not to try to delete the module using an adhoc task. Async also depends on a plugin hook. |
moodle_exception |
|
inherited |
Deletes a section.
Do not call this function directly, instead call course_delete_section()
int | stdClass | section_info | $sectionornum | |
bool | $forcedeleteifnotempty | if set to false section will not be deleted if it has modules in it. |
bool | whether section was deleted |
|
inherited |
Duplicate a section.
section_info | $originalsection | The section to be duplicated |
section_info | The new duplicated section |
|
inherited |
Override if you need to perform some extra validation of the format options.
array | $data | array of ("fieldname"=>value) of submitted data |
array | $files | array of uploaded files "element_name"=>tmp_file_path |
array | $errors | errors already discovered in edit form validation |
array | of "element_name"=>"error_description" if there are errors, or an empty array if everything is OK. Do not repeat errors from $errors param here |
|
inherited |
Return an instance of moodleform to edit a specified section.
Default implementation returns instance of editsection_form that automatically adds additional fields defined in course_format\section_format_options()
Format plugins may extend editsection_form if they want to have custom edit section form.
mixed | $action | the action attribute for the form. If empty defaults to auto detect the current url. If a moodle_url object then outputs params as hidden variables. |
array | $customdata | the array with custom data to be passed to the form /course/editsection.php passes section_info object in 'cs' field for filling availability fields |
moodleform |
format_singleactivity::extend_course_navigation | ( | $navigation, | |
navigation_node | $node ) |
Loads all of the course sections into the navigation.
global_navigation | $navigation | |
navigation_node | $node | The course node within the navigation |
Reimplemented from core_courseformat\base.
|
protected |
Returns the current activity if exists.
null|cm_info |
|
protected |
Returns the name of activity type used for this course.
string|null |
|
staticfinalprotectedinherited |
Get class name for the format.
If course format xxx does not declare class format_xxx, format_legacy will be returned. This function also includes lib.php file from corresponding format plugin
string | $format |
string |
format_singleactivity::get_config_for_external | ( | ) |
Return the plugin configs for external functions.
array | the list of configuration settings |
Reimplemented from core_courseformat\base.
|
finalinherited |
Returns the course context.
context_course | the course context |
|
inherited |
Returns a record from course database table plus additional fields that course format defines.
?stdClass |
|
inherited |
Get the course display value for the current course.
Formats extending topics or weeks will use coursedisplay as this setting name so they don't need to override the method. However, if the format uses a different display logic it must override this method to ensure the core renderers know if a COURSE_DISPLAY_MULTIPAGE or COURSE_DISPLAY_SINGLEPAGE is being used.
int | The current value (COURSE_DISPLAY_MULTIPAGE or COURSE_DISPLAY_SINGLEPAGE) |
|
finalinherited |
Returns id of the course (0 if course is not specified)
int |
format_singleactivity::get_default_blocks | ( | ) |
Returns the list of blocks to be automatically added for the newly created course.
array | of default blocks, must contain two keys BLOCK_POS_LEFT and BLOCK_POS_RIGHT each of values is an array of block names (for left and right side columns) |
Reimplemented from core_courseformat\base.
|
inherited |
Returns the default end date value based on the start date.
This is the default implementation for course formats, it is based on moodlecourse/courseduration setting. Course formats like format_weeks for example can overwrite this method and return a value based on their internal options.
MoodleQuickForm | $mform | |
array | $fieldnames | The form - field names mapping. |
int |
Reimplemented in format_weeks.
|
inherited |
Returns the default section using course_format's implementation of get_section_name.
int | stdClass | $section | Section object from database or just field course_sections section |
string | The default value for the section name based on the given course format. |
Reimplemented in format_topics, and format_weeks.
|
inherited |
Return custom strings for the course editor.
This method is mainly used to translate the "section" related strings into the specific format plugins name such as "Topics" or "Weeks".
stdClass[] | an array of objects with string "component" and "key" |
|
protectedinherited |
Get the start date value from the course settings page form.
MoodleQuickForm | $mform | |
array | $fieldnames | The form - field names mapping. |
int |
|
finalinherited |
Returns the format name used by this course.
string |
|
finalinherited |
Returns the localised name of this course format plugin.
lang_string |
|
inherited |
Returns the format options stored for this course or course section.
When overriding please note that this function is called from rebuild_course_cache() and section_info object, therefore using of get_fast_modinfo() and/or any function that accesses it may lead to recursion.
null | int | stdClass | section_info | $section | if null the course format options will be returned otherwise options for specified section will be returned. This can be either section object or relative section number (field course_sections.section) |
array |
|
staticfinalprotectedinherited |
Validates that course format exists and enabled and returns either itself or default format.
string | $format |
string |
|
inherited |
Get the proper format plugin string if it exists.
If the format_PLUGINNAME does not provide a valid string, core_courseformat will be user as the component.
string | $key | the string key |
string | object | array | int | $data | extra data that can be used within translation strings |
string | the get_string result |
|
inherited |
Method used in the rendered and during backup instead of legacy 'numsections'.
Default renderer will treat sections with sectionnumber greater that the value returned by this method as "orphaned" and not display them on the course page unless in editing mode. Backup will store this value as 'numsections'.
This method ensures that 3rd party course format plugins that still use 'numsections' continue to work but at the same time we no longer expect formats to have 'numsections' property.
int | The last section number, or -1 if sections are entirely missing |
|
inherited |
Method used to get the maximum number of sections for this course format.
int |
|
inherited |
Return the current course modinfo.
This method is used mainly by the output components to avoid unnecesary get_fast_modinfo calls.
course_modinfo |
|
inherited |
Return the old non-ajax activity action url.
BrowserKit behats tests cannot trigger javascript events, so we must translate to an old non-ajax url while non-ajax course editing is still supported.
string | $action | action name the reactive action |
cm_info | $cm | course module |
moodle_url |
|
inherited |
Returns instance of output component used by this plugin.
coding_exception | if the format class does not extends the original core one. |
string | $outputname | the element to render (section, activity...) |
string | the output component classname |
|
inherited |
Returns instance of page renderer used by this plugin.
moodle_page | $page |
renderer_base |
Reimplemented in format_site.
|
inherited |
Get the required javascript files for the course format.
array | The list of javascript files required by the course format. |
Reimplemented in format_topics, and format_weeks.
|
finalinherited |
Returns information about section used in course.
int | stdClass | $section | either section number (field course_section.section) or row from course_section table |
int | $strictness |
?section_info |
|
inherited |
Returns the name for the highlighted section.
string | The name for the highlighted section based on the given course format. |
Reimplemented in format_weeks.
|
protectedinherited |
Return an array with all section modules content.
This method is used in section_action method to generate the updated modules content after a modinfo change.
section_info | $section | the section |
string[] | the full modules content. |
|
inherited |
Returns the display name of the given section that the course prefers.
int | stdClass | section_info | $section | Section object from database or just field course_sections.section |
string | Display name that the course format prefers, e.g. "Topic 2" |
Reimplemented in format_legacy, format_site, format_topics, and format_weeks.
|
inherited |
Set if the current format instance will show multiple sections or an individual one.
Some formats has the hability to swith from one section to multiple sections per page, output components will use this method to know if the current display is a single or multiple sections.
int | zero for all sections or the sectin number |
|
inherited |
Get if the current format instance will show multiple sections or an individual one.
Some formats has the hability to swith from one section to multiple sections per page, output components will use this method to know if the current display is a single or multiple sections.
int|null | null for all sections or the sectionid. |
|
inherited |
Get the current section number to display.
Some formats has the hability to swith from one section to multiple sections per page.
int|null | the current section number or null when there is no single section. |
Reimplemented in format_site.
|
finalinherited |
Returns a list of sections used in the course.
This is a shortcut to get_fast_modinfo()->get_section_info_all()
array | of section_info objects |
|
inherited |
Return the format section preferences.
array | of preferences indexed by sectionid |
|
inherited |
Return the format section preferences.
array | of preferences indexed by preference name |
|
static |
Get the activities supported by the format.
Here we ignore the modules that do not have a page of their own, like the label.
array | array($module => $name of the module). |
format_singleactivity::get_view_url | ( | $section, | |
$options = array() ) |
The URL to use for the specified course.
int | stdClass | $section | Section object from database or just field course_sections.section if null the course view page is returned |
array | $options | options for view URL. At the moment core uses: 'navigation' (bool) ignored by this format 'sr' (int) ignored by this format |
null|moodle_url |
Reimplemented from core_courseformat\base.
format_singleactivity::has_view_page | ( | ) |
Returns true if the course has a front page.
boolean | false |
Reimplemented from core_courseformat\base.
|
inherited |
Prepares the templateable object to display section name.
section_info | stdClass | $section | |
bool | $linkifneeded | |
bool | $editable | |
null | lang_string | string | $edithint | |
null | lang_string | string | $editlabel |
core\output\inplace_editable |
|
inherited |
Updates the value in the database and modifies this object respectively.
ALWAYS check user permissions before performing an update! Throw exceptions if permissions are not sufficient or value is not legit.
stdClass | $section | |
string | $itemtype | |
mixed | $newvalue |
?\core\output\inplace_editable |
|
staticfinalinherited |
|
inherited |
Returns true if the specified section is current.
By default we analyze $course->marker
int | stdClass | section_info | $section |
bool |
Reimplemented in format_weeks.
|
inherited |
Returns if an specific section is visible to the current user.
Formats can overrride this method to implement any special section logic.
section_info | $section | the section modinfo |
bool; |
|
inherited |
Moves a section just after the target section.
section_info | $section | the section to move |
section_info | $destination | the section that should be below the moved section |
boolean | if the section can be moved or not |
|
protected |
Adds a course module to the navigation node.
This is basically copied from function global_navigation\load_section_activities() because it is not accessible from outside.
navigation_node | $node | |
cm_info | $cm |
null|navigation_node |
format_singleactivity::page_set_cm | ( | moodle_page | $page | ) |
Allows course format to execute code on moodle_page\set_cm()
If we are inside the main module for this course, remove extra node level from navigation: substitute course node with activity node, move all children
moodle_page | $page | instance of page calling set_cm |
Reimplemented from core_courseformat\base.
format_singleactivity::page_set_course | ( | moodle_page | $page | ) |
Allows course format to execute code on moodle_page\set_course()
This function is executed before the output starts.
If everything is configured correctly, user is redirected from the default course view page to the activity view page.
"Section 1" is the administrative page to manage orphaned activities
If user is on course view page and there is no module added to the course and the user has 'moodle/course:manageactivities' capability, redirect to create module form.
moodle_page | $page | instance of page calling set_course |
Reimplemented from core_courseformat\base.
|
inherited |
Generate the title for this section page.
string | the page title |
Reimplemented in format_topics, and format_weeks.
|
inherited |
Remove section preference ids.
string | $preferencename | preference name |
array | $sectionids | affected section ids |
format_singleactivity::reorder_activities | ( | ) |
Make sure that current active activity is in section 0.
All other activities are moved to section 1 that will be displayed as 'Orphaned'. It may be needed after the course format was changed or activitytype in course settings has been changed.
null|cm_info | current activity |
|
staticfinalinherited |
Resets cache for the course (or all caches)
To be called from rebuild_course_cache()
int | $courseid |
|
inherited |
Callback used in WS core_course_edit_section when teacher performs an AJAX action on a section (show/hide)
Access to the course is already validated in the WS but the callback has to make sure that particular action is allowed by checking capabilities
Course formats should register
stdClass | section_info | $section | |
string | $action | |
int | $sr | the section return |
null|array|stdClass | any data for the Javascript post-processor (must be json-encodeable) |
Reimplemented in format_topics, and format_weeks.
|
inherited |
Definitions of the additional options that this course format uses for section.
See course_format\course_format_options() for return array definition.
Additionally section format options may have property 'cache' set to true if this option needs to be cached in get_fast_modinfo(). The 'cache' property is recommended to be set only for fields used in course_format\get_section_name(), course_format\extend_course_navigation() and course_format\get_view_url()
For better performance cached options are recommended to have 'cachedefault' property Unlike 'default', 'cachedefault' should be static and not access get_config().
Regardless of value of 'cache' all options are accessed in the code as $sectioninfo->OPTIONNAME where $sectioninfo is instance of section_info, returned by get_fast_modinfo($course)->get_section_info($sectionnum) or get_fast_modinfo($course)->get_section_info_all()
All format options for particular section are returned by calling: $this->get_format_options($section);
bool | $foreditform |
array |
|
inherited |
Allows to specify for modinfo that section is not available even when it is visible and conditionally available.
Note: affected user can be retrieved as: $section->modinfo->userid
Course format plugins can override the method to change the properties $available and $availableinfo that were calculated by conditional availability. To make section unavailable set: $available = false; To make unavailable section completely hidden set: $availableinfo = ''; To make unavailable section visible with availability message set: $availableinfo = get_string('sectionhidden', 'format_xxx');
section_info | $section | |
bool | $available | the 'available' propery of the section_info as it was evaluated by conditional availability. Can be changed by the method but 'false' can not be overridden by 'true'. |
string | $availableinfo | the 'availableinfo' propery of the section_info as it was evaluated by conditional availability. Can be changed by the method |
|
staticinherited |
Return the current user course format cache key.
The course format session cache can be used to cache the user course representation. The statekey will be reset when the the course state changes. For example when the course is edited, the user completes an activity or simply some course preference like collapsing a section happens.
stdClass | $course | the course object |
string | the current statekey |
|
staticinherited |
Reset the current user course format cache.
The course format cache resets every time the course cache resets but also when the user changes their course format preference, complete an activity...
stdClass | $course | the course object |
string | the new statekey |
|
staticinherited |
Reset the current user for all courses.
The course format cache resets every time the course cache resets but also when the user changes their language, all course editors
void |
|
inherited |
Set if the current format instance will show multiple sections or an individual one.
Some formats has the hability to swith from one section to multiple sections per page.
int | $singlesection | zero for all sections or a section number |
|
inherited |
Set if the current format instance will show multiple sections or an individual one.
Some formats has the hability to swith from one section to multiple sections per page.
int | null | $sectionid | null for all sections or a sectionid. |
|
inherited |
Set the current section number to display.
Some formats has the hability to swith from one section to multiple sections per page.
int | null | $sectionnum | null for all sections or a sectionid. |
|
inherited |
Return the format section preferences.
string | $preferencename | preference name |
int[] | $sectionids | affected section ids |
|
inherited |
return true if the course editor must be displayed.
array | null | $capabilities | array of capabilities a user needs to have to see edit controls in general. If null or not specified, the user needs to have 'moodle/course:manageactivities'. |
bool | true if edit controls must be displayed |
|
inherited |
Check if the group mode can be displayed.
cm_info | $cm | the activity module |
bool |
|
inherited |
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.
stdClass |
Reimplemented in format_legacy, format_social, format_topics, and format_weeks.
|
inherited |
Returns true if this course format is compatible with content components.
Using components means the content elements can watch the frontend course state and react to the changes. Formats with component compatibility can have more interactions without refreshing the page, like having drag and drop from the course index to reorder sections and activities.
bool | if the format is compatible with components. |
Reimplemented in format_topics, and format_weeks.
|
inherited |
Indicates whether the course format supports the creation of the Announcements forum.
For course format plugin developers, please override this to return true if you want the Announcements forum to be created upon course creation.
bool |
Reimplemented in format_topics, and format_weeks.
|
inherited |
Updates format options for a course.
If $data does not contain property with the option name, the option will not be updated
stdClass | array | $data | return value from moodleform\get_data() or array with data |
stdClass | $oldcourse | if this function is called from update_course() this object contains information about the course before update |
bool | whether there were any changes to the options values |
Reimplemented in format_legacy, format_topics, and format_weeks.
|
protectedinherited |
Updates format options for a course or section.
If $data does not contain property with the option name, the option will not be updated
stdClass | array | $data | return value from moodleform\get_data() or array with data |
null | int | $sectionid | null if these are options for course or section id (course_sections.id) if these are options for section |
bool | whether there were any changes to the options values |
|
inherited |
Updates format options for a section.
Section id is expected in $data->id (or $data['id']) If $data does not contain property with the option name, the option will not be updated
stdClass | array | $data | return value from moodleform\get_data() or array with data |
bool | whether there were any changes to the options values |
|
inherited |
Returns true if this course format uses course index.
This function may be called without specifying the course id i.e. in course_index_drawer()
bool |
Reimplemented in format_topics, and format_weeks.
|
inherited |
Returns true if this course format uses activity indentation.
bool | if the course format uses indentation. |
Reimplemented in format_topics, and format_weeks.
|
inherited |
Returns true if this course format uses sections.
This function may be called without specifying the course id i.e. in course_format_uses_sections()
Developers, note that if course format does use sections there should be defined a language string with the name 'sectionname' defining what the section relates to in the format, i.e. $string['sectionname'] = 'Topic'; or $string['sectionname'] = 'Week';
bool |
Reimplemented in format_legacy, format_topics, and format_weeks.
|
inherited |
Validates format options for the course.
array | $data | data to insert/update |
array | array of options that have valid values |
|
protectedinherited |
Prepares values of course or section format options before storing them in DB.
If an option has invalid value it is not returned
array | $rawdata | associative array of the proposed course/section format options |
int | null | $sectionid | null if it is course format option |
array | array of options that have valid values |
|
protectedinherited |
format used for this course.
Please note that it can be different from course.format field if course referes to non-existing of disabled format