A bit more progress on subgroups.
authorNik Okuntseff <support@anuko.com>
Wed, 21 Nov 2018 08:49:12 +0000 (08:49 +0000)
committerNik Okuntseff <support@anuko.com>
Wed, 21 Nov 2018 08:49:12 +0000 (08:49 +0000)
WEB-INF/lib/ttUser.class.php
WEB-INF/templates/footer.tpl
WEB-INF/templates/group_edit.tpl
groups.php

index 6bac7cb..8617454 100644 (file)
@@ -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) {
index 9a9be2d..53f93ac 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.18.25.4477 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.18.25.4478 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
index ef00ca4..ea46bec 100644 (file)
@@ -41,6 +41,14 @@ function handleTaskRequiredCheckbox() {
             <td><a href="roles.php">{$i18n.label.configure}</a></td>
           </tr>
   {/if}
+{if $smarty.const.SUBGROUP_DEBUG == 'true'}
+  {if $user->can('manage_subgroups')}
+          <tr>
+            <td align="right" nowrap>{$i18n.label.subgroups}:</td>
+            <td><a href="groups.php">{$i18n.label.configure}</a></td>
+          </tr>
+  {/if}
+{/if}
           <tr>
            <td align="right" nowrap>{$i18n.label.language}:</td>
            <td>{$forms.groupForm.lang.control}</td>
index 5a612c1..12e54da 100644 (file)
@@ -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');