// The ttRoleHelper is a class to help with custom group roles.
class ttRoleHelper {
+
+ // get - gets details of a role identified by its id.
+ static function get($id)
+ {
+ global $user;
+
+ $mdb2 = getConnection();
+
+ $sql = "select id, name, description, rank, rights, status from tt_roles
+ where id = $id and team_id = $user->team_id and (status = 0 or status = 1)";
+ $res = $mdb2->query($sql);
+
+ if (!is_a($res, 'PEAR_Error')) {
+ $val = $res->fetchRow();
+ if ($val['id'] != '') {
+ return $val;
+ } else
+ return false;
+ }
+ return false;
+ }
+
+ // delete - marks the role as deleted.
+ static function delete($role_id) {
+ global $user;
+
+ $mdb2 = getConnection();
+
+ // Mark the task as deleted.
+ $sql = "update tt_roles set status = NULL where id = $role_id and team_id = $user->team_id";
+ $affected = $mdb2->exec($sql);
+ return (!is_a($affected, 'PEAR_Error'));
+ }
+
// insert - inserts an entry into tt_roles table.
static function insert($fields)
{
// Class ttTaskHelper is used to help with task related operations.
class ttTaskHelper {
- // getTask - gets details of the task identified by its id.
- static function getTask($id)
+ // get - gets details of a task identified by its id.
+ static function get($id)
{
global $user;
'title.add_project' => 'Agregant projecte',
'title.edit_project' => 'Modificant projecte',
'title.delete_project' => 'Eliminant projecte',
+// TODO: translate the following.
// 'title.tasks' => 'Tasks',
// 'title.add_task' => 'Adding Task',
// 'title.edit_task' => 'Editing Task',
'title.add_user' => 'Agregant usuari',
'title.edit_user' => 'Modificant usuari',
'title.delete_user' => 'Eliminant usuari',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Clients',
'title.add_client' => 'Agregar client',
'title.edit_client' => 'Modificar client',
// 'title.edit_user' => 'Editing User',
'title.delete_user' => 'Smazat uživatele',
// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Zákazníci',
'title.add_client' => 'Přidat zákazníka',
'title.edit_client' => 'Upravit zákazníka',
'title.add_user' => 'Tilføj Bruger',
'title.edit_user' => 'Redigér Bruger',
'title.delete_user' => 'Slet Bruger',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Klienter',
'title.add_client' => 'Tilføj Klient',
'title.edit_client' => 'Redigér Klient',
'title.add_user' => 'Benutzerkonto erstellen',
'title.edit_user' => 'Benutzerdaten bearbeiten',
'title.delete_user' => 'Benutzer löschen',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Kunden',
'title.add_client' => 'Kunden hinzufügen',
'title.edit_client' => 'Kunden bearbeiten',
'title.add_user' => 'Adding User',
'title.edit_user' => 'Editing User',
'title.delete_user' => 'Deleting User',
+'title.roles' => 'Roles',
+'title.add_role' => 'Adding Role',
+'title.edit_role' => 'Editing Role',
+'title.delete_role' => 'Deleting Role',
'title.clients' => 'Clients',
'title.add_client' => 'Adding Client',
'title.edit_client' => 'Editing Client',
'title.add_user' => 'Creando usuario',
'title.edit_user' => 'Modificando usuario',
'title.delete_user' => 'Eliminando usuario',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Clientes',
'title.add_client' => 'Agregar cliente',
'title.edit_client' => 'Modificando cliente',
'title.add_user' => 'Kasutaja lisamine', // TODO: is this correct?
'title.edit_user' => 'Kasutaja muutmine',
'title.delete_user' => 'Kasutaja kustutamine',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Kliendid',
'title.add_client' => 'Lisa klient',
'title.edit_client' => 'Muuda klienti',
'title.add_user' => 'درج کاربر',
'title.edit_user' => 'ویرایش کاربر',
'title.delete_user' => 'حذف کاربر',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'مشتریان',
'title.add_client' => 'درج مشتری',
'title.edit_client' => 'ویرایش مشتری',
'title.add_user' => 'Käyttäjän lisäys',
'title.edit_user' => 'Käyttäjän muokkaus',
'title.delete_user' => 'Käyttäjän poisto',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Asiakkaat',
'title.add_client' => 'Asiakkaan lisäys',
'title.edit_client' => 'Asiakkaan muokkaus',
'title.add_user' => 'Création d\\\'un utilisateur',
'title.edit_user' => 'Modification d\\\'un utilisateur',
'title.delete_user' => 'Suppression d\\\'un utilisateur',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Clients',
'title.add_client' => 'Ajout d\\\'un client',
'title.edit_client' => 'Modification d\\\'un client',
'title.add_user' => 'הוספת משתמש',
'title.edit_user' => 'עריכת משתמש',
'title.delete_user' => 'מחיקת משתמש',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'לקוחות',
'title.add_client' => 'הוספת לקוח',
'title.edit_client' => 'עריכת לקוח',
// 'title.add_user' => 'Adding User',
// 'title.edit_user' => 'Editing User',
// 'title.delete_user' => 'Deleting User',
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Ügyfelek',
'title.add_client' => 'Ügyfél hozzáadása',
'title.edit_client' => 'Ügyfél szerkesztése',
'title.add_user' => 'Crea utente',
'title.edit_user' => 'Modifica utente',
'title.delete_user' => 'Elimina utente',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Clienti',
'title.add_client' => 'Aggiungi cliente',
'title.edit_client' => 'Modifica cliente',
'title.add_user' => 'ユーザーの作成',
'title.edit_user' => 'ユーザーの編集',
'title.delete_user' => 'ユーザーの削除',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'クライアント',
'title.add_client' => 'クライアントの追加',
'title.edit_client' => 'クライアントの編集',
'title.add_user' => '사용자를 추가하기', // TODO: is this correct?
'title.edit_user' => '사용자를 편집하기',
'title.delete_user' => '사용자를 삭제하기',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => '클라이언트',
'title.add_client' => '클라이언트 추가',
'title.edit_client' => '클라이언트 편집',
'title.add_user' => 'Medewerker toevoegen',
'title.edit_user' => 'Medewerker wijzigen',
'title.delete_user' => 'Medewerker verwijderen',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Klanten',
'title.add_client' => 'Klant toevoegen',
'title.edit_client' => 'Klant wijzigen',
'title.add_user' => 'Legg til bruker',
'title.edit_user' => 'Endre bruker',
'title.delete_user' => 'Slett bruker',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Klienter',
'title.add_client' => 'Legg til klient',
'title.edit_client' => 'Endre klient',
'title.add_user' => 'Dodawanie użytkownika',
'title.edit_user' => 'Edytowanie użytkownika',
'title.delete_user' => 'Usuwanie użytkownika',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Klienci',
'title.add_client' => 'Dodawanie klienta',
'title.edit_client' => 'Edytowanie klienta',
'title.add_user' => 'Adicionando usuário',
'title.edit_user' => 'Editando usuário',
'title.delete_user' => 'Apagando usuário',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Clientes',
'title.add_client' => 'Adicionando cliente',
'title.edit_client' => 'Editando cliente',
'title.add_user' => 'Adicionando usuário',
'title.edit_user' => 'Editando usuário',
'title.delete_user' => 'Apagando usuário',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
// 'title.clients' => 'Clients',
// 'title.add_client' => 'Adding Client',
// 'title.edit_client' => 'Editing Client',
'title.add_user' => 'Adaugare utilizator',
'title.edit_user' => 'Editare utilizator',
'title.delete_user' => 'Stergere utilizator', // TODO: is this correct?
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Clienti',
'title.add_client' => 'Adaugare client', // TODO: is this correct?
'title.edit_client' => 'Editare client', // TODO: is this correct?
'menu.charts' => 'Диаграммы',
'menu.projects' => 'Проекты',
'menu.tasks' => 'Задачи',
-'menu.users' => 'Ð\9bÑ\8eди',
+'menu.users' => 'Ð\9fолÑ\8cзоваÑ\82ели',
'menu.teams' => 'Команды',
'menu.export' => 'Экспорт',
'menu.clients' => 'Клиенты',
'menu.options' => 'Опции',
// Footer - strings on the bottom of most pages.
-'footer.mobile_phones' => 'Time Tracker доступен на мобильных телефонах.',
'footer.contribute_msg' => 'Вы можете улучшить Time Tracker разными способами.',
'footer.credits' => 'Авторы',
'footer.license' => 'Лицензия',
'title.add_task' => 'Добавление задачи',
'title.edit_task' => 'Редактирование задачи',
'title.delete_task' => 'Удаление задачи',
-'title.users' => 'СоÑ\82Ñ\80Ñ\83дники',
-'title.add_user' => 'Создание пользователя',
+'title.users' => 'Ð\9fолÑ\8cзоваÑ\82ели',
+'title.add_user' => 'Ð\94обавление пользователя',
'title.edit_user' => 'Редактирование пользователя',
'title.delete_user' => 'Удаление пользователя',
+'title.roles' => 'Роли',
+'title.add_role' => 'Добавление роли',
+'title.edit_role' => 'Редактирование роли',
+'title.delete_role' => 'Удаление роли',
'title.clients' => 'Клиенты',
'title.add_client' => 'Добавление клиента',
'title.edit_client' => 'Редактирование клиента',
'title.add_user' => 'Pridávanie používateľa',
'title.edit_user' => 'Upravovanie používateľa',
'title.delete_user' => 'Vymazávanie používateľa',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Klienti',
'title.add_client' => 'Pridávanie klienta',
'title.edit_client' => 'Upravovanie klienta',
// 'title.add_user' => 'Adding User',
// 'title.edit_user' => 'Editing User',
// 'title.delete_user' => 'Deleting User',
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
// 'title.clients' => 'Clients',
// 'title.add_client' => 'Adding Client',
// 'title.edit_client' => 'Editing Client',
'title.add_user' => 'Dodavanje korisnika',
'title.edit_user' => 'Izmena korisnika',
'title.delete_user' => 'Brisanje korisnika',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Klijenti',
'title.add_client' => 'Dodavanje klijenta',
'title.edit_client' => 'Izmena klijenta',
'title.add_user' => 'Lägg till användare',
'title.edit_user' => 'Redigera användare',
'title.delete_user' => 'Ta bort användare',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Kunder',
'title.add_client' => 'Lägg till kund',
'title.edit_client' => 'Redigera kund',
'title.add_user' => 'Kullanıcı yarat', // TODO: we need consistency with all titles. Why not ekleniyor?
'title.edit_user' => 'Kullanıcı düzenleniyor',
'title.delete_user' => 'Kullanıcı siliniyor',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => 'Müşteriler',
'title.add_client' => 'Müşteri ekle',
'title.edit_client' => 'Müşteriyi düzenle',
'title.add_user' => '添加用户', // TODO: is this correct?
'title.edit_user' => '编辑用户',
'title.delete_user' => '删除用户',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => '客户',
'title.add_client' => '添加客户',
'title.edit_client' => '编辑客户',
'title.add_user' => '添加用戶', // TODO: is this correct?
'title.edit_user' => '編輯用戶',
'title.delete_user' => '刪除用戶',
+// TODO: translate the following.
+// 'title.roles' => 'Roles',
+// 'title.add_role' => 'Adding Role',
+// 'title.edit_role' => 'Editing Role',
+// 'title.delete_role' => 'Deleting Role',
'title.clients' => '客戶',
'title.add_client' => '添加客戶',
'title.edit_client' => '編輯客戶',
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.17.31.4021 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.17.31.4022 | 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>
--- /dev/null
+{$forms.roleDeleteForm.open}
+<table cellspacing="4" cellpadding="7" border="0">
+ <tr>
+ <td>
+ <table cellspacing="0" cellpadding="0" border="0">
+ <tr>
+ <td colspan="2" align="center"><b>{$role_to_delete|escape}</b></td>
+ </tr>
+ <tr>
+ <td colspan="2" align="center"> </td>
+ </tr>
+ <tr>
+ <td align="right">{$forms.roleDeleteForm.btn_delete.control} </td>
+ <td align="left"> {$forms.roleDeleteForm.btn_cancel.control}</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+{$forms.roleDeleteForm.close}
}
$cl_task_id = (int)$request->getParameter('id');
-$task = ttTaskHelper::getTask($cl_task_id);
+$task = ttTaskHelper::get($cl_task_id);
$task_to_delete = $task['name'];
$form = new Form('taskDeleteForm');
if ($request->isPost()) {
if ($request->getParameter('btn_delete')) {
- if(ttTaskHelper::getTask($cl_task_id)) {
+ if(ttTaskHelper::get($cl_task_id)) {
if (ttTaskHelper::delete($cl_task_id)) {
header('Location: tasks.php');
exit();
$cl_status = $request->getParameter('status');
$cl_projects = $request->getParameter('projects');
} else {
- $task = ttTaskHelper::getTask($cl_task_id);
+ $task = ttTaskHelper::get($cl_task_id);
$cl_name = $task['name'];
$cl_description = $task['description'];
$cl_status = $task['status'];
--- /dev/null
+<?php
+// +----------------------------------------------------------------------+
+// | Anuko Time Tracker
+// +----------------------------------------------------------------------+
+// | Copyright (c) Anuko International Ltd. (https://www.anuko.com)
+// +----------------------------------------------------------------------+
+// | LIBERAL FREEWARE LICENSE: This source code document may be used
+// | by anyone for any purpose, and freely redistributed alone or in
+// | combination with other software, provided that the license is obeyed.
+// |
+// | There are only two ways to violate the license:
+// |
+// | 1. To redistribute this code in source form, with the copyright
+// | notice or license removed or altered. (Distributing in compiled
+// | forms without embedded copyright notices is permitted).
+// |
+// | 2. To redistribute modified versions of this code in *any* form
+// | that bears insufficient indications that the modifications are
+// | not the work of the original author(s).
+// |
+// | This license applies to this document only, not any other software
+// | that it may be combined with.
+// |
+// +----------------------------------------------------------------------+
+// | Contributors:
+// | https://www.anuko.com/time_tracker/credits.htm
+// +----------------------------------------------------------------------+
+
+require_once('initialize.php');
+import('ttRoleHelper');
+import('form.Form');
+
+// Access check.
+if (!ttAccessCheck(right_manage_team)) {
+ header('Location: access_denied.php');
+ exit();
+}
+
+$cl_role_id = (int)$request->getParameter('id');
+$role = ttRoleHelper::get($cl_role_id);
+$role_to_delete = $role['name'];
+
+$form = new Form('roleDeleteForm');
+$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$cl_role_id));
+$form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->getKey('label.delete')));
+$form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->getKey('button.cancel')));
+
+if ($request->isPost()) {
+ if ($request->getParameter('btn_delete')) {
+ if(ttRoleHelper::get($cl_role_id)) {
+ if (ttRoleHelper::delete($cl_role_id)) {
+ header('Location: roles.php');
+ exit();
+ } else
+ $err->add($i18n->getKey('error.db'));
+ } else
+ $err->add($i18n->getKey('error.db'));
+ } elseif ($request->getParameter('btn_cancel')) {
+ header('Location: roles.php');
+ exit();
+ }
+} // isPost
+
+$smarty->assign('role_to_delete', $role_to_delete);
+$smarty->assign('forms', array($form->getName()=>$form->toArray()));
+$smarty->assign('onload', 'onLoad="document.taskDeleteForm.btn_cancel.focus()"');
+$smarty->assign('title', $i18n->getKey('title.delete_role'));
+$smarty->assign('content_page_name', 'role_delete.tpl');
+$smarty->display('index.tpl');
$smarty->assign('active_roles', ttTeamHelper::getActiveRoles($user->team_id));
$smarty->assign('inactive_roles', ttTeamHelper::getInactiveRoles($user->team_id));
-$smarty->assign('title', $i18n->getKey('label.roles'));
+$smarty->assign('title', $i18n->getKey('title.roles'));
$smarty->assign('content_page_name', 'roles.tpl');
$smarty->display('index.tpl');
}
$cl_task_id = (int)$request->getParameter('id');
-$task = ttTaskHelper::getTask($cl_task_id);
+$task = ttTaskHelper::get($cl_task_id);
$task_to_delete = $task['name'];
$form = new Form('taskDeleteForm');
if ($request->isPost()) {
if ($request->getParameter('btn_delete')) {
- if(ttTaskHelper::getTask($cl_task_id)) {
+ if(ttTaskHelper::get($cl_task_id)) {
if (ttTaskHelper::delete($cl_task_id)) {
header('Location: tasks.php');
exit();
$cl_status = $request->getParameter('status');
$cl_projects = $request->getParameter('projects');
} else {
- $task = ttTaskHelper::getTask($cl_task_id);
+ $task = ttTaskHelper::get($cl_task_id);
$cl_name = $task['name'];
$cl_description = $task['description'];
$cl_status = $task['status'];