Course formats: Difference between revisions
mNo edit summary |
|||
Line 3: | Line 3: | ||
'''course/format/FORMATNAME/lang/en/format_FORMATNAME.php''' | '''course/format/FORMATNAME/lang/en/format_FORMATNAME.php''' | ||
Contains the English language strings used in the format. You can also | Contains the English language strings used in the format. You can also define strings for other languages. | ||
'''course/format/FORMATNAME/config.php''' | '''course/format/FORMATNAME/config.php''' | ||
Line 36: | Line 36: | ||
4. Change ''$string['pluginname']'' in ''course/format/FORMATNAME/lang/en/format_FORMATNAME.php'' to the new name. | 4. Change ''$string['pluginname']'' in ''course/format/FORMATNAME/lang/en/format_FORMATNAME.php'' to the new name. | ||
5. The | 5. Rename callback functions in lib.php. The names of the functions is formed as callback_FORMATNAME_CALLBACKNAME() | ||
6 | 6. The new format is ready for modification. | ||
[[Category:Plugins]] | [[Category:Plugins]] |
Revision as of 02:50, 30 November 2011
Course formats are plugins that determine the layout of course resources.
Components
course/format/FORMATNAME/lang/en/format_FORMATNAME.php
Contains the English language strings used in the format. You can also define strings for other languages.
course/format/FORMATNAME/config.php
Contains $format['defaultblocks'] which defines the default blocks loaded with the format.
course/format/FORMATNAME/format.php
This is is the layout itself. It is loaded by course/view.php.
course/format/FORMATNAME/lib.php
The main library of the format.
course/format/FORMATNAME/styles.css
Optional stylesheet.
course/format/FORMATNAME/version.php
Optional version definitions.
Creating a New Format
The easiest way to create a new course format is to copy an existing one.
1. Copy the folder containing the format files.
2. Rename the folder to the new name. NOTE: course format names cannot exceed ten characters. This is a limit set in the database.
3. Rename language files in course/format/FORMATNAME/lang/
4. Change $string['pluginname'] in course/format/FORMATNAME/lang/en/format_FORMATNAME.php to the new name.
5. Rename callback functions in lib.php. The names of the functions is formed as callback_FORMATNAME_CALLBACKNAME()
6. The new format is ready for modification.