| Moodle APIs 4.3
    Moodle 4.3.6 (Build: 20240812) | 
Class template for database activity. More...
| Public Member Functions | |
| __construct (manager $manager, string $templatecontent, array $options=[], array $fields=null) | |
| Class contructor. | |
| add_options (array $options=[]) | |
| Add extra display options. | |
| get_template_content () | |
| Return the raw template content. | |
| get_template_name () | |
| Return the current template name. | |
| has_tag (string $tagname) | |
| Check if a tag is present in the template. | |
| parse_add_entry (?stdClass $processeddata=null, ?int $entryid=null, ?stdClass $entrydata=null) | |
| Parse the template as if it was for add entry. | |
| parse_entries (array $entries) | |
| Return the parsed entry using a template. | |
| Static Public Member Functions | |
| static | create_default_template (manager $manager, string $templatename, bool $form=false) | 
| Create a template class with the default template content. | |
| static | get_default_display_options (string $templatename) | 
| Get default options for templates. | |
| Protected Member Functions | |
| get_icons () | |
| Generate the list of action icons. | |
| get_tag_actionsmenu_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##actionsmenu## tag replacement for an entry. | |
| get_tag_approvalstatus_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##approvalstatus## tag replacement for an entry. | |
| get_tag_approvalstatusclass_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##approvalstatusclass## tag replacement for an entry. | |
| get_tag_approve_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##approve## tag replacement for an entry. | |
| get_tag_comments_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##comments## tag replacement for an entry. | |
| get_tag_delcheck_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##delcheck## tag replacement for an entry. | |
| get_tag_delete_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##delete## tag replacement for an entry. | |
| get_tag_disapprove_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##disapprove## tag replacement for an entry. | |
| get_tag_edit_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##edit## tag replacement for an entry. | |
| get_tag_export_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##export## tag replacement for an entry. | |
| get_tag_id_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the #id## tag replacement for an entry. | |
| get_tag_more_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##more## tag replacement for an entry. | |
| get_tag_moreurl_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##moreurl## tag replacement for an entry. | |
| get_tag_otherfields_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##otherfields## tag replacement for an entry. | |
| get_tag_tags_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##tags## tag replacement for an entry. | |
| get_tag_timeadded_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##timeadded## tag replacement for an entry. | |
| get_tag_timemodified_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##timemodified## tag replacement for an entry. | |
| get_tag_user_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##user## tag replacement for an entry. | |
| get_tag_userpicture_replacement (stdClass $entry, bool $canmanageentry) | |
| Returns the ##userpicture## tag replacement for an entry. | |
| load_template_tags (string $templatecontent) | |
| Scan the template tags. | |
| preprocess_tag_otherfields (string $templatecontent) | |
| Prepare otherfield tag scanning the present template fields. | |
| Protected Attributes | |
| array | $fields = [] | 
| The mod_data fields. | |
| array | $otherfields = [] | 
| All fields that are not present in the template content. | |
| array | $tags = [] | 
| All template tags (calculated in load_template_tags). | |
Class template for database activity.
| mod_data\template::__construct | ( | manager | $manager, | 
| string | $templatecontent, | ||
| array | $options = [], | ||
| array | $fields = null ) | 
Class contructor.
See the add_options method for the available display options.
| manager | $manager | the current instance manager | 
| string | $templatecontent | the template string to use | 
| array | $options | an array of extra diplay options | 
| array | $fields | alternative array of fields (for preview presets) | 
| mod_data\template::add_options | ( | array | $options = [] | ) | 
Add extra display options.
The extra options are:
| array | $options | the array of options. | 
| 
 | static | 
Create a template class with the default template content.
| manager | $manager | the current instance manager. | 
| string | $templatename | the template name. | 
| bool | $form | whether the fields should be displayed as form instead of data. | 
| self | The template with the default content (to be displayed when no template is defined). | 
| 
 | static | 
Get default options for templates.
For instance, the list template supports the show more button.
| string | $templatename | the template name. | 
| array | an array of extra diplay options. | 
| 
 | protected | 
Generate the list of action icons.
| pix_icon[] | icon name => pix_icon | 
| 
 | protected | 
Returns the ##actionsmenu## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##approvalstatus## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##approvalstatusclass## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##approve## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##comments## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##delcheck## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##delete## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##disapprove## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##edit## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##export## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the #id## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##more## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##moreurl## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##otherfields## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##tags## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##timeadded## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##timemodified## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##user## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| 
 | protected | 
Returns the ##userpicture## tag replacement for an entry.
| stdClass | $entry | the entry object | 
| bool | $canmanageentry | if the current user can manage this entry | 
| string | the tag replacement | 
| mod_data\template::get_template_content | ( | ) | 
Return the raw template content.
| string | the template content before parsing | 
| mod_data\template::get_template_name | ( | ) | 
Return the current template name.
| string | the template name | 
| mod_data\template::has_tag | ( | string | $tagname | ) | 
Check if a tag is present in the template.
| bool | $tagname | the tag to check (without ##) | 
| bool | if the tag is present | 
| 
 | protected | 
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.
| string | $templatecontent | the current template | 
| mod_data\template::parse_add_entry | ( | ?stdClass | $processeddata = null, | 
| ?int | $entryid = null, | ||
| ?stdClass | $entrydata = null ) | 
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.
| stdClass | null | $processeddata | the previous process data information. | 
| int | null | $entryid | the possible entry id | 
| stdClass | null | $entrydata | the entry data from a previous form or from a real entry | 
| string | the add entry HTML content | 
| mod_data\template::parse_entries | ( | array | $entries | ) | 
Return the parsed entry using a template.
This method apply a template replacing all necessary tags.
| array | $entries | of entres to parse | 
| string | the entries outputs using the template | 
| 
 | protected | 
Prepare otherfield tag scanning the present template fields.
| string | $templatecontent | the template content |