From: Nik Okuntseff Date: Thu, 22 Feb 2018 19:23:07 +0000 (+0000) Subject: A bit more work in progress on roles. X-Git-Tag: timetracker_1.19-1~1098 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=983bd79a9542306ecbd0f1be372d7006e7b337e1;p=timetracker.git A bit more work in progress on roles. --- diff --git a/WEB-INF/lib/ttTeamHelper.class.php b/WEB-INF/lib/ttTeamHelper.class.php index 3b01415e..2ae75923 100644 --- a/WEB-INF/lib/ttTeamHelper.class.php +++ b/WEB-INF/lib/ttTeamHelper.class.php @@ -263,6 +263,41 @@ class ttTeamHelper { return false; } + // getActiveRoles - returns an array of active roles for team. + static function getActiveRoles($team_id) + { + $result = array(); + $mdb2 = getConnection(); + + $sql = "select id, name, rights from tt_roles where team_id = $team_id and status = 1 order by upper(name)"; + $res = $mdb2->query($sql); + $result = array(); + if (!is_a($res, 'PEAR_Error')) { + while ($val = $res->fetchRow()) { + $result[] = $val; + } + } + return $result; + } + + // getInactiveRoles - returns an array of inactive roles for team. + static function getInactiveRoles($team_id) + { + $result = array(); + $mdb2 = getConnection(); + + $sql = "select id, name, rights from tt_roles + where team_id = $team_id and status = 0 order by upper(name)"; + $res = $mdb2->query($sql); + $result = array(); + if (!is_a($res, 'PEAR_Error')) { + while ($val = $res->fetchRow()) { + $result[] = $val; + } + } + return $result; + } + // The getActiveClients returns an array of active clients for team. static function getActiveClients($team_id, $all_fields = false) { diff --git a/WEB-INF/resources/ca.lang.php b/WEB-INF/resources/ca.lang.php index 7dcf0e0a..88d59a56 100644 --- a/WEB-INF/resources/ca.lang.php +++ b/WEB-INF/resources/ca.lang.php @@ -453,6 +453,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 4e8d6860..7cd07f5d 100644 --- a/WEB-INF/resources/cs.lang.php +++ b/WEB-INF/resources/cs.lang.php @@ -466,6 +466,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 5514900b..5994d7f9 100644 --- a/WEB-INF/resources/da.lang.php +++ b/WEB-INF/resources/da.lang.php @@ -403,6 +403,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 84d3a537..872a543a 100644 --- a/WEB-INF/resources/de.lang.php +++ b/WEB-INF/resources/de.lang.php @@ -401,6 +401,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 2315da14..21a3fdf9 100644 --- a/WEB-INF/resources/en.lang.php +++ b/WEB-INF/resources/en.lang.php @@ -396,6 +396,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.rights' => 'Rights', // Clients form. See example at https://timetracker.anuko.com/clients.php 'form.clients.active_clients' => 'Active Clients', diff --git a/WEB-INF/resources/es.lang.php b/WEB-INF/resources/es.lang.php index b7085dcf..6c9d5024 100644 --- a/WEB-INF/resources/es.lang.php +++ b/WEB-INF/resources/es.lang.php @@ -464,6 +464,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 f16823c5..2011aae0 100644 --- a/WEB-INF/resources/et.lang.php +++ b/WEB-INF/resources/et.lang.php @@ -463,6 +463,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 b68518e5..40536a47 100644 --- a/WEB-INF/resources/fa.lang.php +++ b/WEB-INF/resources/fa.lang.php @@ -430,6 +430,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 c88cd45d..58a33405 100644 --- a/WEB-INF/resources/fi.lang.php +++ b/WEB-INF/resources/fi.lang.php @@ -410,6 +410,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 36087481..027fec25 100644 --- a/WEB-INF/resources/fr.lang.php +++ b/WEB-INF/resources/fr.lang.php @@ -400,6 +400,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 2cd8b800..3341f030 100644 --- a/WEB-INF/resources/he.lang.php +++ b/WEB-INF/resources/he.lang.php @@ -436,6 +436,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 b830ba71..f17db397 100644 --- a/WEB-INF/resources/hu.lang.php +++ b/WEB-INF/resources/hu.lang.php @@ -457,6 +457,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 dcd1b37b..3b04c35c 100644 --- a/WEB-INF/resources/it.lang.php +++ b/WEB-INF/resources/it.lang.php @@ -403,6 +403,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 aad7ff30..956fd561 100644 --- a/WEB-INF/resources/ja.lang.php +++ b/WEB-INF/resources/ja.lang.php @@ -454,6 +454,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 cd39cb13..bfa326b7 100644 --- a/WEB-INF/resources/ko.lang.php +++ b/WEB-INF/resources/ko.lang.php @@ -456,6 +456,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 b0890545..8149366d 100644 --- a/WEB-INF/resources/nl.lang.php +++ b/WEB-INF/resources/nl.lang.php @@ -399,6 +399,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 3778d695..79d24e04 100644 --- a/WEB-INF/resources/no.lang.php +++ b/WEB-INF/resources/no.lang.php @@ -452,6 +452,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 9c9c2974..39f37e38 100644 --- a/WEB-INF/resources/pl.lang.php +++ b/WEB-INF/resources/pl.lang.php @@ -413,6 +413,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 b8e4a91f..2a17b26d 100644 --- a/WEB-INF/resources/pt-br.lang.php +++ b/WEB-INF/resources/pt-br.lang.php @@ -408,6 +408,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 2aa049f7..cab935db 100644 --- a/WEB-INF/resources/pt.lang.php +++ b/WEB-INF/resources/pt.lang.php @@ -441,6 +441,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 ee1673c2..3a4d70a1 100644 --- a/WEB-INF/resources/ro.lang.php +++ b/WEB-INF/resources/ro.lang.php @@ -460,6 +460,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 aee9df75..42e0a8b8 100644 --- a/WEB-INF/resources/ru.lang.php +++ b/WEB-INF/resources/ru.lang.php @@ -394,6 +394,7 @@ $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.rights' => 'Права', // 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 df06ddfc..67b2bead 100644 --- a/WEB-INF/resources/sk.lang.php +++ b/WEB-INF/resources/sk.lang.php @@ -428,6 +428,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 ed728153..08b3d296 100644 --- a/WEB-INF/resources/sl.lang.php +++ b/WEB-INF/resources/sl.lang.php @@ -437,6 +437,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 14df2097..783093e3 100644 --- a/WEB-INF/resources/sr.lang.php +++ b/WEB-INF/resources/sr.lang.php @@ -411,6 +411,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 6529f6dc..7500d44c 100644 --- a/WEB-INF/resources/sv.lang.php +++ b/WEB-INF/resources/sv.lang.php @@ -408,6 +408,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 37c22540..ab9251b2 100644 --- a/WEB-INF/resources/tr.lang.php +++ b/WEB-INF/resources/tr.lang.php @@ -471,6 +471,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 a0ef26b0..63931636 100644 --- a/WEB-INF/resources/zh-cn.lang.php +++ b/WEB-INF/resources/zh-cn.lang.php @@ -441,6 +441,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 9e3944f4..2fd24066 100644 --- a/WEB-INF/resources/zh-tw.lang.php +++ b/WEB-INF/resources/zh-tw.lang.php @@ -450,6 +450,7 @@ $i18n_key_words = array( // TODO: translate the following. // 'form.roles.active_roles' => 'Active Roles', // 'form.roles.inactive_roles' => 'Inactive Roles', +// 'form.roles.rights' => 'Rights', // 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 069beb90..1acdad98 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.17.29.4013 | Copyright © Anuko | +  Anuko Time Tracker 1.17.29.4014 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/roles.tpl b/WEB-INF/templates/roles.tpl new file mode 100644 index 00000000..d703fef0 --- /dev/null +++ b/WEB-INF/templates/roles.tpl @@ -0,0 +1,67 @@ + + + + + + +
+ + {if $inactive_roles} + + {/if} + + + + + + + {if $active_roles} + {foreach $active_roles as $role} + + + + + + + {/foreach} + {/if} +
{$i18n.form.roles.active_roles}
{$i18n.label.thing_name}{$i18n.form.roles.rights}{$i18n.label.edit}{$i18n.label.delete}
{$role.name|escape}{$role.rights|escape}{$i18n.label.edit}{$i18n.label.delete}
+ + + + + +

+
+
+ + {if $inactive_roles} + + + + + + + + + {foreach $inactive_roles as $role} + + + + + + + {/foreach} +
{$i18n.form.roles.inactive_roles}
{$i18n.label.thing_name}{$i18n.form.roles.rights}{$i18n.label.edit}{$i18n.label.delete}
{$role.name|escape}{$role.rights|escape}{$i18n.label.edit}{$i18n.label.delete}
+ + + + + +

+
+
+ {/if} +
diff --git a/roles.php b/roles.php new file mode 100644 index 00000000..44255812 --- /dev/null +++ b/roles.php @@ -0,0 +1,43 @@ +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('content_page_name', 'roles.tpl'); +$smarty->display('index.tpl');