PHP Class PMA\libraries\navigation\nodes\Node

Mostrar archivo Open project: phpmyadmin/phpmyadmin Class Usage Examples

Public Properties

Property Type Description
$children An array of Node objects that are direct children of this node
$classes Extra CSS classes for the node
$icon An IMG tag, used when rendering the node
$isNew Whether this node is a link for creating new objects
$is_group Whether this object has been created while grouping nodes Only relevant if the node is of type CONTAINER
$links An array of A tags, used when rendering the node The indexes in the array may be 'icon' and 'text'
$name A non-unique identifier for the node This may be trimmed when grouping nodes
$parent A reference to the parent object of this node, NULL for the root node.
$pos2 The position for the pagination of the branch at the second level of the tree
$pos3 The position for the pagination of the branch at the third level of the tree
$real_name A non-unique identifier for the node This will never change after being assigned
$separator A string used to group nodes, or an array of strings Only relevant if the node is of type CONTAINER
$separator_depth How many time to recursively apply the grouping function Only relevant if the node is of type CONTAINER
$title HTML title
$type May be one of CONTAINER or OBJECT
$visible Whether to add a "display: none;" CSS rule to the node when rendering it

Public Methods

Method Description
__construct ( string $name, integer $type = Node::OBJECT, boolean $is_group = false ) Initialises the class by setting the mandatory variables
addChild ( Node $child ) : void Adds a child node to this node
getChild ( string $name, boolean $real_name = false ) : false | Node Returns a child node given it's name
getCssClasses ( boolean $match ) : String Returns CSS classes for a node
getData ( string $type, integer $pos, string $searchClause = '' ) : array Returns the names of children of type $type present inside this container This method is overridden by the PMA\libraries\navigation\nodes\NodeDatabase and PMA\libraries\navigation\nodes\NodeTable classes
getHtmlForControlButtons ( ) : String Returns HTML for control buttons displayed infront of a node
getIcon ( boolean $match ) : String Returns icon for the node
getNavigationHidingData ( ) : array Gets the count of hidden elements for each database
getPaths ( ) : array Returns the actual path and the virtual paths for a node both as clean arrays and base64 encoded strings
getPresence ( string $type = '', string $searchClause = '' ) : integer Returns the number of children of type $type present inside this container This method is overridden by the PMA\libraries\navigation\nodes\NodeDatabase and PMA\libraries\navigation\nodes\NodeTable classes
hasChildren ( boolean $count_empty_containers = true ) : boolean This function checks if the node has children nodes associated with it
hasSiblings ( ) : boolean Returns true if the node has some siblings (other nodes on the same tree level, in the same branch), false otherwise.
numChildren ( ) : integer Returns the number of child nodes that a node has associated with it
parents ( boolean $self = false, boolean $containers = false, boolean $groups = false ) : array Retrieves the parents for a node
realParent ( ) : Node | false Returns the actual parent of a node. If used twice on an index or columns node, it will return the table and database nodes. The names of the returned nodes can be used in SQL queries, etc.
removeChild ( string $name ) : void Removes a child node from this node

Private Methods

Method Description
_getDatabasesToSearch ( string $searchClause ) : array Get the list of databases for 'SHOW DATABASES LIKE' queries.
_getWhereClause ( string $columnName, string $searchClause = '' ) : string Returns the WHERE clause depending on the $searchClause parameter and the hide_db directive
_isHideDb ( string $db ) : boolean Detemines whether a given database should be hidden according to 'hide_db'

Method Details

__construct() public method

Initialises the class by setting the mandatory variables
public __construct ( string $name, integer $type = Node::OBJECT, boolean $is_group = false )
$name string An identifier for the new node
$type integer Type of node, may be one of CONTAINER or OBJECT
$is_group boolean Whether this object has been created while grouping nodes

addChild() public method

Adds a child node to this node
public addChild ( Node $child ) : void
$child Node A child node
return void

getChild() public method

Returns a child node given it's name
public getChild ( string $name, boolean $real_name = false ) : false | Node
$name string The name of requested child
$real_name boolean Whether to use the "real_name" instead of "name" in comparisons
return false | Node The requested child node or false, if the requested node cannot be found

getCssClasses() public method

Returns CSS classes for a node
public getCssClasses ( boolean $match ) : String
$match boolean Whether the node matched loaded tree
return String with html classes.

getData() public method

Returns the names of children of type $type present inside this container This method is overridden by the PMA\libraries\navigation\nodes\NodeDatabase and PMA\libraries\navigation\nodes\NodeTable classes
public getData ( string $type, integer $pos, string $searchClause = '' ) : array
$type string The type of item we are looking for ('tables', 'views', etc)
$pos integer The offset of the list within the results
$searchClause string A string used to filter the results of the query
return array

getHtmlForControlButtons() public method

Returns HTML for control buttons displayed infront of a node
public getHtmlForControlButtons ( ) : String
return String HTML for control buttons

getIcon() public method

Returns icon for the node
public getIcon ( boolean $match ) : String
$match boolean Whether the node matched loaded tree
return String with image name

getNavigationHidingData() public method

Gets the count of hidden elements for each database
public getNavigationHidingData ( ) : array
return array array containing the count of hidden elements for each database

getPaths() public method

Returns the actual path and the virtual paths for a node both as clean arrays and base64 encoded strings
public getPaths ( ) : array
return array

getPresence() public method

Returns the number of children of type $type present inside this container This method is overridden by the PMA\libraries\navigation\nodes\NodeDatabase and PMA\libraries\navigation\nodes\NodeTable classes
public getPresence ( string $type = '', string $searchClause = '' ) : integer
$type string The type of item we are looking for ('tables', 'views', etc)
$searchClause string A string used to filter the results of the query
return integer

hasChildren() public method

This function checks if the node has children nodes associated with it
public hasChildren ( boolean $count_empty_containers = true ) : boolean
$count_empty_containers boolean Whether to count empty child containers as valid children
return boolean Whether the node has child nodes

hasSiblings() public method

The only exception is for nodes on the third level of the tree (columns and indexes), for which the function always returns true. This is because we want to render the containers for these nodes
public hasSiblings ( ) : boolean
return boolean

numChildren() public method

Returns the number of child nodes that a node has associated with it
public numChildren ( ) : integer
return integer The number of children nodes

parents() public method

Retrieves the parents for a node
public parents ( boolean $self = false, boolean $containers = false, boolean $groups = false ) : array
$self boolean Whether to include the Node itself in the results
$containers boolean Whether to include nodes of type CONTAINER
$groups boolean Whether to include nodes which have $group == true
return array An array of parent Nodes

realParent() public method

..
public realParent ( ) : Node | false
return Node | false

removeChild() public method

Removes a child node from this node
public removeChild ( string $name ) : void
$name string The name of child to be removed
return void

Property Details

$children public_oe property

An array of Node objects that are direct children of this node
public $children

$classes public_oe property

Extra CSS classes for the node
public $classes

$icon public_oe property

An IMG tag, used when rendering the node
public $icon

$isNew public_oe property

Whether this node is a link for creating new objects
public $isNew

$is_group public_oe property

Whether this object has been created while grouping nodes Only relevant if the node is of type CONTAINER
public $is_group

$name public_oe property

A non-unique identifier for the node This may be trimmed when grouping nodes
public $name

$parent public_oe property

A reference to the parent object of this node, NULL for the root node.
public $parent

$pos2 public_oe property

The position for the pagination of the branch at the second level of the tree
public $pos2

$pos3 public_oe property

The position for the pagination of the branch at the third level of the tree
public $pos3

$real_name public_oe property

A non-unique identifier for the node This will never change after being assigned
public $real_name

$separator public_oe property

A string used to group nodes, or an array of strings Only relevant if the node is of type CONTAINER
public $separator

$separator_depth public_oe property

How many time to recursively apply the grouping function Only relevant if the node is of type CONTAINER
public $separator_depth

$title public_oe property

HTML title
public $title

$type public_oe property

May be one of CONTAINER or OBJECT
public $type

$visible public_oe property

Whether to add a "display: none;" CSS rule to the node when rendering it
public $visible