Commit | Line | Data |
---|---|---|
2db66a93 DP |
1 | This files describes API changes for course formats |
2 | ||
3 | Overview of this plugin type at http://docs.moodle.org/dev/Course_formats | |
4 | ||
3f224a1a SA |
5 | === 3.9 === |
6 | ||
7 | * The following functions, previously used (exclusively) by upgrade steps are not available anymore because of the upgrade cleanup performed for this version. See MDL-65809 for more info: | |
8 | - format_topics_upgrade_remove_numsections() | |
9 | - format_topics_upgrade_hide_extra_sections() | |
10 | - format_topics_upgrade_add_empty_sections() | |
11 | - format_weeks_upgrade_remove_numsections() | |
12 | - format_weeks_upgrade_hide_extra_sections() | |
13 | - format_weeks_upgrade_add_empty_sections() | |
14 | ||
77e4d6f1 AA |
15 | === 3.8 === |
16 | ||
17 | * The following functions have been finally deprecated and can not be used anymore: | |
18 | * section_edit_controls() | |
19 | ||
a589b992 MG |
20 | === 3.6 === |
21 | * New method validate_format_options() cleans the values of the course/section format options before inserting them | |
22 | in the database. Course format options can now be set in tool_uploadcourse and validation of user-submitted data is important. | |
23 | Note that validate_format_options() is now always called when somebody creates or edits course or section and also | |
24 | during restore and course upload. Default implementation validates against the definition of the form elements for | |
25 | format options. | |
605354de | 26 | * The final deprecation of xxx_delete_course callback means that this function will no longer be called. |
27 | Please use the observer for event \core\event\course_content_deleted instead. | |
a589b992 | 28 | |
ef184ad6 JL |
29 | === 3.5 === |
30 | * Course formats should overwrite get_config_for_external function to return the course format settings viewable by the | |
31 | current user. | |
32 | If the course format does not have any setting that could be considerated private (like a private/access key/token), | |
33 | is ok to return all the settigns via the get_format_options function. | |
34 | ||
8341055e MG |
35 | === 3.3 === |
36 | * Javascript code for editing activities and sections was moved to an AMD module, course/rest.php is no longer | |
37 | responsible for editing actions, instead it is done in web services. Carefully test all editing actions during upgrade. | |
38 | * The new method format_base::allow_stealth_module_visibility() can indicate whether course format supports "stealth" | |
39 | activities mode when they are available but not visible on course page. Course format that supports stealth mode | |
40 | must check $cm->is_visible_on_course_page() when displaying activities list on the course page instead of $cm->uservisible. | |
41 | For all other plugins except course formats the same property $cm->uservisible indicates if the activity contents | |
42 | is actually available to student. | |
89b909f6 MG |
43 | * Option "Number of sections" (numsections) was removed from topics and weeks formats, instead the actual number of records |
44 | in the course_sections table is treated as a number of sections (excluding section 0 that should always be present). | |
45 | * Method create_course() will populate the new course with empty sections if $data->numsections is provided even if | |
46 | "numsections" is not an option defined by the course format. | |
dbcc8b31 MN |
47 | * course/changenumsections.php can now be used to insert sections at any positions. |
48 | * The variable SECTIONLEFTSIDE was changed from '.left .section-handle img' to '.left .section-handle .icon' in | |
49 | course/format/topics/format.js and course/format/weeks/format.js due to the introduction of Font Awesome (see MDL-40759) | |
50 | which altered the HTML. Please check if your course format relies on this selector, and if so, update it. | |
8341055e | 51 | |
8fef061d MG |
52 | === 3.2 === |
53 | * Callback delete_course is deprecated and should be replaced with observer for event \core\event\course_content_deleted | |
8643c576 DM |
54 | * Course formats can overwrite get_default_course_enddate function to set the default course end date for new courses. |
55 | format_base::get_default_course_enddate uses the new "Course duration" site setting to calculate the default course end date | |
56 | from the default course start date. | |
87799e9f JP |
57 | * New method format_base::supports_news() which is used to determine whether an Announcements forum will be automatically created on |
58 | course creation. For course format plugin developers, please override format_base::supports_news() to return true if you want the | |
59 | Announcements forum to be created upon course creation and remove the block names defined in format_base::get_default_blocks(). | |
8fef061d | 60 | |
f26481c2 MG |
61 | === 3.1 === |
62 | * Course format may use the inplace_editable template to allow quick editing of section names, see | |
63 | https://docs.moodle.org/dev/Inplace_editable and MDL-51802 for example implementation. | |
64 | ||
60cf0742 S |
65 | === 3.0 === |
66 | * Course formats should now use section_edit_control_items and use the returned array of controls items and their attributes to create a | |
67 | renderable menu or array of links. Plugin calls to section_edit_controls will now include the section edit control in the returned array. | |
5b971892 DM |
68 | * The section name is now wrapped in a new span (.sectionname > span), process_sections method in format.js should be updated so .sectionname |
69 | DOM node's wraps the section title in a span. You can look at how to implement the change in course/format/topics/format.js or MDL-48947. | |
f1bfc897 JP |
70 | * New method format_base::get_default_section_name retrieves the default section name for the given course format. The base |
71 | implementation basically uses the implementation of format_base::get_section_name. The method can be overridden in | |
72 | format_base subclasses that use sections (i.e. format_topics, format_weeks). In relation to the changes made for the default | |
73 | section name, the default section name is now being shown when editing the section information. | |
60cf0742 | 74 | |
ca9cae84 MG |
75 | === 2.9 === |
76 | * Course formats may support deleting sections, see MDL-10405 for more details. | |
77 | format_section_renderer_base::section_edit_controls() is now also called for | |
78 | stealth sections and it also returns "delete" control. | |
79 | ||
b791ee3d AN |
80 | === 2.8 === |
81 | * The activity chooser now uses M.course.format.get_sectionwrapperclass() | |
82 | to determine the section selector, rather than a hard-coded `li.section`. | |
60df6787 S |
83 | * Activity duplication in /course/modduplicate.php is deprecated and is now done in /course/mod.php. Deprecated calls will be honored by |
84 | redirecting to /course/mod.php for 3rd party plugin support. | |
daad1b4b | 85 | * New method format_base::section_get_available_hook() allows plugins to override section availability. |
b791ee3d | 86 | |
af64bc61 AN |
87 | === 2.7 === |
88 | * The ->testedbrowsers array no longer needs to be defined in supports_ajax(). | |
0a293483 SH |
89 | * format_section_renderer_base::section_hidden has an new second optional argument $courseorid. |
90 | If provided the section name is printed in the not available string when displaying the hidden section. | |
af64bc61 | 91 | |
e5de4933 SH |
92 | === 2.6 === |
93 | ||
94 | * core_course_renderer::course_section_cm_edit_actions has two new optional arguments and now uses and action_menu component. | |
95 | * core_course_renderer::course_section_cm has been altered to call core_course_renderer::course_section_cm_edit_actions with the two new arguments | |
9ce4fa2f AN |
96 | * An additional course renderer function has been created which allows you to |
97 | specify the wrapper for a course module within a section (e.g. the <li>). This can be | |
98 | found in core_course_renderer::course_section_cm_list_item(). | |
e5de4933 | 99 | |
b1c2fc65 MG |
100 | === 2.5 === |
101 | ||
102 | * Functions responsible for output in course/lib.php are deprecated, the code is moved to | |
103 | appropriate renderers: print_section(), print_section_add_menus(), get_print_section_cm_text(), | |
104 | make_editing_buttons() | |
105 | See functions' phpdocs in lib/deprecatedlib.php | |
106 | * Function get_print_section_cm_text() is deprecated, replaced with methods in cm_info | |
107 | ||
b874d5c6 MG |
108 | === 2.4 === |
109 | ||
ee7084e9 MG |
110 | Course format API has been changed significantly. Instead of implementing callbacks course formats |
111 | may overwrite the class format_base. See format_legacy class for a template for upgrading course | |
112 | format. | |
113 | ||
b874d5c6 MG |
114 | * Function settings_navigation::add_course_editing_links() is completely removed, course format |
115 | functions callback_XXXX_request_key() are no longer used (where XXXX is the course format name) | |
97960146 MG |
116 | * functions get_generic_section_name(), get_all_sections(), add_mod_to_section(), get_all_mods() |
117 | are deprecated. See their phpdocs in lib/deprecatedlib.php on how to replace them | |
3776335c | 118 | * Course formats may now have their settings.php file as the most of other plugin types |
081c8f7f MG |
119 | * Function format_section_renderer_base::is_section_current() is deprecated, overwrite/use |
120 | function is_section_current in format class | |
b874d5c6 | 121 | |
2db66a93 DP |
122 | === 2.3 === |
123 | ||
124 | * The new $course->coursedisplay option was introduced, users can now choose to display | |
125 | a section at a time if the course formats support it: | |
126 | - COURSE_DISPLAY_SINGLEPAGE indicates the teacher has chosen to display all sections on one page | |
127 | - COURSE_DISPLAY_MULTIPAGE indicates the teacher has chose to have seperate pages with each section. | |
128 | ||
129 | * The parameter for 'currently active section' was standardised in core: | |
130 | - The course format is passed the currently live section through the $displaysection varaible to format.php | |
131 | - A 'section' paramter is the standardised way to pass around the current section in a course | |
132 | - Navigation no longer looks for custom parameters defined in callback_format_request_key |