From: Nik Okuntseff Date: Wed, 21 Nov 2018 08:49:12 +0000 (+0000) Subject: A bit more progress on subgroups. X-Git-Tag: timetracker_1.19-1~593 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=d6a5ffec0f76b9ab5b1ee4f8e69ecdb2afd7c0ff;p=timetracker.git A bit more progress on subgroups. --- diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index 6bac7cb4..86174547 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -410,6 +410,20 @@ class ttUser { return $groups; } + // getSubgroups obtains a list of immediate subgroups. + function getSubgroups() { + $mdb2 = getConnection(); + + $sql = "select id, name from tt_groups where org_id = $this->org_id and parent_id = ".$this->getActiveGroup();; + $res = $mdb2->query($sql); + if (!is_a($res, 'PEAR_Error')) { + while ($val = $res->fetchRow()) { + $groups[] = array('id'=>$val['id'],'name'=>$val['name']); + } + } + return $groups; + } + // getUser function is used to manage users in group and returns user details. // At the moment, the function is used for user edits and deletes. function getUser($user_id) { diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 9a9be2d0..53f93ace 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- {/if} +{if $smarty.const.SUBGROUP_DEBUG == 'true'} + {if $user->can('manage_subgroups')} + + + + + {/if} +{/if} diff --git a/groups.php b/groups.php index 5a612c13..12e54da2 100644 --- a/groups.php +++ b/groups.php @@ -39,7 +39,7 @@ if (!ttAccessAllowed('manage_subgroups')) { } // End of access checks. -$smarty->assign('groups', $user->getGroups()); -$smarty->assign('title', $i18n->get('title.groups')); +$smarty->assign('groups', $user->getSubgroups()); +$smarty->assign('title', $i18n->get('label.subgroups')); $smarty->assign('content_page_name', 'groups.tpl'); $smarty->display('index.tpl');
 Anuko Time Tracker 1.18.25.4477 | Copyright © Anuko | +  Anuko Time Tracker 1.18.25.4478 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/group_edit.tpl b/WEB-INF/templates/group_edit.tpl index ef00ca4d..ea46bec6 100644 --- a/WEB-INF/templates/group_edit.tpl +++ b/WEB-INF/templates/group_edit.tpl @@ -41,6 +41,14 @@ function handleTaskRequiredCheckbox() { {$i18n.label.configure}
{$i18n.label.subgroups}:{$i18n.label.configure}
{$i18n.label.language}: {$forms.groupForm.lang.control}