From a56ec50fb2cb7c3bb9d86fff8823794d9825a51b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Sat, 10 May 2014 09:42:53 +0200 Subject: [PATCH] Move code for geting navigation node icon into Node class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- libraries/navigation/NavigationTree.class.php | 12 +----------- libraries/navigation/Nodes/Node.class.php | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/libraries/navigation/NavigationTree.class.php b/libraries/navigation/NavigationTree.class.php index ce03f58e95..80ce657a45 100644 --- a/libraries/navigation/NavigationTree.class.php +++ b/libraries/navigation/NavigationTree.class.php @@ -873,21 +873,11 @@ class PMA_NavigationTree if (strpos($class, 'last') === false) { $retval .= ""; } - $icon = PMA_Util::getImage('b_plus.png', __('Expand/Collapse')); $match = $this->_findTreeMatch($this->_aPath, 'aPath_clean'); $match |= $this->_findTreeMatch($this->_vPath, 'vPath_clean'); - if ($match && ! $node->is_group) { - $icon = PMA_Util::getImage( - 'b_minus.png' - ); - } $retval .= '_pos; $retval .= ""; $retval .= $this->_getPaginationParamsHtml($node); - $retval .= $icon; + $retval .= $node->getIcon($match); $retval .= ""; $retval .= ""; diff --git a/libraries/navigation/Nodes/Node.class.php b/libraries/navigation/Nodes/Node.class.php index c310008c27..655f61aa82 100644 --- a/libraries/navigation/Nodes/Node.class.php +++ b/libraries/navigation/Nodes/Node.class.php @@ -482,5 +482,23 @@ class Node return implode(' ', $result); } + + /** + * Returns icon for the node + * + * @param boolean $match Whether the node matched loaded tree + * + * @return String with image name + */ + public function getIcon($match) + { + if ($GLOBALS['cfg']['NavigationTreeDisableDatabaseExpansion']) { + return ''; + } elseif ($match && ! $node->is_group) { + return PMA_Util::getImage('b_minus.png'); + } else { + return PMA_Util::getImage('b_plus.png', __('Expand/Collapse')); + } + } } ?>