Improved a comment for translators in translation files.
[timetracker.git] / WEB-INF / lib / ttExportHelper.class.php
index 67224c8..77b2db1 100644 (file)
@@ -73,12 +73,12 @@ class ttExportHelper {
     fwrite($file, "</team>\n");
 
     // Prepare role map.
-    $roles = ttExportHelper::getAllRoles();
+    $roles = $this->getRoles();
     foreach ($roles as $key=>$role_item)
       $this->roleMap[$role_item['id']] = $key + 1;
 
     // Prepare user map.
-    $users = ttExportHelper::getAllUsers();
+    $users = $this->getUsers();
     foreach ($users as $key=>$user_item)
       $this->userMap[$user_item['id']] = $key + 1;
 
@@ -116,7 +116,7 @@ class ttExportHelper {
     fwrite($file, "<roles>\n");
     foreach ($roles as $role) {
       fwrite($file, "  <role id=\"".$this->roleMap[$role['id']]."\" rank=\"".$role['rank']."\"".
-        " rights=\"".$role['rights']."\">\n");
+        " rights=\"".$role['rights']."\" status=\"".$role['status']."\">\n");
       fwrite($file, "    <name><![CDATA[".$role['name']."]]></name>\n");
       fwrite($file, "  </role>\n");
     }
@@ -237,7 +237,7 @@ class ttExportHelper {
       foreach ($records as $record) {
         $key++;
         $this->logMap[$record['id']] = $key;
-        fwrite($file, "  <log_item id=\"$key\" timestamp=\"".$record['timestamp']."\" user_id=\"".$this->userMap[$record['user_id']]."\" date=\"".$record['date']."\" start=\"".$record['start']."\" finish=\"".$record['finish']."\" duration=\"".($record['start']?"":$record['duration'])."\" client_id=\"".$this->clientMap[$record['client_id']]."\" project_id=\"".$this->projectMap[$record['project_id']]."\" task_id=\"".$this->taskMap[$record['task_id']]."\" invoice_id=\"".$this->invoiceMap[$record['invoice_id']]."\" billable=\"".$record['billable']."\" paid=\"".$record['paid']."\" status=\"".$record['status']."\">\n");
+        fwrite($file, "  <log_item id=\"$key\" user_id=\"".$this->userMap[$record['user_id']]."\" date=\"".$record['date']."\" start=\"".$record['start']."\" finish=\"".$record['finish']."\" duration=\"".($record['start']?"":$record['duration'])."\" client_id=\"".$this->clientMap[$record['client_id']]."\" project_id=\"".$this->projectMap[$record['project_id']]."\" task_id=\"".$this->taskMap[$record['task_id']]."\" invoice_id=\"".$this->invoiceMap[$record['invoice_id']]."\" billable=\"".$record['billable']."\" paid=\"".$record['paid']."\" status=\"".$record['status']."\">\n");
         fwrite($file, "    <comment><![CDATA[".$record['comment']."]]></comment>\n");
         fwrite($file, "  </log_item>\n");
       }
@@ -291,6 +291,8 @@ class ttExportHelper {
         " period_end=\"".$fav_report['period_end']."\"".
         " show_client=\"".$fav_report['show_client']."\"".
         " show_invoice=\"".$fav_report['show_invoice']."\"".
+        " show_paid=\"".$fav_report['show_paid']."\"".
+        " show_ip=\"".$fav_report['show_ip']."\"".
         " show_project=\"".$fav_report['show_project']."\"".
         " show_start=\"".$fav_report['show_start']."\"".
         " show_duration=\"".$fav_report['show_duration']."\"".
@@ -356,8 +358,27 @@ class ttExportHelper {
     return true;
   }
 
-  // getAllRoles - obtains all roles defined for team.
-  static function getAllRoles() {
+  /*
+   * Note about the utility functions below.
+   * We have roughly 3 groups of operations:
+   *   1) Regular system usage for tracking time, etc.
+   *   2) Admin usage - used infrequently.
+   *   3) Export - used infrequently.
+   *
+   * TODO: we also have user registration process without initialized user.
+   * Perhaps we need a separate helper class for this. Think about it.
+   *
+   * It is tempting to have a generic function to get things done for
+   * all situations. However, as export and admin access are one-off
+   * operations, while regular system usage is daily and must be efficient,
+   * the current approach is to have SEPARATE functions for each mode.
+   *
+   * This is because each mode requires a slightly different approach,
+   * and we don't want to over-complicate things.
+   */
+
+  // getRoles - obtains all roles defined for team.
+  function getRoles() {
     global $user;
     $mdb2 = getConnection();
 
@@ -374,8 +395,8 @@ class ttExportHelper {
     return false;
   }
 
-  // The getAllUsers obtains all users in team for the purpose of export.
-  static function getAllUsers() {
+  // The getUsers obtains all users in team for the purpose of export.
+  function getUsers() {
     global $user;
     $mdb2 = getConnection();