}
return false;
}
+
+ // The getActiveUsers obtains all active users in a given group.
+ static function getActiveUsers($options = null) {
+ global $user;
+ global $i18n;
+ $mdb2 = getConnection();
+
+ $group_id = $user->getGroup();
+ $org_id = $user->org_id;
+
+ if (isset($options['getAllFields']))
+ $sql = "select u.*, r.name as role_name, r.rank from tt_users u left join tt_roles r on (u.role_id = r.id) where u.group_id = $group_id and u.org_id = $org_id and u.status = 1 order by upper(u.name)";
+ else
+ $sql = "select id, name from tt_users where group_id = $group_id and org_id = $org_id and status = 1 order by upper(name)";
+ $res = $mdb2->query($sql);
+ $user_list = array();
+ if (is_a($res, 'PEAR_Error'))
+ return false;
+ while ($val = $res->fetchRow()) {
+ // Localize top manager role name, as it is not localized in db.
+ if ($val['rank'] == 512)
+ $val['role_name'] = $i18n->get('role.top_manager.label');
+ $user_list[] = $val;
+ }
+
+ if (isset($options['putSelfFirst'])) {
+ // Put own entry at the front.
+ $cnt = count($user_list);
+ for($i = 0; $i < $cnt; $i++) {
+ if ($user_list[$i]['id'] == $user->id) {
+ $self = $user_list[$i]; // Found self.
+ array_unshift($user_list, $self); // Put own entry at the front.
+ array_splice($user_list, $i+1, 1); // Remove duplicate.
+ }
+ }
+ }
+ return $user_list;
+ }
}
import('ttTeamHelper');
import('ttUserHelper');
+import('ttGroupHelper');
// Class ttProjectHelper is used to help with project related tasks.
class ttProjectHelper {
$last_id = $mdb2->lastInsertID('tt_projects', 'id');
// Bind the project to users.
- $active_users = ttTeamHelper::getActiveUsers(array('getAllFields'=>true));
+ $active_users = ttGroupHelper::getActiveUsers(array('getAllFields'=>true));
foreach ($active_users as $u) {
if(in_array($u['id'], $users)) {
$sql = "insert into tt_user_project_binds (project_id, user_id, group_id, org_id, status, rate) values(
return $user_list;
}
- // The getActiveUsers obtains all active users in a given group.
- static function getActiveUsers($options = null) {
- global $user;
- global $i18n;
- $mdb2 = getConnection();
-
- $group_id = $user->getGroup();
- $org_id = $user->org_id;
-
- if (isset($options['getAllFields']))
- $sql = "select u.*, r.name as role_name, r.rank from tt_users u left join tt_roles r on (u.role_id = r.id) where u.group_id = $group_id and u.org_id = $org_id and u.status = 1 order by upper(u.name)";
- else
- $sql = "select id, name from tt_users where group_id = $group_id and org_id = $org_id and status = 1 order by upper(name)";
- $res = $mdb2->query($sql);
- $user_list = array();
- if (is_a($res, 'PEAR_Error'))
- return false;
- while ($val = $res->fetchRow()) {
- // Localize top manager role name, as it is not localized in db.
- if ($val['rank'] == 512)
- $val['role_name'] = $i18n->get('role.top_manager.label');
- $user_list[] = $val;
- }
-
- if (isset($options['putSelfFirst'])) {
- // Put own entry at the front.
- $cnt = count($user_list);
- for($i = 0; $i < $cnt; $i++) {
- if ($user_list[$i]['id'] == $user->id) {
- $self = $user_list[$i]; // Found self.
- array_unshift($user_list, $self); // Put own entry at the front.
- array_splice($user_list, $i+1, 1); // Remove duplicate.
- }
- }
- }
- return $user_list;
- }
-
// The swapRolesWith swaps existing user role with that of another user.
static function swapRolesWith($user_id) {
global $user;
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.29.4619 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.29.4620 | 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>
import('form.Form');
import('ttProjectHelper');
import('ttTeamHelper');
+import('ttGroupHelper');
// Access checks.
if (!ttAccessAllowed('manage_projects')) {
}
// End of access checks.
-$users = ttTeamHelper::getActiveUsers();
+$users = ttGroupHelper::getActiveUsers();
foreach ($users as $user_item)
$all_users[$user_item['id']] = $user_item['name'];
import('form.Form');
import('ttProjectHelper');
import('ttTeamHelper');
+import('ttGroupHelper');
// Access checks.
if (!ttAccessAllowed('manage_projects')) {
}
// End of access checks.
-$users = ttTeamHelper::getActiveUsers();
+$users = ttGroupHelper::getActiveUsers();
foreach ($users as $user_item)
$all_users[$user_item['id']] = $user_item['name'];
require_once('../initialize.php');
import('form.Form');
import('ttTeamHelper');
+import('ttGroupHelper');
import('ttTimeHelper');
// Access checks.
$uncompleted_indicators = $user->getConfigOption('uncompleted_indicators');
// Get users.
-$active_users = ttTeamHelper::getActiveUsers(array('getAllFields'=>true));
+$active_users = ttGroupHelper::getActiveUsers(array('getAllFields'=>true));
if($user->can('manage_users')) {
$can_delete_manager = (1 == count($active_users));
$inactive_users = ttTeamHelper::getInactiveUsers($user->group_id, true);
import('form.Form');
import('ttProjectHelper');
import('ttTeamHelper');
+import('ttGroupHelper');
// Access checks.
if (!ttAccessAllowed('manage_projects')) {
}
// End of access checks.
-$users = ttTeamHelper::getActiveUsers();
+$users = ttGroupHelper::getActiveUsers();
foreach ($users as $user_item)
$all_users[$user_item['id']] = $user_item['name'];
import('form.Form');
import('ttProjectHelper');
import('ttTeamHelper');
+import('ttGroupHelper');
// Access checks.
if (!ttAccessAllowed('manage_projects')) {
}
// End of access checks.
-$users = ttTeamHelper::getActiveUsers();
+$users = ttGroupHelper::getActiveUsers();
foreach ($users as $user_item)
$all_users[$user_item['id']] = $user_item['name'];