Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
core_courseformat\output\local\content\cm\availability Class Reference

Base class to render a course module availability inside a course format. More...

Inheritance diagram for core_courseformat\output\local\content\cm\availability:
core_courseformat\output\local\content\section\availability core\output\named_templatable renderable templatable

Public Member Functions

 __construct (course_format $format, section_info $section, cm_info $mod, array $displayoptions=[])
 Constructor.
 
 export_for_template (\renderer_base $output)
 Export this data so it can be used as the context for a mustache template.
 
 export_for_template (renderer_base $output)
 Function to export the renderer data in a format that is suitable for a mustache template.
 
 get_template_name (\renderer_base $renderer)
 Get the name of the template to use for this templatable.
 
 has_availability (\renderer_base $output)
 Returns if the output has availability info to display.
 

Protected Member Functions

 availability_info ($text, $additionalclasses='')
 Generate the basic availability information data.
 
 availability_info_from_output (renderer_base $output, core_availability_multiple_messages $availabilityinfo)
 Generate the basic availability information data from a renderable.
 
 availability_info_from_string (\renderer_base $output, string $availabilityinfo)
 Generate the basic availability information data from a string.
 
 build_export_data (\renderer_base $output)
 Protected method to build the export data.
 
 conditional_availability_info (\renderer_base $output)
 Get the activity availability data to display.
 
 get_availability_data ($output, $availabilityinfo, $additionalclasses='')
 Get the basic availability information data.
 
 get_info (\renderer_base $output)
 Get the availability data to be used as the context for a mustache template.
 
 user_availability_info (\renderer_base $output)
 Get the current user availability data.
 

Protected Attributes

stdClass null $data = null
 the instance export data
 
array $displayoptions
 optional display options
 
course_format $format
 the course format
 
bool $hasavailabilityname
 the has availability attribute name
 
cm_info $mod
 the course module instance
 
section_info $section
 the section object
 
int const AVAILABILITY_EXCERPT_MAXSIZE = 100
 Availability excerpt text max size treshold.
 

Detailed Description

Base class to render a course module availability inside a course format.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core_courseformat\output\local\content\cm\availability::__construct ( course_format $format,
section_info $section,
cm_info $mod,
array $displayoptions = [] )

Constructor.

Parameters
course_format$formatthe course format
section_info$sectionthe section info
cm_info$modthe course module ionfo
array$displayoptionsoptional extra display options

Member Function Documentation

◆ availability_info()

core_courseformat\output\local\content\section\availability::availability_info ( $text,
$additionalclasses = '' )
protectedinherited

Generate the basic availability information data.

Deprecated
since Moodle 4.3 MDL-78204. Please use {
See also
self\get_availability_data} instead.
Todo
MDL-78489 This will be deleted in Moodle 4.7.
Parameters
string$textthe formatted avalability text
string$additionalclassesadditional css classes
Return values
stdClassthe availability information data

◆ availability_info_from_output()

core_courseformat\output\local\content\section\availability::availability_info_from_output ( renderer_base $output,
core_availability_multiple_messages $availabilityinfo )
protectedinherited

Generate the basic availability information data from a renderable.

Use the header and the first item to generate the excerpt text.

Parameters
renderer_base$outputtypically, the renderer that's calling this function
core_availability_multiple_messages$availabilityinfothe avalability info
Return values
stdClassthe availability information data

◆ availability_info_from_string()

core_courseformat\output\local\content\section\availability::availability_info_from_string ( \renderer_base $output,
string $availabilityinfo )
protectedinherited

Generate the basic availability information data from a string.

Just shorten availability text to generate the excerpt text.

Parameters
renderer_base$outputtypically, the renderer that's calling this function
string$availabilityinfothe avalability info
Return values
stdClassthe availability information data

◆ build_export_data()

core_courseformat\output\local\content\section\availability::build_export_data ( \renderer_base $output)
protectedinherited

Protected method to build the export data.

Parameters
renderer_base$outputtypically, the renderer that's calling this function

◆ conditional_availability_info()

core_courseformat\output\local\content\cm\availability::conditional_availability_info ( \renderer_base $output)
protected

Get the activity availability data to display.

Parameters
renderer_base$outputtypically, the renderer that's calling this function
Return values
arraythe availability data.

◆ export_for_template() [1/2]

core_courseformat\output\local\content\section\availability::export_for_template ( \renderer_base $output)
inherited

Export this data so it can be used as the context for a mustache template.

Parameters
renderer_base$outputtypically, the renderer that's calling this function
Return values
stdClassdata context for a mustache template

◆ export_for_template() [2/2]

templatable::export_for_template ( renderer_base $output)
inherited

Function to export the renderer data in a format that is suitable for a mustache template.

This means:

  1. No complex types - only stdClass, array, int, string, float, bool
  2. Any additional info that is required for the template is pre-calculated (e.g. capability checks).
Parameters
renderer_base$outputUsed to do a final render of any components that need to be rendered for export.
Return values
stdClass|array

Implemented in action_menu, assign_attempt_history_chooser, block_lp\output\competencies_to_review_page, block_lp\output\plans_to_review_page, block_lp\output\summary, block_myoverview\output\main, block_myprofile\output\myprofile, block_recentlyaccessedcourses\output\main, block_recentlyaccesseditems\output\main, block_search_forums\output\search_form, block_starredcourses\output\main, block_timeline\output\main, booktool_print\output\print_book_chapter_page, booktool_print\output\print_book_page, component_action, context_header, core\navigation\output\more_menu, core\output\activity_header, core\output\checkbox_toggleall, core\output\choicelist, core\output\chooser, core\output\chooser_item, core\output\chooser_section, core\output\comboboxsearch, core\output\dynamic_tabs, core\output\select_menu, core_admin\output\theme_selector, core_auth\output\digital_minor_page, core_auth\output\login, core_auth\output\verify_age_location_page, core_badges\output\manage_badge_action_bar, core_badges\output\recipients_action_bar, core_badges\output\standard_action_bar, core_contentbank\output\bankcontent, core_contentbank\output\viewcontent, core_course\output\activity_completion, core_course\output\activity_dates, core_course\output\activity_information, core_course\output\completion_action_bar, core_courseformat\output\activitybadge, core_courseformat\output\local\content\cm, core_courseformat\output\local\content\section, core_group\output\group_details, core_group\output\index_page, core_h5p\output\libraries, core_privacy\output\exported_html_page, core_privacy\output\exported_navigation_page, core_question\output\qbank_action_menu, core_question\output\question_bank_filter_ui, core_question\output\question_version_info, core_question\output\question_version_selection, core_reportbuilder\output\custom_report, core_reportbuilder\output\dynamictabs\access, core_reportbuilder\output\dynamictabs\audience, core_reportbuilder\output\dynamictabs\editor, core_reportbuilder\output\dynamictabs\schedules, core_reportbuilder\output\system_report, core_tag\output\tag, core_tag\output\tagcloud, core_tag\output\tagfeed, core_tag\output\tagindex, core_tag\output\taglist, core_user\output\participants_filter, core_user\output\status_field, custom_menu_item, enrol_lti\output\registration, format_topics\output\courseformat\content, forumreport_summary\output\filters, gradereport_singleview\output\action_bar, help_icon, initials_bar, login_signup_form, mod_assign\output\grading_app, mod_assign\output\timelimit_panel, mod_bigbluebuttonbn\output\import_view, mod_bigbluebuttonbn\output\instance_updated_message, mod_bigbluebuttonbn\output\recording_row_actionbar, mod_bigbluebuttonbn\output\recording_row_playback, mod_bigbluebuttonbn\output\recording_row_preview, mod_bigbluebuttonbn\output\recordings_session, mod_bigbluebuttonbn\output\view_page, mod_data\output\presets, mod_data\output\view_footer, mod_feedback\output\base_action_bar, mod_feedback\output\summary, mod_forum\output\big_search_form, mod_forum\output\forum_actionbar, mod_forum\output\quick_search_form, mod_forum\output\subscription_actionbar, mod_glossary\output\standard_action_bar, mod_h5pactivity\output\attempt, mod_h5pactivity\output\reportattempts, mod_h5pactivity\output\reportlink, mod_h5pactivity\output\reportresults, mod_h5pactivity\output\result, mod_h5pactivity\output\result\longfillin, mod_h5pactivity\output\result\other, mod_lti\output\course_tools_page_header, mod_lti\output\external_registration_return_page, mod_lti\output\registration_upgrade_choice_page, mod_lti\output\repost_crosssite_page, mod_lti\output\tool_configure_page, mod_quiz\output\attempt_summary_information, mod_quiz\output\edit_grading_page, mod_quiz\output\edit_nav_actions, mod_quiz\output\list_of_attempts, mod_quiz\output\overrides_actions, mod_scorm\output\actionbar, mod_scorm\output\userreportsactionbar, mod_survey\output\actionbar, mod_workshop\output\actionbar, MoodleQuickForm_advcheckbox, MoodleQuickForm_autocomplete, MoodleQuickForm_button, MoodleQuickForm_checkbox, MoodleQuickForm_choicedropdown, MoodleQuickForm_date_selector, MoodleQuickForm_date_time_selector, MoodleQuickForm_editor, MoodleQuickForm_filemanager, MoodleQuickForm_filepicker, MoodleQuickForm_grading, MoodleQuickForm_group, MoodleQuickForm_passwordunmask, MoodleQuickForm_recaptcha, MoodleQuickForm_select, MoodleQuickForm_selectgroups, MoodleQuickForm_selectwithlink, MoodleQuickForm_static, MoodleQuickForm_submit, MoodleQuickForm_tags, MoodleQuickForm_textarea, MoodleQuickForm_url, MoodleQuickForm_warning, MoodleQuickForm_wikieditor, paging_bar, pix_icon, pix_icon_font, progress_bar, qbank_columnsortorder\output\add_column, qbank_columnsortorder\output\reset_columns, qbank_editquestion\output\add_new_question, qbank_viewquestiontext\output\question_text_format, qtype_ordering\output\feedback, report_competency\output\report, report_competency\output\user_course_navigation, single_select, tabobject, tabtree, tool_admin_presets\output\export_import, tool_admin_presets\output\presets_list, tool_componentlibrary\local\examples\dynamictabs\tab1, tool_componentlibrary\local\examples\dynamictabs\tab2, tool_customlang\output\translator, tool_dataprivacy\output\categories, tool_dataprivacy\output\data_deletion_page, tool_dataprivacy\output\data_registry_compliance_page, tool_dataprivacy\output\data_registry_page, tool_dataprivacy\output\data_requests_page, tool_dataprivacy\output\defaults_page, tool_dataprivacy\output\my_data_requests_page, tool_dataprivacy\output\purposes, tool_dataprivacy\output\request_filter, tool_dataprivacy\output\summary_page, tool_generator\output\parsingresult, tool_langimport\output\langimport_page, tool_lp\output\competency_plan_navigation, tool_lp\output\competency_summary, tool_lp\output\course_competencies_page, tool_lp\output\manage_competencies_page, tool_lp\output\manage_competency_frameworks_page, tool_lp\output\manage_templates_page, tool_lp\output\module_navigation, tool_lp\output\plans_page, tool_lp\output\related_competencies, tool_lp\output\template_competencies_page, tool_lp\output\user_competency_course_navigation, tool_lp\output\user_competency_summary, tool_lp\output\user_competency_summary_in_course, tool_lp\output\user_evidence_list_page, tool_policy\output\acceptances, tool_policy\output\guestconsent, tool_policy\output\page_agreedocs, tool_policy\output\page_managedocs_list, tool_policy\output\page_nopermission, tool_policy\output\page_viewalldoc, tool_policy\output\page_viewdoc, tool_templatelibrary\output\list_templates_page, and url_select.

◆ get_availability_data()

core_courseformat\output\local\content\section\availability::get_availability_data ( $output,
$availabilityinfo,
$additionalclasses = '' )
protectedinherited

Get the basic availability information data.

Parameters
renderer_base$outputtypically, the renderer that's calling this function
string | core_availability_multiple_messages$availabilityinfothe avalability info
string$additionalclassesadditional css classes
Return values
stdClassthe availability information data

◆ get_info()

core_courseformat\output\local\content\cm\availability::get_info ( \renderer_base $output)
protected

Get the availability data to be used as the context for a mustache template.

Parameters
renderer_base$outputtypically, the renderer that's calling this function
Return values
arraythe availability data.

Reimplemented from core_courseformat\output\local\content\section\availability.

◆ get_template_name()

core\output\named_templatable::get_template_name ( \renderer_base $renderer)
inherited

Get the name of the template to use for this templatable.

Parameters
renderer_base$rendererThe renderer requesting the template name
Return values
string

Implemented in core\output\local\dropdown\dialog, core\output\local\dropdown\status, core\output\sticky_footer, core_courseformat\output\local\content\cm\title, mod_quiz\output\list_of_attempts, and qbank_viewquestionname\output\questionname.

◆ has_availability()

core_courseformat\output\local\content\section\availability::has_availability ( \renderer_base $output)
inherited

Returns if the output has availability info to display.

Parameters
renderer_base$outputtypically, the renderer that's calling this function
Return values
boolif the element has availability data to display

◆ user_availability_info()

core_courseformat\output\local\content\cm\availability::user_availability_info ( \renderer_base $output)
protected

Get the current user availability data.

This is a student who is not allowed to see the module but might be allowed to see availability info (i.e. "Available from ...").

Parameters
renderer_base$outputtypically, the renderer that's calling this function
Return values
arraythe availability data.

The documentation for this class was generated from the following file: