// Write roles.
fwrite($file, "<roles>\n");
- $roles = ttTeamHelper::getRoles($user->team_id);
+ $roles = ttTeamHelper::getAllRoles($user->team_id);
foreach ($roles as $role) {
fwrite($file, "\t<role rank=\"".$role['rank']."\"".
" rights=\"".$role['rights']."\">\n");
$mdb2 = getConnection();
global $user;
- $sql = "select id from tt_roless where team_id = $user->team_id and name = ".
+ $sql = "select id from tt_roles where team_id = $user->team_id and name = ".
$mdb2->quote($role_name)." and (status = 1 or status = 0)";
$res = $mdb2->query($sql);
return false;
}
+ // The getRoleByRank looks up a role by its rank.
+ static function getRoleByRank($rank) {
+ global $user;
+ $mdb2 = getConnection();
+
+ $rank = (int) $rank; // Cast to int just in case for better security.
+
+ $sql = "select id from tt_roles where team_id = $user->team_id and rank = $rank and (status = 1 or status = 0)";
+ $res = $mdb2->query($sql);
+
+ if (!is_a($res, 'PEAR_Error')) {
+ $val = $res->fetchRow();
+ if ($val['id'])
+ return $val;
+ }
+ return false;
+ }
+
// update function updates a role in the database.
static function update($fields) {
global $user;
$team_id = (int) $fields['team_id'];
$name = $fields['name'];
$rank = (int) $fields['rank'];
+ $description = $fields['description'];
$rights = $fields['rights'];
$status = $fields['status'];
- $sql = "insert into tt_roles (team_id, name, rank, rights, status)
- values ($team_id, ".$mdb2->quote($name).", $rank, ".$mdb2->quote($rights).", ".$mdb2->quote($status).")";
+ $sql = "insert into tt_roles (team_id, name, rank, description, rights, status)
+ values ($team_id, ".$mdb2->quote($name).", $rank, ".$mdb2->quote($description).", ".$mdb2->quote($rights).", ".$mdb2->quote($status).")";
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error'))
return false;
$result = array();
$mdb2 = getConnection();
- $sql = "select id, name, description from tt_roles where team_id = $team_id and status = 1 order by rank";
+ $sql = "select id, name, rank, description from tt_roles where team_id = $team_id and status = 1 order by rank";
$res = $mdb2->query($sql);
$result = array();
if (!is_a($res, 'PEAR_Error')) {
$result = array();
$mdb2 = getConnection();
- $sql = "select id, name, description from tt_roles
+ $sql = "select id, name, rank, description from tt_roles
where team_id = $team_id and status = 0 order by rank";
$res = $mdb2->query($sql);
$result = array();
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)
{
return false;
}
- // getRoles - obtains all roles defined for team.
- static function getRoles($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;
- }
-
// getExpenseItems - obtains all expense items for all users in team.
static function getExpenseItems($team_id) {
$mdb2 = getConnection();
// 'error.task_exists' => 'Task with this name already exists.',
// 'error.client_exists' => 'Client with this name already exists.',
// 'error.invoice_exists' => 'Invoice with this number already exists.',
+// 'error.role_exists' => 'Role with this rank already exists.',
// 'error.no_invoiceable_items' => 'There are no invoiceable items.',
// 'error.no_login' => 'No user with this login.',
'error.no_teams' => 'La seva base de dades està buida. Iniciï sessió com a administrador i creï un nou grup.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
// TODO: translate the following.
// 'error.task_exists' => 'Task with this name already exists.',
// 'error.client_exists' => 'Client with this name already exists.',
// 'error.invoice_exists' => 'Invoice with this number already exists.',
+// 'error.role_exists' => 'Role with this rank already exists.',
// 'error.no_invoiceable_items' => 'There are no invoiceable items.',
// 'error.no_login' => 'No user with this login.',
'error.no_teams' => 'Vaše databáze je prázdná. Přihlašte se jako admin a vytvořte nový tým.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
// TODO: translate the following.
'error.task_exists' => 'Opgavenavn eksistere allerede.',
'error.client_exists' => 'Der eksistere allerede en klient med dette navn.',
'error.invoice_exists' => 'Fakturanummer eksistere allerede.',
+// TODO: translate the following.
+// 'error.role_exists' => 'Role with this rank already exists.',
'error.no_invoiceable_items' => 'Der er ingen fakturerbar emner.',
'error.no_login' => 'Der finde ingen bruger med dette brugernavn.',
'error.no_teams' => 'Din database er tom, log ind som administrator og lav et nyt team.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
'form.clients.active_clients' => 'Aktive Klienter',
'error.task_exists' => 'Task mit diesem Namen existiert bereits.',
'error.client_exists' => 'Der Kunde mit dem Namen existiert schon.',
'error.invoice_exists' => 'Rechnung mit dieser Nummer existiert bereits.',
+// TODO: translate the following.
+// 'error.role_exists' => 'Role with this rank already exists.',
'error.no_invoiceable_items' => 'Keine Einträge zur Rechnungsstellung gefunden.',
'error.no_login' => 'Benutzer mit diesen Anmeldedaten nicht vorhanden.',
'error.no_teams' => 'Die Datenbank ist leer. Als Administrator anmelden und ein neues Team erzeugen.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
'form.clients.active_clients' => 'Aktive Kunden',
'error.task_exists' => 'Task with this name already exists.',
'error.client_exists' => 'Client with this name already exists.',
'error.invoice_exists' => 'Invoice with this number already exists.',
+'error.role_exists' => 'Role with this rank already exists.',
'error.no_invoiceable_items' => 'There are no invoiceable items.',
'error.no_login' => 'No user with this login.',
'error.no_teams' => 'Your database is empty. Login as admin and create a new team.',
// Roles form. See example at https://timetracker.anuko.com/roles.php
'form.roles.active_roles' => 'Active Roles',
'form.roles.inactive_roles' => 'Inactive Roles',
+'form.roles.rank' => 'Rank',
'form.roles.rights' => 'Rights',
'form.roles.assigned' => 'Assigned',
'form.roles.not_assigned' => 'Not assigned',
// 'error.task_exists' => 'Task with this name already exists.',
// 'error.client_exists' => 'Client with this name already exists.',
// 'error.invoice_exists' => 'Invoice with this number already exists.',
+// 'error.role_exists' => 'Role with this rank already exists.',
// 'error.no_invoiceable_items' => 'There are no invoiceable items.',
// 'error.no_login' => 'No user with this login.',
'error.no_teams' => 'Su base de datos esta vacía. Inicie sesión como administrador y cree un nuevo grupo.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
// TODO: translate the following.
// 'error.task_exists' => 'Task with this name already exists.',
// 'error.client_exists' => 'Client with this name already exists.',
// 'error.invoice_exists' => 'Invoice with this number already exists.',
+// 'error.role_exists' => 'Role with this rank already exists.',
// 'error.no_invoiceable_items' => 'There are no invoiceable items.',
// 'error.no_login' => 'No user with this login.',
'error.no_teams' => 'Sinu andmebaas on tühi. Logi adminina sisse ja loo uus meeskond.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
// TODO: translate the following.
'error.task_exists' => 'وظیفه ای با این نام هم اکنون وجود دارد.',
'error.client_exists' => 'مشتری با این نام هم اکنون وجود دارد.',
'error.invoice_exists' => 'فاکتوری با این شماره هم اکنون موجود است.',
+// TODO: translate the following.
+// 'error.role_exists' => 'Role with this rank already exists.',
'error.no_invoiceable_items' => 'آیتمی جهت فاکتور کردن وجود ندارد.',
'error.no_login' => 'کاربری با این نام کاربری موجود نیست.',
'error.no_teams' => 'پایگاه داده شما خالی است با کاربر admin وارد شوید و تیم ایجاد کنید.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
'form.clients.active_clients' => 'مشتری های فعال',
'error.task_exists' => 'Tämän niminen tehtävä on jo olemassa.',
'error.client_exists' => 'Tämän niminen asiakas on jo olemassa.',
'error.invoice_exists' => 'Tällä numerolla oleva lasku on jo olemassa.',
+// TODO: translate the following.
+// 'error.role_exists' => 'Role with this rank already exists.',
'error.no_invoiceable_items' => 'Ei laskutettavia syötteitä.',
'error.no_login' => 'Tuntematon käyttäjänimi.',
'error.no_teams' => 'Tietokanta on tyhjä. Kirjaudu ylläpitäjänä ja luo uusi tiimi.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
'form.clients.active_clients' => 'Aktiiviset asiakkaat',
'error.task_exists' => 'Une tâche avec ce nom existe déjà.',
'error.client_exists' => 'Un client avec ce nom existe déjà.',
'error.invoice_exists' => 'Une facture avec ce numéro existe déjà.',
+// TODO: translate the following.
+// 'error.role_exists' => 'Role with this rank already exists.',
'error.no_invoiceable_items' => 'Il n\\\'y a pas d\\\'éléments à facturer.',
'error.no_login' => 'Aucun utilisateur avec cet identifiant.',
'error.no_teams' => 'Votre base de données est vide. Connectez-vous comme administrateur et créez une nouvelle équipe.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
'form.clients.active_clients' => 'Clients actifs',
'error.task_exists' => 'קיימת משימה עם שם דומה',
'error.client_exists' => 'שם לקוח כבר קיים',
'error.invoice_exists' => 'קיימת חשבונית עם מספר זה',
+// TODO: translate the following.
+// 'error.role_exists' => 'Role with this rank already exists.',
'error.no_invoiceable_items' => 'אין פריטים לחיוב',
'error.no_login' => 'משתמש זה אינו קיים',
'error.no_teams' => 'בסיס הנתונים שלך ריק. התחבר כמנהל וצור צוות חדש',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
'form.clients.active_clients' => 'לקוחות פעילים',
// 'error.task_exists' => 'Task with this name already exists.',
// 'error.client_exists' => 'Client with this name already exists.',
// 'error.invoice_exists' => 'Invoice with this number already exists.',
+// 'error.role_exists' => 'Role with this rank already exists.',
// 'error.no_invoiceable_items' => 'There are no invoiceable items.',
// 'error.no_login' => 'No user with this login.',
// 'error.no_teams' => 'Your database is empty. Login as admin and create a new team.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
// TODO: translate the following.
'error.task_exists' => 'Esiste già un compito con questo nome.',
'error.client_exists' => 'Esiste già un cliente con questo nome.',
'error.invoice_exists' => 'Esiste già una fattura con questo numero.',
+// TODO: translate the following.
+// 'error.role_exists' => 'Role with this rank already exists.',
'error.no_invoiceable_items' => 'Non ci sono voci fatturabili.',
'error.no_login' => 'Non esiste un utente con questo username.',
'error.no_teams' => 'Il database è vuoto. Loggati come amministratore e crea un nuovo gruppo.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
'form.clients.active_clients' => 'Clienti attivi',
// 'error.task_exists' => 'Task with this name already exists.',
// 'error.client_exists' => 'Client with this name already exists.',
// 'error.invoice_exists' => 'Invoice with this number already exists.',
+// TODO: translate the following.
+// 'error.role_exists' => 'Role with this rank already exists.',
// 'error.no_invoiceable_items' => 'There are no invoiceable items.',
'error.no_login' => 'このログインと関連されたユーザーはいません。',
'error.no_teams' => 'あなたのデータベースは空いています。管理者にログインして新規チームを作成してください。',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
// TODO: translate the following.
// 'error.task_exists' => 'Task with this name already exists.',
// 'error.client_exists' => 'Client with this name already exists.',
// 'error.invoice_exists' => 'Invoice with this number already exists.',
+// 'error.role_exists' => 'Role with this rank already exists.',
// 'error.no_invoiceable_items' => 'There are no invoiceable items.',
'error.no_login' => '본 로그인과 연계된 사용자가 없습니다.',
'error.no_teams' => '당신의 데이터베이스는 비어있습니다. 관리자로 로그인하여 새로운 팀을 생성하십시오.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
// TODO: translate the following.
'error.task_exists' => 'Er bestaat al een taak met deze naam.',
'error.client_exists' => 'Een klant met deze naam bestaat al.',
'error.invoice_exists' => 'Dit nummer is al eens toegekend aan een factuur.',
+// TODO: translate the following.
+// 'error.role_exists' => 'Role with this rank already exists.',
'error.no_invoiceable_items' => 'Er zijn geen factuureerbare onderdelen.',
'error.no_login' => 'Een medewerker met deze inlognaam bestaat niet.',
'error.no_teams' => 'Uw database is leeg. Meld je aan als admin en maak een nieuw team.',
// Roles form. See example at https://timetracker.anuko.com/roles.php
'form.roles.active_roles' => 'Actieve rollen',
-'form.roles.inactive_roles' => 'Inactieve Rollen',
+'form.roles.inactive_roles' => 'Inactieve rollen',
+// TODO: translate the following.
+// 'form.roles.rank' => 'Rank',
'form.roles.rights' => 'Rechten',
+// TODO: translate the following.
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
'form.clients.active_clients' => 'Actieve klanten',
'error.client_exists' => 'En klient med dette navnet er allerede opprettet.',
// TODO: translate the following.
// 'error.invoice_exists' => 'Invoice with this number already exists.',
+// 'error.role_exists' => 'Role with this rank already exists.',
// 'error.no_invoiceable_items' => 'There are no invoiceable items.',
'error.no_login' => 'Det er ingen bruker med dette brukernavnet.',
'error.no_teams' => 'Databasen din er tom. Logg inn som admin og opprett et nytt team.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
// TODO: translate the following.
'error.task_exists' => 'Zadanie o takiej nazwie już istnieje.',
'error.client_exists' => 'Klient o takiej nazwie już istnieje.',
'error.invoice_exists' => 'Faktura o tym numerze już istnieje.',
+// TODO: translate the following.
+// 'error.role_exists' => 'Role with this rank already exists.',
'error.no_invoiceable_items' => 'Brak przedmiotów do faktury.',
'error.no_login' => 'Użytkownik o takiej nazwie nie istnieje.',
'error.no_teams' => 'Twoja baza danych jest pusta. Zaloguj się jako administrator i stwórz nowy zespół.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.phpp
'form.clients.active_clients' => 'Aktywni klienci',
'error.task_exists' => 'Já existe tarefa com este nome.',
'error.client_exists' => 'Já existe cliente com este nome.',
'error.invoice_exists' => 'Já existe fatura com este número.',
+// TODO: translate the following.
+// 'error.role_exists' => 'Role with this rank already exists.',
'error.no_invoiceable_items' => 'Não há items faturáveis.',
'error.no_login' => 'Não há usuário com este login.',
'error.no_teams' => 'Sua base de dados está vazia. Entre como admin e crie uma equipe nova.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
'form.clients.active_clients' => 'Clientes ativos',
// 'error.task_exists' => 'Task with this name already exists.',
// 'error.client_exists' => 'Client with this name already exists.',
// 'error.invoice_exists' => 'Invoice with this number already exists.',
+// 'error.role_exists' => 'Role with this rank already exists.',
// 'error.no_invoiceable_items' => 'There are no invoiceable items.',
// 'error.no_login' => 'No user with this login.',
// 'error.no_teams' => 'Your database is empty. Login as admin and create a new team.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
// TODO: translate the following.
// 'error.task_exists' => 'Task with this name already exists.',
// 'error.client_exists' => 'Client with this name already exists.',
// 'error.invoice_exists' => 'Invoice with this number already exists.',
+// 'error.role_exists' => 'Role with this rank already exists.',
// 'error.no_invoiceable_items' => 'There are no invoiceable items.',
// 'error.no_login' => 'No user with this login.',
'error.no_teams' => 'Baza de date este goala. Intra ca admin si adauga o noua echipa.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
// TODO: translate the following.
'error.task_exists' => 'Задача с таким названием уже есть.',
'error.client_exists' => 'Клиент с таким именем уже есть.',
'error.invoice_exists' => 'Счёт с таким номером уже есть.',
+'error.role_exists' => 'Роль с таким рангом уже есть.',
'error.no_invoiceable_items' => 'Нет записей для включения в счёт.',
'error.no_login' => 'Нет пользователя с таким логином.',
'error.no_teams' => 'Ваша база данных пуста. Войдите в систему как администратор и создайте новую команду.',
// Roles form. See example at https://timetracker.anuko.com/roles.php
'form.roles.active_roles' => 'Активные роли',
'form.roles.inactive_roles' => 'Неактивные роли',
+'form.roles.rank' => 'Ранг',
'form.roles.rights' => 'Права',
+'form.roles.assigned' => 'Присвоены',
+'form.roles.not_assigned' => 'Не присвоены',
// Deleting Client form. See example at https://timetracker.anuko.com/client_delete.php
'form.client.client_to_delete' => 'Клиент для удаления',
'error.task_exists' => 'Úloha s týmto názvom už existuje.',
'error.client_exists' => 'Klient s týmto menom už existuje.',
'error.invoice_exists' => 'Faktúra s týmto číslom už existuje.',
+// TODO: translate the following.
+// 'error.role_exists' => 'Role with this rank already exists.',
'error.no_invoiceable_items' => 'Neexistujú položky, ktoré by bolo možné fakturovať.',
'error.no_login' => 'Neexistuje používateľ s týmto prihlasovacím menom.',
'error.no_teams' => 'Vaša databáza je prázdna. Prihláste sa ako admin a vytvorte nový tím.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
'form.clients.active_clients' => 'Aktívny klienti',
// 'error.task_exists' => 'Task with this name already exists.',
// 'error.client_exists' => 'Client with this name already exists.',
// 'error.invoice_exists' => 'Invoice with this number already exists.',
+// 'error.role_exists' => 'Role with this rank already exists.',
// 'error.no_invoiceable_items' => 'There are no invoiceable items.',
// 'error.no_login' => 'No user with this login.',
// 'error.no_teams' => 'Your database is empty. Login as admin and create a new team.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
// TODO: translate the following.
'error.task_exists' => 'Zadatak pod ovim nazivom već postoji.',
'error.client_exists' => 'Klijent pod ovim imenom već postoji.',
'error.invoice_exists' => 'Račun pod ovim brojem već postoji.',
+// TODO: translate the following.
+// 'error.role_exists' => 'Role with this rank already exists.',
'error.no_invoiceable_items' => 'Nema stavke za naplatu.',
'error.no_login' => 'Nema korisnika pod ovom prijavom',
'error.no_teams' => 'Vaša baza podataka je prazna. Prijavite se kao administrator i napravite novi tim.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Forma klijenata. Pogledajte primer na https://timetracker.anuko.com/clients.php
'form.clients.active_clients' => 'Aktivni klijent',
'error.task_exists' => 'Det finns redan en arbetsuppgift med det här namnet.',
'error.client_exists' => 'Det finns redan en kund med det här namnet.',
'error.invoice_exists' => 'Det finns redan en faktura med det här numret.',
+// TODO: translate the following.
+// 'error.role_exists' => 'Role with this rank already exists.',
'error.no_invoiceable_items' => 'Det finns inga debiterbara tidsregistreringar.',
'error.no_login' => 'Det finns ingen användare med det här användarnamnet.',
'error.no_teams' => 'Databasen är tom. Logga in som administratör och skapa en ny arbetsgrupp.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
'form.clients.active_clients' => 'Aktiva kunder',
// 'error.task_exists' => 'Task with this name already exists.',
// 'error.client_exists' => 'Client with this name already exists.',
// 'error.invoice_exists' => 'Invoice with this number already exists.',
+// 'error.role_exists' => 'Role with this rank already exists.',
// 'error.no_invoiceable_items' => 'There are no invoiceable items.',
// 'error.no_login' => 'No user with this login.',
'error.no_teams' => 'Veritabanınız boş. Yeni bir ekip yaratmak için yönetici olarak giriş yapın.',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
// TODO: translate the following.
'error.client_exists' => '具有此名称的客户端已经存在。',
// TODO: translate the following.
// 'error.invoice_exists' => 'Invoice with this number already exists.',
+// 'error.role_exists' => 'Role with this rank already exists.',
// 'error.no_invoiceable_items' => 'There are no invoiceable items.',
'error.no_login' => '没有该登录信息的用户。',
'error.no_teams' => '您的数据库没有任何记录。请以管理员身份登录并创建一个新团队。',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
// TODO: translate the following.
// 'error.task_exists' => 'Task with this name already exists.',
// 'error.client_exists' => 'Client with this name already exists.',
// 'error.invoice_exists' => 'Invoice with this number already exists.',
+// 'error.role_exists' => 'Role with this rank already exists.',
// 'error.no_invoiceable_items' => 'There are no invoiceable items.',
'error.no_login' => '沒有該登錄資訊的使用者。',
'error.no_teams' => '您的資料庫沒有任何記錄。請以管理員身份登錄並創建一個新團隊。',
// TODO: translate the following.
// 'form.roles.active_roles' => 'Active Roles',
// 'form.roles.inactive_roles' => 'Inactive Roles',
+// 'form.roles.rank' => 'Rank',
// 'form.roles.rights' => 'Rights',
+// 'form.roles.assigned' => 'Assigned',
+// 'form.roles.not_assigned' => 'Not assigned',
// Clients form. See example at https://timetracker.anuko.com/clients.php
// TODO: translate the following.
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.17.32.4029 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.17.32.4030 | 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.roleForm.open}
+<table cellspacing="4" cellpadding="7" border="0">
+ <tr>
+ <td>
+ <table cellspacing="1" cellpadding="2" border="0">
+ <tr>
+ <td align="right">{$i18n.label.thing_name} (*):</td>
+ <td>{$forms.roleForm.name.control}</td>
+ </tr>
+ <tr>
+ <td align = "right">{$i18n.label.description}:</td>
+ <td>{$forms.roleForm.description.control}</td>
+ </tr>
+ <tr>
+ <td align = "right">{$i18n.form.roles.rank}:</td>
+ <td>{$forms.roleForm.rank.control} <a href="https://www.anuko.com/lp/tt_20.htm" target="_blank">{$i18n.label.what_is_it}</a></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>{$i18n.label.required_fields}</td>
+ </tr>
+ <tr>
+ <td colspan="2" align="center" height="50">{$forms.roleForm.btn_submit.control}</td>
+ </tr>
+ <tr>
+ <td></td>
+ <td> </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+{$forms.roleForm.close}
<tr><td class="sectionHeaderNoBorder">{$i18n.form.roles.active_roles}</td></tr>
{/if}
<tr>
- <td width="35%" class="tableHeader">{$i18n.label.thing_name}</td>
+ <td width="25%" class="tableHeader">{$i18n.label.thing_name}</td>
+ <td class="tableHeader">{$i18n.form.roles.rank}</td>
<td width="35%" class="tableHeader">{$i18n.label.description}</td>
<td class="tableHeader">{$i18n.label.edit}</td>
<td class="tableHeader">{$i18n.label.delete}</td>
{foreach $active_roles as $role}
<tr bgcolor="{cycle values="#f5f5f5,#ffffff"}">
<td>{$role.name|escape}</td>
+ <td>{$role.rank}</td>
<td>{$role.description|escape}</td>
<td><a href="role_edit.php?id={$role.id}">{$i18n.label.edit}</a></td>
<td><a href="role_delete.php?id={$role.id}">{$i18n.label.delete}</a></td>
<table cellspacing="1" cellpadding="3" border="0" width="100%">
<tr><td class="sectionHeaderNoBorder">{$i18n.form.roles.inactive_roles}</td></tr>
<tr>
- <td width="35%" class="tableHeader">{$i18n.label.thing_name}</td>
+ <td width="25%" class="tableHeader">{$i18n.label.thing_name}</td>
+ <td class="tableHeader">{$i18n.form.roles.rank}</td>
<td width="35%" class="tableHeader">{$i18n.label.description}</td>
<td class="tableHeader">{$i18n.label.edit}</td>
<td class="tableHeader">{$i18n.label.delete}</td>
{foreach $inactive_roles as $role}
<tr bgcolor="{cycle values="#f5f5f5,#ffffff"}">
<td>{$role.name|escape}</td>
+ <td>{$role.rank}</td>
<td>{$role.description|escape}</td>
<td><a href="role_edit.php?id={$role.id}">{$i18n.label.edit}</a></td>
<td><a href="role_delete.php?id={$role.id}">{$i18n.label.delete}</a></td>
--- /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('form.Form');
+import('ttTeamHelper');
+import('ttRoleHelper');
+
+// Access check.
+if (!ttAccessCheck(right_manage_team)) {
+ header('Location: access_denied.php');
+ exit();
+}
+
+if ($request->isPost()) {
+ $cl_name = trim($request->getParameter('name'));
+ $cl_description = trim($request->getParameter('description'));
+ $cl_rank = (int) $request->getParameter('rank');
+}
+
+$form = new Form('roleForm');
+$form->addInput(array('type'=>'text','maxlength'=>'100','name'=>'name','style'=>'width: 250px;','value'=>$cl_name));
+$form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: 250px; height: 40px;','value'=>$cl_description));
+for ($i = 0; $i < $user->role; $i++) {
+ $existing_role_name = null;
+ $rank_data[] = $i;
+}
+$form->addInput(array('type'=>'combobox','name'=>'rank','data'=>$rank_data));
+$form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->getKey('button.submit')));
+
+if ($request->isPost()) {
+ // Validate user input.
+ if (!ttValidString($cl_name)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.thing_name'));
+ if (!ttValidString($cl_description, true)) $err->add($i18n->getKey('error.field'), $i18n->getKey('label.description'));
+
+ if ($err->no()) {
+ $existing_role = ttRoleHelper::getRoleByRank($cl_rank);
+ if (!$existing_role) {
+ // Update role information.
+ if (ttRoleHelper::insert(array(
+ 'team_id' => $user->team_id,
+ 'name' => $cl_name,
+ 'rank' => $cl_rank,
+ 'description' => $cl_description,
+ 'status' => ACTIVE))) {
+ header('Location: roles.php');
+ exit();
+ } else
+ $err->add($i18n->getKey('error.db'));
+ } else
+ $err->add($i18n->getKey('error.role_exists'));
+ }
+} // isPost
+
+$smarty->assign('forms', array($form->getName()=>$form->toArray()));
+$smarty->assign('title', $i18n->getKey('title.add_role'));
+$smarty->assign('content_page_name', 'role_add.tpl');
+$smarty->display('index.tpl');