@ -25,12 +25,12 @@ function AngelType_render_membership($user_angeltype) {
if ($user_angeltype['restricted']) {
if ($user_angeltype['restricted']) {
if ($user_angeltype['confirm_user_id'] == null) {
if ($user_angeltype['confirm_user_id'] == null) {
return glyph('lock') . _("Unconfirmed");
return glyph('lock') . _("Unconfirmed");
} elseif ($user_angeltype['coordinato r']) {
} elseif ($user_angeltype['supporte r']) {
return glyph_bool(true) . _("Coordinato r");
return glyph_bool(true) . _("supporte r");
}
}
return glyph_bool(true) . _("Member");
return glyph_bool(true) . _("Member");
} elseif ($user_angeltype['coordinato r']) {
} elseif ($user_angeltype['supporte r']) {
return glyph_bool(true) . _("Coordinato r");
return glyph_bool(true) . _("supporte r");
}
}
return glyph_bool(true) . _("Member");
return glyph_bool(true) . _("Member");
}
}
@ -47,16 +47,16 @@ function AngelType_delete_view($angeltype) {
]);
]);
}
}
function AngelType_edit_view($name, $restricted, $description, $coordinato r_mode, $requires_driver_license) {
function AngelType_edit_view($name, $restricted, $description, $supporte r_mode, $requires_driver_license) {
return page_with_title(sprintf(_("Edit %s"), $name), [
return page_with_title(sprintf(_("Edit %s"), $name), [
buttons([
buttons([
button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
]),
]),
msg(),
msg(),
form([
form([
$coordinato r_mode ? form_info(_("Name"), $name) : form_text('name', _("Name"), $name),
$supporte r_mode ? form_info(_("Name"), $name) : form_text('name', _("Name"), $name),
$coordinato r_mode ? form_info(_("Restricted"), $restricted ? _("Yes") : _("No")) : form_checkbox('restricted', _("Restricted"), $restricted),
$supporte r_mode ? form_info(_("Restricted"), $restricted ? _("Yes") : _("No")) : form_checkbox('restricted', _("Restricted"), $restricted),
$coordinato r_mode ? form_info(_("Requires driver license"), $requires_driver_license ? _("Yes") : _("No")) : form_checkbox('requires_driver_license', _("Requires driver license"), $requires_driver_license),
$supporte r_mode ? form_info(_("Requires driver license"), $requires_driver_license ? _("Yes") : _("No")) : form_checkbox('requires_driver_license', _("Requires driver license"), $requires_driver_license),
form_info("", _("Restricted angel types can only be used by an angel if enabled by an archangel (double opt-in).")),
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_textarea('description', _("Description"), $description),
form_info("", _("Please use markdown for the description.")),
form_info("", _("Please use markdown for the description.")),
@ -68,7 +68,7 @@ function AngelType_edit_view($name, $restricted, $description, $coordinator_mode
/**
/**
* Renders the buttons for the angeltype view.
* Renders the buttons for the angeltype view.
*/
*/
function AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $coordinato r, $user_driver_license, $user) {
function AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporte r, $user_driver_license, $user) {
$buttons = [
$buttons = [
button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
];
];
@ -90,7 +90,7 @@ function AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes,
$buttons[] = button(page_link_to('user_angeltypes') . '& action=delete& user_angeltype_id=' . $user_angeltype['id'], _("leave"), 'cancel');
$buttons[] = button(page_link_to('user_angeltypes') . '& action=delete& user_angeltype_id=' . $user_angeltype['id'], _("leave"), 'cancel');
}
}
if ($admin_angeltypes || $coordinato r) {
if ($admin_angeltypes || $supporte r) {
$buttons[] = button(page_link_to('angeltypes') . '& action=edit& angeltype_id=' . $angeltype['id'], _("edit"), 'edit');
$buttons[] = button(page_link_to('angeltypes') . '& action=edit& angeltype_id=' . $angeltype['id'], _("edit"), 'edit');
}
}
if ($admin_angeltypes) {
if ($admin_angeltypes) {
@ -101,12 +101,12 @@ function AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes,
}
}
/**
/**
* Renders and sorts the members of an angeltype into coordinato rs, members and unconfirmed members.
* Renders and sorts the members of an angeltype into supporte rs, members and unconfirmed members.
*
*
* @return [coordinato rs, members, unconfirmed members]
* @return [supporte rs, members, unconfirmed members]
*/
*/
function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $admin_angeltypes) {
function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $admin_angeltypes) {
$coordinato rs = [];
$supporte rs = [];
$members_confirmed = [];
$members_confirmed = [];
$members_unconfirmed = [];
$members_unconfirmed = [];
foreach ($members as $member) {
foreach ($members as $member) {
@ -128,19 +128,19 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a
button(page_link_to('user_angeltypes') . '& action=delete& user_angeltype_id=' . $member['user_angeltype_id'], _("deny"), 'btn-xs')
button(page_link_to('user_angeltypes') . '& action=delete& user_angeltype_id=' . $member['user_angeltype_id'], _("deny"), 'btn-xs')
]);
]);
$members_unconfirmed[] = $member;
$members_unconfirmed[] = $member;
} elseif ($member['coordinato r']) {
} elseif ($member['supporte r']) {
if ($admin_angeltypes) {
if ($admin_angeltypes) {
$member['actions'] = table_buttons([
$member['actions'] = table_buttons([
button(page_link_to('user_angeltypes') . '& action=update& user_angeltype_id=' . $member['user_angeltype_id'] . '& coordinator=0', _("Remove coordinato r rights"), 'btn-xs')
button(page_link_to('user_angeltypes') . '& action=update& user_angeltype_id=' . $member['user_angeltype_id'] . '& supporter=0', _("Remove supporte r rights"), 'btn-xs')
]);
]);
} else {
} else {
$member['actions'] = '';
$member['actions'] = '';
}
}
$coordinato rs[] = $member;
$supporte rs[] = $member;
} else {
} else {
if ($admin_user_angeltypes) {
if ($admin_user_angeltypes) {
$member['actions'] = table_buttons([
$member['actions'] = table_buttons([
$admin_angeltypes ? button(page_link_to('user_angeltypes') . '& action=update& user_angeltype_id=' . $member['user_angeltype_id'] . '& coordinator=1', _("Add coordinato r rights"), 'btn-xs') : '',
$admin_angeltypes ? button(page_link_to('user_angeltypes') . '& action=update& user_angeltype_id=' . $member['user_angeltype_id'] . '& supporter=1', _("Add supporte r rights"), 'btn-xs') : '',
button(page_link_to('user_angeltypes') . '& action=delete& user_angeltype_id=' . $member['user_angeltype_id'], _("remove"), 'btn-xs')
button(page_link_to('user_angeltypes') . '& action=delete& user_angeltype_id=' . $member['user_angeltype_id'], _("remove"), 'btn-xs')
]);
]);
}
}
@ -149,7 +149,7 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a
}
}
return [
return [
$coordinato rs,
$supporte rs,
$members_confirmed,
$members_confirmed,
$members_unconfirmed
$members_unconfirmed
];
];
@ -158,8 +158,8 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a
/**
/**
* Creates the needed member table headers according to given rights and settings from the angeltype.
* Creates the needed member table headers according to given rights and settings from the angeltype.
*/
*/
function AngelType_view_table_headers($angeltype, $coordinato r, $admin_angeltypes) {
function AngelType_view_table_headers($angeltype, $supporte r, $admin_angeltypes) {
if ($angeltype['requires_driver_license'] & & ($coordinato r || $admin_angeltypes)) {
if ($angeltype['requires_driver_license'] & & ($supporte r || $admin_angeltypes)) {
return [
return [
'Nick' => _("Nick"),
'Nick' => _("Nick"),
'DECT' => _("DECT"),
'DECT' => _("DECT"),
@ -183,10 +183,10 @@ function AngelType_view_table_headers($angeltype, $coordinator, $admin_angeltype
/**
/**
* Render an angeltype page containing the member lists.
* Render an angeltype page containing the member lists.
*/
*/
function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angeltypes, $admin_angeltypes, $coordinato r, $user_driver_license, $user) {
function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angeltypes, $admin_angeltypes, $supporte r, $user_driver_license, $user) {
$page = [
$page = [
msg(),
msg(),
AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $coordinato r, $user_driver_license, $user)
AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporte r, $user_driver_license, $user)
];
];
$page[] = '< h3 > ' . _("Description") . '< / h3 > ';
$page[] = '< h3 > ' . _("Description") . '< / h3 > ';
@ -195,12 +195,12 @@ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angel
$page[] = '< div class = "well" > ' . $parsedown->parse($angeltype['description']) . '< / div > ';
$page[] = '< div class = "well" > ' . $parsedown->parse($angeltype['description']) . '< / div > ';
}
}
list($coordinato rs, $members_confirmed, $members_unconfirmed) = AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $admin_angeltypes);
list($supporte rs, $members_confirmed, $members_unconfirmed) = AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $admin_angeltypes);
$table_headers = AngelType_view_table_headers($angeltype, $coordinato r, $admin_angeltypes);
$table_headers = AngelType_view_table_headers($angeltype, $supporte r, $admin_angeltypes);
if (count($coordinato rs) > 0) {
if (count($supporte rs) > 0) {
$page[] = '< h3 > ' . _("Coordinato rs") . '< / h3 > ';
$page[] = '< h3 > ' . _("supporte rs") . '< / h3 > ';
$page[] = table($table_headers, $coordinato rs);
$page[] = table($table_headers, $supporte rs);
}
}
if (count($members_confirmed) > 0) {
if (count($members_confirmed) > 0) {
@ -279,7 +279,7 @@ function AngelTypes_about_view_angeltype($angeltype) {
}
}
if ($angeltype['restricted']) {
if ($angeltype['restricted']) {
$html .= info(_("This angeltype is restricted by double-opt-in by a team coordinato r. Please show up at the according introduction meetings."), true);
$html .= info(_("This angeltype is restricted by double-opt-in by a team supporte r. Please show up at the according introduction meetings."), true);
}
}
if ($angeltype['description'] != "") {
if ($angeltype['description'] != "") {
$html .= '< div class = "well" > ' . $parsedown->parse($angeltype['description']) . '< / div > ';
$html .= '< div class = "well" > ' . $parsedown->parse($angeltype['description']) . '< / div > ';