Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400]
This file contains main class for Topics course format.
Copyright: | 2009 Sam Hemelryk |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 479 lines (19 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
format_topics:: (22 methods):
uses_sections()
uses_course_index()
uses_indentation()
get_section_name()
get_default_section_name()
page_title()
get_view_url()
supports_ajax()
supports_components()
extend_course_navigation()
ajax_section_move()
get_default_blocks()
course_format_options()
create_edit_form_elements()
update_course_format_options()
can_delete_section()
inplace_editable_render_section_name()
supports_news()
allow_stealth_module_visibility()
section_action()
get_config_for_external()
format_topics_inplace_editable()
Class: format_topics - X-Ref
Main class for the Topics course format.uses_sections() X-Ref |
Returns true if this course format uses sections. return: bool |
uses_course_index() X-Ref |
No description |
uses_indentation() X-Ref |
No description |
get_section_name($section) X-Ref |
Returns the display name of the given section that the course prefers. Use section name is specified by user. Otherwise use default ("Topic #"). return: string Display name that the course format prefers, e.g. "Topic 2" param: int|stdClass $section Section object from database or just field section.section |
get_default_section_name($section) X-Ref |
Returns the default section name for the topics course format. If the section number is 0, it will use the string with key = section0name from the course format's lang file. If the section number is not 0, the base implementation of course_format::get_default_section_name which uses the string with the key = 'sectionname' from the course format's lang file + the section number will be used. return: string The default value for the section name. param: stdClass $section Section object from database or just field course_sections section |
page_title() X-Ref |
Generate the title for this section page. return: string the page title |
get_view_url($section, $options = []) X-Ref |
The URL to use for the specified course (with section). return: null|moodle_url param: int|stdClass $section Section object from database or just field course_sections.section param: array $options options for view URL. At the moment core uses: |
supports_ajax() X-Ref |
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. return: stdClass |
supports_components() X-Ref |
No description |
extend_course_navigation($navigation, navigation_node $node) X-Ref |
Loads all of the course sections into the navigation. return: void param: global_navigation $navigation param: navigation_node $node The course node within the navigation |
ajax_section_move() X-Ref |
Custom action after section has been moved in AJAX mode. Used in course/rest.php return: array This will be passed in ajax respose |
get_default_blocks() X-Ref |
Returns the list of blocks to be automatically added for the newly created course. return: array of default blocks, must contain two keys BLOCK_POS_LEFT and BLOCK_POS_RIGHT |
course_format_options($foreditform = false) X-Ref |
Definitions of the additional options that this course format uses for course. Topics format uses the following options: - coursedisplay - hiddensections return: array of options param: bool $foreditform |
create_edit_form_elements(&$mform, $forsection = false) X-Ref |
Adds format options elements to the course/section edit form. This function is called from {@link course_edit_form::definition_after_data()}. return: array array of references to the added form elements. param: MoodleQuickForm $mform form the elements are added to. param: bool $forsection 'true' if this is a section edit form, 'false' if this is course edit form. |
update_course_format_options($data, $oldcourse = null) X-Ref |
Updates format options for a course. In case if course format was changed to 'topics', we try to copy options 'coursedisplay' and 'hiddensections' from the previous format. return: bool whether there were any changes to the options values param: stdClass|array $data return value from {@link moodleform::get_data()} or array with data param: stdClass $oldcourse if this function is called from {@link update_course()} |
can_delete_section($section) X-Ref |
Whether this format allows to delete sections. Do not call this function directly, instead use {@link course_can_delete_section()} return: bool param: int|stdClass|section_info $section |
inplace_editable_render_section_name($section, $linkifneeded = true,$editable = null, $edithint = null, $editlabel = null) X-Ref |
Prepares the templateable object to display section name. return: inplace_editable param: \section_info|\stdClass $section param: bool $linkifneeded param: bool $editable param: null|lang_string|string $edithint param: null|lang_string|string $editlabel |
supports_news() X-Ref |
Indicates whether the course format supports the creation of a news forum. return: bool |
allow_stealth_module_visibility($cm, $section) X-Ref |
Returns whether this course format allows the activity to have "triple visibility state" - visible always, hidden on course page but available, hidden. return: bool param: stdClass|cm_info $cm course module (may be null if we are displaying a form for adding a module) param: stdClass|section_info $section section where this module is located or will be added to |
section_action($section, $action, $sr) X-Ref |
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. return: null|array any data for the Javascript post-processor (must be json-encodeable) param: section_info|stdClass $section param: string $action param: int $sr |
get_config_for_external() X-Ref |
Return the plugin configs for external functions. return: array the list of configuration settings |
format_topics_inplace_editable($itemtype, $itemid, $newvalue) X-Ref |
Implements callback inplace_editable() allowing to edit values in-place. return: inplace_editable param: string $itemtype param: int $itemid param: mixed $newvalue |