diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-03-04 20:10:34 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-03-04 20:10:34 -0500 |
commit | 8f3e2b2e5c62a6130f6c8867ab335fb4c1a32c5c (patch) | |
tree | ce28cdc2dba9c31560ef753ac1b4dc39d567b7a6 /app/Helper/App.php | |
parent | f32507d423c46e8e9612b5239728e6c617e4cbcb (diff) |
Helper refactoring
Diffstat (limited to 'app/Helper/App.php')
-rw-r--r-- | app/Helper/App.php | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/app/Helper/App.php b/app/Helper/App.php deleted file mode 100644 index 79afa5b9..00000000 --- a/app/Helper/App.php +++ /dev/null @@ -1,128 +0,0 @@ -<?php - -namespace Kanboard\Helper; - -use Kanboard\Core\Base; - -/** - * Application helpers - * - * @package helper - * @author Frederic Guillot - */ -class App extends Base -{ - /** - * Get config variable - * - * @access public - * @param string $param - * @param mixed $default_value - * @return mixed - */ - public function config($param, $default_value = '') - { - return $this->config->get($param, $default_value); - } - - /** - * 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 - * @return string - */ - public function getPluginName() - { - return $this->router->getPlugin(); - } - - /** - * Get router controller - * - * @access public - * @return string - */ - public function getRouterController() - { - return $this->router->getController(); - } - - /** - * Get router action - * - * @access public - * @return string - */ - public function getRouterAction() - { - return $this->router->getAction(); - } - - /** - * Get javascript language code - * - * @access public - * @return string - */ - public function jsLang() - { - return $this->config->getJsLanguageCode(); - } - - /** - * Get current timezone - * - * @access public - * @return string - */ - public function getTimezone() - { - return $this->config->getCurrentTimezone(); - } - - /** - * Get session flash message - * - * @access public - * @return string - */ - public function flashMessage() - { - $success_message = $this->flash->getMessage('success'); - $failure_message = $this->flash->getMessage('failure'); - - if (! empty($success_message)) { - return '<div class="alert alert-success alert-fade-out">'.$this->helper->e($success_message).'</div>'; - } - - if (! empty($failure_message)) { - return '<div class="alert alert-error">'.$this->helper->e($failure_message).'</div>'; - } - - return ''; - } -} |