Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Class for manipulating with the template records.

Author: Dmitrii Metelkin <dmitriim@catalyst-au.net>
Copyright: 2020 Catalyst IT
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 384 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

template_controller:: (21 methods):
  __construct()
  execute()
  set_external_page()
  get_instance()
  display_all_records()
  get_create_button_text()
  get_form()
  get_view_heading()
  get_new_heading()
  get_edit_heading()
  get_base_url()
  edit()
  delete()
  view()
  show()
  hide()
  show_hide()
  print_add_button()
  header()
  footer()
  trigger_enabled_event()


Class: template_controller  - X-Ref

Class for manipulating with the template records.

__construct()   X-Ref
region_manager constructor.


execute($action)   X-Ref
Execute required action.

param: string $action Action to execute.

set_external_page()   X-Ref
Set external page for the manager.


get_instance($id = 0, \stdClass $data = null)   X-Ref
Return record instance.

param: int $id
param: \stdClass|null $data
return: \quizaccess_seb\template

display_all_records()   X-Ref
Print out all records in a table.


get_create_button_text()   X-Ref
Returns a text for create new record button.

return: string

get_form($instance)   X-Ref
Returns form for the record.

param: \quizaccess_seb\template|null $instance
return: \quizaccess_seb\local\form\template

get_view_heading()   X-Ref
View page heading string.

return: string

get_new_heading()   X-Ref
New record heading string.

return: string

get_edit_heading()   X-Ref
Edit record heading string.

return: string

get_base_url()   X-Ref
Returns base URL for the manager.

return: string

edit($action, $id = null)   X-Ref
Execute edit action.

param: string $action Could be edit or create.
param: null|int $id Id of the region or null if creating a new one.

delete($id)   X-Ref
Execute delete action.

param: int $id ID of the region.

view()   X-Ref
Execute view action.


show(int $id)   X-Ref
Show the template.

param: int $id The ID of the template to show.

hide($id)   X-Ref
Hide the template.

param: int $id The ID of the template to hide.

show_hide(int $id, int $visibility)   X-Ref
Show or Hide the template.

param: int $id The ID of the template to hide.
param: int $visibility The intended visibility.

print_add_button()   X-Ref
Print out add button.


header($title)   X-Ref
Print out page header.

param: string $title Title to display.

footer()   X-Ref
Print out the page footer.

return: void

trigger_enabled_event(template $template)   X-Ref
Helper function to fire off an event that informs of if a template is enabled or not.

param: template $template The template persistent object.