From: Nik Okuntseff Date: Fri, 23 Mar 2018 20:26:41 +0000 (+0000) Subject: Put a swap roles link on user_edit.php. X-Git-Tag: timetracker_1.19-1~962 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=a003ad003dfa29eb043c45f18e7f395cb3331aa5;p=timetracker.git Put a swap roles link on user_edit.php. --- diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index e0bbbe5a..0a104888 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -32,6 +32,7 @@ class ttUser { var $id = null; // User id. var $team_id = null; // Team id. var $role_id = null; // Role id. + var $role_name = null; // Role name. var $rank = null; // User role rank. var $client_id = null; // Client id for client user role. var $behalf_id = null; // User id, on behalf of whom we are working. @@ -71,7 +72,7 @@ class ttUser { $mdb2 = getConnection(); - $sql = "SELECT u.id, u.login, u.name, u.team_id, u.role_id, r.rank, r.rights, u.client_id, u.email, t.name as team_name, + $sql = "SELECT u.id, u.login, u.name, u.team_id, u.role_id, r.rank, r.name as role_name, r.rights, u.client_id, u.email, t.name as team_name, t.currency, t.lang, t.decimal_mark, t.date_format, t.time_format, t.week_start, t.tracking_mode, t.project_required, t.task_required, t.record_type, t.bcc_email, t.plugins, t.config, t.lock_spec, t.workday_minutes, t.custom_logo @@ -94,6 +95,7 @@ class ttUser { $this->id = $val['id']; $this->team_id = $val['team_id']; $this->role_id = $val['role_id']; + $this->role_name = $val['role_name']; $this->rights = explode(',', $val['rights']); $this->is_client = !in_array('track_own_time', $this->rights); $this->rank = $val['rank']; diff --git a/WEB-INF/resources/en.lang.php b/WEB-INF/resources/en.lang.php index ce65dc62..bedc4f6a 100644 --- a/WEB-INF/resources/en.lang.php +++ b/WEB-INF/resources/en.lang.php @@ -427,6 +427,7 @@ $i18n_key_words = array( 'form.teams.hint' => 'Create a new team by creating a new team manager account.
You can also import team data from an xml file from another Anuko Time Tracker server (no login collisions are allowed).', // Profile form. See example at https://timetracker.anuko.com/profile_edit.php. +'form.profile.swap_roles' => 'Swap roles', 'form.profile.12_hours' => '12 hours', 'form.profile.24_hours' => '24 hours', 'form.profile.show_holidays' => 'Show holidays', @@ -460,6 +461,7 @@ $i18n_key_words = array( 'form.quota.hint' => 'If values are empty, quotas are calculated automatically based on workday hours and holidays.', // Swap roles form. See example at https://timetracker.anuko.com/swap_roles.php. +'form.swap.hint' => 'Demote yourself to a lower role by swapping roles with someone else. This cannot be undone.', 'form.swap.swap_with' => 'Swap roles with', // Roles and rights. These strings are used in multiple places. Grouped here to provide consistent translations. diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 8f2c0a6c..6ca757e0 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.17.67.4146 | Copyright © Anuko | +  Anuko Time Tracker 1.17.68.4147 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/swap_roles.tpl b/WEB-INF/templates/swap_roles.tpl index d2d99240..b96334f0 100644 --- a/WEB-INF/templates/swap_roles.tpl +++ b/WEB-INF/templates/swap_roles.tpl @@ -1,8 +1,10 @@ {$forms.swapForm.open}
+ - + diff --git a/WEB-INF/templates/user_edit.tpl b/WEB-INF/templates/user_edit.tpl index 85e2cd44..15bf3fe2 100644 --- a/WEB-INF/templates/user_edit.tpl +++ b/WEB-INF/templates/user_edit.tpl @@ -104,6 +104,12 @@ function handleClientControl() { +{/if} +{if $user->id == $user_id} + + + + {/if}
{$i18n.form.swap.hint}
 
{$i18n.form.swap.swap_with}:{$i18n.form.swap.swap_with}: {$forms.swapForm.swap_with.control}
{$i18n.label.status}: {$forms.userForm.status.control}
{$i18n.form.users.role}:{$user->role_name} {if $user->can('swap_roles')}{$i18n.form.profile.swap_roles}{/if}
{$i18n.form.users.default_rate} (0{$user->decimal_mark}00):