From 035970e91c0a4c132874656b8f13a88c46684717 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sat, 1 Dec 2018 16:25:54 +0000 Subject: [PATCH] Optimized a bit more for uncompleted indicators option. --- WEB-INF/lib/ttGroup.class.php | 2 -- WEB-INF/lib/ttUser.class.php | 2 -- WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/mobile/users.tpl | 2 +- WEB-INF/templates/users.tpl | 2 +- mobile/users.php | 6 ++++-- users.php | 5 +++-- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/WEB-INF/lib/ttGroup.class.php b/WEB-INF/lib/ttGroup.class.php index 44e225b2..b7e78f95 100644 --- a/WEB-INF/lib/ttGroup.class.php +++ b/WEB-INF/lib/ttGroup.class.php @@ -49,7 +49,6 @@ class ttGroup { var $punch_mode = 0; // Whether punch mode is enabled for user. var $allow_overlap = 0; // Whether to allow overlapping time entries. var $future_entries = 0; // Whether to allow creating future entries. - var $uncompleted_indicators = 0; // Uncompleted time entry indicators (show nowhere or on users page). var $bcc_email = null; // Bcc email. var $allow_ip = null; // Specification from where user is allowed access. var $password_complexity = null; // Password complexity example. @@ -110,7 +109,6 @@ class ttGroup { $this->punch_mode = $config->getDefinedValue('punch_mode'); $this->allow_overlap = $config->getDefinedValue('allow_overlap'); $this->future_entries = $config->getDefinedValue('future_entries'); - $this->uncompleted_indicators = $config->getDefinedValue('uncompleted_indicators'); /* if ($this->isPluginEnabled('wu')) { $minutes_in_unit = $config->getIntValue('minutes_in_unit'); diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index 60f4f984..0db272ff 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -59,7 +59,6 @@ class ttUser { var $punch_mode = 0; // Whether punch mode is enabled for user. var $allow_overlap = 0; // Whether to allow overlapping time entries. var $future_entries = 0; // Whether to allow creating future entries. - var $uncompleted_indicators = 0; // Uncompleted time entry indicators (show nowhere or on users page). var $bcc_email = null; // Bcc email. var $allow_ip = null; // Specification from where user is allowed access. var $password_complexity = null; // Password complexity example. @@ -142,7 +141,6 @@ class ttUser { $this->punch_mode = $config->getDefinedValue('punch_mode'); $this->allow_overlap = $config->getDefinedValue('allow_overlap'); $this->future_entries = $config->getDefinedValue('future_entries'); - $this->uncompleted_indicators = $config->getDefinedValue('uncompleted_indicators'); if ($this->isPluginEnabled('wu')) { $minutes_in_unit = $config->getIntValue('minutes_in_unit'); if ($minutes_in_unit) $this->minutes_in_unit = $minutes_in_unit; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index b17fa675..071a29a4 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.29.4555 | Copyright © Anuko | +  Anuko Time Tracker 1.18.29.4556 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/mobile/users.tpl b/WEB-INF/templates/mobile/users.tpl index e2b815f1..ae04bd44 100644 --- a/WEB-INF/templates/mobile/users.tpl +++ b/WEB-INF/templates/mobile/users.tpl @@ -19,7 +19,7 @@ {foreach $active_users as $u}
- {if $user->uncompleted_indicators} + {if $uncompleted_indicators} {/if} {if $u.rank < $user->rank || ($u.rank == $user->rank && $u.id == $user->id)} diff --git a/WEB-INF/templates/users.tpl b/WEB-INF/templates/users.tpl index fb46c96d..4faf1249 100644 --- a/WEB-INF/templates/users.tpl +++ b/WEB-INF/templates/users.tpl @@ -31,7 +31,7 @@ {foreach $active_users as $u}
- {if $user->uncompleted_indicators} + {if $uncompleted_indicators} {/if} {$u.name|escape} diff --git a/mobile/users.php b/mobile/users.php index d0b5d218..874b0763 100644 --- a/mobile/users.php +++ b/mobile/users.php @@ -38,6 +38,8 @@ if (!(ttAccessAllowed('view_users') || ttAccessAllowed('manage_users'))) { } // End of access checks. +$uncompleted_indicators = $user->getConfigOption('uncompleted_indicators'); + // Get users. $active_users = ttTeamHelper::getActiveUsers(array('getAllFields'=>true)); if($user->can('manage_users')) { @@ -45,12 +47,12 @@ if($user->can('manage_users')) { $inactive_users = ttTeamHelper::getInactiveUsers($user->group_id, true); } -// Check if the group is set to show indicators for uncompleted time entries. -if ($user->uncompleted_indicators) { +if ($uncompleted_indicators) { // Check each active user if they have an uncompleted time entry. foreach ($active_users as $key => $user) { $active_users[$key]['has_uncompleted_entry'] = (bool) ttTimeHelper::getUncompleted($user['id']); } + $smarty->assign('uncompleted_indicators', true); } $smarty->assign('active_users', $active_users); diff --git a/users.php b/users.php index fe0e92da..47ec0145 100644 --- a/users.php +++ b/users.php @@ -50,6 +50,7 @@ if ($request->isPost()) { } else { $group_id = $user->getGroup(); } +$uncompleted_indicators = $user->getConfigOption('uncompleted_indicators'); $form = new Form('usersForm'); if ($user->can('manage_subgroups')) { @@ -79,12 +80,12 @@ if($user->can('manage_users')) { $inactive_users = $user->getUsers($options); } -// Check if the group is set to show indicators for uncompleted time entries. -if ($user->uncompleted_indicators) { +if ($uncompleted_indicators) { // Check each active user if they have an uncompleted time entry. foreach ($active_users as $key => $user) { $active_users[$key]['has_uncompleted_entry'] = (bool) ttTimeHelper::getUncompleted($user['id']); } + $smarty->assign('uncompleted_indicators', true); } $smarty->assign('forms', array($form->getName()=>$form->toArray())); -- 2.20.1