See Release Notes
Long Term Support Release
Differences Between: [Versions 401 and 402] [Versions 401 and 403]
(no description)
File Size: | 906 lines (32 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
template:: (33 methods):
__construct()
create_default_template()
get_default_display_options()
get_template_content()
add_options()
load_template_tags()
has_tag()
get_template_name()
get_icons()
parse_entries()
parse_entry()
get_fields_replacements()
get_tags_replacements()
post_parse()
get_tag_edit_replacement()
get_tag_delete_replacement()
get_tag_more_replacement()
get_tag_moreurl_replacement()
get_tag_delcheck_replacement()
get_tag_user_replacement()
get_tag_userpicture_replacement()
get_tag_export_replacement()
get_tag_timeadded_replacement()
get_tag_timemodified_replacement()
get_tag_approve_replacement()
get_tag_disapprove_replacement()
get_tag_approvalstatus_replacement()
get_tag_approvalstatusclass_replacement()
get_tag_comments_replacement()
get_tag_tags_replacement()
get_tag_id_replacement()
get_tag_actionsmenu_replacement()
parse_add_entry()
__construct(manager $manager, string $templatecontent, array $options = [], array $fields = null) X-Ref |
Class contructor. See the add_options method for the available display options. param: manager $manager the current instance manager param: string $templatecontent the template string to use param: array $options an array of extra diplay options param: array $fields alternative array of fields (for preview presets) |
create_default_template(manager $manager,string $templatename,bool $form = false) X-Ref |
Create a template class with the default template content. param: manager $manager the current instance manager. param: string $templatename the template name. param: bool $form whether the fields should be displayed as form instead of data. return: self The template with the default content (to be displayed when no template is defined). |
get_default_display_options(string $templatename) X-Ref |
Get default options for templates. For instance, the list template supports the show more button. param: string $templatename the template name. return: array an array of extra diplay options. |
get_template_content() X-Ref |
Return the raw template content. return: string the template content before parsing |
add_options(array $options = []) X-Ref |
Add extra display options. The extra options are: - page: the current pagination page - search: the current search text - baseurl: an alternative entry url (moodle_url) - comments: if comments must be added if not present - ratings: if ratings must be added param: array $options the array of options. |
load_template_tags(string $templatecontent) X-Ref |
Scan the template tags. This method detects which tags are used in this template and store them in the $this->tags attribute. This attribute will be used to determine which replacements needs to be calculated. param: string $templatecontent the current template |
has_tag(string $tagname) X-Ref |
Check if a tag is present in the template. param: bool $tagname the tag to check (without ##) return: bool if the tag is present |
get_template_name() X-Ref |
Return the current template name. return: string the template name |
get_icons() X-Ref |
Generate the list of action icons. return: pix_icon[] icon name => pix_icon |
parse_entries(array $entries) X-Ref |
Return the parsed entry using a template. This method apply a template replacing all necessary tags. param: array $entries of entres to parse return: string the entries outputs using the template |
parse_entry(stdClass $entry) X-Ref |
Parse a single entry. param: stdClass $entry the entry to parse return: string the parsed entry |
get_fields_replacements(stdClass $entry) X-Ref |
Get all field replacements. param: stdClass $entry the entry object return: array of pattern => replacement |
get_tags_replacements(stdClass $entry, bool $canmanageentry) X-Ref |
Get all standard tags replacements. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: array of pattern => replacement |
post_parse(string $result, stdClass $entry) X-Ref |
Add any extra information to the parsed entry. param: string $result the parsed template with the entry data param: stdClass $entry the entry object return: string the final parsed template |
get_tag_edit_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##edit## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_delete_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##delete## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_more_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##more## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_moreurl_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##moreurl## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_delcheck_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##delcheck## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_user_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##user## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_userpicture_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##userpicture## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_export_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##export## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_timeadded_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##timeadded## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_timemodified_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##timemodified## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_approve_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##approve## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_disapprove_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##disapprove## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_approvalstatus_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##approvalstatus## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_approvalstatusclass_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##approvalstatusclass## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_comments_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##comments## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_tags_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##tags## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_id_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##id## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
get_tag_actionsmenu_replacement(stdClass $entry, bool $canmanageentry) X-Ref |
Returns the ##actionsmenu## tag replacement for an entry. param: stdClass $entry the entry object param: bool $canmanageentry if the current user can manage this entry return: string the tag replacement |
parse_add_entry(?stdClass $processeddata = null,?int $entryid = null,?stdClass $entrydata = null) X-Ref |
Parse the template as if it was for add entry. This method is similar to the parse_entry but it uses the display_add_field method instead of the display_browse_field. param: stdClass|null $processeddata the previous process data information. param: int|null $entryid the possible entry id param: stdClass|null $entrydata the entry data from a previous form or from a real entry return: string the add entry HTML content |