2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Functionality for the navigation tree
6 * @package PhpMyAdmin-Navigation
8 if (! defined('PHPMYADMIN')) {
13 * Displays a collapsible of database objects in the navigation frame
15 * @package PhpMyAdmin-Navigation
17 class PMA_NavigationTree
20 * @var Node Reference to the root node of the tree
25 * @var array The actual paths to all expanded nodes in the tree
26 * This does not include nodes created after the grouping
27 * of nodes has been performed
29 private $_aPath = array();
32 * @var array The virtual paths to all expanded nodes in the tree
33 * This includes nodes created after the grouping of
34 * nodes has been performed
36 private $_vPath = array();
39 * @var int Position in the list of databases,
45 * @var int The names of the type of items that are being paginated on
46 * the second level of the navigation tree. These may be
47 * tables, views, functions, procedures or events.
49 private $_pos2_name = array();
52 * @var int The positions of nodes in the lists of tables, views,
53 * routines or events used for pagination
55 private $_pos2_value = array();
58 * @var int The names of the type of items that are being paginated
59 * on the second level of the navigation tree.
60 * These may be columns or indexes
62 private $_pos3_name = array();
65 * @var int The positions of nodes in the lists of columns or indexes
68 private $_pos3_value = array();
71 * @var string The search clause to use in SQL queries for
73 * Used by the asynchronous fast filter
75 private $_searchClause = '';
78 * @var string The search clause to use in SQL queries for
80 * Used by the asynchronous fast filter
82 private $_searchClause2 = '';
85 * Initialises the class
89 public function __construct()
91 // Save the position at which we are in the database list
92 if (isset($_REQUEST['pos'])) {
93 $this->_pos
= (int) $_REQUEST['pos'];
95 if (! isset($this->_pos
)) {
96 $this->_pos
= $this->_getNavigationDbPos();
98 // Get the active node
99 if (isset($_REQUEST['aPath'])) {
100 $this->_aPath
[0] = $this->_parsePath($_REQUEST['aPath']);
101 $this->_pos2_name
[0] = $_REQUEST['pos2_name'];
102 $this->_pos2_value
[0] = $_REQUEST['pos2_value'];
103 if (isset($_REQUEST['pos3_name'])) {
104 $this->_pos3_name
[0] = $_REQUEST['pos3_name'];
105 $this->_pos3_value
[0] = $_REQUEST['pos3_value'];
107 } else if (isset($_REQUEST['n0_aPath'])) {
109 while (isset($_REQUEST['n' . $count . '_aPath'])) {
110 $this->_aPath
[$count] = $this->_parsePath(
111 $_REQUEST['n' . $count . '_aPath']
113 $index = 'n' . $count . '_pos2_';
114 $this->_pos2_name
[$count] = $_REQUEST[$index . 'name'];
115 $this->_pos2_value
[$count] = $_REQUEST[$index . 'value'];
116 $index = 'n' . $count . '_pos3_';
117 if (isset($_REQUEST[$index])) {
118 $this->_pos3_name
[$count] = $_REQUEST[$index . 'name'];
119 $this->_pos3_value
[$count] = $_REQUEST[$index . 'value'];
124 if (isset($_REQUEST['vPath'])) {
125 $this->_vPath
[0] = $this->_parsePath($_REQUEST['vPath']);
126 } else if (isset($_REQUEST['n0_vPath'])) {
128 while (isset($_REQUEST['n' . $count . '_vPath'])) {
129 $this->_vPath
[$count] = $this->_parsePath(
130 $_REQUEST['n' . $count . '_vPath']
135 if (isset($_REQUEST['searchClause'])) {
136 $this->_searchClause
= $_REQUEST['searchClause'];
138 if (isset($_REQUEST['searchClause2'])) {
139 $this->_searchClause2
= $_REQUEST['searchClause2'];
141 // Initialise the tree by creating a root node
142 $node = PMA_NodeFactory
::getInstance('Node', 'root', Node
::CONTAINER
);
143 $this->_tree
= $node;
144 if ($GLOBALS['cfg']['NavigationTreeEnableGrouping']) {
145 $this->_tree
->separator
= $GLOBALS['cfg']['NavigationTreeDbSeparator'];
146 $this->_tree
->separator_depth
= 10000;
151 * Returns the database position for the page selector
155 private function _getNavigationDbPos()
158 if (! empty($GLOBALS['db'])) {
159 $query = "SELECT (COUNT(`SCHEMA_NAME`) DIV %d) * %d ";
160 $query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` ";
161 $query .= "WHERE `SCHEMA_NAME` < '%s' ";
162 $query .= "ORDER BY `SCHEMA_NAME` ASC";
163 $retval = PMA_DBI_fetch_value(
166 (int)$GLOBALS['cfg']['MaxNavigationItems'],
167 (int)$GLOBALS['cfg']['MaxNavigationItems'],
168 PMA_Util
::sqlAddSlashes($GLOBALS['db'])
176 * Converts an encoded path to a node in string format to an array
178 * @param string $string The path to parse
182 private function _parsePath($string)
184 $path = explode('.', $string);
185 foreach ($path as $key => $value) {
186 $path[$key] = base64_decode($value);
192 * Generates the tree structure so that it can be rendered later
194 * @return Node|false The active node or false in case of failure
196 private function _buildPath()
198 $retval = $this->_tree
;
200 // Add all databases unconditionally
201 $data = $this->_tree
->getData(
206 foreach ($data as $db) {
207 $node = PMA_NodeFactory
::getInstance('Node_Database', $db);
208 $this->_tree
->addChild($node);
211 // Whether build other parts of the tree depends
212 // on whether we have any paths in $this->_aPath
213 foreach ($this->_aPath
as $key => $path) {
214 $retval = $this->_buildPathPart(
216 $this->_pos2_name
[$key],
217 $this->_pos2_value
[$key],
218 isset($this->_pos3_name
[$key]) ?
$this->_pos3_name
[$key] : '',
219 isset($this->_pos3_value
[$key]) ?
$this->_pos3_value
[$key] : ''
226 * Builds a branch of the tree
228 * @param array $path A paths pointing to the branch
229 * of the tree that needs to be built
230 * @param string $type2 The type of item being paginated on
231 * the second level of the tree
232 * @param int $pos2 The position for the pagination of
233 * the branch at the second level of the tree
234 * @param string $type3 The type of item being paginated on
235 * the third level of the tree
236 * @param int $pos3 The position for the pagination of
237 * the branch at the third level of the tree
239 * @return Node|false The active node or false in case of failure
241 private function _buildPathPart($path, $type2, $pos2, $type3, $pos3)
244 if (count($path) > 1) {
245 array_shift($path); // remove 'root'
246 $db = $this->_tree
->getChild($path[0]);
253 $containers = $this->_addDbContainers($db, $type2, $pos2);
255 array_shift($path); // remove db
257 if ((count($path) > 0
258 && array_key_exists($path[0], $containers))
259 ||
count($containers) == 1
261 if (count($containers) == 1) {
262 $container = array_shift($containers);
264 $container = $db->getChild($path[0], true);
265 if ($container === false) {
269 $retval = $container;
271 if (count($container->children
) <= 1) {
272 $dbData = $db->getData(
273 $container->real_name
,
275 $this->_searchClause2
277 foreach ($dbData as $item) {
278 switch ($container->real_name
) {
280 $node = PMA_NodeFactory
::getInstance(
286 $node = PMA_NodeFactory
::getInstance(
292 $node = PMA_NodeFactory
::getInstance(
298 $node = PMA_NodeFactory
::getInstance(
304 $node = PMA_NodeFactory
::getInstance(
313 if ($type2 == $container->real_name
) {
316 $container->addChild($node);
320 if (count($path) > 1 && $path[0] != 'tables') {
323 array_shift($path); // remove container
324 if (count($path) > 0) {
325 $table = $container->getChild($path[0], true);
326 if ($table === false) {
330 $containers = $this->_addTableContainers(
336 array_shift($path); // remove table
338 && array_key_exists($path[0], $containers)
340 $container = $table->getChild($path[0], true);
341 $retval = $container;
342 $tableData = $table->getData(
343 $container->real_name
,
346 foreach ($tableData as $item) {
347 switch ($container->real_name
) {
349 $node = PMA_NodeFactory
::getInstance(
355 $node = PMA_NodeFactory
::getInstance(
361 $node = PMA_NodeFactory
::getInstance(
370 $node->pos2
= $container->parent
->pos2
;
371 if ($type3 == $container->real_name
) {
374 $container->addChild($node);
386 * Adds containers to a node that is a table
388 * References to existing children are returned
389 * if this function is called twice on the same node
391 * @param Node $table The table node, new containers will be
392 * attached to this node
393 * @param int $pos2 The position for the pagination of
394 * the branch at the second level of the tree
395 * @param string $type3 The type of item being paginated on
396 * the third level of the tree
397 * @param int $pos3 The position for the pagination of
398 * the branch at the third level of the tree
400 * @return array An array of new nodes
402 private function _addTableContainers($table, $pos2, $type3, $pos3)
405 if ($table->hasChildren(true) == 0) {
406 if ($table->getPresence('columns')) {
407 $retval['columns'] = PMA_NodeFactory
::getInstance(
408 'Node_Column_Container'
411 if ($table->getPresence('indexes')) {
412 $retval['indexes'] = PMA_NodeFactory
::getInstance(
413 'Node_Index_Container'
416 if ($table->getPresence('triggers')) {
417 $retval['triggers'] = PMA_NodeFactory
::getInstance(
418 'Node_Trigger_Container'
421 // Add all new Nodes to the tree
422 foreach ($retval as $node) {
424 if ($type3 == $node->real_name
) {
427 $table->addChild($node);
430 foreach ($table->children
as $node) {
431 if ($type3 == $node->real_name
) {
434 $retval[$node->real_name
] = $node;
441 * Adds containers to a node that is a database
443 * References to existing children are returned
444 * if this function is called twice on the same node
446 * @param Node $db The database node, new containers will be
447 * attached to this node
448 * @param string $type The type of item being paginated on
449 * the second level of the tree
450 * @param int $pos2 The position for the pagination of
451 * the branch at the second level of the tree
453 * @return array An array of new nodes
455 private function _addDbContainers($db, $type, $pos2)
458 if ($db->hasChildren(true) == 0) {
459 if ($db->getPresence('tables')) {
460 $retval['tables'] = PMA_NodeFactory
::getInstance(
461 'Node_Table_Container'
464 if ($db->getPresence('views')) {
465 $retval['views'] = PMA_NodeFactory
::getInstance(
466 'Node_View_Container'
469 if ($db->getPresence('functions')) {
470 $retval['functions'] = PMA_NodeFactory
::getInstance(
471 'Node_Function_Container'
474 if ($db->getPresence('procedures')) {
475 $retval['procedures'] = PMA_NodeFactory
::getInstance(
476 'Node_Procedure_Container'
479 if ($db->getPresence('events')) {
480 $retval['events'] = PMA_NodeFactory
::getInstance(
481 'Node_Event_Container'
484 // Add all new Nodes to the tree
485 foreach ($retval as $node) {
486 if ($type == $node->real_name
) {
489 $db->addChild($node);
492 foreach ($db->children
as $node) {
493 if ($type == $node->real_name
) {
496 $retval[$node->real_name
] = $node;
503 * Recursively groups tree nodes given a separator
505 * @param mixed $node The node to group or null
506 * to group the whole tree. If
507 * passed as an argument, $node
508 * must be of type CONTAINER
512 public function groupTree($node = null)
514 if (! isset($node)) {
515 $node = $this->_tree
;
517 $this->groupNode($node);
518 foreach ($node->children
as $child) {
519 $this->groupTree($child);
524 * Recursively groups tree nodes given a sperarator
526 * @param Node $node The node to group
530 public function groupNode($node)
532 if ($node->type
== Node
::CONTAINER
) {
533 $separators = array();
534 if (is_array($node->separator
)) {
535 $separators = $node->separator
;
536 } else if (strlen($node->separator
)) {
537 $separators[] = $node->separator
;
540 if ($node->separator_depth
> 0) {
541 foreach ($node->children
as $child) {
543 foreach ($separators as $separator) {
544 $sep_pos = strpos($child->name
, $separator);
545 if ($sep_pos != false
546 && $sep_pos != strlen($child->name
)
548 && ($prefix_pos == false ||
$sep_pos < $prefix_pos)
550 $prefix_pos = $sep_pos;
553 if ($prefix_pos !== false) {
554 $prefix = substr($child->name
, 0, $prefix_pos);
555 if (! isset($prefixes[$prefix])) {
556 $prefixes[$prefix] = 1;
558 $prefixes[$prefix]++
;
563 foreach ($prefixes as $key => $value) {
565 unset($prefixes[$key]);
568 if (count($prefixes)) {
570 foreach ($prefixes as $key => $value) {
571 $groups[$key] = new Node(
576 $groups[$key]->separator
= $node->separator
;
577 $groups[$key]->separator_depth
= $node->separator_depth
- 1;
578 $groups[$key]->icon
= '';
579 if ($GLOBALS['cfg']['NavigationBarIconic']) {
580 $groups[$key]->icon
= PMA_Util
::getImage(
584 $groups[$key]->pos2
= $node->pos2
;
585 $groups[$key]->pos3
= $node->pos3
;
586 $node->addChild($groups[$key]);
587 foreach ($separators as $separator) {
588 // FIXME: this could be more efficient
589 foreach ($node->children
as $child) {
590 $name_substring = substr(
591 $child->name
, 0, strlen($key) +
strlen($separator)
593 if ($name_substring == $key . $separator
594 && $child->type
== Node
::OBJECT
596 $class = get_class($child);
597 $new_child = PMA_NodeFactory
::getInstance(
601 strlen($key) +
strlen($separator)
604 $new_child->real_name
= $child->real_name
;
605 $new_child->icon
= $child->icon
;
606 $new_child->links
= $child->links
;
607 $new_child->pos2
= $child->pos2
;
608 $new_child->pos3
= $child->pos3
;
609 $groups[$key]->addChild($new_child);
610 foreach ($child->children
as $elm) {
611 $new_child->addChild($elm);
613 $node->removeChild($child->name
);
618 foreach ($prefixes as $key => $value) {
619 $this->groupNode($groups[$key]);
620 $groups[$key]->classes
= "navGroup";
627 * Renders a state of the tree, used in light mode when
628 * either JavaScript and/or Ajax are disabled
630 * @return string HTML code for the navigation tree
632 public function renderState()
635 $retval = $this->_fastFilterHtml($this->_tree
);
636 $retval .= $this->_getPageSelector($this->_tree
);
638 $retval .= "<div><ul>";
639 $children = $this->_tree
->children
;
640 usort($children, array('PMA_NavigationTree', 'sortNode'));
641 $this->_setVisibility();
642 for ($i=0; $i<count($children); $i++
) {
644 $retval .= $this->_renderNode($children[0], true, 'first');
645 } else if ($i +
1 != count($children)) {
646 $retval .= $this->_renderNode($children[$i], true);
648 $retval .= $this->_renderNode($children[$i], true, 'last');
651 $retval .= "</ul></div>";
656 * Renders a part of the tree, used for Ajax
657 * requests in light mode
659 * @return string HTML code for the navigation tree
661 public function renderPath()
663 $node = $this->_buildPath();
664 if ($node === false) {
668 $retval = "<div class='list_container' style='display: none;'>";
670 $retval .= $this->_fastFilterHtml($node);
671 $retval .= $this->_getPageSelector($node);
672 $children = $node->children
;
673 usort($children, array('PMA_NavigationTree', 'sortNode'));
674 for ($i=0; $i<count($children); $i++
) {
675 if ($i +
1 != count($children)) {
676 $retval .= $this->_renderNode($children[$i], true);
678 $retval .= $this->_renderNode($children[$i], true, 'last');
685 if (! empty($this->_searchClause
) ||
! empty($this->_searchClause2
)) {
686 if (! empty($this->_searchClause2
)) {
687 $results = $node->realParent()->getPresence(
689 $this->_searchClause2
692 $results = $this->_tree
->getPresence(
699 if (! empty($_REQUEST['results'])) {
700 $clientResults = (int)$_REQUEST['results'];
702 $otherResults = $results - $clientResults;
703 if ($otherResults < 1) {
706 $otherResults = sprintf(
708 '%s other result found',
709 '%s other results found',
715 PMA_Response
::getInstance()->addJSON(
724 * Renders the parameters that are required on the client
725 * side to know which page(s) we will be requesting data from
727 * @param Node $node The node to create the pagination parameters for
731 private function _getPaginationParamsHtml($node)
734 $paths = $node->getPaths();
735 if (isset($paths['aPath_clean'][2])) {
736 $retval .= "<span class='hide pos2_name'>";
737 $retval .= $paths['aPath_clean'][2];
738 $retval .= "</span>";
739 $retval .= "<span class='hide pos2_value'>";
740 $retval .= $node->pos2
;
741 $retval .= "</span>";
743 if (isset($paths['aPath_clean'][4])) {
744 $retval .= "<span class='hide pos3_name'>";
745 $retval .= $paths['aPath_clean'][4];
746 $retval .= "</span>";
747 $retval .= "<span class='hide pos3_value'>";
748 $retval .= $node->pos3
;
749 $retval .= "</span>";
755 * Renders a single node or a branch of the tree
757 * @param Node $node The node to render
758 * @param int|bool $recursive Bool: Whether to render a single node or a branch
759 * Int: How many levels deep to render
760 * @param string $class An additional class for the list item
762 * @return string HTML code for the tree node or branch
764 private function _renderNode($node, $recursive = -1, $class = '')
767 $paths = $node->getPaths();
768 if ($node->hasSiblings()
769 ||
isset($_REQUEST['results'])
770 ||
$node->realParent() === false
772 if ( $node->type
== Node
::CONTAINER
773 && count($node->children
) == 0
774 && $GLOBALS['is_ajax_request'] != true
779 if ($class ||
$node->classes
) {
780 $liClass = " class='" . trim($class . ' ' . $node->classes
) . "'";
782 $retval .= "<li$liClass>";
793 $parents = $node->parents(false, true);
794 if (count($parents)) {
795 $parentName = $parents[0]->real_name
;
798 ||
(! in_array($parentName, $sterile) && ! $node->isNew
)
801 if ($node->is_group
) {
805 if ($node->type
== Node
::CONTAINER
) {
806 $container = ' container';
808 $retval .= "<div class='block'>";
810 if ($class == 'first') {
811 $iClass = " class='first'";
813 $retval .= "<i$iClass></i>";
814 if (strpos($class, 'last') === false) {
815 $retval .= "<b></b>";
817 $icon = PMA_Util
::getImage('b_plus.png');
819 foreach ($this->_aPath
as $path) {
821 foreach ($paths['aPath_clean'] as $key => $part) {
822 if (! isset($path[$key]) ||
$part != $path[$key]) {
829 if (! $node->is_group
) {
830 $icon = PMA_Util
::getImage(
838 foreach ($this->_vPath
as $path) {
840 foreach ($paths['vPath_clean'] as $key => $part) {
841 if ((! isset($path[$key]) ||
$part != $path[$key])) {
848 $icon = PMA_Util
::getImage('b_minus.png');
853 $retval .= "<a class='expander$loaded$container'";
854 $retval .= " href='#'>";
855 $retval .= "<span class='hide aPath'>";
856 $retval .= $paths['aPath'];
857 $retval .= "</span>";
858 $retval .= "<span class='hide vPath'>";
859 $retval .= $paths['vPath'];
860 $retval .= "</span>";
861 $retval .= "<span class='hide pos'>";
862 $retval .= $this->_pos
;
863 $retval .= "</span>";
864 $retval .= $this->_getPaginationParamsHtml($node);
870 $retval .= "<div class='block'>";
872 if ($class == 'first') {
873 $iClass = " class='first'";
875 $retval .= "<i$iClass></i>";
876 $retval .= $this->_getPaginationParamsHtml($node);
888 $parent = $node->parents(false, true);
889 if ($parent[0]->type
== Node
::CONTAINER
890 && (in_array($parent[0]->real_name
, $haveAjax)
891 ||
($parent[0]->real_name
== 'views'
892 && $node->isNew
== true
896 $linkClass = ' class="ajax"';
899 if ($node->type
== Node
::CONTAINER
) {
902 if ($GLOBALS['cfg']['NavigationBarIconic']) {
903 $retval .= "<div class='block'>";
904 if (isset($node->links
['icon'])) {
906 foreach ($node->parents(true) as $parent) {
907 $args[] = urlencode($parent->real_name
);
909 $link = vsprintf($node->links
['icon'], $args);
910 $retval .= "<a$linkClass href='$link'>{$node->icon}</a>";
912 $retval .= "<u>{$node->icon}</u>";
916 if (isset($node->links
['text'])) {
918 foreach ($node->parents(true) as $parent) {
919 $args[] = urlencode($parent->real_name
);
921 $link = vsprintf($node->links
['text'], $args);
922 if ($node->type
== Node
::CONTAINER
) {
923 $retval .= "<a href='$link'>";
924 $retval .= htmlspecialchars($node->name
);
927 if ($GLOBALS['cfg']['ShowTooltip']) {
928 $title = $node->getComment();
931 . htmlentities($title, ENT_QUOTES
, 'UTF-8')
937 $retval .= "<a$linkClass$title href='$link'>";
938 $retval .= htmlspecialchars($node->real_name
);
942 $retval .= "{$node->name}";
944 if ($node->type
== Node
::CONTAINER
) {
949 $node->visible
= true;
951 $retval .= $this->_getPaginationParamsHtml($node);
956 if ($node->visible
== false) {
957 $hide = " style='display: none;'";
959 $children = $node->children
;
960 usort($children, array('PMA_NavigationTree', 'sortNode'));
962 for ($i=0; $i<count($children); $i++
) {
963 if ($i +
1 != count($children)) {
964 $buffer .= $this->_renderNode(
967 $children[$i]->classes
970 $buffer .= $this->_renderNode(
973 $children[$i]->classes
. ' last'
977 if (! empty($buffer)) {
979 $retval .= "<div$hide class='list_container'><ul>";
981 $retval .= $this->_fastFilterHtml($node);
982 $retval .= $this->_getPageSelector($node);
985 $retval .= "</ul></div>";
989 if ($node->hasSiblings() ||
isset($_REQUEST['results'])) {
996 * Makes some nodes visible based on the which node is active
1000 private function _setVisibility()
1002 foreach ($this->_vPath
as $path) {
1003 $node = $this->_tree
;
1004 foreach ($path as $value) {
1005 $child = $node->getChild($value);
1006 if ($child !== false) {
1007 $child->visible
= true;
1015 * Generates the HTML code for displaying the fast filter for tables
1017 * @param Node $node The node for which to generate the fast filter html
1019 * @return string LI element used for the fast filter
1021 private function _fastFilterHtml($node)
1024 if ($node === $this->_tree
1025 && $this->_tree
->getPresence() >= (int)$GLOBALS['cfg']['NavigationTreeDisplayDbFilterMinimum']
1027 $url_params = array(
1031 $retval .= "<li class='fast_filter db_fast_filter'>";
1032 $retval .= "<form class='ajax fast_filter'>";
1033 $retval .= PMA_getHiddenFields($url_params);
1034 $retval .= "<input class='searchClause' name='searchClause'";
1035 $retval .= " value='" . __('filter databases by name') . "' />";
1036 $retval .= "<span title='" . __('Clear Fast Filter') . "'>X</span>";
1037 $retval .= "</form>";
1040 } else if (($node->type
== Node
::CONTAINER
1041 && ( $node->real_name
== 'tables'
1042 ||
$node->real_name
== 'views'
1043 ||
$node->real_name
== 'functions'
1044 ||
$node->real_name
== 'procedures'
1045 ||
$node->real_name
== 'events')
1047 && $node->realParent()->getPresence($node->real_name
) >= (int)$GLOBALS['cfg']['NavigationTreeDisplayItemFilterMinimum']
1049 $paths = $node->getPaths();
1050 $url_params = array(
1051 'pos' => $this->_pos
,
1052 'aPath' => $paths['aPath'],
1053 'vPath' => $paths['vPath'],
1054 'pos2_name' => $node->real_name
,
1057 $retval .= "<li class='fast_filter'>";
1058 $retval .= "<form class='ajax fast_filter'>";
1059 $retval .= PMA_getHiddenFields($url_params);
1060 $retval .= "<input class='searchClause' name='searchClause2'";
1061 $retval .= " value='" . __('filter items by name') . "' />";
1062 $retval .= "<span title='" . __('Clear Fast Filter') . "'>X</span>";
1063 $retval .= "</form>";
1070 * Generates the HTML code for displaying the list pagination
1072 * @param Node $node The node for whose children the page
1073 * selector will be created
1077 private function _getPageSelector($node)
1080 if ($node === $this->_tree
) {
1081 $retval .= PMA_Util
::getListNavigator(
1082 $this->_tree
->getPresence('databases', $this->_searchClause
),
1084 array('server' => $GLOBALS['server']),
1087 $GLOBALS['cfg']['MaxNavigationItems'],
1091 } else if ($node->type
== Node
::CONTAINER
&& ! $node->is_group
) {
1092 $paths = $node->getPaths();
1094 $level = isset($paths['aPath_clean'][4]) ?
3 : 2;
1095 $_url_params = array(
1096 'aPath' => $paths['aPath'],
1097 'vPath' => $paths['vPath'],
1098 'pos' => $this->_pos
,
1099 'server' => $GLOBALS['server'],
1100 'pos2_name' => $paths['aPath_clean'][2]
1104 $_url_params['pos2_value'] = $node->pos2
;
1105 $_url_params['pos3_name'] = $paths['aPath_clean'][4];
1109 $num = $node->realParent()->getPresence(
1111 $this->_searchClause2
1113 $retval .= PMA_Util
::getListNavigator(
1119 $GLOBALS['cfg']['MaxNavigationItems'],
1120 'pos' . $level . '_value'
1127 * Called by usort() for sorting the nodes in a container
1129 * @param Node $a The first element used in the comparison
1130 * @param Node $b The second element used in the comparison
1132 * @return int See strnatcmp() and strcmp()
1134 static public function sortNode($a, $b)
1138 } else if ($b->isNew
) {
1141 if ($GLOBALS['cfg']['NaturalOrder']) {
1142 return strnatcasecmp($a->name
, $b->name
);
1144 return strcasecmp($a->name
, $b->name
);