Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
admin_externalpage Class Reference

Links external PHP pages into the admin tree. More...

Inheritance diagram for admin_externalpage:
part_of_admin_tree core_admin\local\settings\linkable_settings_page admin_page_manageblocks admin_page_managefilters admin_page_managemessageoutputs admin_page_managemods admin_page_manageportfolios admin_page_manageqbehaviours admin_page_manageqtypes admin_page_managerepositories admin_page_pluginsoverview assign_admin_page_manage_assign_plugins core_admin\local\externalpage\accesscallback

Public Member Functions

 __construct ($name, $visiblename, $url, $req_capability='moodle/site:config', $hidden=false, $context=NULL)
 Constructor for adding an external page into the admin tree.
 
 check_access ()
 Determines if the current user has access to this external page based on $this->req_capability.
 
 get_settings_page_url ()
 Get the URL to view this settings page.
 
 is_hidden ()
 Is this external page hidden in admin tree block?
 
 locate ($name, $findpath=false)
 Returns a reference to the part_of_admin_tree object with internal name $name.
 
 locate ($name)
 Finds a named part_of_admin_tree.
 
 prune ($name)
 This function always returns false, required function by interface.
 
 search ($query)
 Search using query.
 
 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
 either string or array of string
 
array $req_capability
 The role capability/permission a user must have to access this external page.
 
string $url
 The external URL that we should link to when someone requests this external page.
 
string $visiblename
 The displayed name for this external page.
 
array $visiblepath
 list of visible names of page parents
 

Detailed Description

Links external PHP pages into the admin tree.

See detailed usage example at the top of this document (adminlib.php)

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor for adding an external page into the admin tree.

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().
string$urlThe external URL that we should link to when someone requests this external page.
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

◆ check_access()

admin_externalpage::check_access ( )

Determines if the current user has access to this external page based on $this->req_capability.

Return values
boolTrue if user has access, false otherwise.

Implements part_of_admin_tree.

Reimplemented in core_admin\local\externalpage\accesscallback.

◆ get_settings_page_url()

admin_externalpage::get_settings_page_url ( )

Get the URL to view this settings page.

Return values
moodle_url

Implements core_admin\local\settings\linkable_settings_page.

◆ is_hidden()

admin_externalpage::is_hidden ( )

Is this external page hidden in admin tree block?

Return values
boolTrue if hidden

Implements part_of_admin_tree.

◆ locate() [1/2]

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

Returns a reference to the part_of_admin_tree object with internal name $name.

Parameters
string$nameThe internal name of the object we want.
bool$findpathdefaults to false
Return values
mixedA reference to the object with internal name $name if found, otherwise a reference to 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.

◆ prune()

admin_externalpage::prune ( $name)

This function always returns false, required function by interface.

Parameters
string$name
Return values
false

Implements part_of_admin_tree.

◆ search()

admin_externalpage::search ( $query)

◆ show_save()

admin_externalpage::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_externalpage::$name

An internal name for this external page.

Must be unique amongst ALL part_of_admin_tree objects

◆ $visiblename

string admin_externalpage::$visiblename

The displayed name for this external page.

Usually obtained through get_string().


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