fwrite($file, "</team>\n");
// Prepare role map.
- $roles = ttTeamHelper::getAllRoles($user->team_id);
+ $roles = ttExportHelper::getAllRoles();
foreach ($roles as $key=>$role_item)
$this->roleMap[$role_item['id']] = $key + 1;
// Write roles.
fwrite($file, "<roles>\n");
- $roles = ttTeamHelper::getAllRoles($user->team_id);
foreach ($roles as $role) {
fwrite($file, " <role id=\"".$this->roleMap[$role['id']]."\" rank=\"".$role['rank']."\"".
" rights=\"".$role['rights']."\">\n");
// Write users.
fwrite($file, "<users>\n");
foreach ($users as $user_item) {
- fwrite($file, " <user id=\"".$this->userMap[$user_item['id']]."\" login=\"".htmlentities($user_item['login'])."\" password=\"".$user_item['password']."\" role_id=\"".$this->roleMap[$user_item['role_id']]."\" client_id=\"".$this->clientMap[$user_item['client_id']]."\" rate=\"".$user_item['rate']."\" email=\"".$user_item['email']."\" status=\"".$user_item['status']."\">\n");
+ $role_id = $user_item['rank'] == 512 ? 0 : $this->roleMap[$user_item['role_id']]; // Special role_id 0 (not null) for top manager.
+ fwrite($file, " <user id=\"".$this->userMap[$user_item['id']]."\" login=\"".htmlentities($user_item['login'])."\" password=\"".$user_item['password']."\" role_id=\"".$role_id."\" client_id=\"".$this->clientMap[$user_item['client_id']]."\" rate=\"".$user_item['rate']."\" email=\"".$user_item['email']."\" status=\"".$user_item['status']."\">\n");
fwrite($file, " <name><![CDATA[".$user_item['name']."]]></name>\n");
fwrite($file, " </user>\n");
}
return true;
}
- // The getAllUsers obtains all users in team.
+ // getAllRoles - obtains all roles defined for team.
+ static function getAllRoles() {
+ global $user;
+ $mdb2 = getConnection();
+
+ $result = array();
+ $sql = "select * from tt_roles where team_id = $user->team_id";
+ $res = $mdb2->query($sql);
+ $result = array();
+ if (!is_a($res, 'PEAR_Error')) {
+ while ($val = $res->fetchRow()) {
+ $result[] = $val;
+ }
+ return $result;
+ }
+ return false;
+ }
+
+ // The getAllUsers obtains all users in team for the purpose of export.
static function getAllUsers() {
global $user;
$mdb2 = getConnection();
- $sql = "select * from tt_users where team_id = $user->team_id order by upper(name)"; // Note: deleted users are included.
+ $sql = "select u.*, r.rank from tt_users u left join tt_roles r on (u.role_id = r.id) where u.team_id = $user->team_id order by upper(u.name)"; // Note: deleted users are included.
$res = $mdb2->query($sql);
$result = array();
if (!is_a($res, 'PEAR_Error')) {
return false;
}
- // The getAllUsers obtains all users in a given team.
- static function getAllUsers($team_id, $all_fields = false) {
- $mdb2 = getConnection();
-
- if ($all_fields)
- $sql = "select * from tt_users where team_id = $team_id order by upper(name)";
- else
- $sql = "select id, name from tt_users where team_id = $team_id order by upper(name)";
- $res = $mdb2->query($sql);
- $result = array();
- if (!is_a($res, 'PEAR_Error')) {
- while ($val = $res->fetchRow()) {
- $result[] = $val;
- }
- return $result;
- }
- return false;
- }
-
// getActiveProjects - returns an array of active projects for team.
static function getActiveProjects($team_id)
{
return $result;
}
- // getAllRoles - obtains all roles defined for team.
- static function getAllRoles($team_id) {
- $mdb2 = getConnection();
-
- $result = array();
- $sql = "select * from tt_roles where team_id = $team_id";
- $res = $mdb2->query($sql);
- $result = array();
- if (!is_a($res, 'PEAR_Error')) {
- while ($val = $res->fetchRow()) {
- $result[] = $val;
- }
- return $result;
- }
- return false;
- }
-
// The getActiveClients returns an array of active clients for team.
static function getActiveClients($team_id, $all_fields = false)
{
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.17.51.4093 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.17.51.4094 | Copyright © <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>