/** * View a list of all angeltypes. */ function angeltypes_list_controller() { global $privileges, $user; if (!in_array('angeltypes', $privileges)) { redirect('?'); } $angeltypes = AngelTypes_with_user($user); if ($angeltypes === false) { engelsystem_error("Unable to load angeltypes."); } foreach ($angeltypes as &$angeltype) { $actions = array(button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("view"), "btn-xs")); if (in_array('admin_angel_types', $privileges)) { $actions[] = button(page_link_to('angeltypes') . '&action=edit&angeltype_id=' . $angeltype['id'], _("edit"), "btn-xs"); $actions[] = button(page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'], _("delete"), "btn-xs"); //$actions[] = '<a class="edit" href="' . page_link_to('angeltypes') . '&action=edit&angeltype_id=' . $angeltype['id'] . '">' . _("edit") . '</a>'; //$actions[] = '<a class="delete" href="' . page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'] . '">' . _("delete") . '</a>'; } $angeltype['membership'] = AngelType_render_membership($angeltype); if ($angeltype['user_angeltype_id'] != null) { //$actions[] = '<a class="cancel" href="' . page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'] . '">' . _("leave") . '</a>'; $actions[] = button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'], _("leave"), "btn-xs"); } else { $actions[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), "btn-xs"); //$actions[] = '<a class="add" href="' . page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'] . '">' . _("join") . '</a>'; } $angeltype['restricted'] = $angeltype['restricted'] ? glyph('lock') : ''; $angeltype['name'] = '<a href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'] . '">' . $angeltype['name'] . '</a>'; $angeltype['actions'] = table_buttons($actions); } return array(angeltypes_title(), AngelTypes_list_view($angeltypes, in_array('admin_angel_types', $privileges))); }
function make_navigation() { global $p, $privileges; $menu = array(); $pages = array("news" => news_title(), "user_meetings" => meetings_title(), "user_shifts" => shifts_title(), "angeltypes" => angeltypes_title(), "user_questions" => questions_title()); foreach ($pages as $page => $title) { if (in_array($page, $privileges)) { $menu[] = toolbar_item_link(page_link_to($page), '', $title, $page == $p); } } $admin_menu = array(); $admin_pages = array("admin_arrive" => admin_arrive_title(), "admin_active" => admin_active_title(), "admin_user" => admin_user_title(), "admin_free" => admin_free_title(), "admin_questions" => admin_questions_title(), "shifttypes" => shifttypes_title(), "admin_shifts" => admin_shifts_title(), "admin_rooms" => admin_rooms_title(), "admin_groups" => admin_groups_title(), "admin_import" => admin_import_title(), "admin_log" => admin_log_title()); foreach ($admin_pages as $page => $title) { if (in_array($page, $privileges)) { $admin_menu[] = toolbar_item_link(page_link_to($page), '', $title, $page == $p); } } if (count($admin_menu) > 0) { $menu[] = toolbar_dropdown('', _("Admin"), $admin_menu); } return toolbar($menu); }
function AngelTypes_about_view($angeltypes, $user_logged_in) { global $faq_url; $content = array(buttons(array(!$user_logged_in ? button(page_link_to('register'), register_title()) : '', !$user_logged_in ? button(page_link_to('login'), login_title()) : '', $user_logged_in ? button(page_link_to('angeltypes'), angeltypes_title(), 'back') : '', button($faq_url, _("FAQ"), "btn-primary"))), '<p>' . _("Here is the list of teams and their tasks. If you have questions, read the FAQ.") . '</p>', '<hr />'); $parsedown = new Parsedown(); foreach ($angeltypes as $angeltype) { $content[] = '<h2>' . $angeltype['name'] . '</h2>'; 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); } if ($angeltype['description'] != "") { $content[] = '<div class="well">' . $parsedown->parse($angeltype['description']) . '</div>'; } $content[] = '<hr />'; } return page_with_title(_("Teams/Job description"), $content); }