Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
|
Basic renderer for weeks format. More...
Public Member Functions | |
__call ($method, $arguments) | |
Magic method used to pass calls otherwise meant for the standard renderer to it to ensure we don't go causing unnecessary grief. | |
add_action_handler (component_action $action, $id=null) | |
Adds a JS action for the element with the provided id. | |
add_new_course_button () | |
Returns HTML to the "add new course" button for the page. | |
availability_info ($text, $additionalclasses='') | |
bulk_editing_button (course_format $format) | |
Render the enable bulk editing button. | |
course_activitychooser ($courseid) | |
Build the HTML for the module chooser javascript popup. | |
course_category ($category) | |
Renders HTML to display particular course category - list of it's subcategories and courses. | |
course_category_tree (array $ignored) | |
Renderers a structured array of courses and categories into a nice XHTML tree structure. | |
course_index_drawer (course_format $format) | |
Get the course index drawer with placeholder. | |
course_info_box (stdClass $course) | |
Renders course info box. | |
course_modchooser () | |
course_search_form ($value='') | |
Renders html to display a course search form. | |
course_section_add_cm_control ($course, $section, $sectionreturn=null, $displayoptions=array()) | |
Renders HTML for the menus to add activities and resources to the current course. | |
course_section_cm ($course, &$completioninfo, cm_info $mod, $sectionreturn, $displayoptions=[]) | |
course_section_cm_availability (cm_info $mod, $displayoptions=array()) | |
course_section_cm_completion () | |
course_section_cm_edit_actions ($actions, cm_info $mod=null, $displayoptions=array()) | |
course_section_cm_list ($course, $section, $sectionreturn=null, $displayoptions=[]) | |
course_section_cm_list_item ($course, &$completioninfo, cm_info $mod, $sectionreturn, $displayoptions=[]) | |
course_section_cm_name (cm_info $mod, $displayoptions=array()) | |
course_section_cm_name_title (cm_info $mod, $displayoptions=array()) | |
course_section_cm_text (cm_info $mod, $displayoptions=array()) | |
course_section_cm_unavailable_error_message (cm_info $cm) | |
Message displayed to the user when they try to access unavailable activity following URL. | |
course_section_updated (course_format $format, section_info $section) | |
Get the updated rendered version of a section. | |
course_section_updated_cm_item (course_format $format, section_info $section, cm_info $cm, array $displayoptions=[]) | |
Get the updated rendered version of a cm list item. | |
coursecat_ajax () | |
Serves requests to /course/category.ajax.php. | |
courses_list ($courses, $showcategoryname=false, $additionalclasses=null, $paginationurl=null, $totalcount=null, $page=0, $perpage=null) | |
Displays a custom list of courses with paging bar if necessary. | |
frontpage () | |
Outputs contents for frontpage as configured in $CFG->frontpage or $CFG->frontpageloggedin. | |
frontpage_available_courses () | |
Returns HTML to print list of available courses for the frontpage. | |
frontpage_categories_list () | |
Returns HTML to print tree of course categories (with number of courses) for the frontpage. | |
frontpage_combo_list () | |
Returns HTML to print tree with course categories and courses for the frontpage. | |
frontpage_my_courses () | |
Returns HTML to print list of courses user is enrolled to for the frontpage. | |
frontpage_section1 () | |
Output frontpage summary text and frontpage modules (stored as section 1 in site course) | |
get_compact_logo_url ($maxwidth=300, $maxheight=300) | |
Return the site's compact logo URL, if any. | |
get_logo_url ($maxwidth=null, $maxheight=200) | |
Return the site's logo URL, if any. | |
get_page () | |
Returns the moodle page object. | |
has_started () | |
Returns true is output has already started, and false if not. | |
hubinfo ($hubinfo) | |
Hub information (logo - name - description - link) | |
image_url ($imagename, $component='moodle') | |
Return the moodle_url for an image. | |
is_cm_conditionally_hidden (cm_info $mod) | |
pix_url ($imagename, $component='moodle') | |
Return the direct URL for an image from the pix folder. | |
print_multiple_section_page ($course, $sections, $mods, $modnames, $modnamesused) | |
print_single_section_page ($course, $sections, $mods, $modnames, $modnamesused, $displaysection) | |
render (renderable $widget) | |
Renders the provided widget and returns the HTML to display it. | |
render_activity_information (\core_course\output\activity_information $page) | |
Renders the activity information. | |
render_activity_navigation (\core_course\output\activity_navigation $page) | |
Renders the activity navigation. | |
render_from_template ($templatename, $context) | |
Renders a template by name with the given context. | |
render_modchooser (renderable $modchooser) | |
Render a modchooser. | |
search_courses ($searchcriteria) | |
Renders html to display search result page. | |
section_availability ($section) | |
section_title ($section, $course) | |
Generate the section title, wraps it in a link to the section page if page is to be displayed on a separate page. | |
section_title_without_link ($section, $course) | |
Generate the section title to be displayed on the section page, without a link. | |
sendingbackupinfo ($backupfile) | |
Display waiting information about backup size during uploading backup process. | |
should_display_main_logo () | |
should_display_navbar_logo () | |
Whether we should display the logo in the navbar. | |
tagged_courses ($tagid, $exclusivemode=true, $ctx=0, $rec=true, $displayoptions=null) | |
Renders html to print list of courses tagged with particular tag. | |
Static Public Member Functions | |
static | prepare_classes ($classes) |
Given an array or space-separated list of classes, prepares and returns the HTML class attribute value. | |
Protected Member Functions | |
add_modchoosertoggle () | |
change_number_sections ($course, $sectionreturn=null) | |
course_activity_clipboard ($course, $sectionno=null) | |
course_category_name (coursecat_helper $chelper, core_course_list_element $course) | |
Returns HTML to display course category name. | |
course_category_tree_category (stdClass $category, $depth=1) | |
Renderers a category for use with course_category_tree. | |
course_contacts (core_course_list_element $course) | |
Returns HTML to display course contacts. | |
course_custom_fields (core_course_list_element $course) | |
Returns HTML to display course custom fields. | |
course_enrolment_icons (core_course_list_element $course) | |
Returns HTML to display course enrolment icons. | |
course_modchooser_module ($module, $classes=array('option')) | |
Return the HTML for the specified module adding any required classes. | |
course_modchooser_module_types ($modules) | |
Build the HTML for a specified set of modules. | |
course_modchooser_title ($title, $identifier=null) | |
course_name (coursecat_helper $chelper, core_course_list_element $course) | |
Returns HTML to display course name. | |
course_overview_files (core_course_list_element $course) | |
Returns HTML to display course overview files. | |
course_section_cm_classes (cm_info $mod) | |
course_summary (coursecat_helper $chelper, core_course_list_element $course) | |
Returns HTML to display course summary. | |
coursecat_category (coursecat_helper $chelper, $coursecat, $depth) | |
Returns HTML to display a course category as a part of a tree. | |
coursecat_category_content (coursecat_helper $chelper, $coursecat, $depth) | |
Returns HTML to display the subcategories and courses in the given category. | |
coursecat_coursebox (coursecat_helper $chelper, $course, $additionalclasses='') | |
Displays one course in the list of courses. | |
coursecat_coursebox_content (coursecat_helper $chelper, $course) | |
Returns HTML to display course content (summary, course contacts and optionally category name) | |
coursecat_courses (coursecat_helper $chelper, $courses, $totalcount=null) | |
Renders the list of courses. | |
coursecat_include_js () | |
Make sure that javascript file for AJAX expanding of courses and categories content is included. | |
coursecat_subcategories (coursecat_helper $chelper, $coursecat, $depth) | |
Renders the list of subcategories in a category. | |
coursecat_tree (coursecat_helper $chelper, $coursecat) | |
Returns HTML to display a tree of subcategories and courses in the given category. | |
end_section_list () | |
format_summary_text ($section) | |
frontpage_news ($forum) | |
Output news for the frontpage (extract from site-wide news forum) | |
frontpage_part ($skipdivid, $contentsdivid, $header, $contents) | |
Renders part of frontpage with a skip link (i.e. | |
frontpage_remote_course (stdClass $course) | |
Returns HTML to display one remote course. | |
frontpage_remote_host ($host) | |
Returns HTML to display one remote host. | |
get_mustache () | |
Return an instance of the mustache class. | |
get_nav_links ($course, $sections, $sectionno) | |
section_activity_summary ($section, $course, $mods) | |
section_availability_message ($section, $canviewhidden) | |
section_edit_control_items ($course, $section, $onsectionpage=false) | |
section_edit_control_menu ($controls, $course, $section) | |
section_edit_controls () | |
Old method to print section edit controls. | |
section_footer () | |
section_header ($section, $course, $onsectionpage, $sectionreturn=null) | |
section_hidden ($sectionno, $courseorid=null) | |
Generate the html for a hidden section. | |
section_left_content ($section, $course, $onsectionpage) | |
section_nav_selection ($course, $sections, $displaysection) | |
section_right_content ($section, $course, $onsectionpage) | |
section_summary ($section, $course, $mods) | |
start_section_list () | |
stealth_section_footer () | |
stealth_section_header ($sectionno) | |
Protected Attributes | |
bool | $categoryexpandedonload = false |
Whether a category content is being initially rendered with children. | |
xhtml_container_stack | $opencontainers |
The xhtml_container_stack to use. | |
renderer_base core_renderer | $output |
A reference to the current renderer. | |
moodle_page | $page |
The Moodle page the renderer has been created to assist with. | |
stdClass | $strings |
A cache of strings. | |
string | $target |
The requested rendering target. | |
array | $templatecache = [] |
$templatecache The mustache template cache. | |
Basic renderer for weeks format.
|
protectedinherited |
|
inherited |
Returns HTML to the "add new course" button for the page.
string |
|
inherited |
|
inherited |
Render the enable bulk editing button.
course_format | $format | the course format |
string|null | the enable bulk button HTML (or null if no bulk available). |
|
protectedinherited |
|
protectedinherited |
|
inherited |
Build the HTML for the module chooser javascript popup.
int | $courseid | The course id to fetch modules for. |
string |
|
inherited |
Renders HTML to display particular course category - list of it's subcategories and courses.
Invoked from /course/index.php
int | stdClass | core_course_category | $category |
|
protectedinherited |
Returns HTML to display course category name.
coursecat_helper | $chelper | |
core_course_list_element | $course |
string |
|
finalinherited |
Renderers a structured array of courses and categories into a nice XHTML tree structure.
array | $ignored | argument ignored |
string |
|
finalprotectedinherited |
Renderers a category for use with course_category_tree.
array | $category | |
int | $depth |
string |
|
protectedinherited |
Returns HTML to display course contacts.
core_course_list_element | $course |
string |
|
protectedinherited |
Returns HTML to display course custom fields.
core_course_list_element | $course |
string |
|
protectedinherited |
Returns HTML to display course enrolment icons.
core_course_list_element | $course |
string |
|
inherited |
Get the course index drawer with placeholder.
The default course index is loaded after the page is ready. Format plugins can override this method to provide an alternative course index.
If the format is not compatible with the course index, this method will return an empty string.
course_format | $format | the course format |
String | the course index HTML. |
|
inherited |
Renders course info box.
stdClass | $course |
string |
|
inherited |
|
protectedinherited |
Return the HTML for the specified module adding any required classes.
object | $module | An object containing the title, and link. An icon, and help text may optionally be specified. If the module contains subtypes in the types option, then these will also be displayed. |
array | $classes | Additional classes to add to the encompassing div element |
string | The composed HTML for the module |
|
protectedinherited |
Build the HTML for a specified set of modules.
array | $modules | A set of modules as used by the course_modchooser_module function |
string | The composed HTML for the module |
|
protectedinherited |
Returns HTML to display course name.
coursecat_helper | $chelper | |
core_course_list_element | $course |
string |
|
protectedinherited |
Returns HTML to display course overview files.
core_course_list_element | $course |
string |
|
inherited |
Renders html to display a course search form.
string | $value | default value to populate the search field |
string |
|
inherited |
Renders HTML for the menus to add activities and resources to the current course.
Renders the ajax control (the link which when clicked produces the activity chooser modal). No noscript fallback.
stdClass | $course | |
int | $section | relative section number (field course_sections.section) |
int | $sectionreturn | The section to link back to |
array | $displayoptions | additional display options, for example blocks add option 'inblock' => true, suggesting to display controls vertically |
string |
|
inherited |
|
inherited |
|
protectedinherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
Message displayed to the user when they try to access unavailable activity following URL.
This method is a very simplified version of course_section_cm() to be part of the error notification only. It also does not check if module is visible on course page or not.
The message will be displayed inside notification!
cm_info | $cm |
string |
|
inherited |
Get the updated rendered version of a section.
This method will only be used when the course editor requires to get an updated cm item HTML to perform partial page refresh. It will be used for supporting the course editor webservices.
By default, the template used for update a section is the same as when it renders initially, but format plugins are free to override this method to provide extra effects or so.
course_format | $format | the course format |
section_info | $section | the section info |
string | the rendered element |
|
inherited |
Get the updated rendered version of a cm list item.
This method is used when an activity is duplicated or copied in on the client side without refreshing the page. Note that the previous method is used every time an activity is rendered, independent of it is the initial page loading or an Ajax update. In this case, course_section_updated_cm_item will only be used when the course editor requires to get an updated cm item HTML to perform partial page refresh. It will be used for suporting the course editor webservices.
By default, the template used for update a cm_item is the same as when it renders initially, but format plugins are free to override this methos to provide extra affects or so.
course_format | $format | the course format |
section_info | $section | the section info |
cm_info | $cm | the course module ionfo |
array | $displayoptions | optional extra display options |
string | the rendered element |
|
protectedinherited |
Returns HTML to display course summary.
coursecat_helper | $chelper | |
core_course_list_element | $course |
string |
|
inherited |
Serves requests to /course/category.ajax.php.
In this renderer implementation it may expand the category content or course content.
string |
coding_exception |
|
protectedinherited |
Returns HTML to display a course category as a part of a tree.
This is an internal function, to display a particular category and all its contents use core_course_renderer::course_category()
coursecat_helper | $chelper | various display options |
core_course_category | $coursecat | |
int | $depth | depth of this category in the current tree |
string |
|
protectedinherited |
Returns HTML to display the subcategories and courses in the given category.
This method is re-used by AJAX to expand content of not loaded category
coursecat_helper | $chelper | various display options |
core_course_category | $coursecat | |
int | $depth | depth of the category in the current tree |
string |
|
protectedinherited |
Displays one course in the list of courses.
This is an internal function, to display an information about just one course please use core_course_renderer::course_info_box()
coursecat_helper | $chelper | various display options |
core_course_list_element | stdClass | $course | |
string | $additionalclasses | additional classes to add to the main tag (usually depend on the course position in list - first/last/even/odd) |
string |
|
protectedinherited |
Returns HTML to display course content (summary, course contacts and optionally category name)
This method is called from coursecat_coursebox() and may be re-used in AJAX
coursecat_helper | $chelper | various display options |
stdClass | core_course_list_element | $course |
string |
|
protectedinherited |
Renders the list of courses.
This is internal function, please use core_course_renderer::courses_list() or another public method from outside of the class
If list of courses is specified in $courses; the argument $chelper is only used to retrieve display options and attributes, only methods get_show_courses(), get_courses_display_option() and get_and_erase_attributes() are called.
coursecat_helper | $chelper | various display options |
array | $courses | the list of courses to display |
int | null | $totalcount | total number of courses (affects display mode if it is AUTO or pagination if applicable), defaulted to count($courses) |
string |
|
protectedinherited |
Renders the list of subcategories in a category.
coursecat_helper | $chelper | various display options |
core_course_category | $coursecat | |
int | $depth | depth of the category in the current tree |
string |
|
protectedinherited |
Returns HTML to display a tree of subcategories and courses in the given category.
coursecat_helper | $chelper | various display options |
core_course_category | $coursecat | top category (this category's name and description will NOT be added to the tree) |
string |
|
inherited |
Displays a custom list of courses with paging bar if necessary.
If $paginationurl is specified but $totalcount is not, the link 'View more' appears under the list.
If both $paginationurl and $totalcount are specified, and $totalcount is bigger than count($courses), a paging bar is displayed above and under the courses list.
array | $courses | array of course records (or instances of core_course_list_element) to show on this page |
bool | $showcategoryname | whether to add category name to the course description |
string | $additionalclasses | additional CSS classes to add to the div.courses |
moodle_url | $paginationurl | url to view more or url to form links to the other pages in paging bar |
int | $totalcount | total number of courses on all pages, if omitted $paginationurl will be displayed as 'View more' link |
int | $page | current page number (defaults to 0 referring to the first page) |
int | $perpage | number of records per page (defaults to $CFG->coursesperpage) |
string |
|
protectedinherited |
|
protectedinherited |
|
inherited |
Outputs contents for frontpage as configured in $CFG->frontpage or $CFG->frontpageloggedin.
string |
|
inherited |
Returns HTML to print list of available courses for the frontpage.
string |
|
inherited |
Returns HTML to print tree of course categories (with number of courses) for the frontpage.
string |
|
inherited |
Returns HTML to print tree with course categories and courses for the frontpage.
string |
|
inherited |
Returns HTML to print list of courses user is enrolled to for the frontpage.
Also lists remote courses or remote hosts if MNET authorisation is used
string |
|
protectedinherited |
Output news for the frontpage (extract from site-wide news forum)
stdClass | $forum | record from db table 'forum' that represents the site news forum |
string |
|
protectedinherited |
Renders part of frontpage with a skip link (i.e.
"My courses", "Site news", etc.)
string | $skipdivid | |
string | $contentsdivid | |
string | $header | Header of the part |
string | $contents | Contents of the part |
string |
|
protectedinherited |
Returns HTML to display one remote course.
stdClass | $course | remote course information, contains properties: id, remoteid, shortname, fullname, hostid, summary, summaryformat, cat_name, hostname |
string |
|
protectedinherited |
Returns HTML to display one remote host.
array | $host | host information, contains properties: name, url, count |
string |
|
inherited |
Output frontpage summary text and frontpage modules (stored as section 1 in site course)
This may be disabled in settings
string |
|
protectedinherited |
|
inherited |
Hub information (logo - name - description - link)
object | $hubinfo |
string | html code |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
Renders the provided widget and returns the HTML to display it.
Course format templates uses a similar subfolder structure to the renderable classes. This method find out the specific template for a course widget. That's the reason why this render method is different from the normal plugin renderer one.
course format templatables can be rendered using the core_course/local/* templates. Format plugins are free to override the default template location using render_xxx methods as usual.
renderable | $widget | instance with renderable interface |
string | the widget HTML |
Reimplemented from plugin_renderer_base.
|
inherited |
Renders the activity information.
Defer to template.
core_course\output\activity_information | $page |
string | html for the page |
|
inherited |
Renders the activity navigation.
Defer to template.
core_course\output\activity_navigation | $page |
string | html for the page |
|
inherited |
Render a modchooser.
renderable | $modchooser | The chooser. |
string |
|
inherited |
Renders html to display search result page.
array | $searchcriteria | may contain elements: search, blocklist, modulelist, tagid |
string |
|
protectedinherited |
|
inherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
Old method to print section edit controls.
Do not use it!
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
Generate the html for a hidden section.
int | $sectionno | The section number in the course which is being displayed |
int | stdClass | $courseorid | The course to get the section name for (object or just course id) |
string | HTML to output. |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
format_weeks\output\renderer::section_title | ( | $section, | |
$course ) |
Generate the section title, wraps it in a link to the section page if page is to be displayed on a separate page.
string | HTML to output. |
Reimplemented from core_courseformat\output\section_renderer.
format_weeks\output\renderer::section_title_without_link | ( | $section, | |
$course ) |
Generate the section title to be displayed on the section page, without a link.
string | HTML to output. |
Reimplemented from core_courseformat\output\section_renderer.
|
inherited |
Display waiting information about backup size during uploading backup process.
object | $backupfile | the backup stored_file |
$html | string |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
inherited |
Renders html to print list of courses tagged with particular tag.
int | $tagid | id of the tag |
bool | $exclusivemode | if set to true it means that no other entities tagged with this tag are displayed on the page and the per-page limit may be bigger |
int | $fromctx | context id where the link was displayed, may be used by callbacks to display items in the same context first |
int | $ctx | context id where to search for records |
bool | $rec | search in subcontexts as well |
array | $displayoptions |
string | empty string if no courses are marked with this tag or rendered list of courses |
|
protectedinherited |
Whether a category content is being initially rendered with children.
This is mainly used by the core_course_renderer\corsecat_tree() to render the appropriate action for the Expand/Collapse all link on page load.