Differences Between: [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]
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: | 448 lines (18 kb) |
Included or required: | 0 times |
Referenced: | 1 time |
Includes or requires: | 0 files |
format_topics:: (18 methods):
uses_sections()
get_section_name()
get_default_section_name()
get_view_url()
supports_ajax()
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 |
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 #"). param: int|stdClass $section Section object from database or just field section.section return: string Display name that the course format prefers, e.g. "Topic 2" |
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 format_base::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. param: stdClass $section Section object from database or just field course_sections section return: string The default value for the section name. |
get_view_url($section, $options = []) X-Ref |
The URL to use for the specified course (with section). 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: return: null|moodle_url |
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 |
extend_course_navigation($navigation, navigation_node $node) X-Ref |
Loads all of the course sections into the navigation. param: global_navigation $navigation param: navigation_node $node The course node within the navigation return: void |
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 param: bool $foreditform return: array of options |
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()}. 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. return: array array of references to the added form elements. |
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. 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()} return: bool whether there were any changes to the options values |
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()} param: int|stdClass|section_info $section return: bool |
inplace_editable_render_section_name($section, $linkifneeded = true,$editable = null, $edithint = null, $editlabel = null) X-Ref |
Prepares the templateable object to display section name. param: \section_info|\stdClass $section param: bool $linkifneeded param: bool $editable param: null|lang_string|string $edithint param: null|lang_string|string $editlabel return: inplace_editable |
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. 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 return: bool |
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. param: section_info|stdClass $section param: string $action param: int $sr return: null|array any data for the Javascript post-processor (must be json-encodeable) |
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. param: string $itemtype param: int $itemid param: mixed $newvalue return: inplace_editable |