summaryrefslogtreecommitdiff
path: root/app
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
parent4003b122d085b58ad7acb31bafa44121ed94c37f (diff)
Update active menu in sidebars
Diffstat (limited to 'app')
-rw-r--r--app/Helper/App.php24
-rw-r--r--app/Template/analytic/sidebar.php14
-rw-r--r--app/Template/app/sidebar.php14
-rw-r--r--app/Template/config/sidebar.php22
-rw-r--r--app/Template/project/sidebar.php31
-rw-r--r--app/Template/project_user/sidebar.php8
-rw-r--r--app/Template/task/sidebar.php36
-rw-r--r--app/Template/user/sidebar.php28
8 files changed, 101 insertions, 76 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
diff --git a/app/Template/analytic/sidebar.php b/app/Template/analytic/sidebar.php
index 746fcebb..8d4f7023 100644
--- a/app/Template/analytic/sidebar.php
+++ b/app/Template/analytic/sidebar.php
@@ -1,25 +1,25 @@
<div class="sidebar">
<h2><?= t('Reportings') ?></h2>
<ul>
- <li <?= $this->app->getRouterAction() === 'tasks' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('analytic', 'tasks') ?>>
<?= $this->url->link(t('Task distribution'), 'analytic', 'tasks', array('project_id' => $project['id'])) ?>
</li>
- <li <?= $this->app->getRouterAction() === 'users' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('analytic', 'users') ?>>
<?= $this->url->link(t('User repartition'), 'analytic', 'users', array('project_id' => $project['id'])) ?>
</li>
- <li <?= $this->app->getRouterAction() === 'cfd' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('analytic', 'cfd') ?>>
<?= $this->url->link(t('Cumulative flow diagram'), 'analytic', 'cfd', array('project_id' => $project['id'])) ?>
</li>
- <li <?= $this->app->getRouterAction() === 'burndown' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('analytic', 'burndown') ?>>
<?= $this->url->link(t('Burndown chart'), 'analytic', 'burndown', array('project_id' => $project['id'])) ?>
</li>
- <li <?= $this->app->getRouterAction() === 'averagetimebycolumn' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('analytic', 'averageTimeByColumn') ?>>
<?= $this->url->link(t('Average time into each column'), 'analytic', 'averageTimeByColumn', array('project_id' => $project['id'])) ?>
</li>
- <li <?= $this->app->getRouterAction() === 'leadandcycletime' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('analytic', 'leadAndCycleTime') ?>>
<?= $this->url->link(t('Lead and cycle time'), 'analytic', 'leadAndCycleTime', array('project_id' => $project['id'])) ?>
</li>
- <li <?= $this->app->getRouterAction() === 'comparehours' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('analytic', 'compareHours') ?>>
<?= $this->url->link(t('Compare hours'), 'analytic', 'compareHours', array('project_id' => $project['id'])) ?>
</li>
</ul>
diff --git a/app/Template/app/sidebar.php b/app/Template/app/sidebar.php
index 552a9c27..b5e14aaf 100644
--- a/app/Template/app/sidebar.php
+++ b/app/Template/app/sidebar.php
@@ -1,25 +1,25 @@
<div class="sidebar">
<h2><?= $this->e($user['name'] ?: $user['username']) ?></h2>
<ul>
- <li <?= $this->app->getRouterAction() === 'index' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('app', 'index') ?>>
<?= $this->url->link(t('Overview'), 'app', 'index', array('user_id' => $user['id'])) ?>
</li>
- <li <?= $this->app->getRouterAction() === 'projects' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('app', 'projects') ?>>
<?= $this->url->link(t('My projects'), 'app', 'projects', array('user_id' => $user['id'])) ?>
</li>
- <li <?= $this->app->getRouterAction() === 'tasks' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('app', 'tasks') ?>>
<?= $this->url->link(t('My tasks'), 'app', 'tasks', array('user_id' => $user['id'])) ?>
</li>
- <li <?= $this->app->getRouterAction() === 'subtasks' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('app', 'subtasks') ?>>
<?= $this->url->link(t('My subtasks'), 'app', 'subtasks', array('user_id' => $user['id'])) ?>
</li>
- <li <?= $this->app->getRouterAction() === 'calendar' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('app', 'calendar') ?>>
<?= $this->url->link(t('My calendar'), 'app', 'calendar', array('user_id' => $user['id'])) ?>
</li>
- <li <?= $this->app->getRouterAction() === 'activity' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('app', 'activity') ?>>
<?= $this->url->link(t('My activity stream'), 'app', 'activity', array('user_id' => $user['id'])) ?>
</li>
- <li <?= $this->app->getRouterAction() === 'notifications' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('app', 'notifications') ?>>
<?= $this->url->link(t('My notifications'), 'app', 'notifications', array('user_id' => $user['id'])) ?>
</li>
<?= $this->hook->render('template:dashboard:sidebar') ?>
diff --git a/app/Template/config/sidebar.php b/app/Template/config/sidebar.php
index 4195cde1..a8174505 100644
--- a/app/Template/config/sidebar.php
+++ b/app/Template/config/sidebar.php
@@ -1,37 +1,37 @@
<div class="sidebar">
<h2><?= t('Actions') ?></h2>
<ul>
- <li <?= $this->app->getRouterAction() === 'index' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('config', 'index') ?>>
<?= $this->url->link(t('About'), 'config', 'index') ?>
</li>
- <li <?= $this->app->getRouterAction() === 'plugins' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('config', 'plugins') ?>>
<?= $this->url->link(t('Plugins'), 'config', 'plugins') ?>
</li>
- <li <?= $this->app->getRouterAction() === 'application' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('config', 'application') ?>>
<?= $this->url->link(t('Application settings'), 'config', 'application') ?>
</li>
- <li <?= $this->app->getRouterAction() === 'project' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('config', 'project') ?>>
<?= $this->url->link(t('Project settings'), 'config', 'project') ?>
</li>
- <li <?= $this->app->getRouterAction() === 'board' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('config', 'board') ?>>
<?= $this->url->link(t('Board settings'), 'config', 'board') ?>
</li>
- <li <?= $this->app->getRouterAction() === 'calendar' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('config', 'calendar') ?>>
<?= $this->url->link(t('Calendar settings'), 'config', 'calendar') ?>
</li>
- <li <?= $this->app->getRouterController() === 'link' && $this->app->getRouterAction() === 'index' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('link') ?>>
<?= $this->url->link(t('Link settings'), 'link', 'index') ?>
</li>
- <li <?= $this->app->getRouterController() === 'currency' && $this->app->getRouterAction() === 'index' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('currency', 'index') ?>>
<?= $this->url->link(t('Currency rates'), 'currency', 'index') ?>
</li>
- <li <?= $this->app->getRouterAction() === 'integrations' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('config', 'integrations') ?>>
<?= $this->url->link(t('Integrations'), 'config', 'integrations') ?>
</li>
- <li <?= $this->app->getRouterAction() === 'webhook' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('config', 'webhook') ?>>
<?= $this->url->link(t('Webhooks'), 'config', 'webhook') ?>
</li>
- <li <?= $this->app->getRouterAction() === 'api' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('config', 'api') ?>>
<?= $this->url->link(t('API'), 'config', 'api') ?>
</li>
<li>
diff --git a/app/Template/project/sidebar.php b/app/Template/project/sidebar.php
index 92794038..025c410d 100644
--- a/app/Template/project/sidebar.php
+++ b/app/Template/project/sidebar.php
@@ -1,60 +1,61 @@
<div class="sidebar">
<h2><?= t('Actions') ?></h2>
<ul>
- <li <?= $this->app->getRouterAction() === 'show' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('project', 'show') ?>>
<?= $this->url->link(t('Summary'), 'project', 'show', array('project_id' => $project['id'])) ?>
</li>
<?php if ($this->user->hasProjectAccess('customfilter', 'index', $project['id'])): ?>
- <li <?= $this->app->getRouterController() === 'customfilter' && $this->app->getRouterAction() === 'index' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('customfilter') ?>>
<?= $this->url->link(t('Custom filters'), 'customfilter', 'index', array('project_id' => $project['id'])) ?>
</li>
<?php endif ?>
<?php if ($this->user->hasProjectAccess('project', 'edit', $project['id'])): ?>
- <li <?= $this->app->getRouterController() === 'project' && $this->app->getRouterAction() === 'share' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('project', 'share') ?>>
<?= $this->url->link(t('Public access'), 'project', 'share', array('project_id' => $project['id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'project' && $this->app->getRouterAction() === 'notifications' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('project', 'notifications') ?>>
<?= $this->url->link(t('Notifications'), 'project', 'notifications', array('project_id' => $project['id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'project' && $this->app->getRouterAction() === 'integrations' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('project', 'integrations') ?>>
<?= $this->url->link(t('Integrations'), 'project', 'integrations', array('project_id' => $project['id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'project' && $this->app->getRouterAction() === 'edit' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('project', 'edit') ?>>
<?= $this->url->link(t('Edit project'), 'project', 'edit', array('project_id' => $project['id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'column' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('column') ?>>
<?= $this->url->link(t('Columns'), 'column', 'index', array('project_id' => $project['id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'swimlane' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('swimlane') ?>>
<?= $this->url->link(t('Swimlanes'), 'swimlane', 'index', array('project_id' => $project['id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'category' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('category') ?>>
<?= $this->url->link(t('Categories'), 'category', 'index', array('project_id' => $project['id'])) ?>
</li>
<?php if ($project['is_private'] == 0): ?>
- <li <?= $this->app->getRouterController() === 'ProjectPermission' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('ProjectPermission') ?>>
<?= $this->url->link(t('Permissions'), 'ProjectPermission', 'index', array('project_id' => $project['id'])) ?>
</li>
<?php endif ?>
- <li <?= $this->app->getRouterController() === 'action' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('action') ?>>
<?= $this->url->link(t('Automatic actions'), 'action', 'index', array('project_id' => $project['id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'project' && $this->app->getRouterAction() === 'duplicate' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('project', 'duplicate') ?>>
<?= $this->url->link(t('Duplicate'), 'project', 'duplicate', array('project_id' => $project['id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'project' && ($this->app->getRouterAction() === 'disable' || $this->app->getRouterAction() === 'enable') ? 'class="active"' : '' ?>>
<?php if ($project['is_active']): ?>
+ <li <?= $this->app->checkMenuSelection('project', 'disable') ?>>
<?= $this->url->link(t('Disable'), 'project', 'disable', array('project_id' => $project['id']), true) ?>
<?php else: ?>
+ <li <?= $this->app->checkMenuSelection('project', 'enable') ?>>
<?= $this->url->link(t('Enable'), 'project', 'enable', array('project_id' => $project['id']), true) ?>
<?php endif ?>
</li>
- <li <?= $this->app->getRouterController() === 'taskImport' && $this->app->getRouterAction() === 'step1' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('taskImport') ?>>
<?= $this->url->link(t('Import'), 'taskImport', 'step1', array('project_id' => $project['id'])) ?>
</li>
<?php if ($this->user->hasProjectAccess('project', 'remove', $project['id'])): ?>
- <li <?= $this->app->getRouterController() === 'project' && $this->app->getRouterAction() === 'remove' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('project', 'remove') ?>>
<?= $this->url->link(t('Remove'), 'project', 'remove', array('project_id' => $project['id'])) ?>
</li>
<?php endif ?>
diff --git a/app/Template/project_user/sidebar.php b/app/Template/project_user/sidebar.php
index b81ba14a..27f1094c 100644
--- a/app/Template/project_user/sidebar.php
+++ b/app/Template/project_user/sidebar.php
@@ -12,16 +12,16 @@
<br/><br/>
<ul>
- <li <?= $this->app->getRouterAction() === 'managers' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('projectuser', 'managers') ?>>
<?= $this->url->link(t('Project managers'), 'projectuser', 'managers', $filter) ?>
</li>
- <li <?= $this->app->getRouterAction() === 'members' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('projectuser', 'members') ?>>
<?= $this->url->link(t('Project members'), 'projectuser', 'members', $filter) ?>
</li>
- <li <?= $this->app->getRouterAction() === 'opens' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('projectuser', 'opens') ?>>
<?= $this->url->link(t('Open tasks'), 'projectuser', 'opens', $filter) ?>
</li>
- <li <?= $this->app->getRouterAction() === 'closed' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('projectuser', 'closed') ?>>
<?= $this->url->link(t('Closed tasks'), 'projectuser', 'closed', $filter) ?>
</li>
diff --git a/app/Template/task/sidebar.php b/app/Template/task/sidebar.php
index d994aad3..f522c1c4 100644
--- a/app/Template/task/sidebar.php
+++ b/app/Template/task/sidebar.php
@@ -1,20 +1,20 @@
<div class="sidebar">
<h2><?= t('Information') ?></h2>
<ul>
- <li <?= $this->app->getRouterController() === 'task' && $this->app->getRouterAction() === 'show' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('task', 'show') ?>>
<?= $this->url->link(t('Summary'), 'task', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'activity' && $this->app->getRouterAction() === 'task' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('activity', 'task') ?>>
<?= $this->url->link(t('Activity stream'), 'activity', 'task', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'task' && $this->app->getRouterAction() === 'transitions' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('task', 'transitions') ?>>
<?= $this->url->link(t('Transitions'), 'task', 'transitions', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'task' && $this->app->getRouterAction() === 'analytics' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('task', 'analytics') ?>>
<?= $this->url->link(t('Analytics'), 'task', 'analytics', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
<?php if ($task['time_estimated'] > 0 || $task['time_spent'] > 0): ?>
- <li <?= $this->app->getRouterController() === 'task' && $this->app->getRouterAction() === 'timetracking' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('task', 'timetracking') ?>>
<?= $this->url->link(t('Time tracking'), 'task', 'timetracking', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
<?php endif ?>
@@ -24,40 +24,40 @@
<?php if ($this->user->hasProjectAccess('taskmodification', 'edit', $task['project_id'])): ?>
<h2><?= t('Actions') ?></h2>
<ul>
- <li <?= $this->app->getRouterController() === 'taskmodification' && $this->app->getRouterAction() === 'edit' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('taskmodification', 'edit') ?>>
<?= $this->url->link(t('Edit the task'), 'taskmodification', 'edit', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'taskmodification' && $this->app->getRouterAction() === 'description' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('taskmodification', 'description') ?>>
<?= $this->url->link(t('Edit the description'), 'taskmodification', 'description', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'taskmodification' && $this->app->getRouterAction() === 'recurrence' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('taskmodification', 'recurrence') ?>>
<?= $this->url->link(t('Edit recurrence'), 'taskmodification', 'recurrence', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'subtask' && $this->app->getRouterAction() === 'create' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('subtask', 'create') ?>>
<?= $this->url->link(t('Add a sub-task'), 'subtask', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'tasklink' && $this->app->getRouterAction() === 'create' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('tasklink', 'create') ?>>
<?= $this->url->link(t('Add a link'), 'tasklink', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'comment' && $this->app->getRouterAction() === 'create' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('comment', 'create') ?>>
<?= $this->url->link(t('Add a comment'), 'comment', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'file' && $this->app->getRouterAction() === 'create' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('file', 'create') ?>>
<?= $this->url->link(t('Attach a document'), 'file', 'create', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'file' && $this->app->getRouterAction() === 'screenshot' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('file', 'screenshot') ?>>
<?= $this->url->link(t('Add a screenshot'), 'file', 'screenshot', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'taskduplication' && $this->app->getRouterAction() === 'duplicate' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('taskduplication', 'duplicate') ?>>
<?= $this->url->link(t('Duplicate'), 'taskduplication', 'duplicate', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'taskduplication' && $this->app->getRouterAction() === 'copy' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('taskduplication', 'copy') ?>>
<?= $this->url->link(t('Duplicate to another project'), 'taskduplication', 'copy', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'taskduplication' && $this->app->getRouterAction() === 'move' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('taskduplication', 'move') ?>>
<?= $this->url->link(t('Move to another project'), 'taskduplication', 'move', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'taskstatus' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('taskstatus') ?>>
<?php if ($task['is_active'] == 1): ?>
<?= $this->url->link(t('Close this task'), 'taskstatus', 'close', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
<?php else: ?>
@@ -65,7 +65,7 @@
<?php endif ?>
</li>
<?php if ($this->task->canRemove($task)): ?>
- <li <?= $this->app->getRouterController() === 'task' && $this->app->getRouterAction() === 'remove' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('task', 'remove') ?>>
<?= $this->url->link(t('Remove'), 'task', 'remove', array('task_id' => $task['id'], 'project_id' => $task['project_id'])) ?>
</li>
<?php endif ?>
diff --git a/app/Template/user/sidebar.php b/app/Template/user/sidebar.php
index 011994b9..7756126e 100644
--- a/app/Template/user/sidebar.php
+++ b/app/Template/user/sidebar.php
@@ -1,7 +1,7 @@
<div class="sidebar">
<h2><?= t('Information') ?></h2>
<ul>
- <li <?= $this->app->getRouterController() === 'user' && $this->app->getRouterAction() === 'show' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('user', 'show') ?>>
<?= $this->url->link(t('Summary'), 'user', 'show', array('user_id' => $user['id'])) ?>
</li>
<?php if ($this->user->isAdmin()): ?>
@@ -10,13 +10,13 @@
</li>
<?php endif ?>
<?php if ($this->user->isAdmin() || $this->user->isCurrentUser($user['id'])): ?>
- <li <?= $this->app->getRouterController() === 'user' && $this->app->getRouterAction() === 'timesheet' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('user', 'timesheet') ?>>
<?= $this->url->link(t('Time tracking'), 'user', 'timesheet', array('user_id' => $user['id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'user' && $this->app->getRouterAction() === 'last' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('user', 'last') ?>>
<?= $this->url->link(t('Last logins'), 'user', 'last', array('user_id' => $user['id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'user' && $this->app->getRouterAction() === 'sessions' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('user', 'sessions') ?>>
<?= $this->url->link(t('Persistent connections'), 'user', 'sessions', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
@@ -27,42 +27,42 @@
<h2><?= t('Actions') ?></h2>
<ul>
<?php if ($this->user->isAdmin() || $this->user->isCurrentUser($user['id'])): ?>
- <li <?= $this->app->getRouterController() === 'user' && $this->app->getRouterAction() === 'edit' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('user', 'edit') ?>>
<?= $this->url->link(t('Edit profile'), 'user', 'edit', array('user_id' => $user['id'])) ?>
</li>
<?php if ($user['is_ldap_user'] == 0): ?>
- <li <?= $this->app->getRouterController() === 'user' && $this->app->getRouterAction() === 'password' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('user', 'password') ?>>
<?= $this->url->link(t('Change password'), 'user', 'password', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?php if ($this->user->isCurrentUser($user['id'])): ?>
- <li <?= $this->app->getRouterController() === 'twofactor' && $this->app->getRouterAction() === 'index' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('twofactor', 'index') ?>>
<?= $this->url->link(t('Two factor authentication'), 'twofactor', 'index', array('user_id' => $user['id'])) ?>
</li>
<?php elseif ($this->user->hasAccess('twofactor', 'disable') && $user['twofactor_activated'] == 1): ?>
- <li <?= $this->app->getRouterController() === 'twofactor' && $this->app->getRouterAction() === 'disable' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('twofactor', 'disable') ?>>
<?= $this->url->link(t('Two factor authentication'), 'twofactor', 'disable', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
- <li <?= $this->app->getRouterController() === 'user' && $this->app->getRouterAction() === 'share' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('user', 'share') ?>>
<?= $this->url->link(t('Public access'), 'user', 'share', array('user_id' => $user['id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'user' && $this->app->getRouterAction() === 'notifications' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('user', 'notifications') ?>>
<?= $this->url->link(t('Notifications'), 'user', 'notifications', array('user_id' => $user['id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'user' && $this->app->getRouterAction() === 'external' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('user', 'external') ?>>
<?= $this->url->link(t('External accounts'), 'user', 'external', array('user_id' => $user['id'])) ?>
</li>
- <li <?= $this->app->getRouterController() === 'user' && $this->app->getRouterAction() === 'integrations' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('user', 'integrations') ?>>
<?= $this->url->link(t('Integrations'), 'user', 'integrations', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
<?php if ($this->user->hasAccess('user', 'authentication')): ?>
- <li <?= $this->app->getRouterController() === 'user' && $this->app->getRouterAction() === 'authentication' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('user', 'authentication') ?>>
<?= $this->url->link(t('Edit Authentication'), 'user', 'authentication', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>
@@ -70,7 +70,7 @@
<?= $this->hook->render('template:user:sidebar:actions', array('user' => $user)) ?>
<?php if ($this->user->hasAccess('user', 'remove') && ! $this->user->isCurrentUser($user['id'])): ?>
- <li <?= $this->app->getRouterController() === 'user' && $this->app->getRouterAction() === 'remove' ? 'class="active"' : '' ?>>
+ <li <?= $this->app->checkMenuSelection('user', 'remove') ?>>
<?= $this->url->link(t('Remove'), 'user', 'remove', array('user_id' => $user['id'])) ?>
</li>
<?php endif ?>