replace all the remaining old icons with glyphicons

main
Felix Favre 10 years ago
parent 524acb15ba
commit 191ba6e1b1

@ -13,7 +13,7 @@ function angeltypes_title() {
function angeltypes_controller() { function angeltypes_controller() {
if (! isset($_REQUEST['action'])) if (! isset($_REQUEST['action']))
$_REQUEST['action'] = 'list'; $_REQUEST['action'] = 'list';
switch ($_REQUEST['action']) { switch ($_REQUEST['action']) {
default: default:
case 'list': case 'list':
@ -34,17 +34,17 @@ function angeltypes_controller() {
*/ */
function angeltypes_about_controller() { function angeltypes_about_controller() {
global $privileges, $user; global $privileges, $user;
if (isset($user)) if (isset($user))
$angeltypes = AngelTypes_with_user($user); $angeltypes = AngelTypes_with_user($user);
else else
$angeltypes = AngelTypes(); $angeltypes = AngelTypes();
if ($angeltypes === false) if ($angeltypes === false)
engelsystem_error("Unable to load angeltypes."); engelsystem_error("Unable to load angeltypes.");
return array( return array(
_("Teams/Job description"), _("Teams/Job description"),
AngelTypes_about_view($angeltypes, isset($user)) AngelTypes_about_view($angeltypes, isset($user))
); );
} }
@ -53,29 +53,29 @@ function angeltypes_about_controller() {
*/ */
function angeltype_delete_controller() { function angeltype_delete_controller() {
global $privileges, $user; global $privileges, $user;
if (! in_array('admin_angel_types', $privileges)) if (! in_array('admin_angel_types', $privileges))
redirect(page_link_to('angeltypes')); redirect(page_link_to('angeltypes'));
$angeltype = AngelType($_REQUEST['angeltype_id']); $angeltype = AngelType($_REQUEST['angeltype_id']);
if ($angeltype === false) if ($angeltype === false)
engelsystem_error("Unable to load angeltype."); engelsystem_error("Unable to load angeltype.");
if ($angeltype == null) if ($angeltype == null)
redirect(page_link_to('angeltypes')); redirect(page_link_to('angeltypes'));
if (isset($_REQUEST['confirmed'])) { if (isset($_REQUEST['confirmed'])) {
$result = AngelType_delete($angeltype); $result = AngelType_delete($angeltype);
if ($result === false) if ($result === false)
engelsystem_error("Unable to delete angeltype."); engelsystem_error("Unable to delete angeltype.");
engelsystem_log("Deleted angeltype: " . $name); engelsystem_log("Deleted angeltype: " . $name);
success(sprintf(_("Angeltype %s deleted."), $name)); success(sprintf(_("Angeltype %s deleted."), $name));
redirect(page_link_to('angeltypes')); redirect(page_link_to('angeltypes'));
} }
return array( return array(
sprintf(_("Delete angeltype %s"), $angeltype['name']), sprintf(_("Delete angeltype %s"), $angeltype['name']),
AngelType_delete_view($angeltype) AngelType_delete_view($angeltype)
); );
} }
@ -84,35 +84,35 @@ function angeltype_delete_controller() {
*/ */
function angeltype_edit_controller() { function angeltype_edit_controller() {
global $privileges, $user; global $privileges, $user;
$name = ""; $name = "";
$restricted = false; $restricted = false;
$description = ""; $description = "";
if (isset($_REQUEST['angeltype_id'])) { if (isset($_REQUEST['angeltype_id'])) {
$angeltype = AngelType($_REQUEST['angeltype_id']); $angeltype = AngelType($_REQUEST['angeltype_id']);
if ($angeltype === false) if ($angeltype === false)
engelsystem_error("Unable to load angeltype."); engelsystem_error("Unable to load angeltype.");
if ($angeltype == null) if ($angeltype == null)
redirect(page_link_to('angeltypes')); redirect(page_link_to('angeltypes'));
$name = $angeltype['name']; $name = $angeltype['name'];
$restricted = $angeltype['restricted']; $restricted = $angeltype['restricted'];
$description = $angeltype['description']; $description = $angeltype['description'];
if (! User_is_AngelType_coordinator($user, $angeltype)) if (! User_is_AngelType_coordinator($user, $angeltype))
redirect(page_link_to('angeltypes')); redirect(page_link_to('angeltypes'));
} else { } else {
if (! in_array('admin_angel_types', $privileges)) if (! in_array('admin_angel_types', $privileges))
redirect(page_link_to('angeltypes')); redirect(page_link_to('angeltypes'));
} }
// In coordinator mode only allow to modify description // In coordinator mode only allow to modify description
$coordinator_mode = ! in_array('admin_angel_types', $privileges); $coordinator_mode = ! in_array('admin_angel_types', $privileges);
if (isset($_REQUEST['submit'])) { if (isset($_REQUEST['submit'])) {
$ok = true; $ok = true;
if (! $coordinator_mode) { if (! $coordinator_mode) {
if (isset($_REQUEST['name'])) { if (isset($_REQUEST['name'])) {
list($valid, $name) = AngelType_validate_name($_REQUEST['name'], $angeltype); list($valid, $name) = AngelType_validate_name($_REQUEST['name'], $angeltype);
@ -121,13 +121,13 @@ function angeltype_edit_controller() {
error(_("Please check the name. Maybe it already exists.")); error(_("Please check the name. Maybe it already exists."));
} }
} }
$restricted = isset($_REQUEST['restricted']); $restricted = isset($_REQUEST['restricted']);
} }
if (isset($_REQUEST['description'])) if (isset($_REQUEST['description']))
$description = strip_request_item_nl('description'); $description = strip_request_item_nl('description');
if ($ok) { if ($ok) {
$restricted = $restricted ? 1 : 0; $restricted = $restricted ? 1 : 0;
if (isset($angeltype)) { if (isset($angeltype)) {
@ -142,15 +142,15 @@ function angeltype_edit_controller() {
engelsystem_error("Unable to create angeltype."); engelsystem_error("Unable to create angeltype.");
engelsystem_log("Created angeltype: " . $name . ", restricted: " . $restricted); engelsystem_log("Created angeltype: " . $name . ", restricted: " . $restricted);
} }
success("Angel type saved."); success("Angel type saved.");
redirect(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype_id); redirect(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype_id);
} }
} }
return array( return array(
sprintf(_("Edit %s"), $name), sprintf(_("Edit %s"), $name),
AngelType_edit_view($name, $restricted, $description, $coordinator_mode) AngelType_edit_view($name, $restricted, $description, $coordinator_mode)
); );
} }
@ -159,30 +159,30 @@ function angeltype_edit_controller() {
*/ */
function angeltype_controller() { function angeltype_controller() {
global $privileges, $user; global $privileges, $user;
if (! in_array('angeltypes', $privileges)) if (! in_array('angeltypes', $privileges))
redirect('?'); redirect('?');
if (! isset($_REQUEST['angeltype_id'])) if (! isset($_REQUEST['angeltype_id']))
redirect(page_link_to('angeltypes')); redirect(page_link_to('angeltypes'));
$angeltype = AngelType($_REQUEST['angeltype_id']); $angeltype = AngelType($_REQUEST['angeltype_id']);
if ($angeltype === false) if ($angeltype === false)
engelsystem_error("Unable to load angeltype."); engelsystem_error("Unable to load angeltype.");
if ($angeltype == null) if ($angeltype == null)
redirect(page_link_to('angeltypes')); redirect(page_link_to('angeltypes'));
$user_angeltype = UserAngelType_by_User_and_AngelType($user, $angeltype); $user_angeltype = UserAngelType_by_User_and_AngelType($user, $angeltype);
if ($user_angeltype === false) if ($user_angeltype === false)
engelsystem_error("Unable to load user angeltype."); engelsystem_error("Unable to load user angeltype.");
$members = Users_by_angeltype($angeltype); $members = Users_by_angeltype($angeltype);
if ($members === false) if ($members === false)
engelsystem_error("Unable to load members."); engelsystem_error("Unable to load members.");
return array( return array(
sprintf(_("Team %s"), $angeltype['name']), sprintf(_("Team %s"), $angeltype['name']),
AngelType_view($angeltype, $members, $user_angeltype, in_array('admin_user_angeltypes', $privileges) || $user_angeltype['coordinator'], in_array('admin_angel_types', $privileges), $user_angeltype['coordinator']) AngelType_view($angeltype, $members, $user_angeltype, in_array('admin_user_angeltypes', $privileges) || $user_angeltype['coordinator'], in_array('admin_angel_types', $privileges), $user_angeltype['coordinator'])
); );
} }
@ -191,20 +191,20 @@ function angeltype_controller() {
*/ */
function angeltypes_list_controller() { function angeltypes_list_controller() {
global $privileges, $user; global $privileges, $user;
if (! in_array('angeltypes', $privileges)) if (! in_array('angeltypes', $privileges))
redirect('?'); redirect('?');
$angeltypes = AngelTypes_with_user($user); $angeltypes = AngelTypes_with_user($user);
if ($angeltypes === false) if ($angeltypes === false)
engelsystem_error("Unable to load angeltypes."); engelsystem_error("Unable to load angeltypes.");
foreach ($angeltypes as &$angeltype) { foreach ($angeltypes as &$angeltype) {
$actions = array( $actions = array(
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'],_("view"),"btn-xs") button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'],_("view"),"btn-xs")
//'<a class="view btn btn-default" href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'] . '">' . _("view") . '</a>' //'<a class="view btn btn-default" href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'] . '">' . _("view") . '</a>'
); );
if (in_array('admin_angel_types', $privileges)) { 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=edit&angeltype_id=' . $angeltype['id'], _("edit"), "btn-xs");
$actions[] = button(page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'], _("delete"), "btn-xs"); $actions[] = button(page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'], _("delete"), "btn-xs");
@ -212,7 +212,7 @@ function angeltypes_list_controller() {
//$actions[] = '<a class="edit" href="' . page_link_to('angeltypes') . '&action=edit&angeltype_id=' . $angeltype['id'] . '">' . _("edit") . '</a>'; //$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>'; //$actions[] = '<a class="delete" href="' . page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'] . '">' . _("delete") . '</a>';
} }
$angeltype['membership'] = AngelType_render_membership($angeltype); $angeltype['membership'] = AngelType_render_membership($angeltype);
if ($angeltype['user_angeltype_id'] != null) { 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[] = '<a class="cancel" href="' . page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'] . '">' . _("leave") . '</a>';
@ -221,16 +221,16 @@ function angeltypes_list_controller() {
$actions[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), "btn-xs"); $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>'; //$actions[] = '<a class="add" href="' . page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'] . '">' . _("join") . '</a>';
} }
$angeltype['restricted'] = $angeltype['restricted'] ? '<img src="pic/icons/lock.png" alt="' . _("Restricted") . '" title="' . _("Restricted") . '">' : ''; $angeltype['restricted'] = $angeltype['restricted'] ? glyph('lock') : '';
$angeltype['name'] = '<a href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'] . '">' . $angeltype['name'] . '</a>'; $angeltype['name'] = '<a href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'] . '">' . $angeltype['name'] . '</a>';
$angeltype['actions'] = table_buttons($actions); $angeltype['actions'] = table_buttons($actions);
} }
return array( return array(
angeltypes_title(), angeltypes_title(),
AngelTypes_list_view($angeltypes, in_array('admin_angel_types', $privileges)) AngelTypes_list_view($angeltypes, in_array('admin_angel_types', $privileges))
); );
} }
?> ?>

@ -570,7 +570,7 @@ function view_user_shifts() {
if (time() > $shift['start']) if (time() > $shift['start'])
$entry_list[] = $inner_text . ' (vorbei)'; $entry_list[] = $inner_text . ' (vorbei)';
elseif ($angeltype['restricted'] == 1 && isset($angeltype['user_id']) && ! isset($angeltype['confirm_user_id'])) elseif ($angeltype['restricted'] == 1 && isset($angeltype['user_id']) && ! isset($angeltype['confirm_user_id']))
$entry_list[] = $inner_text . ' <img src="pic/icons/lock.png" alt="unconfirmed" title="' . _("You are not confirmed for this angel type.") . '" />'; $entry_list[] = $inner_text . glyph('lock');
elseif ($collides) elseif ($collides)
$entry_list[] = $inner_text; $entry_list[] = $inner_text;
else else
@ -707,7 +707,7 @@ function view_user_shifts() {
if (time() > $shift['end']) { if (time() > $shift['end']) {
$entry_list[] = $inner_text . ' (vorbei)'; $entry_list[] = $inner_text . ' (vorbei)';
} elseif ($angeltype['restricted'] == 1 && isset($angeltype['user_id']) && ! isset($angeltype['confirm_user_id'])) { } elseif ($angeltype['restricted'] == 1 && isset($angeltype['user_id']) && ! isset($angeltype['confirm_user_id'])) {
$entry_list[] = $inner_text . ' <img src="pic/icons/lock.png" alt="unconfirmed" title="Du bist für diesen Engeltyp noch nicht freigeschaltet." />'; $entry_list[] = $inner_text . glyph("lock");
} else { } else {
$entry_list[] = $inner_text . ' <a href="' . page_link_to('user_settings') . '#angel_types_anchor">(Werde ' . $angeltype['name'] . ')</a>'; $entry_list[] = $inner_text . ' <a href="' . page_link_to('user_settings') . '#angel_types_anchor">(Werde ' . $angeltype['name'] . ')</a>';
} }
@ -786,7 +786,7 @@ function make_select($items, $selected, $name, $title = null) {
$html_items[] = '<h4>' . $title . '</h4>' . "\n"; $html_items[] = '<h4>' . $title . '</h4>' . "\n";
foreach ($items as $i) foreach ($items as $i)
$html_items[] = '<div class="checkbox"><label><input type="checkbox" name="' . $name . '[]" value="' . $i['id'] . '"' . (in_array($i['id'], $selected) ? ' checked="checked"' : '') . '> ' . $i['name'] . '</label>' . (! isset($i['enabled']) || $i['enabled'] ? '' : ' <img src="pic/icons/lock.png" alt="unconfirmed" title="Du bist für diesen Engeltyp noch nicht freigeschaltet." />') . '</div><br />'; $html_items[] = '<div class="checkbox"><label><input type="checkbox" name="' . $name . '[]" value="' . $i['id'] . '"' . (in_array($i['id'], $selected) ? ' checked="checked"' : '') . '> ' . $i['name'] . '</label>' . (! isset($i['enabled']) || $i['enabled'] ? '' : glyph("lock")) . '</div><br />';
$html = '<div id="selection_' . $name . '" class="selection ' . $name . '">' . "\n"; $html = '<div id="selection_' . $name . '" class="selection ' . $name . '">' . "\n";
$html .= implode("\n", $html_items); $html .= implode("\n", $html_items);
$html .= buttons(array( $html .= buttons(array(

@ -15,17 +15,17 @@ function AngelType_render_membership($user_angeltype) {
if ($user_angeltype['user_angeltype_id'] != null) { if ($user_angeltype['user_angeltype_id'] != null) {
if ($user_angeltype['restricted']) { if ($user_angeltype['restricted']) {
if ($user_angeltype['confirm_user_id'] == null) if ($user_angeltype['confirm_user_id'] == null)
$membership = '<img src="pic/icons/lock.png" alt="' . _("Unconfirmed") . '" title="' . _("Unconfirmed") . '"> ' . _("Unconfirmed"); $membership = glyph('lock') . _("Unconfirmed");
elseif ($user_angeltype['coordinator']) elseif ($user_angeltype['coordinator'])
$membership = '<img src="pic/icons/tick.png" alt="' . _("Coordinator") . '" title="' . _("Coordinator") . '"> ' . _("Coordinator"); $membership = glyph_bool(true) . _("Coordinator");
else else
$membership = '<img src="pic/icons/tick.png" alt="' . _("Member") . '" title="' . _("Member") . '"> ' . _("Member"); $membership = glyph_bool(true) . _("Member");
} elseif ($user_angeltype['coordinator']) } elseif ($user_angeltype['coordinator'])
$membership = '<img src="pic/icons/tick.png" alt="' . _("Coordinator") . '" title="' . _("Coordinator") . '"> ' . _("Coordinator"); $membership = glyph_bool(true) . _("Coordinator");
else else
$membership = '<img src="pic/icons/tick.png" alt="' . _("Member") . '" title="' . _("Member") . '"> ' . _("Member"); $membership = glyph_bool(true) . _("Member");
} else { } else {
$membership = '<img src="pic/icons/cross.png" alt="" title="">'; $membership = glyph_bool(false);
} }
return $membership; return $membership;
} }
@ -35,15 +35,15 @@ function AngelType_delete_view($angeltype) {
info(sprintf(_("Do you want to delete angeltype %s?"), $angeltype['name']), true), info(sprintf(_("Do you want to delete angeltype %s?"), $angeltype['name']), true),
buttons(array( buttons(array(
button(page_link_to('angeltypes'), _("cancel"), 'cancel'), 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) { function AngelType_edit_view($name, $restricted, $description, $coordinator_mode) {
return page_with_title(sprintf(_("Edit %s"), $name), array( return page_with_title(sprintf(_("Edit %s"), $name), array(
buttons(array( buttons(array(
button(page_link_to('angeltypes'), _("Angeltypes"), 'back') button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
)), )),
msg(), msg(),
form(array( form(array(
@ -52,16 +52,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_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.")),
form_submit('submit', _("Save")) form_submit('submit', _("Save"))
)) ))
)); ));
} }
function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angeltypes, $admin_angeltypes, $coordinator) { function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angeltypes, $admin_angeltypes, $coordinator) {
$buttons = array( $buttons = array(
button(page_link_to('angeltypes'), _("Angeltypes"), 'back') button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
); );
if ($user_angeltype == null) if ($user_angeltype == null)
$buttons[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), 'add'); $buttons[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), 'add');
else { else {
@ -69,24 +69,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'])); 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'); $buttons[] = button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $user_angeltype['id'], _("leave"), 'cancel');
} }
if ($admin_angeltypes || $coordinator) if ($admin_angeltypes || $coordinator)
$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)
$buttons[] = button(page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'], _("delete"), 'delete'); $buttons[] = button(page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'], _("delete"), 'delete');
$page = array( $page = array(
msg(), msg(),
buttons($buttons) buttons($buttons)
); );
$page[] = '<h3>' . _("Description") . '</h3>'; $page[] = '<h3>' . _("Description") . '</h3>';
$parsedown = new Parsedown(); $parsedown = new Parsedown();
if ($angeltype['description'] != "") if ($angeltype['description'] != "")
$page[] = '<div class="well">' . $parsedown->parse($angeltype['description']) . '</div>'; $page[] = '<div class="well">' . $parsedown->parse($angeltype['description']) . '</div>';
// Team-Coordinators list missing // Team-Coordinators list missing
$coordinators = array(); $coordinators = array();
$members_confirmed = array(); $members_confirmed = array();
$members_unconfirmed = array(); $members_unconfirmed = array();
@ -95,7 +95,7 @@ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angel
if ($angeltype['restricted'] && $member['confirm_user_id'] == null) { if ($angeltype['restricted'] && $member['confirm_user_id'] == null) {
$member['actions'] = join(" ", array( $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=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; $members_unconfirmed[] = $member;
} elseif ($member['coordinator']) { } elseif ($member['coordinator']) {
@ -108,7 +108,7 @@ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angel
if ($admin_user_angeltypes) if ($admin_user_angeltypes)
$member['actions'] = join(" ", array( $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>' : '', $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; $members_confirmed[] = $member;
} }
@ -118,74 +118,74 @@ function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angel
$page[] = table(array( $page[] = table(array(
'Nick' => _("Nick"), 'Nick' => _("Nick"),
'DECT' => _("DECT"), 'DECT' => _("DECT"),
'actions' => "" 'actions' => ""
), $coordinators); ), $coordinators);
} }
$page[] = '<h3>' . _("Members") . '</h3>'; $page[] = '<h3>' . _("Members") . '</h3>';
if ($admin_user_angeltypes) if ($admin_user_angeltypes)
$page[] = buttons(array( $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( $page[] = table(array(
'Nick' => _("Nick"), 'Nick' => _("Nick"),
'DECT' => _("DECT"), 'DECT' => _("DECT"),
'actions' => "" 'actions' => ""
), $members_confirmed); ), $members_confirmed);
if ($admin_user_angeltypes && $angeltype['restricted'] && count($members_unconfirmed) > 0) { if ($admin_user_angeltypes && $angeltype['restricted'] && count($members_unconfirmed) > 0) {
$page[] = '<h3>' . _("Unconfirmed") . '</h3>'; $page[] = '<h3>' . _("Unconfirmed") . '</h3>';
$page[] = buttons(array( $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=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( $page[] = table(array(
'Nick' => _("Nick"), 'Nick' => _("Nick"),
'DECT' => _("DECT"), 'DECT' => _("DECT"),
'actions' => "" 'actions' => ""
), $members_unconfirmed); ), $members_unconfirmed);
} }
return page_with_title(sprintf(_("Team %s"), $angeltype['name']), $page); return page_with_title(sprintf(_("Team %s"), $angeltype['name']), $page);
} }
/** /**
* Display the list of angeltypes. * Display the list of angeltypes.
* *
* @param array $angeltypes * @param array $angeltypes
*/ */
function AngelTypes_list_view($angeltypes, $admin_angeltypes) { function AngelTypes_list_view($angeltypes, $admin_angeltypes) {
return page_with_title(angeltypes_title(), array( return page_with_title(angeltypes_title(), array(
msg(), msg(),
buttons(array( buttons(array(
$admin_angeltypes ? button(page_link_to('angeltypes') . '&action=edit', _("New angeltype"), 'add') : '', $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( table(array(
'name' => _("Name"), 'name' => _("Name"),
'restricted' => '<img src="pic/icons/lock.png" alt="' . _("Restricted") . '" title="' . _("Restricted") . '" />', 'restricted' => glyph('lock') . _("Restricted"),
'membership' => _("Membership"), 'membership' => _("Membership"),
'actions' => "" 'actions' => ""
), $angeltypes) ), $angeltypes)
)); ));
} }
function AngelTypes_about_view($angeltypes, $user_logged_in) { function AngelTypes_about_view($angeltypes, $user_logged_in) {
global $faq_url; global $faq_url;
$content = array( $content = array(
buttons(array( buttons(array(
! $user_logged_in ? button(page_link_to('register'), register_title()) : '', ! $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('login'), login_title()) : '',
$user_logged_in ? button(page_link_to('angeltypes'), angeltypes_title(), 'back') : '', $user_logged_in ? button(page_link_to('angeltypes'), angeltypes_title(), 'back') : '',
button($faq_url, _("FAQ")) button($faq_url, _("FAQ"))
)), )),
'<p>' . _("Here is the list of teams and their tasks. If you have questions, read the FAQ.") . '</p>', '<p>' . _("Here is the list of teams and their tasks. If you have questions, read the FAQ.") . '</p>',
'<hr />' '<hr />'
); );
$parsedown = new Parsedown(); $parsedown = new Parsedown();
foreach ($angeltypes as $angeltype) { foreach ($angeltypes as $angeltype) {
$content[] = '<h2>' . $angeltype['name'] . '</h2>'; $content[] = '<h2>' . $angeltype['name'] . '</h2>';
if (isset($angeltype['user_angeltype_id'])) { if (isset($angeltype['user_angeltype_id'])) {
$buttons = array(); $buttons = array();
if ($angeltype['user_angeltype_id'] != null) if ($angeltype['user_angeltype_id'] != null)
@ -194,15 +194,15 @@ function AngelTypes_about_view($angeltypes, $user_logged_in) {
$buttons[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), 'add'); $buttons[] = button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _("join"), 'add');
$content[] = buttons($buttons); $content[] = buttons($buttons);
} }
if ($angeltype['restricted']) 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[] = 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'] != "") if ($angeltype['description'] != "")
$content[] = '<div class="well">' . $parsedown->parse($angeltype['description']) . '</div>'; $content[] = '<div class="well">' . $parsedown->parse($angeltype['description']) . '</div>';
$content[] = '<hr />'; $content[] = '<hr />';
} }
return page_with_title(_("Teams/Job description"), $content); return page_with_title(_("Teams/Job description"), $content);
} }
?> ?>

Loading…
Cancel
Save