From ecbf1ecf19bfeb85794717fc7a6deb7ecc8c5f58 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sun, 25 Feb 2018 19:35:45 +0000 Subject: [PATCH] Added capability to add custom roles - work in progress. --- WEB-INF/lib/ttExportHelper.class.php | 2 +- WEB-INF/lib/ttRoleHelper.class.php | 25 ++++++++- WEB-INF/lib/ttTeamHelper.class.php | 38 ++++++------- WEB-INF/resources/ca.lang.php | 4 ++ WEB-INF/resources/cs.lang.php | 4 ++ WEB-INF/resources/da.lang.php | 5 ++ WEB-INF/resources/de.lang.php | 5 ++ WEB-INF/resources/en.lang.php | 2 + WEB-INF/resources/es.lang.php | 4 ++ WEB-INF/resources/et.lang.php | 4 ++ WEB-INF/resources/fa.lang.php | 5 ++ WEB-INF/resources/fi.lang.php | 5 ++ WEB-INF/resources/fr.lang.php | 5 ++ WEB-INF/resources/he.lang.php | 5 ++ WEB-INF/resources/hu.lang.php | 4 ++ WEB-INF/resources/it.lang.php | 5 ++ WEB-INF/resources/ja.lang.php | 5 ++ WEB-INF/resources/ko.lang.php | 4 ++ WEB-INF/resources/nl.lang.php | 9 ++- WEB-INF/resources/no.lang.php | 4 ++ WEB-INF/resources/pl.lang.php | 5 ++ WEB-INF/resources/pt-br.lang.php | 5 ++ WEB-INF/resources/pt.lang.php | 4 ++ WEB-INF/resources/ro.lang.php | 4 ++ WEB-INF/resources/ru.lang.php | 4 ++ WEB-INF/resources/sk.lang.php | 5 ++ WEB-INF/resources/sl.lang.php | 4 ++ WEB-INF/resources/sr.lang.php | 5 ++ WEB-INF/resources/sv.lang.php | 5 ++ WEB-INF/resources/tr.lang.php | 4 ++ WEB-INF/resources/zh-cn.lang.php | 4 ++ WEB-INF/resources/zh-tw.lang.php | 4 ++ WEB-INF/templates/footer.tpl | 2 +- WEB-INF/templates/role_add.tpl | 33 +++++++++++ WEB-INF/templates/roles.tpl | 8 ++- role_add.php | 83 ++++++++++++++++++++++++++++ 36 files changed, 296 insertions(+), 27 deletions(-) create mode 100644 WEB-INF/templates/role_add.tpl create mode 100644 role_add.php diff --git a/WEB-INF/lib/ttExportHelper.class.php b/WEB-INF/lib/ttExportHelper.class.php index cce9246e..ef13e2ee 100644 --- a/WEB-INF/lib/ttExportHelper.class.php +++ b/WEB-INF/lib/ttExportHelper.class.php @@ -291,7 +291,7 @@ class ttExportHelper { // Write roles. fwrite($file, "\n"); - $roles = ttTeamHelper::getRoles($user->team_id); + $roles = ttTeamHelper::getAllRoles($user->team_id); foreach ($roles as $role) { fwrite($file, "\t\n"); diff --git a/WEB-INF/lib/ttRoleHelper.class.php b/WEB-INF/lib/ttRoleHelper.class.php index 7e103943..f96d7c47 100644 --- a/WEB-INF/lib/ttRoleHelper.class.php +++ b/WEB-INF/lib/ttRoleHelper.class.php @@ -56,7 +56,7 @@ class ttRoleHelper { $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); @@ -68,6 +68,24 @@ class ttRoleHelper { 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; @@ -104,11 +122,12 @@ class ttRoleHelper { $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; diff --git a/WEB-INF/lib/ttTeamHelper.class.php b/WEB-INF/lib/ttTeamHelper.class.php index 3af484c8..2344fe32 100644 --- a/WEB-INF/lib/ttTeamHelper.class.php +++ b/WEB-INF/lib/ttTeamHelper.class.php @@ -269,7 +269,7 @@ class ttTeamHelper { $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')) { @@ -286,7 +286,7 @@ class ttTeamHelper { $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(); @@ -298,6 +298,23 @@ class ttTeamHelper { 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) { @@ -520,23 +537,6 @@ class ttTeamHelper { 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(); diff --git a/WEB-INF/resources/ca.lang.php b/WEB-INF/resources/ca.lang.php index 5da5aa50..6365f122 100644 --- a/WEB-INF/resources/ca.lang.php +++ b/WEB-INF/resources/ca.lang.php @@ -98,6 +98,7 @@ $i18n_key_words = array( // '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.', @@ -453,7 +454,10 @@ $i18n_key_words = array( // 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. diff --git a/WEB-INF/resources/cs.lang.php b/WEB-INF/resources/cs.lang.php index 411dc555..232ba89d 100644 --- a/WEB-INF/resources/cs.lang.php +++ b/WEB-INF/resources/cs.lang.php @@ -100,6 +100,7 @@ $i18n_key_words = array( // '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.', @@ -464,7 +465,10 @@ $i18n_key_words = array( // 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. diff --git a/WEB-INF/resources/da.lang.php b/WEB-INF/resources/da.lang.php index 6390680e..83cdc887 100644 --- a/WEB-INF/resources/da.lang.php +++ b/WEB-INF/resources/da.lang.php @@ -86,6 +86,8 @@ $i18n_key_words = array( '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.', @@ -405,7 +407,10 @@ $i18n_key_words = array( // 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', diff --git a/WEB-INF/resources/de.lang.php b/WEB-INF/resources/de.lang.php index eb2dfdac..b7b07d26 100644 --- a/WEB-INF/resources/de.lang.php +++ b/WEB-INF/resources/de.lang.php @@ -86,6 +86,8 @@ $i18n_key_words = array( '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.', @@ -403,7 +405,10 @@ $i18n_key_words = array( // 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', diff --git a/WEB-INF/resources/en.lang.php b/WEB-INF/resources/en.lang.php index b53e4836..e083f450 100644 --- a/WEB-INF/resources/en.lang.php +++ b/WEB-INF/resources/en.lang.php @@ -85,6 +85,7 @@ $i18n_key_words = array( '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.', @@ -396,6 +397,7 @@ $i18n_key_words = array( // 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', diff --git a/WEB-INF/resources/es.lang.php b/WEB-INF/resources/es.lang.php index 2adf12e5..d58791c8 100644 --- a/WEB-INF/resources/es.lang.php +++ b/WEB-INF/resources/es.lang.php @@ -96,6 +96,7 @@ $i18n_key_words = array( // '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.', @@ -463,7 +464,10 @@ $i18n_key_words = array( // 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. diff --git a/WEB-INF/resources/et.lang.php b/WEB-INF/resources/et.lang.php index 9663f5f2..1afc24bd 100644 --- a/WEB-INF/resources/et.lang.php +++ b/WEB-INF/resources/et.lang.php @@ -100,6 +100,7 @@ $i18n_key_words = array( // '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.', @@ -462,7 +463,10 @@ $i18n_key_words = array( // 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. diff --git a/WEB-INF/resources/fa.lang.php b/WEB-INF/resources/fa.lang.php index d1605891..3ce94e49 100644 --- a/WEB-INF/resources/fa.lang.php +++ b/WEB-INF/resources/fa.lang.php @@ -92,6 +92,8 @@ $i18n_key_words = array( '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 وارد شوید و تیم ایجاد کنید.', @@ -432,7 +434,10 @@ $i18n_key_words = array( // 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' => 'مشتری های فعال', diff --git a/WEB-INF/resources/fi.lang.php b/WEB-INF/resources/fi.lang.php index 639154e4..6e69c4c9 100644 --- a/WEB-INF/resources/fi.lang.php +++ b/WEB-INF/resources/fi.lang.php @@ -88,6 +88,8 @@ $i18n_key_words = array( '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.', @@ -412,7 +414,10 @@ $i18n_key_words = array( // 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', diff --git a/WEB-INF/resources/fr.lang.php b/WEB-INF/resources/fr.lang.php index e2babb37..772ea879 100644 --- a/WEB-INF/resources/fr.lang.php +++ b/WEB-INF/resources/fr.lang.php @@ -86,6 +86,8 @@ $i18n_key_words = array( '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.', @@ -402,7 +404,10 @@ $i18n_key_words = array( // 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', diff --git a/WEB-INF/resources/he.lang.php b/WEB-INF/resources/he.lang.php index a27e41ee..fd76b9e0 100644 --- a/WEB-INF/resources/he.lang.php +++ b/WEB-INF/resources/he.lang.php @@ -102,6 +102,8 @@ $i18n_key_words = array( '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' => 'בסיס הנתונים שלך ריק. התחבר כמנהל וצור צוות חדש', @@ -438,7 +440,10 @@ $i18n_key_words = array( // 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' => 'לקוחות פעילים', diff --git a/WEB-INF/resources/hu.lang.php b/WEB-INF/resources/hu.lang.php index a15c6812..517fc94b 100644 --- a/WEB-INF/resources/hu.lang.php +++ b/WEB-INF/resources/hu.lang.php @@ -97,6 +97,7 @@ $i18n_key_words = array( // '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.', @@ -455,7 +456,10 @@ $i18n_key_words = array( // 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. diff --git a/WEB-INF/resources/it.lang.php b/WEB-INF/resources/it.lang.php index beed939f..cc868122 100644 --- a/WEB-INF/resources/it.lang.php +++ b/WEB-INF/resources/it.lang.php @@ -87,6 +87,8 @@ $i18n_key_words = array( '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.', @@ -405,7 +407,10 @@ $i18n_key_words = array( // 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', diff --git a/WEB-INF/resources/ja.lang.php b/WEB-INF/resources/ja.lang.php index 669fe10c..1bc641e9 100644 --- a/WEB-INF/resources/ja.lang.php +++ b/WEB-INF/resources/ja.lang.php @@ -98,6 +98,8 @@ $i18n_key_words = array( // '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' => 'あなたのデータベースは空いています。管理者にログインして新規チームを作成してください。', @@ -455,7 +457,10 @@ $i18n_key_words = array( // 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. diff --git a/WEB-INF/resources/ko.lang.php b/WEB-INF/resources/ko.lang.php index 28117227..9fd64013 100644 --- a/WEB-INF/resources/ko.lang.php +++ b/WEB-INF/resources/ko.lang.php @@ -98,6 +98,7 @@ $i18n_key_words = array( // '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' => '당신의 데이터베이스는 비어있습니다. 관리자로 로그인하여 새로운 팀을 생성하십시오.', @@ -457,7 +458,10 @@ $i18n_key_words = array( // 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. diff --git a/WEB-INF/resources/nl.lang.php b/WEB-INF/resources/nl.lang.php index 89fec11b..91fb611f 100644 --- a/WEB-INF/resources/nl.lang.php +++ b/WEB-INF/resources/nl.lang.php @@ -85,6 +85,8 @@ $i18n_key_words = array( '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.', @@ -393,8 +395,13 @@ $i18n_key_words = array( // 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', diff --git a/WEB-INF/resources/no.lang.php b/WEB-INF/resources/no.lang.php index 04fe3c46..61078383 100644 --- a/WEB-INF/resources/no.lang.php +++ b/WEB-INF/resources/no.lang.php @@ -98,6 +98,7 @@ $i18n_key_words = array( '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.', @@ -452,7 +453,10 @@ $i18n_key_words = array( // 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. diff --git a/WEB-INF/resources/pl.lang.php b/WEB-INF/resources/pl.lang.php index 8889ec2a..389429fe 100644 --- a/WEB-INF/resources/pl.lang.php +++ b/WEB-INF/resources/pl.lang.php @@ -89,6 +89,8 @@ $i18n_key_words = array( '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ół.', @@ -415,7 +417,10 @@ $i18n_key_words = array( // 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', diff --git a/WEB-INF/resources/pt-br.lang.php b/WEB-INF/resources/pt-br.lang.php index 8b49b7b7..0b262ce1 100644 --- a/WEB-INF/resources/pt-br.lang.php +++ b/WEB-INF/resources/pt-br.lang.php @@ -87,6 +87,8 @@ $i18n_key_words = array( '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.', @@ -410,7 +412,10 @@ $i18n_key_words = array( // 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', diff --git a/WEB-INF/resources/pt.lang.php b/WEB-INF/resources/pt.lang.php index c8bb53c6..a9844715 100644 --- a/WEB-INF/resources/pt.lang.php +++ b/WEB-INF/resources/pt.lang.php @@ -96,6 +96,7 @@ $i18n_key_words = array( // '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.', @@ -440,7 +441,10 @@ $i18n_key_words = array( // 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. diff --git a/WEB-INF/resources/ro.lang.php b/WEB-INF/resources/ro.lang.php index f1ce0376..254fc5be 100644 --- a/WEB-INF/resources/ro.lang.php +++ b/WEB-INF/resources/ro.lang.php @@ -103,6 +103,7 @@ $i18n_key_words = array( // '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.', @@ -459,7 +460,10 @@ $i18n_key_words = array( // 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. diff --git a/WEB-INF/resources/ru.lang.php b/WEB-INF/resources/ru.lang.php index a612f95c..f234baf7 100644 --- a/WEB-INF/resources/ru.lang.php +++ b/WEB-INF/resources/ru.lang.php @@ -84,6 +84,7 @@ $i18n_key_words = array( 'error.task_exists' => 'Задача с таким названием уже есть.', 'error.client_exists' => 'Клиент с таким именем уже есть.', 'error.invoice_exists' => 'Счёт с таким номером уже есть.', +'error.role_exists' => 'Роль с таким рангом уже есть.', 'error.no_invoiceable_items' => 'Нет записей для включения в счёт.', 'error.no_login' => 'Нет пользователя с таким логином.', 'error.no_teams' => 'Ваша база данных пуста. Войдите в систему как администратор и создайте новую команду.', @@ -393,7 +394,10 @@ $i18n_key_words = array( // 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' => 'Клиент для удаления', diff --git a/WEB-INF/resources/sk.lang.php b/WEB-INF/resources/sk.lang.php index 25676d2e..87a224ac 100644 --- a/WEB-INF/resources/sk.lang.php +++ b/WEB-INF/resources/sk.lang.php @@ -91,6 +91,8 @@ $i18n_key_words = array( '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.', @@ -430,7 +432,10 @@ $i18n_key_words = array( // 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', diff --git a/WEB-INF/resources/sl.lang.php b/WEB-INF/resources/sl.lang.php index 839bdba8..43a33d17 100644 --- a/WEB-INF/resources/sl.lang.php +++ b/WEB-INF/resources/sl.lang.php @@ -95,6 +95,7 @@ $i18n_key_words = array( // '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.', @@ -435,7 +436,10 @@ $i18n_key_words = array( // 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. diff --git a/WEB-INF/resources/sr.lang.php b/WEB-INF/resources/sr.lang.php index 3bfa69c0..4fa8325d 100644 --- a/WEB-INF/resources/sr.lang.php +++ b/WEB-INF/resources/sr.lang.php @@ -86,6 +86,8 @@ $i18n_key_words = array( '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.', @@ -413,7 +415,10 @@ $i18n_key_words = array( // 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', diff --git a/WEB-INF/resources/sv.lang.php b/WEB-INF/resources/sv.lang.php index ae5e2d33..9136be47 100644 --- a/WEB-INF/resources/sv.lang.php +++ b/WEB-INF/resources/sv.lang.php @@ -87,6 +87,8 @@ $i18n_key_words = array( '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.', @@ -410,7 +412,10 @@ $i18n_key_words = array( // 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', diff --git a/WEB-INF/resources/tr.lang.php b/WEB-INF/resources/tr.lang.php index dc15a2e6..da1359c7 100644 --- a/WEB-INF/resources/tr.lang.php +++ b/WEB-INF/resources/tr.lang.php @@ -105,6 +105,7 @@ $i18n_key_words = array( // '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.', @@ -470,7 +471,10 @@ $i18n_key_words = array( // 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. diff --git a/WEB-INF/resources/zh-cn.lang.php b/WEB-INF/resources/zh-cn.lang.php index 3ab0904a..819bda4d 100644 --- a/WEB-INF/resources/zh-cn.lang.php +++ b/WEB-INF/resources/zh-cn.lang.php @@ -91,6 +91,7 @@ $i18n_key_words = array( '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' => '您的数据库没有任何记录。请以管理员身份登录并创建一个新团队。', @@ -442,7 +443,10 @@ $i18n_key_words = array( // 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. diff --git a/WEB-INF/resources/zh-tw.lang.php b/WEB-INF/resources/zh-tw.lang.php index b9e73bae..0db33200 100644 --- a/WEB-INF/resources/zh-tw.lang.php +++ b/WEB-INF/resources/zh-tw.lang.php @@ -96,6 +96,7 @@ $i18n_key_words = array( // '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' => '您的資料庫沒有任何記錄。請以管理員身份登錄並創建一個新團隊。', @@ -451,7 +452,10 @@ $i18n_key_words = array( // 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. diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 43029028..0589a0cb 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- {/if} - + + @@ -19,6 +20,7 @@ {foreach $active_roles as $role} + @@ -39,7 +41,8 @@
 Anuko Time Tracker 1.17.32.4029 | Copyright © Anuko | +  Anuko Time Tracker 1.17.32.4030 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/role_add.tpl b/WEB-INF/templates/role_add.tpl new file mode 100644 index 00000000..6a56fd25 --- /dev/null +++ b/WEB-INF/templates/role_add.tpl @@ -0,0 +1,33 @@ +{$forms.roleForm.open} + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
{$i18n.label.thing_name} (*):{$forms.roleForm.name.control}
{$i18n.label.description}:{$forms.roleForm.description.control}
{$i18n.form.roles.rank}:{$forms.roleForm.rank.control} {$i18n.label.what_is_it}
{$i18n.label.required_fields}
{$forms.roleForm.btn_submit.control}
 
+
+{$forms.roleForm.close} diff --git a/WEB-INF/templates/roles.tpl b/WEB-INF/templates/roles.tpl index ead3ad3e..ba3328c5 100644 --- a/WEB-INF/templates/roles.tpl +++ b/WEB-INF/templates/roles.tpl @@ -10,7 +10,8 @@
{$i18n.form.roles.active_roles}
{$i18n.label.thing_name}{$i18n.label.thing_name}{$i18n.form.roles.rank} {$i18n.label.description} {$i18n.label.edit} {$i18n.label.delete}
{$role.name|escape}{$role.rank} {$role.description|escape} {$i18n.label.edit} {$i18n.label.delete}
- + + @@ -47,6 +50,7 @@ {foreach $inactive_roles as $role} + diff --git a/role_add.php b/role_add.php new file mode 100644 index 00000000..71220089 --- /dev/null +++ b/role_add.php @@ -0,0 +1,83 @@ +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'); -- 2.20.1
{$i18n.form.roles.inactive_roles}
{$i18n.label.thing_name}{$i18n.label.thing_name}{$i18n.form.roles.rank} {$i18n.label.description} {$i18n.label.edit} {$i18n.label.delete}
{$role.name|escape}{$role.rank} {$role.description|escape} {$i18n.label.edit} {$i18n.label.delete}