X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttExportHelper.class.php;h=c71b856da2288a67df3cccdac8efe9ec266eb49b;hb=ecf7d911c95935f8cfb2403f645cd12f93d8c3f5;hp=88ea5acb21031eada41991a37ee5c26af6af1fbc;hpb=074e8daef75c2b729e75f350b52935a6b7ecfba8;p=timetracker.git diff --git a/WEB-INF/lib/ttExportHelper.class.php b/WEB-INF/lib/ttExportHelper.class.php index 88ea5acb..c71b856d 100644 --- a/WEB-INF/lib/ttExportHelper.class.php +++ b/WEB-INF/lib/ttExportHelper.class.php @@ -73,12 +73,12 @@ class ttExportHelper { fwrite($file, "\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; @@ -356,8 +356,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 +393,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();