]> wagnertech.de Git - timetracker.git/commitdiff
Some more refactoring for subgroups.
authorNik Okuntseff <support@anuko.com>
Sat, 1 Dec 2018 22:58:13 +0000 (22:58 +0000)
committerNik Okuntseff <support@anuko.com>
Sat, 1 Dec 2018 22:58:13 +0000 (22:58 +0000)
WEB-INF/lib/ttGroupHelper.class.php
WEB-INF/lib/ttTeamHelper.class.php
WEB-INF/templates/footer.tpl
mobile/projects.php
projects.php

index e04c221d1bfd0a7ab089e24532b500fd52889bab..9f9f4a2f9b04840e0ec571b05ab0d3601f229f6b 100644 (file)
@@ -320,4 +320,46 @@ class ttGroupHelper {
     }
     return $result;
   }
+
+  // getActiveProjects - returns an array of active projects for a group.
+  static function getActiveProjects()
+  {
+    global $user;
+    $mdb2 = getConnection();
+
+    $group_id = $user->getGroup();
+    $org_id = $user->org_id;
+
+    $sql = "select id, name, description, tasks from tt_projects".
+      " where group_id = $group_id and org_id = $org_id and status = 1 order by upper(name)";
+    $res = $mdb2->query($sql);
+    $result = array();
+    if (!is_a($res, 'PEAR_Error')) {
+      while ($val = $res->fetchRow()) {
+        $result[] = $val;
+      }
+    }
+    return $result;
+  }
+
+  // getInactiveProjects - returns an array of inactive projects for a group.
+  static function getInactiveProjects()
+  {
+    global $user;
+    $mdb2 = getConnection();
+
+    $group_id = $user->getGroup();
+    $org_id = $user->org_id;
+
+    $sql = "select id, name, description, tasks from tt_projects".
+      "  where group_id = $group_id and org_id = $org_id and status = 0 order by upper(name)";
+    $res = $mdb2->query($sql);
+    $result = array();
+    if (!is_a($res, 'PEAR_Error')) {
+      while ($val = $res->fetchRow()) {
+        $result[] = $val;
+      }
+    }
+    return $result;
+  }
 }
index f82fc2630c0c48e0c10389c863ea9707cc846821..67d97b850c0bce3b980aae0c17aefa76041d96b8 100644 (file)
@@ -194,24 +194,6 @@ class ttTeamHelper {
     return $result;
   }
 
-  // getInactiveProjects - returns an array of inactive projects for a group.
-  static function getInactiveProjects($group_id)
-  {
-    $result = array();
-    $mdb2 = getConnection();
-
-    $sql = "select id, name, description, tasks from tt_projects
-      where group_id = $group_id and status = 0 order by upper(name)";
-    $res = $mdb2->query($sql);
-    $result = array();
-    if (!is_a($res, 'PEAR_Error')) {
-      while ($val = $res->fetchRow()) {
-        $result[] = $val;
-      }
-    }
-    return $result;
-  }
-
   // The getAllProjects obtains all projects in a group.
   static function getAllProjects($group_id, $all_fields = false) {
     $mdb2 = getConnection();
index 83288cf474482e6ffcbd021dc283070fb51e5e12..00eaa060a5dddf3db6f5373b997749c9aa0488a3 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.29.4563 | 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.29.4564 | 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 e3dc2f87e33614792684c8f1924a53327dc28a4d..d244ae1b7e6cb3b7bb8d6793f30fd1ea0123ea1a 100644 (file)
@@ -29,6 +29,7 @@
 require_once('../initialize.php');
 import('form.Form');
 import('ttTeamHelper');
+import('ttGroupHelper');
 
 // Access checks.
 if (!(ttAccessAllowed('view_own_projects') || ttAccessAllowed('manage_projects'))) {
@@ -42,8 +43,8 @@ if (MODE_PROJECTS != $user->tracking_mode && MODE_PROJECTS_AND_TASKS != $user->t
 // End of access checks.
 
 if($user->can('manage_projects')) {
-  $active_projects = ttTeamHelper::getActiveProjects($user->group_id);
-  $inactive_projects = ttTeamHelper::getInactiveProjects($user->group_id);
+  $active_projects = ttGroupHelper::getActiveProjects();
+  $inactive_projects = ttGroupHelper::getInactiveProjects();
 } else
   $active_projects = $user->getAssignedProjects();
 
index b8faa14d6b695565b5db7749fd139952e208a26d..8b4537e796579c462a6a71ca591f54c9ddddd3e4 100644 (file)
@@ -29,6 +29,7 @@
 require_once('initialize.php');
 import('form.Form');
 import('ttTeamHelper');
+import('ttGroupHelper');
 
 // Access checks.
 if (!(ttAccessAllowed('view_own_projects') || ttAccessAllowed('manage_projects'))) {
@@ -73,8 +74,8 @@ if ($user->can('manage_subgroups')) {
 }
 
 if($user->can('manage_projects')) {
-  $active_projects = ttTeamHelper::getActiveProjects($group_id);
-  $inactive_projects = ttTeamHelper::getInactiveProjects($group_id);
+  $active_projects = ttGroupHelper::getActiveProjects();
+  $inactive_projects = ttGroupHelper::getInactiveProjects();
 } else
   $active_projects = $user->getAssignedProjects();