return true;
}
+
+ // getGroupDetails obtains group name and its top manager details.
+ function getGroupDetails($group_id) {
+ $result = array();
+ $mdb2 = getConnection();
+
+ $sql = "select g.name as group_name, u.id as manager_id, u.name as manager_name, u.login as manager_login, u.email as manager_email".
+ " from tt_groups g".
+ " inner join tt_users u on (u.group_id = g.id)".
+ " inner join tt_roles r on (r.id = u.role_id and r.rank = 512)".
+ " where g.id = $group_id";
+
+ $res = $mdb2->query($sql);
+ if (!is_a($res, 'PEAR_Error')) {
+ $val = $res->fetchRow();
+ return $val;
+ }
+
+ return false;
+ }
}
return true;
}
- // The getTeamDetails function returns team details.
- static function getTeamDetails($group_id) {
- $result = array();
- $mdb2 = getConnection();
-
- $sql = "select t.name as team_name, u.id as manager_id, u.name as manager_name, u.login as manager_login, u.email as manager_email
- from tt_groups t
- inner join tt_users u on (u.group_id = t.id)
- inner join tt_roles r on (r.id = u.role_id and r.rank = 512)
- where t.id = $group_id";
-
- $res = $mdb2->query($sql);
- if (!is_a($res, 'PEAR_Error')) {
- $val = $res->fetchRow();
- return $val;
- }
-
- return false;
- }
-
// The insert function creates a new team.
static function insert($fields) {
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.17.86.4230 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.17.86.4231 | 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>
require_once('initialize.php');
import('form.Form');
-import('ttTeamHelper');
+import('ttAdmin');
// Access checks.
if (!ttAccessAllowed('administer_site')) {
// End of access checks.
$group_id = (int)$request->getParameter('id');
-$group_details = ttTeamHelper::getTeamDetails($group_id); // TODO: refactor this.
-$group_name = $group_details['team_name'];
+
+$admin = new ttAdmin();
+$group_details = $admin->getGroupDetails($group_id);
+$group_name = $group_details['group_name'];
$form = new Form('groupForm');
$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$group_id));
if ($request->isPost()) {
if ($request->getParameter('btn_delete')) {
- import('ttAdmin');
- $admin = new ttAdmin();
$result = $admin->markGroupDeleted($group_id);
if ($result) {
header('Location: admin_groups.php');
require_once('initialize.php');
import('form.Form');
import('ttUserHelper');
-import('ttTeamHelper');
+import('ttAdmin');
// Access checks.
if (!ttAccessAllowed('administer_site')) {
// End of access checks.
$group_id = $request->getParameter('id');
-$group_details = ttTeamHelper::getTeamDetails($group_id);
+
+$admin = new ttAdmin();
+$group_details = $admin->getGroupDetails($group_id);
if ($request->isPost()) {
$cl_group_name = trim($request->getParameter('group_name'));
}
$cl_manager_email = trim($request->getParameter('manager_email'));
} else {
- $cl_group_name = $group_details['team_name'];
+ $cl_group_name = $group_details['group_name'];
$cl_manager_name = $group_details['manager_name'];
$cl_manager_login = $group_details['manager_login'];
if (!$auth->isPasswordExternal()) {
if ($request->getParameter('btn_save')) {
// Create fields array for ttAdmin instance.
$fields = array(
- 'old_group_name' => $group_details['team_name'],
+ 'old_group_name' => $group_details['group_name'],
'new_group_name' => $cl_group_name,
'user_id' => $group_details['manager_id'],
'user_name' => $cl_manager_name,