Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
admin_settingpage Class Reference

Used to group a number of admin_setting objects into a page and add them to the admin tree. More...

Inheritance diagram for admin_settingpage:
part_of_admin_tree core_admin\local\settings\linkable_settings_page theme_boost_admin_settingspage_tabs

Public Member Functions

 __construct ($name, $visiblename, $req_capability='moodle/site:config', $hidden=false, $context=NULL)
 see admin_settingpage for details of this function
 
 add ($setting)
 adds an admin_setting to this admin_settingpage
 
 check_access ()
 see admin_externalpage
 
 get_dependencies_for_javascript ()
 Format the setting show/hide conditions ready to initialise the page javascript.
 
 get_settings_page_url ()
 Get the URL to view this page.
 
 has_dependencies ()
 Should any of the settings on this page be shown / hidden based on conditions?
 
 hide_if ($settingname, $dependenton, $condition='notchecked', $value='1')
 Hide the named setting if the specified condition is matched.
 
 is_hidden ()
 Is this settings page hidden in admin tree block?
 
 locate ($name, $findpath=false)
 see admin_category
 
 locate ($name)
 Finds a named part_of_admin_tree.
 
 output_html ()
 outputs this page as html in a table (suitable for inclusion in an admin pagetype)
 
 prune ($name)
 This function always returns false, required by interface.
 
 search ($query)
 Search string in settings page.
 
 show_save ()
 Show we display Save button at the page bottom?
 

Public Attributes

object $context
 The context in which capability/permission should be checked, default is site context.
 
bool $hidden
 hidden in admin tree block.
 
string $name
 An internal name for this external page.
 
mixed $path
 string of paths or array of strings of paths
 
array $req_capability
 The role capability/permission a user must have to access this external page.
 
mixed $settings
 An array of admin_setting objects that are part of this setting page.
 
string $visiblename
 The displayed name for this external page.
 
array $visiblepath
 list of visible names of page parents
 

Protected Attributes

admin_settingdependency[] $dependencies = []
 list of settings to hide when certain conditions are met
 

Detailed Description

Used to group a number of admin_setting objects into a page and add them to the admin tree.

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

Constructor & Destructor Documentation

◆ __construct()

admin_settingpage::__construct ( $name,
$visiblename,
$req_capability = 'moodle/site:config',
$hidden = false,
$context = NULL )

see admin_settingpage for details of this function

Parameters
string$nameThe internal name for this external page. Must be unique amongst ALL part_of_admin_tree objects.
string$visiblenameThe displayed name for this external page. Usually obtained through get_string().
mixed$req_capabilityThe role capability/permission a user must have to access this external page. Defaults to 'moodle/site:config'.
boolean$hiddenIs this external page hidden in admin tree block? Default false.
stdClass$contextThe context the page relates to. Not sure what happens if you specify something other than system or front page. Defaults to system.

Member Function Documentation

◆ add()

admin_settingpage::add ( $setting)

adds an admin_setting to this admin_settingpage

not the same as add for admin_category. adds an admin_setting to this admin_settingpage. settings appear (on the settingpage) in the order in which they're added n.b. each admin_setting in an admin_settingpage must have a unique internal name

Parameters
object$settingis the admin_setting object you want to add
Return values
booltrue if successful, false if not

Reimplemented in theme_boost_admin_settingspage_tabs.

◆ check_access()

admin_settingpage::check_access ( )

see admin_externalpage

Return values
boolReturns true for yes false for no

Implements part_of_admin_tree.

◆ get_dependencies_for_javascript()

admin_settingpage::get_dependencies_for_javascript ( )

Format the setting show/hide conditions ready to initialise the page javascript.

Return values
array

◆ get_settings_page_url()

admin_settingpage::get_settings_page_url ( )

Get the URL to view this page.

Return values
moodle_url

Implements core_admin\local\settings\linkable_settings_page.

◆ has_dependencies()

admin_settingpage::has_dependencies ( )

Should any of the settings on this page be shown / hidden based on conditions?

Return values
bool

◆ hide_if()

admin_settingpage::hide_if ( $settingname,
$dependenton,
$condition = 'notchecked',
$value = '1' )

Hide the named setting if the specified condition is matched.

Parameters
string$settingname
string$dependenton
string$condition
string$value

◆ is_hidden()

admin_settingpage::is_hidden ( )

Is this settings page hidden in admin tree block?

Return values
boolTrue if hidden

Implements part_of_admin_tree.

◆ locate() [1/2]

admin_settingpage::locate ( $name,
$findpath = false )

see admin_category

Parameters
string$name
bool$findpath
Return values
mixedObject (this) if name == this->name, else returns null

◆ locate() [2/2]

part_of_admin_tree::locate ( $name)
inherited

Finds a named part_of_admin_tree.

Used to find a part_of_admin_tree. If a class only inherits part_of_admin_tree and not parentable_part_of_admin_tree, then this function should only check if $this->name matches $name. If it does, it should return a reference to $this, otherwise, it should return a reference to NULL.

If a class inherits parentable_part_of_admin_tree, this method should be called recursively on all child objects (assuming, of course, the parent object's name doesn't match the search criterion).

Parameters
string$nameThe internal name of the part_of_admin_tree we're searching for.
Return values
mixedAn object reference or a NULL reference.

◆ output_html()

admin_settingpage::output_html ( )

outputs this page as html in a table (suitable for inclusion in an admin pagetype)

Return values
stringReturns an XHTML string

Reimplemented in theme_boost_admin_settingspage_tabs.

◆ prune()

admin_settingpage::prune ( $name)

This function always returns false, required by interface.

Parameters
string$name
Return values
boolAlways false

Implements part_of_admin_tree.

◆ search()

admin_settingpage::search ( $query)

Search string in settings page.

Parameters
string$query
Return values
array

Implements part_of_admin_tree.

◆ show_save()

admin_settingpage::show_save ( )

Show we display Save button at the page bottom?

Return values
bool

Implements part_of_admin_tree.

Member Data Documentation

◆ $name

string admin_settingpage::$name

An internal name for this external page.

Must be unique amongst ALL part_of_admin_tree objects

◆ $visiblename

string admin_settingpage::$visiblename

The displayed name for this external page.

Usually obtained through get_string().


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