diff options
Diffstat (limited to 'includes/view')
-rw-r--r-- | includes/view/AngelTypes_view.php | 52 | ||||
-rw-r--r-- | includes/view/UserAngelTypes_view.php | 30 |
2 files changed, 80 insertions, 2 deletions
diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php index d71bbbfd..c9293903 100644 --- a/includes/view/AngelTypes_view.php +++ b/includes/view/AngelTypes_view.php @@ -1,4 +1,34 @@ <?php +/** + * AngelTypes + */ + +/** + * Render angeltype membership state + * + * @param UserAngelType $user_angeltype + * UserAngelType and AngelType + * @return string + */ +function AngelType_render_membership($user_angeltype) { + $membership = ""; + if ($user_angeltype['user_angeltype_id'] != null) { + if ($user_angeltype['restricted']) { + if ($user_angeltype['confirm_user_id'] == null) + $membership = '<img src="pic/icons/lock.png" alt="' . _("Unconfirmed") . '" title="' . _("Unconfirmed") . '"> ' . _("Unconfirmed"); + elseif ($user_angeltype['coordinator']) + $membership = '<img src="pic/icons/tick.png" alt="' . _("Coordinator") . '" title="' . _("Coordinator") . '"> ' . _("Coordinator"); + else + $membership = '<img src="pic/icons/tick.png" alt="' . _("Member") . '" title="' . _("Member") . '"> ' . _("Member"); + } elseif ($user_angeltype['coordinator']) + $membership = '<img src="pic/icons/tick.png" alt="' . _("Coordinator") . '" title="' . _("Coordinator") . '"> ' . _("Coordinator"); + else + $membership = '<img src="pic/icons/tick.png" alt="' . _("Member") . '" title="' . _("Member") . '"> ' . _("Member"); + } else { + $membership = '<img src="pic/icons/cross.png" alt="" title="">'; + } + return $membership; +} function AngelType_delete_view($angeltype) { return page(array( @@ -56,7 +86,7 @@ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angel // Team-Coordinators list missing - $page[] = '<h3>' . _("Members") . '</h3>'; + $coordinators = array(); $members_confirmed = array(); $members_unconfirmed = array(); foreach ($members as $member) { @@ -67,14 +97,34 @@ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angel '<a href="' . page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $member['user_angeltype_id'] . '" class="cancel">' . _("deny") . '</a>' )); $members_unconfirmed[] = $member; + } elseif ($member['coordinator']) { + if ($admin_angeltypes) + $member['actions'] = '<a href="' . page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $member['user_angeltype_id'] . '&coordinator=0" class="cancel">' . _("Remove coordinator rights") . '</a>'; + else + $member['actions'] = ''; + $coordinators[] = $member; } else { if ($admin_user_angeltypes) $member['actions'] = join(" ", array( + $admin_angeltypes ? '<a href="' . page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $member['user_angeltype_id'] . '&coordinator=1" class="add">' . _("Add coordinator rights") . '</a>' : '', '<a href="' . page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $member['user_angeltype_id'] . '" class="cancel">' . _("remove") . '</a>' )); $members_confirmed[] = $member; } } + if (count($coordinators) > 0) { + $page[] = '<h3>' . _("Coordinators") . '</h3>'; + $page[] = table(array( + 'Nick' => _("Nick"), + 'DECT' => _("DECT"), + 'actions' => "" + ), $coordinators); + } + $page[] = '<h3>' . _("Members") . '</h3>'; + if ($admin_user_angeltypes) + $page[] = buttons(array( + button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("Add"), 'add') + )); $page[] = table(array( 'Nick' => _("Nick"), 'DECT' => _("DECT"), diff --git a/includes/view/UserAngelTypes_view.php b/includes/view/UserAngelTypes_view.php index ed825c04..68bb1ec9 100644 --- a/includes/view/UserAngelTypes_view.php +++ b/includes/view/UserAngelTypes_view.php @@ -1,4 +1,14 @@ <?php +function UserAngelType_update_view($user_angeltype, $user, $angeltype, $coordinator) { + return page(array( + msg(), + info(sprintf($coordinator ? _("Do you really want to add coordinator rights for %s to %s?") : _("Do you really want to remove coordinator rights for %s from %s?"), $angeltype['name'], User_Nick_render($user)), true), + buttons(array( + button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'), + button(page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $user_angeltype['id'] . '&coordinator=' . ($coordinator ? '1' : '0') . '&confirmed', _("yes"), 'ok') + )) + )); +} function UserAngelTypes_delete_all_view($angeltype) { return page(array( @@ -44,7 +54,25 @@ function UserAngelType_delete_view($user_angeltype, $user, $angeltype) { )); } -function UserAngelType_add_view($user, $angeltype) { +function UserAngelType_add_view($angeltype, $users_source, $user_id) { + $users = array(); + foreach ($users_source as $user_source) + $users[$user_source['UID']] = User_Nick_render($user_source); + + return page(array( + msg(), + buttons(array( + button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("back"), 'back') + )), + form(array( + form_info(_("Angeltype"), $angeltype['name']), + form_select('user_id', _("User"), $users, $user_id), + form_submit('submit', _("Add")) + )) + )); +} + +function UserAngelType_join_view($user, $angeltype) { return page(array( msg(), info(sprintf(_("Do you really want to add %s to %s?"), User_Nick_render($user), $angeltype['name']), true), |