summaryrefslogtreecommitdiff
path: root/app/Helper
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-12-24 15:34:50 +0100
committerFrederic Guillot <fred@kanboard.net>2015-12-24 15:34:50 +0100
commit9ff0abd8d683ab5a285fcf70e27d1bcd1cbc47df (patch)
treed8680640f331ea8dec2fe3f6be55a66f3f986b84 /app/Helper
parent4003b122d085b58ad7acb31bafa44121ed94c37f (diff)
Update active menu in sidebars
Diffstat (limited to 'app/Helper')
-rw-r--r--app/Helper/App.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/app/Helper/App.php b/app/Helper/App.php
index 6e6028fc..2015d896 100644
--- a/app/Helper/App.php
+++ b/app/Helper/App.php
@@ -13,6 +13,30 @@ use Kanboard\Core\Base;
class App extends Base
{
/**
+ * Make sidebar menu active
+ *
+ * @access public
+ * @param string $controller
+ * @param string $action
+ * @param string $plugin
+ * @return string
+ */
+ public function checkMenuSelection($controller, $action = '', $plugin = '')
+ {
+ $result = strtolower($this->getRouterController()) === strtolower($controller);
+
+ if ($result && $action !== '') {
+ $result = strtolower($this->getRouterAction()) === strtolower($action);
+ }
+
+ if ($result && $plugin !== '') {
+ $result = strtolower($this->getPluginName()) === strtolower($plugin);
+ }
+
+ return $result ? 'class="active"' : '';
+ }
+
+ /**
* Get plugin name from route
*
* @access public