summaryrefslogtreecommitdiff
path: root/includes/view/AngelTypes_view.php
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2014-12-19 22:59:18 +0100
committerPhilip Häusler <msquare@notrademark.de>2014-12-19 22:59:18 +0100
commit038bf97178ec369f693ca1ca8445ab527abc919d (patch)
tree9e4008775bdf1aae5166b9cd619108bae8ad973d /includes/view/AngelTypes_view.php
parentd02272afd6725d46c37b7ba781c5d40268aa09a6 (diff)
link to next shift in menu
Diffstat (limited to 'includes/view/AngelTypes_view.php')
-rw-r--r--includes/view/AngelTypes_view.php74
1 files changed, 42 insertions, 32 deletions
diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php
index 7b3e162a..78563c0b 100644
--- a/includes/view/AngelTypes_view.php
+++ b/includes/view/AngelTypes_view.php
@@ -1,9 +1,19 @@
<?php
+
/**
* AngelTypes
*/
/**
+ * Renders the angeltypes name as link.
+ *
+ * @param AngelType $angeltype
+ */
+function AngelType_name_render($angeltype) {
+ return '<a href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'] . '">' . ($angeltype['restricted'] ? glyph('lock') : '') . $angeltype['name'] . '</a>';
+}
+
+/**
* Render angeltype membership state
*
* @param UserAngelType $user_angeltype
@@ -35,15 +45,15 @@ function AngelType_delete_view($angeltype) {
info(sprintf(_("Do you want to delete angeltype %s?"), $angeltype['name']), true),
buttons(array(
button(page_link_to('angeltypes'), _("cancel"), 'cancel'),
- button(page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'] . '&confirmed', _("delete"), 'ok')
- ))
+ button(page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'] . '&confirmed', _("delete"), 'ok')
+ ))
));
}
function AngelType_edit_view($name, $restricted, $description, $coordinator_mode) {
return page_with_title(sprintf(_("Edit %s"), $name), array(
buttons(array(
- button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
+ button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
)),
msg(),
form(array(
@@ -52,16 +62,16 @@ function AngelType_edit_view($name, $restricted, $description, $coordinator_mode
form_info("", _("Restricted angel types can only be used by an angel if enabled by an archangel (double opt-in).")),
form_textarea('description', _("Description"), $description),
form_info("", _("Please use markdown for the description.")),
- form_submit('submit', _("Save"))
- ))
+ form_submit('submit', _("Save"))
+ ))
));
}
function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angeltypes, $admin_angeltypes, $coordinator) {
$buttons = array(
- button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
+ button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
);
-
+
if ($user_angeltype == null)
$buttons[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), 'add');
else {
@@ -69,24 +79,24 @@ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angel
error(sprintf(_("You are unconfirmed for this angeltype. Please go to the introduction for %s to get confirmed."), $angeltype['name']));
$buttons[] = button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $user_angeltype['id'], _("leave"), 'cancel');
}
-
+
if ($admin_angeltypes || $coordinator)
$buttons[] = button(page_link_to('angeltypes') . '&action=edit&angeltype_id=' . $angeltype['id'], _("edit"), 'edit');
if ($admin_angeltypes)
$buttons[] = button(page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'], _("delete"), 'delete');
-
+
$page = array(
msg(),
- buttons($buttons)
+ buttons($buttons)
);
-
+
$page[] = '<h3>' . _("Description") . '</h3>';
$parsedown = new Parsedown();
if ($angeltype['description'] != "")
$page[] = '<div class="well">' . $parsedown->parse($angeltype['description']) . '</div>';
-
+
// Team-Coordinators list missing
-
+
$coordinators = array();
$members_confirmed = array();
$members_unconfirmed = array();
@@ -95,7 +105,7 @@ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angel
if ($angeltype['restricted'] && $member['confirm_user_id'] == null) {
$member['actions'] = join(" ", array(
'<a href="' . page_link_to('user_angeltypes') . '&action=confirm&user_angeltype_id=' . $member['user_angeltype_id'] . '" class="ok">' . _("confirm") . '</a>',
- '<a href="' . page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $member['user_angeltype_id'] . '" class="cancel">' . _("deny") . '</a>'
+ '<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']) {
@@ -108,7 +118,7 @@ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angel
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>'
+ '<a href="' . page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $member['user_angeltype_id'] . '" class="cancel">' . _("remove") . '</a>'
));
$members_confirmed[] = $member;
}
@@ -118,74 +128,74 @@ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angel
$page[] = table(array(
'Nick' => _("Nick"),
'DECT' => _("DECT"),
- 'actions' => ""
+ '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')
+ button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("Add"), 'add')
));
$page[] = table(array(
'Nick' => _("Nick"),
'DECT' => _("DECT"),
- 'actions' => ""
+ 'actions' => ""
), $members_confirmed);
-
+
if ($admin_user_angeltypes && $angeltype['restricted'] && count($members_unconfirmed) > 0) {
$page[] = '<h3>' . _("Unconfirmed") . '</h3>';
$page[] = buttons(array(
button(page_link_to('user_angeltypes') . '&action=confirm_all&angeltype_id=' . $angeltype['id'], _("confirm all"), 'ok'),
- button(page_link_to('user_angeltypes') . '&action=delete_all&angeltype_id=' . $angeltype['id'], _("deny all"), 'cancel')
+ button(page_link_to('user_angeltypes') . '&action=delete_all&angeltype_id=' . $angeltype['id'], _("deny all"), 'cancel')
));
$page[] = table(array(
'Nick' => _("Nick"),
'DECT' => _("DECT"),
- 'actions' => ""
+ 'actions' => ""
), $members_unconfirmed);
}
-
+
return page_with_title(sprintf(_("Team %s"), $angeltype['name']), $page);
}
/**
* Display the list of angeltypes.
*
- * @param array $angeltypes
+ * @param array $angeltypes
*/
function AngelTypes_list_view($angeltypes, $admin_angeltypes) {
return page_with_title(angeltypes_title(), array(
msg(),
buttons(array(
$admin_angeltypes ? button(page_link_to('angeltypes') . '&action=edit', _("New angeltype"), 'add') : '',
- button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description"))
+ button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description"))
)),
table(array(
'name' => _("Name"),
'restricted' => glyph('lock') . _("Restricted"),
'membership' => _("Membership"),
- 'actions' => ""
- ), $angeltypes)
+ 'actions' => ""
+ ), $angeltypes)
));
}
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")
+ 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 />'
+ '<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)
@@ -194,14 +204,14 @@ function AngelTypes_about_view($angeltypes, $user_logged_in) {
$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);
}