rename coordinator to supporter
This commit is contained in:
parent
468a10774c
commit
82b9436c50
|
@ -1,2 +1,4 @@
|
||||||
INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (40, 'view_rooms', 'User can view rooms');
|
INSERT INTO `Privileges` (`id`, `name`, `desc`) VALUES (40, 'view_rooms', 'User can view rooms');
|
||||||
INSERT INTO `GroupPrivileges` (`id`, `group_id`, `privilege_id`) VALUES (NULL, '-2', '40');
|
INSERT INTO `GroupPrivileges` (`id`, `group_id`, `privilege_id`) VALUES (NULL, '-2', '40');
|
||||||
|
|
||||||
|
ALTER TABLE `UserAngelTypes` CHANGE `coordinator` `supporter` BOOLEAN;
|
|
@ -112,7 +112,7 @@ function angeltype_edit_controller() {
|
||||||
$description = $angeltype['description'];
|
$description = $angeltype['description'];
|
||||||
$requires_driver_license = $angeltype['requires_driver_license'];
|
$requires_driver_license = $angeltype['requires_driver_license'];
|
||||||
|
|
||||||
if (! User_is_AngelType_coordinator($user, $angeltype)) {
|
if (! User_is_AngelType_supporter($user, $angeltype)) {
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -121,13 +121,13 @@ function angeltype_edit_controller() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// In coordinator mode only allow to modify description
|
// In supporter mode only allow to modify description
|
||||||
$coordinator_mode = ! in_array('admin_angel_types', $privileges);
|
$supporter_mode = ! in_array('admin_angel_types', $privileges);
|
||||||
|
|
||||||
if (isset($_REQUEST['submit'])) {
|
if (isset($_REQUEST['submit'])) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
if (! $coordinator_mode) {
|
if (! $supporter_mode) {
|
||||||
if (isset($_REQUEST['name'])) {
|
if (isset($_REQUEST['name'])) {
|
||||||
$result = AngelType_validate_name($_REQUEST['name'], $angeltype);
|
$result = AngelType_validate_name($_REQUEST['name'], $angeltype);
|
||||||
$name = $result->getValue();
|
$name = $result->getValue();
|
||||||
|
@ -168,7 +168,7 @@ function angeltype_edit_controller() {
|
||||||
|
|
||||||
return [
|
return [
|
||||||
sprintf(_("Edit %s"), $name),
|
sprintf(_("Edit %s"), $name),
|
||||||
AngelType_edit_view($name, $restricted, $description, $coordinator_mode, $requires_driver_license)
|
AngelType_edit_view($name, $restricted, $description, $supporter_mode, $requires_driver_license)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ function angeltype_controller() {
|
||||||
|
|
||||||
return [
|
return [
|
||||||
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'], $user_driver_license, $user)
|
AngelType_view($angeltype, $members, $user_angeltype, in_array('admin_user_angeltypes', $privileges) || $user_angeltype['supporter'], in_array('admin_angel_types', $privileges), $user_angeltype['supporter'], $user_driver_license, $user)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a hint for team/angeltype coordinators if there are unconfirmed users for his angeltype.
|
* Display a hint for team/angeltype supporters if there are unconfirmed users for his angeltype.
|
||||||
*/
|
*/
|
||||||
function user_angeltypes_unconfirmed_hint() {
|
function user_angeltypes_unconfirmed_hint() {
|
||||||
global $user;
|
global $user;
|
||||||
|
@ -36,7 +36,7 @@ function user_angeltypes_delete_all_controller() {
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! User_is_AngelType_coordinator($user, $angeltype)) {
|
if (! User_is_AngelType_supporter($user, $angeltype)) {
|
||||||
error(_("You are not allowed to delete all users for this angeltype."));
|
error(_("You are not allowed to delete all users for this angeltype."));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ function user_angeltypes_confirm_all_controller() {
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! in_array('admin_user_angeltypes', $privileges) && ! $user_angeltype['coordinator']) {
|
if (! in_array('admin_user_angeltypes', $privileges) && ! $user_angeltype['supporter']) {
|
||||||
error(_("You are not allowed to confirm all users for this angeltype."));
|
error(_("You are not allowed to confirm all users for this angeltype."));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ function user_angeltype_confirm_controller() {
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! User_is_AngelType_coordinator($user, $angeltype)) {
|
if (! User_is_AngelType_supporter($user, $angeltype)) {
|
||||||
error(_("You are not allowed to confirm this users angeltype."));
|
error(_("You are not allowed to confirm this users angeltype."));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ function user_angeltype_delete_controller() {
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user['UID'] != $user_angeltype['user_id'] && ! User_is_AngelType_coordinator($user, $angeltype)) {
|
if ($user['UID'] != $user_angeltype['user_id'] && ! User_is_AngelType_supporter($user, $angeltype)) {
|
||||||
error(_("You are not allowed to delete this users angeltype."));
|
error(_("You are not allowed to delete this users angeltype."));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ function user_angeltype_update_controller() {
|
||||||
global $privileges;
|
global $privileges;
|
||||||
|
|
||||||
if (! in_array('admin_angel_types', $privileges)) {
|
if (! in_array('admin_angel_types', $privileges)) {
|
||||||
error(_("You are not allowed to set coordinator rights."));
|
error(_("You are not allowed to set supporter rights."));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,10 +217,10 @@ function user_angeltype_update_controller() {
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['coordinator']) && preg_match("/^[01]$/", $_REQUEST['coordinator'])) {
|
if (isset($_REQUEST['supporter']) && preg_match("/^[01]$/", $_REQUEST['supporter'])) {
|
||||||
$coordinator = $_REQUEST['coordinator'] == "1";
|
$supporter = $_REQUEST['supporter'] == "1";
|
||||||
} else {
|
} else {
|
||||||
error(_("No coordinator update given."));
|
error(_("No supporter update given."));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,9 +243,9 @@ function user_angeltype_update_controller() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['confirmed'])) {
|
if (isset($_REQUEST['confirmed'])) {
|
||||||
UserAngelType_update($user_angeltype['id'], $coordinator);
|
UserAngelType_update($user_angeltype['id'], $supporter);
|
||||||
|
|
||||||
$success_message = sprintf($coordinator ? _("Added coordinator rights for %s to %s.") : _("Removed coordinator rights for %s from %s."), AngelType_name_render($angeltype), User_Nick_render($user_source));
|
$success_message = sprintf($supporter ? _("Added supporter rights for %s to %s.") : _("Removed supporter rights for %s from %s."), AngelType_name_render($angeltype), User_Nick_render($user_source));
|
||||||
engelsystem_log($success_message);
|
engelsystem_log($success_message);
|
||||||
success($success_message);
|
success($success_message);
|
||||||
|
|
||||||
|
@ -253,13 +253,13 @@ function user_angeltype_update_controller() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
$coordinator ? _("Add coordinator rights") : _("Remove coordinator rights"),
|
$supporter ? _("Add supporter rights") : _("Remove supporter rights"),
|
||||||
UserAngelType_update_view($user_angeltype, $user_source, $angeltype, $coordinator)
|
UserAngelType_update_view($user_angeltype, $user_source, $angeltype, $supporter)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User joining an Angeltype (Or Coordinator doing this for him).
|
* User joining an Angeltype (Or supporter doing this for him).
|
||||||
*/
|
*/
|
||||||
function user_angeltype_add_controller() {
|
function user_angeltype_add_controller() {
|
||||||
global $user;
|
global $user;
|
||||||
|
@ -267,7 +267,7 @@ function user_angeltype_add_controller() {
|
||||||
$angeltype = load_angeltype();
|
$angeltype = load_angeltype();
|
||||||
|
|
||||||
// User is joining by itself
|
// User is joining by itself
|
||||||
if (! User_is_AngelType_coordinator($user, $angeltype)) {
|
if (! User_is_AngelType_supporter($user, $angeltype)) {
|
||||||
return user_angeltype_join_controller($angeltype);
|
return user_angeltype_join_controller($angeltype);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,16 +9,15 @@ function user_driver_license_required_hint() {
|
||||||
$angeltypes = User_angeltypes($user);
|
$angeltypes = User_angeltypes($user);
|
||||||
$user_driver_license = UserDriverLicense($user['UID']);
|
$user_driver_license = UserDriverLicense($user['UID']);
|
||||||
|
|
||||||
$driving_license_information_required = false;
|
// User has already entered data, no hint needed.
|
||||||
foreach ($angeltypes as $angeltype) {
|
if ($user_driver_license != null) {
|
||||||
if ($angeltype['requires_driver_license']) {
|
return '';
|
||||||
$driving_license_information_required = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($driving_license_information_required && $user_driver_license == null) {
|
foreach ($angeltypes as $angeltype) {
|
||||||
return info(sprintf(_("You joined an angeltype which requires a driving license. Please edit your driving license information here: %s."), '<a href="' . user_driver_license_edit_link() . '">' . _("driving license information") . '</a>'), true);
|
if ($angeltype['requires_driver_license']) {
|
||||||
|
return info(sprintf(_("You joined an angeltype which requires a driving license. Please edit your driving license information here: %s."), '<a href="' . user_driver_license_edit_link() . '">' . _("driving license information") . '</a>'), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
|
|
@ -95,7 +95,7 @@ function AngelTypes_with_user($user) {
|
||||||
SELECT `AngelTypes`.*,
|
SELECT `AngelTypes`.*,
|
||||||
`UserAngelTypes`.`id` as `user_angeltype_id`,
|
`UserAngelTypes`.`id` as `user_angeltype_id`,
|
||||||
`UserAngelTypes`.`confirm_user_id`,
|
`UserAngelTypes`.`confirm_user_id`,
|
||||||
`UserAngelTypes`.`coordinator`
|
`UserAngelTypes`.`supporter`
|
||||||
FROM `AngelTypes`
|
FROM `AngelTypes`
|
||||||
LEFT JOIN `UserAngelTypes` ON `AngelTypes`.`id`=`UserAngelTypes`.`angeltype_id`
|
LEFT JOIN `UserAngelTypes` ON `AngelTypes`.`id`=`UserAngelTypes`.`angeltype_id`
|
||||||
AND `UserAngelTypes`.`user_id`=" . $user['UID'] . "
|
AND `UserAngelTypes`.`user_id`=" . $user['UID'] . "
|
||||||
|
|
|
@ -29,7 +29,7 @@ function UserAngelType_exists($user, $angeltype) {
|
||||||
*/
|
*/
|
||||||
function User_angeltypes($user) {
|
function User_angeltypes($user) {
|
||||||
$result = sql_select("
|
$result = sql_select("
|
||||||
SELECT `AngelTypes`.*, `UserAngelTypes`.`confirm_user_id`, `UserAngelTypes`.`coordinator`
|
SELECT `AngelTypes`.*, `UserAngelTypes`.`confirm_user_id`, `UserAngelTypes`.`supporter`
|
||||||
FROM `UserAngelTypes`
|
FROM `UserAngelTypes`
|
||||||
JOIN `AngelTypes` ON `UserAngelTypes`.`angeltype_id` = `AngelTypes`.`id`
|
JOIN `AngelTypes` ON `UserAngelTypes`.`angeltype_id` = `AngelTypes`.`id`
|
||||||
WHERE `UserAngelTypes`.`user_id`='" . sql_escape($user['UID']) . "'
|
WHERE `UserAngelTypes`.`user_id`='" . sql_escape($user['UID']) . "'
|
||||||
|
@ -42,7 +42,7 @@ function User_angeltypes($user) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets unconfirmed user angeltypes for angeltypes of which the given user is a coordinator.
|
* Gets unconfirmed user angeltypes for angeltypes of which the given user is a supporter.
|
||||||
*
|
*
|
||||||
* @param User $user
|
* @param User $user
|
||||||
*/
|
*/
|
||||||
|
@ -56,7 +56,7 @@ function User_unconfirmed_AngelTypes($user) {
|
||||||
JOIN `AngelTypes` ON `UserAngelTypes`.`angeltype_id`=`AngelTypes`.`id`
|
JOIN `AngelTypes` ON `UserAngelTypes`.`angeltype_id`=`AngelTypes`.`id`
|
||||||
JOIN `UserAngelTypes` as `UnconfirmedMembers` ON `UserAngelTypes`.`angeltype_id`=`UnconfirmedMembers`.`angeltype_id`
|
JOIN `UserAngelTypes` as `UnconfirmedMembers` ON `UserAngelTypes`.`angeltype_id`=`UnconfirmedMembers`.`angeltype_id`
|
||||||
WHERE `UserAngelTypes`.`user_id`='" . sql_escape($user['UID']) . "'
|
WHERE `UserAngelTypes`.`user_id`='" . sql_escape($user['UID']) . "'
|
||||||
AND `UserAngelTypes`.`coordinator`=TRUE
|
AND `UserAngelTypes`.`supporter`=TRUE
|
||||||
AND `AngelTypes`.`restricted`=TRUE
|
AND `AngelTypes`.`restricted`=TRUE
|
||||||
AND `UnconfirmedMembers`.`confirm_user_id` IS NULL
|
AND `UnconfirmedMembers`.`confirm_user_id` IS NULL
|
||||||
GROUP BY `UserAngelTypes`.`angeltype_id`
|
GROUP BY `UserAngelTypes`.`angeltype_id`
|
||||||
|
@ -68,35 +68,35 @@ function User_unconfirmed_AngelTypes($user) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if user is angeltype coordinator or has privilege admin_user_angeltypes.
|
* Returns true if user is angeltype supporter or has privilege admin_user_angeltypes.
|
||||||
*
|
*
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @param AngelType $angeltype
|
* @param AngelType $angeltype
|
||||||
*/
|
*/
|
||||||
function User_is_AngelType_coordinator($user, $angeltype) {
|
function User_is_AngelType_supporter($user, $angeltype) {
|
||||||
return (sql_num_query("
|
return (sql_num_query("
|
||||||
SELECT `id`
|
SELECT `id`
|
||||||
FROM `UserAngelTypes`
|
FROM `UserAngelTypes`
|
||||||
WHERE `user_id`='" . sql_escape($user['UID']) . "'
|
WHERE `user_id`='" . sql_escape($user['UID']) . "'
|
||||||
AND `angeltype_id`='" . sql_escape($angeltype['id']) . "'
|
AND `angeltype_id`='" . sql_escape($angeltype['id']) . "'
|
||||||
AND `coordinator`=TRUE
|
AND `supporter`=TRUE
|
||||||
LIMIT 1") > 0) || in_array('admin_user_angeltypes', privileges_for_user($user['UID']));
|
LIMIT 1") > 0) || in_array('admin_user_angeltypes', privileges_for_user($user['UID']));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add or remove coordinator rights.
|
* Add or remove supporter rights.
|
||||||
*
|
*
|
||||||
* @param int $user_angeltype_id
|
* @param int $user_angeltype_id
|
||||||
* @param bool $coordinator
|
* @param bool $supporter
|
||||||
*/
|
*/
|
||||||
function UserAngelType_update($user_angeltype_id, $coordinator) {
|
function UserAngelType_update($user_angeltype_id, $supporter) {
|
||||||
$result = sql_query("
|
$result = sql_query("
|
||||||
UPDATE `UserAngelTypes`
|
UPDATE `UserAngelTypes`
|
||||||
SET `coordinator`=" . sql_bool($coordinator) . "
|
SET `supporter`=" . sql_bool($supporter) . "
|
||||||
WHERE `id`='" . sql_escape($user_angeltype_id) . "'
|
WHERE `id`='" . sql_escape($user_angeltype_id) . "'
|
||||||
LIMIT 1");
|
LIMIT 1");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to update coordinator rights.");
|
engelsystem_error("Unable to update supporter rights.");
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ function Users_by_angeltype($angeltype) {
|
||||||
`User`.*,
|
`User`.*,
|
||||||
`UserAngelTypes`.`id` as `user_angeltype_id`,
|
`UserAngelTypes`.`id` as `user_angeltype_id`,
|
||||||
`UserAngelTypes`.`confirm_user_id`,
|
`UserAngelTypes`.`confirm_user_id`,
|
||||||
`UserAngelTypes`.`coordinator`,
|
`UserAngelTypes`.`supporter`,
|
||||||
`UserDriverLicenses`.*
|
`UserDriverLicenses`.*
|
||||||
FROM `User`
|
FROM `User`
|
||||||
JOIN `UserAngelTypes` ON `User`.`UID`=`UserAngelTypes`.`user_id`
|
JOIN `UserAngelTypes` ON `User`.`UID`=`UserAngelTypes`.`user_id`
|
||||||
|
|
|
@ -182,7 +182,7 @@ function guest_register() {
|
||||||
engelsystem_log("User " . User_Nick_render(User($user_id)) . " signed up as: " . join(", ", $user_angel_types_info));
|
engelsystem_log("User " . User_Nick_render(User($user_id)) . " signed up as: " . join(", ", $user_angel_types_info));
|
||||||
success(_("Angel registration successful!"));
|
success(_("Angel registration successful!"));
|
||||||
|
|
||||||
// User is already logged in - that means a coordinator has registered an angel. Return to register page.
|
// User is already logged in - that means a supporter has registered an angel. Return to register page.
|
||||||
if (isset($user)) {
|
if (isset($user)) {
|
||||||
redirect(page_link_to('register'));
|
redirect(page_link_to('register'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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['coordinator']) {
|
} elseif ($user_angeltype['supporter']) {
|
||||||
return glyph_bool(true) . _("Coordinator");
|
return glyph_bool(true) . _("supporter");
|
||||||
}
|
}
|
||||||
return glyph_bool(true) . _("Member");
|
return glyph_bool(true) . _("Member");
|
||||||
} elseif ($user_angeltype['coordinator']) {
|
} elseif ($user_angeltype['supporter']) {
|
||||||
return glyph_bool(true) . _("Coordinator");
|
return glyph_bool(true) . _("supporter");
|
||||||
}
|
}
|
||||||
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, $coordinator_mode, $requires_driver_license) {
|
function AngelType_edit_view($name, $restricted, $description, $supporter_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([
|
||||||
$coordinator_mode ? form_info(_("Name"), $name) : form_text('name', _("Name"), $name),
|
$supporter_mode ? form_info(_("Name"), $name) : form_text('name', _("Name"), $name),
|
||||||
$coordinator_mode ? form_info(_("Restricted"), $restricted ? _("Yes") : _("No")) : form_checkbox('restricted', _("Restricted"), $restricted),
|
$supporter_mode ? form_info(_("Restricted"), $restricted ? _("Yes") : _("No")) : form_checkbox('restricted', _("Restricted"), $restricted),
|
||||||
$coordinator_mode ? form_info(_("Requires driver license"), $requires_driver_license ? _("Yes") : _("No")) : form_checkbox('requires_driver_license', _("Requires driver license"), $requires_driver_license),
|
$supporter_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, $coordinator, $user_driver_license, $user) {
|
function AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $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 || $coordinator) {
|
if ($admin_angeltypes || $supporter) {
|
||||||
$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 coordinators, members and unconfirmed members.
|
* Renders and sorts the members of an angeltype into supporters, members and unconfirmed members.
|
||||||
*
|
*
|
||||||
* @return [coordinators, members, unconfirmed members]
|
* @return [supporters, 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) {
|
||||||
$coordinators = [];
|
$supporters = [];
|
||||||
$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['coordinator']) {
|
} elseif ($member['supporter']) {
|
||||||
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 coordinator rights"), 'btn-xs')
|
button(page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $member['user_angeltype_id'] . '&supporter=0', _("Remove supporter rights"), 'btn-xs')
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$member['actions'] = '';
|
$member['actions'] = '';
|
||||||
}
|
}
|
||||||
$coordinators[] = $member;
|
$supporters[] = $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 coordinator rights"), 'btn-xs') : '',
|
$admin_angeltypes ? button(page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $member['user_angeltype_id'] . '&supporter=1', _("Add supporter 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 [
|
||||||
$coordinators,
|
$supporters,
|
||||||
$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, $coordinator, $admin_angeltypes) {
|
function AngelType_view_table_headers($angeltype, $supporter, $admin_angeltypes) {
|
||||||
if ($angeltype['requires_driver_license'] && ($coordinator || $admin_angeltypes)) {
|
if ($angeltype['requires_driver_license'] && ($supporter || $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, $coordinator, $user_driver_license, $user) {
|
function AngelType_view($angeltype, $members, $user_angeltype, $admin_user_angeltypes, $admin_angeltypes, $supporter, $user_driver_license, $user) {
|
||||||
$page = [
|
$page = [
|
||||||
msg(),
|
msg(),
|
||||||
AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $coordinator, $user_driver_license, $user)
|
AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $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($coordinators, $members_confirmed, $members_unconfirmed) = AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $admin_angeltypes);
|
list($supporters, $members_confirmed, $members_unconfirmed) = AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $admin_angeltypes);
|
||||||
$table_headers = AngelType_view_table_headers($angeltype, $coordinator, $admin_angeltypes);
|
$table_headers = AngelType_view_table_headers($angeltype, $supporter, $admin_angeltypes);
|
||||||
|
|
||||||
if (count($coordinators) > 0) {
|
if (count($supporters) > 0) {
|
||||||
$page[] = '<h3>' . _("Coordinators") . '</h3>';
|
$page[] = '<h3>' . _("supporters") . '</h3>';
|
||||||
$page[] = table($table_headers, $coordinators);
|
$page[] = table($table_headers, $supporters);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 coordinator. Please show up at the according introduction meetings."), true);
|
$html .= info(_("This angeltype is restricted by double-opt-in by a team supporter. 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>';
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function UserAngelType_update_view($user_angeltype, $user, $angeltype, $coordinator) {
|
function UserAngelType_update_view($user_angeltype, $user, $angeltype, $supporter) {
|
||||||
return page_with_title($coordinator ? _("Add coordinator rights") : _("Remove coordinator rights"), [
|
return page_with_title($supporter ? _("Add supporter rights") : _("Remove supporter rights"), [
|
||||||
msg(),
|
msg(),
|
||||||
info(sprintf($coordinator ? _("Do you really want to add coordinator rights for %s to %s?") : _("Do you really want to remove coordinator rights for %s from %s?"), $angeltype['name'], User_Nick_render($user)), true),
|
info(sprintf($supporter ? _("Do you really want to add supporter rights for %s to %s?") : _("Do you really want to remove supporter rights for %s from %s?"), $angeltype['name'], User_Nick_render($user)), true),
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'),
|
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("cancel"), 'cancel'),
|
||||||
button(page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $user_angeltype['id'] . '&coordinator=' . ($coordinator ? '1' : '0') . '&confirmed', _("yes"), 'ok')
|
button(page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $user_angeltype['id'] . '&supporter=' . ($supporter ? '1' : '0') . '&confirmed', _("yes"), 'ok')
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $has_car, $h
|
||||||
]),
|
]),
|
||||||
msg(),
|
msg(),
|
||||||
form([
|
form([
|
||||||
form_info(_("Privacy"), _("Your driving license information is only visible for coordinators and admins.")),
|
form_info(_("Privacy"), _("Your driving license information is only visible for supporters and admins.")),
|
||||||
form_checkbox('wants_to_drive', _("I am willing to operate cars for the PL"), $wants_to_drive),
|
form_checkbox('wants_to_drive', _("I am willing to operate cars for the PL"), $wants_to_drive),
|
||||||
div('panel panel-default', [
|
div('panel panel-default', [
|
||||||
div('panel-body', [
|
div('panel-body', [
|
||||||
|
|
|
@ -332,7 +332,7 @@ function User_angeltypes_render($user_angeltypes) {
|
||||||
} else {
|
} else {
|
||||||
$class = 'text-success';
|
$class = 'text-success';
|
||||||
}
|
}
|
||||||
$output[] = '<a href="' . angeltype_link($angeltype['id']) . '" class="' . $class . '">' . ($angeltype['coordinator'] ? glyph('education') : '') . $angeltype['name'] . '</a>';
|
$output[] = '<a href="' . angeltype_link($angeltype['id']) . '" class="' . $class . '">' . ($angeltype['supporter'] ? glyph('education') : '') . $angeltype['name'] . '</a>';
|
||||||
}
|
}
|
||||||
return join('<br />', $output);
|
return join('<br />', $output);
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue