Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | Protected Attributes | List of all members
admin_root Class Reference

Root of admin settings tree, does not have any parent. More...

Inheritance diagram for admin_root:
admin_category parentable_part_of_admin_tree part_of_admin_tree

Public Member Functions

 __construct ($fulltree)
 
 __get ($property)
 Magically gets a property from this object. More...
 
 __isset ($property)
 Checks if an inaccessible property is set. More...
 
 __set ($property, $value)
 Magically sets a property against this object. More...
 
 add ($parentname, $something, $beforesibling=null)
 Adds a part_of_admin_tree to a child or grandchild (or great-grandchild, and so forth) of this object. More...
 
 check_access ()
 Checks if the user has access to anything in this category. More...
 
 get_children ()
 Returns the children associated with this category. More...
 
 is_hidden ()
 Is this category hidden in admin tree block? More...
 
 locate ($name)
 Finds a named part_of_admin_tree. More...
 
 locate ($name, $findpath=false)
 Returns a reference to the part_of_admin_tree object with internal name $name. More...
 
 prune ($name)
 Removes part_of_admin_tree object with internal name $name. More...
 
 purge_children ($requirefulltree)
 Empties children array, and sets loaded to false. More...
 
 search ($query)
 Search using query. More...
 
 set_sorting ($sort, $asc=true, $split=true)
 Sets sorting on this category. More...
 
 show_save ()
 Show we display Save button at the page bottom? More...
 

Public Attributes

mixed $custom_defaults
 site custom defaults overriding defaults in settings files
 
array $errors
 List of errors.
 
bool $fulltree
 full tree flag - true means all settings required, false only pages required
 
bool $hidden
 Should this category be hidden in admin tree block?
 
bool $loaded
 flag indicating loaded tree
 
string $name
 An internal name for this category. More...
 
mixed $path
 Either a string or an array or strings.
 
string $search
 search query
 
string $visiblename
 The displayed name for this category. More...
 
mixed $visiblepath
 Either a string or an array or strings.
 

Protected Attributes

array $category_cache
 fast lookup category cache, all categories of one tree point to one cache
 
part_of_admin_tree[] $children
 An array of part_of_admin_tree objects that are this object's children.
 
bool $sort = false
 If set to true children will be sorted when calling admin_category::get_children().
 
bool $sortasc = true
 If set to true children will be sorted in ascending order.
 
bool $sorted = false
 $sorted True if the children have been sorted and don't need resorting
 
bool $sortsplit = true
 If set to true sub categories and pages will be split and then sorted. More...
 

Detailed Description

Root of admin settings tree, does not have any parent.

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

Constructor & Destructor Documentation

◆ __construct()

admin_root::__construct (   $fulltree)
Parameters
bool$fulltreetrue means all settings required, false only pages required

Member Function Documentation

◆ __get()

admin_category::__get (   $property)
inherited

Magically gets a property from this object.

Parameters
$property
Return values
part_of_admin_tree[]
Exceptions
coding_exception

◆ __isset()

admin_category::__isset (   $property)
inherited

Checks if an inaccessible property is set.

Parameters
string$property
Return values
bool
Exceptions
coding_exception

◆ __set()

admin_category::__set (   $property,
  $value 
)
inherited

Magically sets a property against this object.

Parameters
string$property
mixed$value
Exceptions
coding_exception

◆ add()

admin_category::add (   $parentname,
  $something,
  $beforesibling = null 
)
inherited

Adds a part_of_admin_tree to a child or grandchild (or great-grandchild, and so forth) of this object.

By default the new part of the tree is appended as the last child of the parent. You can specify a sibling node that the new part should be prepended to. If the given sibling is not found, the part is appended to the end (as it would be by default) and a developer debugging message is displayed.

Exceptions
coding_exceptionif the $beforesibling is empty string or is not string at all.
Parameters
string$destinationameThe internal name of the immediate parent that we want for $something.
mixed$somethingA part_of_admin_tree or setting instance to be added.
string$beforesiblingThe name of the parent's child the $something should be prepended to.
Return values
boolTrue if successfully added, false if $something can not be added.

Implements parentable_part_of_admin_tree.

◆ check_access()

admin_category::check_access ( )
inherited

Checks if the user has access to anything in this category.

Return values
boolTrue if the user has access to at least one child in this category, false otherwise.

Implements part_of_admin_tree.

◆ get_children()

admin_category::get_children ( )
inherited

Returns the children associated with this category.

Return values
part_of_admin_tree[]

◆ is_hidden()

admin_category::is_hidden ( )
inherited

Is this category hidden in admin tree block?

Return values
boolTrue if hidden

Implements part_of_admin_tree.

◆ locate() [1/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.

◆ locate() [2/2]

admin_category::locate (   $name,
  $findpath = false 
)
inherited

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$findpathinitialize path and visiblepath arrays
Return values
mixedA reference to the object with internal name $name if found, otherwise a reference to NULL. defaults to false

◆ prune()

admin_category::prune (   $name)
inherited

Removes part_of_admin_tree object with internal name $name.

Parameters
string$nameThe internal name of the object we want to remove.
Return values
boolsuccess

Implements part_of_admin_tree.

◆ purge_children()

admin_root::purge_children (   $requirefulltree)

Empties children array, and sets loaded to false.

Parameters
bool$requirefulltree

◆ search()

admin_category::search (   $query)
inherited

Search using query.

Parameters
stringquery
Return values
mixedarray-object structure of found settings and pages

Implements part_of_admin_tree.

◆ set_sorting()

admin_category::set_sorting (   $sort,
  $asc = true,
  $split = true 
)
inherited

Sets sorting on this category.

Please note this function doesn't actually do the sorting. It can be called anytime. Sorting occurs when the user calls get_children. Code using the children array directly won't see the sorted results.

Parameters
bool$sortIf set to true children will be sorted, if false they won't be.
bool$ascIf true sorting will be ascending, otherwise descending.
bool$splitIf true we sort pages and sub categories separately.

◆ show_save()

admin_category::show_save ( )
inherited

Show we display Save button at the page bottom?

Return values
bool

Implements part_of_admin_tree.

Member Data Documentation

◆ $name

string admin_category::$name
inherited

An internal name for this category.

Must be unique amongst ALL part_of_admin_tree objects

◆ $sortsplit

bool admin_category::$sortsplit = true
protectedinherited

If set to true sub categories and pages will be split and then sorted.

◆ $visiblename

string admin_category::$visiblename
inherited

The displayed name for this category.

Usually obtained through get_string()


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