summaryrefslogtreecommitdiff
path: root/includes/view/AngelTypes_view.php
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2016-11-09 18:05:00 +0100
committermsquare <msquare@notrademark.de>2016-11-09 18:05:00 +0100
commitaf9328f5585a8ab38ae4044e4b8c11d874b6e99c (patch)
tree96d0bf237b19d78ebe8df6198c7182ce556b782e /includes/view/AngelTypes_view.php
parent0ba0ce207d47a0ff506aca44526aa8228e7e0d6e (diff)
split angeltype about view into different methods
Diffstat (limited to 'includes/view/AngelTypes_view.php')
-rw-r--r--includes/view/AngelTypes_view.php50
1 files changed, 31 insertions, 19 deletions
diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php
index dbeabe95..db21efda 100644
--- a/includes/view/AngelTypes_view.php
+++ b/includes/view/AngelTypes_view.php
@@ -260,6 +260,36 @@ function AngelTypes_list_view($angeltypes, $admin_angeltypes) {
]);
}
+/**
+ * Renders the about info for an angeltype.
+ */
+function AngelTypes_about_view_angeltype($angeltype) {
+ $html = '<h2>' . $angeltype['name'] . '</h2>';
+
+ if (isset($angeltype['user_angeltype_id'])) {
+ $buttons = [];
+ 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');
+ }
+ $html .= buttons($buttons);
+ }
+
+ if ($angeltype['restricted']) {
+ $html .= 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'] != "") {
+ $html .= '<div class="well">' . $parsedown->parse($angeltype['description']) . '</div>';
+ }
+ $html .= '<hr />';
+
+ return $html;
+}
+
+/**
+ * Renders a site that contains every angeltype and its description, basically as an overview of the needed help types.
+ */
function AngelTypes_about_view($angeltypes, $user_logged_in) {
global $faq_url;
@@ -275,25 +305,7 @@ function AngelTypes_about_view($angeltypes, $user_logged_in) {
];
$parsedown = new Parsedown();
foreach ($angeltypes as $angeltype) {
- $content[] = '<h2>' . $angeltype['name'] . '</h2>';
-
- if (isset($angeltype['user_angeltype_id'])) {
- $buttons = [];
- 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 />';
+ $content[] = AngelTypes_about_view_angeltype($angeltype);
}
return page_with_title(_("Teams/Job description"), $content);