From ab450600d76f79190b956f7f74cbc6a04ebcdf71 Mon Sep 17 00:00:00 2001 From: Philip Häusler Date: Sun, 9 Mar 2014 16:00:13 +0100 Subject: better integration of angeltypes about --- includes/controller/angeltypes_controller.php | 9 ++++++--- includes/pages/guest_login.php | 17 ++++++++++++---- includes/view/AngelTypes_view.php | 28 ++++++++++++++++++++++----- 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php index 7566a80e..474540d6 100644 --- a/includes/controller/angeltypes_controller.php +++ b/includes/controller/angeltypes_controller.php @@ -44,13 +44,16 @@ function angeltypes_controller() { function angeltypes_about_controller() { global $privileges, $user; - $angeltypes = AngelTypes(); + if (isset($user)) + $angeltypes = AngelTypes_with_user($user); + else + $angeltypes = AngelTypes(); if ($angeltypes === false) engelsystem_error("Unable to load angeltypes."); return array( - _("Teams/Engeltypes description"), - AngelTypes_about_view($angeltypes) + _("Teams/Job description"), + AngelTypes_about_view($angeltypes, isset($user)) ); } diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php index 4540bffb..153c6450 100644 --- a/includes/pages/guest_login.php +++ b/includes/pages/guest_login.php @@ -210,16 +210,25 @@ function guest_login() { return page(array( msg(), - _("Resistance is futile! Your biological and physical parameters will be added to our collectiv! Assimilating angel:"), form(array( form_text('nick', _("Nick"), $nick), form_password('password', _("Password")), - form_submit('submit', _("Login")) + form_info("", buttons(array( + button(page_link_to('user_password_recovery'), _("I forgot my password")) + ))), + form_submit('submit', _("Login")), + info(_("Please note: You have to activate cookies!"), true) )), + '

' . register_title() . '

', + '

' . _("Please sign up, if you want to help us!") . '

', buttons(array( - button(page_link_to('user_password_recovery'), _("I forgot my password")) + button(page_link_to('register'), register_title() . ' »') )), - info(_("Please note: You have to activate cookies!"), true) + '

' . _("What can I do?") . '

', + '

' . _("Please read about the jobs you can do to help us.") . '

', + buttons(array( + button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description") . ' »') + )) )); } ?> diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php index 08305930..b98cb6f5 100644 --- a/includes/view/AngelTypes_view.php +++ b/includes/view/AngelTypes_view.php @@ -105,9 +105,10 @@ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angel function AngelTypes_list_view($angeltypes, $admin_angeltypes) { return page(array( msg(), - $admin_angeltypes ? buttons(array( - button(page_link_to('angeltypes') . '&action=edit', _("New angeltype"), 'add') - )) : '', + buttons(array( + $admin_angeltypes ? button(page_link_to('angeltypes') . '&action=edit', _("New angeltype"), 'add') : '', + button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description")) + )), table(array( 'name' => _("Name"), 'restricted' => '' . _(', @@ -117,13 +118,30 @@ function AngelTypes_list_view($angeltypes, $admin_angeltypes) { )); } -function AngelTypes_about_view($angeltypes) { +function AngelTypes_about_view($angeltypes, $user_logged_in) { + global $faq_url; + $content = array( - '

' . _("Here is the list of teams and their tasks:") . '

' + buttons(array( + ! $user_logged_in ? button(page_link_to('register'), register_title()) : '', + ! $user_logged_in ? button(page_link_to('login'), login_title()) : '', + button($faq_url, _("FAQ")) + )), + '

' . _("Here is the list of teams and their tasks. If you have questions, read the FAQ.") . '

' ); $parsedown = new Parsedown(); foreach ($angeltypes as $angeltype) { $content[] = '

' . $angeltype['name'] . '

'; + + if (isset($angeltype['user_angeltype_id'])) { + $buttons = array(); + if ($angeltype['user_angeltype_id'] != null) + $buttons[] = button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'], _("leave"), 'cancel'); + else + $buttons[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), 'add'); + $content[] = buttons($buttons); + } + if ($angeltype['restricted']) $content[] = info(_("This angeltype is restricted by double-opt-in by a team coordinator. Please show up at the according introduction meetings."), true); $content[] = $parsedown->parse($angeltype['description']); -- cgit v1.2.3-54-g00ecf