Replaced " with '
This commit is contained in:
parent
356b2582f3
commit
55141154c0
|
@ -4,10 +4,10 @@
|
||||||
$maintenance_mode = false;
|
$maintenance_mode = false;
|
||||||
|
|
||||||
// URL to the angel faq and job description
|
// URL to the angel faq and job description
|
||||||
$faq_url = "https://events.ccc.de/congress/2013/wiki/Static:Volunteers";
|
$faq_url = 'https://events.ccc.de/congress/2013/wiki/Static:Volunteers';
|
||||||
|
|
||||||
// contact email address, linked on every page
|
// contact email address, linked on every page
|
||||||
$contact_email = "mailto:ticket@c3heaven.de";
|
$contact_email = 'mailto:ticket@c3heaven.de';
|
||||||
|
|
||||||
// Default-Theme auf der Startseite, 1=style1.css usw.
|
// Default-Theme auf der Startseite, 1=style1.css usw.
|
||||||
$default_theme = 1;
|
$default_theme = 1;
|
||||||
|
@ -36,33 +36,33 @@ $enable_tshirt_size = true;
|
||||||
$max_freeloadable_shifts = 2;
|
$max_freeloadable_shifts = 2;
|
||||||
|
|
||||||
// local timezone
|
// local timezone
|
||||||
date_default_timezone_set("Europe/Berlin");
|
date_default_timezone_set('Europe/Berlin');
|
||||||
|
|
||||||
// multiply "night shifts" and freeloaded shifts (start or end between 2 and 6 exclusive) by 2
|
// multiply 'night shifts' and freeloaded shifts (start or end between 2 and 6 exclusive) by 2
|
||||||
$shift_sum_formula = "SUM(
|
$shift_sum_formula = 'SUM(
|
||||||
(1+(
|
(1+(
|
||||||
(HOUR(FROM_UNIXTIME(`Shifts`.`end`)) > 2 AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) < 6)
|
(HOUR(FROM_UNIXTIME(`Shifts`.`end`)) > 2 AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) < 6)
|
||||||
OR (HOUR(FROM_UNIXTIME(`Shifts`.`start`)) > 2 AND HOUR(FROM_UNIXTIME(`Shifts`.`start`)) < 6)
|
OR (HOUR(FROM_UNIXTIME(`Shifts`.`start`)) > 2 AND HOUR(FROM_UNIXTIME(`Shifts`.`start`)) < 6)
|
||||||
OR (HOUR(FROM_UNIXTIME(`Shifts`.`start`)) <= 2 AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) >= 6)
|
OR (HOUR(FROM_UNIXTIME(`Shifts`.`start`)) <= 2 AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) >= 6)
|
||||||
))*(`Shifts`.`end` - `Shifts`.`start`)*(1 - 3 * `ShiftEntry`.`freeloaded`)
|
))*(`Shifts`.`end` - `Shifts`.`start`)*(1 - 3 * `ShiftEntry`.`freeloaded`)
|
||||||
)";
|
)';
|
||||||
|
|
||||||
// voucher calculation
|
// voucher calculation
|
||||||
$voucher_settings = [
|
$voucher_settings = [
|
||||||
"initial_vouchers" => 2,
|
'initial_vouchers' => 2,
|
||||||
"shifts_per_voucher" => 1
|
'shifts_per_voucher' => 1
|
||||||
];
|
];
|
||||||
|
|
||||||
// weigh every shift the same
|
// weigh every shift the same
|
||||||
// $shift_sum_formula = "SUM(`end` - `start`)";
|
// $shift_sum_formula = 'SUM(`end` - `start`)';
|
||||||
|
|
||||||
// For accessing stats
|
// For accessing stats
|
||||||
$api_key = "";
|
$api_key = '';
|
||||||
|
|
||||||
// MySQL-Connection Settings
|
// MySQL-Connection Settings
|
||||||
$config = [
|
$config = [
|
||||||
'host' => "localhost",
|
'host' => 'localhost',
|
||||||
'user' => "root",
|
'user' => 'root',
|
||||||
'pw' => "",
|
'pw' => '',
|
||||||
'db' => "engelsystem"
|
'db' => 'engelsystem'
|
||||||
];
|
];
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
function angeltypes_title()
|
function angeltypes_title()
|
||||||
{
|
{
|
||||||
return _("Angeltypes");
|
return _('Angeltypes');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +61,7 @@ function angeltypes_about_controller()
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
_("Teams/Job description"),
|
_('Teams/Job description'),
|
||||||
AngelTypes_about_view($angeltypes, isset($user))
|
AngelTypes_about_view($angeltypes, isset($user))
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -83,12 +83,12 @@ function angeltype_delete_controller()
|
||||||
|
|
||||||
if (isset($_REQUEST['confirmed'])) {
|
if (isset($_REQUEST['confirmed'])) {
|
||||||
AngelType_delete($angeltype);
|
AngelType_delete($angeltype);
|
||||||
success(sprintf(_("Angeltype %s deleted."), AngelType_name_render($angeltype)));
|
success(sprintf(_('Angeltype %s deleted.'), AngelType_name_render($angeltype)));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
sprintf(_("Delete angeltype %s"), $angeltype['name']),
|
sprintf(_('Delete angeltype %s'), $angeltype['name']),
|
||||||
AngelType_delete_view($angeltype)
|
AngelType_delete_view($angeltype)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ function angeltype_edit_controller()
|
||||||
$angeltype['name'] = $result->getValue();
|
$angeltype['name'] = $result->getValue();
|
||||||
if (!$result->isValid()) {
|
if (!$result->isValid()) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Please check the name. Maybe it already exists."));
|
error(_('Please check the name. Maybe it already exists.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,13 +149,13 @@ function angeltype_edit_controller()
|
||||||
$angeltype = AngelType_create($angeltype);
|
$angeltype = AngelType_create($angeltype);
|
||||||
}
|
}
|
||||||
|
|
||||||
success("Angel type saved.");
|
success('Angel type saved.');
|
||||||
redirect(angeltype_link($angeltype['id']));
|
redirect(angeltype_link($angeltype['id']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
sprintf(_("Edit %s"), $angeltype['name']),
|
sprintf(_('Edit %s'), $angeltype['name']),
|
||||||
AngelType_edit_view($angeltype, $supporter_mode)
|
AngelType_edit_view($angeltype, $supporter_mode)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ function angeltype_controller()
|
||||||
$members = Users_by_angeltype($angeltype);
|
$members = Users_by_angeltype($angeltype);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
sprintf(_("Team %s"), $angeltype['name']),
|
sprintf(_('Team %s'), $angeltype['name']),
|
||||||
AngelType_view(
|
AngelType_view(
|
||||||
$angeltype,
|
$angeltype,
|
||||||
$members,
|
$members,
|
||||||
|
@ -210,19 +210,19 @@ function angeltypes_list_controller()
|
||||||
|
|
||||||
foreach ($angeltypes as &$angeltype) {
|
foreach ($angeltypes as &$angeltype) {
|
||||||
$actions = [
|
$actions = [
|
||||||
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')
|
||||||
];
|
];
|
||||||
|
|
||||||
if (in_array('admin_angel_types', $privileges)) {
|
if (in_array('admin_angel_types', $privileges)) {
|
||||||
$actions[] = button(
|
$actions[] = button(
|
||||||
page_link_to('angeltypes') . '&action=edit&angeltype_id=' . $angeltype['id'],
|
page_link_to('angeltypes') . '&action=edit&angeltype_id=' . $angeltype['id'],
|
||||||
_("edit"),
|
_('edit'),
|
||||||
"btn-xs"
|
'btn-xs'
|
||||||
);
|
);
|
||||||
$actions[] = button(
|
$actions[] = button(
|
||||||
page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'],
|
page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'],
|
||||||
_("delete"),
|
_('delete'),
|
||||||
"btn-xs"
|
'btn-xs'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,14 +230,14 @@ function angeltypes_list_controller()
|
||||||
if ($angeltype['user_angeltype_id'] != null) {
|
if ($angeltype['user_angeltype_id'] != null) {
|
||||||
$actions[] = button(
|
$actions[] = button(
|
||||||
page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'],
|
page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'],
|
||||||
_("leave"),
|
_('leave'),
|
||||||
"btn-xs"
|
'btn-xs'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$actions[] = button(
|
$actions[] = button(
|
||||||
page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'],
|
page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'],
|
||||||
_("join"),
|
_('join'),
|
||||||
"btn-xs"
|
'btn-xs'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +268,7 @@ function load_angeltype()
|
||||||
|
|
||||||
$angeltype = AngelType($_REQUEST['angeltype_id']);
|
$angeltype = AngelType($_REQUEST['angeltype_id']);
|
||||||
if ($angeltype == null) {
|
if ($angeltype == null) {
|
||||||
error(_("Angeltype doesn't exist."));
|
error(_('Angeltype doesn\'t exist . '));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function event_config_title()
|
function event_config_title()
|
||||||
{
|
{
|
||||||
return _("Event config");
|
return _('Event config');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,40 +53,40 @@ function event_config_edit_controller()
|
||||||
$event_welcome_msg = null;
|
$event_welcome_msg = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = check_request_date('buildup_start_date', _("Please enter buildup start date."), true);
|
$result = check_request_date('buildup_start_date', _('Please enter buildup start date.'), true);
|
||||||
$buildup_start_date = $result->getValue();
|
$buildup_start_date = $result->getValue();
|
||||||
$valid &= $result->isValid();
|
$valid &= $result->isValid();
|
||||||
|
|
||||||
$result = check_request_date('event_start_date', _("Please enter event start date."), true);
|
$result = check_request_date('event_start_date', _('Please enter event start date.'), true);
|
||||||
$event_start_date = $result->getValue();
|
$event_start_date = $result->getValue();
|
||||||
$valid &= $result->isValid();
|
$valid &= $result->isValid();
|
||||||
|
|
||||||
$result = check_request_date('event_end_date', _("Please enter event end date."), true);
|
$result = check_request_date('event_end_date', _('Please enter event end date.'), true);
|
||||||
$event_end_date = $result->getValue();
|
$event_end_date = $result->getValue();
|
||||||
$valid &= $result->isValid();
|
$valid &= $result->isValid();
|
||||||
|
|
||||||
$result = check_request_date('teardown_end_date', _("Please enter teardown end date."), true);
|
$result = check_request_date('teardown_end_date', _('Please enter teardown end date.'), true);
|
||||||
$teardown_end_date = $result->getValue();
|
$teardown_end_date = $result->getValue();
|
||||||
$valid &= $result->isValid();
|
$valid &= $result->isValid();
|
||||||
|
|
||||||
if ($buildup_start_date != null && $event_start_date != null && $buildup_start_date > $event_start_date) {
|
if ($buildup_start_date != null && $event_start_date != null && $buildup_start_date > $event_start_date) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("The buildup start date has to be before the event start date."));
|
error(_('The buildup start date has to be before the event start date.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($event_start_date != null && $event_end_date != null && $event_start_date > $event_end_date) {
|
if ($event_start_date != null && $event_end_date != null && $event_start_date > $event_end_date) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("The event start date has to be before the event end date."));
|
error(_('The event start date has to be before the event end date.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($event_end_date != null && $teardown_end_date != null && $event_end_date > $teardown_end_date) {
|
if ($event_end_date != null && $teardown_end_date != null && $event_end_date > $teardown_end_date) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("The event end date has to be before the teardown end date."));
|
error(_('The event end date has to be before the teardown end date.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($buildup_start_date != null && $teardown_end_date != null && $buildup_start_date > $teardown_end_date) {
|
if ($buildup_start_date != null && $teardown_end_date != null && $buildup_start_date > $teardown_end_date) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("The buildup start date has to be before the teardown end date."));
|
error(_('The buildup start date has to be before the teardown end date.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
@ -100,15 +100,15 @@ function event_config_edit_controller()
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to update event config.");
|
engelsystem_error('Unable to update event config.');
|
||||||
}
|
}
|
||||||
|
|
||||||
engelsystem_log(
|
engelsystem_log(
|
||||||
"Changed event config: $event_name, $event_welcome_msg, "
|
'Changed event config: $event_name, $event_welcome_msg, '
|
||||||
. date("Y-m-d", $buildup_start_date) . ", " . date("Y-m-d", $event_start_date) . ", "
|
. date('Y-m-d', $buildup_start_date) . ', ' . date('Y-m-d', $event_start_date) . ', '
|
||||||
. date("Y-m-d", $event_end_date) . ", " . date("Y-m-d", $teardown_end_date)
|
. date('Y-m-d', $event_end_date) . ', ' . date('Y-m-d', $teardown_end_date)
|
||||||
);
|
);
|
||||||
success(_("Settings saved."));
|
success(_('Settings saved.'));
|
||||||
redirect(page_link_to('admin_event_config'));
|
redirect(page_link_to('admin_event_config'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ function room_controller()
|
||||||
$all_shifts = Shifts_by_room($room);
|
$all_shifts = Shifts_by_room($room);
|
||||||
$days = [];
|
$days = [];
|
||||||
foreach ($all_shifts as $shift) {
|
foreach ($all_shifts as $shift) {
|
||||||
$day = date("Y-m-d", $shift['start']);
|
$day = date('Y-m-d', $shift['start']);
|
||||||
if (!in_array($day, $days)) {
|
if (!in_array($day, $days)) {
|
||||||
$days[] = $day;
|
$days[] = $day;
|
||||||
}
|
}
|
||||||
|
@ -34,15 +34,15 @@ function room_controller()
|
||||||
[$room['RID']],
|
[$room['RID']],
|
||||||
AngelType_ids()
|
AngelType_ids()
|
||||||
);
|
);
|
||||||
$selected_day = date("Y-m-d");
|
$selected_day = date('Y-m-d');
|
||||||
if (!empty($days)) {
|
if (!empty($days)) {
|
||||||
$selected_day = $days[0];
|
$selected_day = $days[0];
|
||||||
}
|
}
|
||||||
if (isset($_REQUEST['shifts_filter_day'])) {
|
if (isset($_REQUEST['shifts_filter_day'])) {
|
||||||
$selected_day = $_REQUEST['shifts_filter_day'];
|
$selected_day = $_REQUEST['shifts_filter_day'];
|
||||||
}
|
}
|
||||||
$shiftsFilter->setStartTime(parse_date("Y-m-d H:i", $selected_day . ' 00:00'));
|
$shiftsFilter->setStartTime(parse_date('Y-m-d H:i', $selected_day . ' 00:00'));
|
||||||
$shiftsFilter->setEndTime(parse_date("Y-m-d H:i", $selected_day . ' 23:59'));
|
$shiftsFilter->setEndTime(parse_date('Y-m-d H:i', $selected_day . ' 23:59'));
|
||||||
|
|
||||||
$shiftsFilterRenderer = new ShiftsFilterRenderer($shiftsFilter);
|
$shiftsFilterRenderer = new ShiftsFilterRenderer($shiftsFilter);
|
||||||
$shiftsFilterRenderer->enableDaySelection($days);
|
$shiftsFilterRenderer->enableDaySelection($days);
|
||||||
|
|
|
@ -10,14 +10,14 @@ function shift_entry_add_controller()
|
||||||
global $privileges, $user;
|
global $privileges, $user;
|
||||||
|
|
||||||
$shift_id = 0;
|
$shift_id = 0;
|
||||||
if (isset($_REQUEST['shift_id']) && preg_match("/^[0-9]*$/", $_REQUEST['shift_id'])) {
|
if (isset($_REQUEST['shift_id']) && preg_match('/^[0-9]*$/', $_REQUEST['shift_id'])) {
|
||||||
$shift_id = $_REQUEST['shift_id'];
|
$shift_id = $_REQUEST['shift_id'];
|
||||||
} else {
|
} else {
|
||||||
redirect(page_link_to('user_shifts'));
|
redirect(page_link_to('user_shifts'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Locations laden
|
// Locations laden
|
||||||
$rooms = sql_select("SELECT * FROM `Room` WHERE `show`='Y' ORDER BY `Name`");
|
$rooms = sql_select('SELECT * FROM `Room` WHERE `show`=\'Y\' ORDER BY `Name`');
|
||||||
$room_array = [];
|
$room_array = [];
|
||||||
foreach ($rooms as $room) {
|
foreach ($rooms as $room) {
|
||||||
$room_array[$room['RID']] = $room['Name'];
|
$room_array[$room['RID']] = $room['Name'];
|
||||||
|
@ -30,7 +30,7 @@ function shift_entry_add_controller()
|
||||||
}
|
}
|
||||||
|
|
||||||
$type_id = 0;
|
$type_id = 0;
|
||||||
if (isset($_REQUEST['type_id']) && preg_match("/^[0-9]*$/", $_REQUEST['type_id'])) {
|
if (isset($_REQUEST['type_id']) && preg_match('/^[0-9]*$/', $_REQUEST['type_id'])) {
|
||||||
$type_id = $_REQUEST['type_id'];
|
$type_id = $_REQUEST['type_id'];
|
||||||
} else {
|
} else {
|
||||||
redirect(page_link_to('user_shifts'));
|
redirect(page_link_to('user_shifts'));
|
||||||
|
@ -60,7 +60,7 @@ function shift_entry_add_controller()
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isset($_REQUEST['user_id'])
|
isset($_REQUEST['user_id'])
|
||||||
&& preg_match("/^[0-9]*$/", $_REQUEST['user_id'])
|
&& preg_match('/^[0-9]*$/', $_REQUEST['user_id'])
|
||||||
&& (
|
&& (
|
||||||
in_array('user_shifts_admin', $privileges)
|
in_array('user_shifts_admin', $privileges)
|
||||||
|| in_array('shiftentry_edit_angeltype_supporter', $privileges)
|
|| in_array('shiftentry_edit_angeltype_supporter', $privileges)
|
||||||
|
@ -84,7 +84,7 @@ function shift_entry_add_controller()
|
||||||
$shift_entries
|
$shift_entries
|
||||||
);
|
);
|
||||||
if (!$shift_signup_allowed->isSignupAllowed()) {
|
if (!$shift_signup_allowed->isSignupAllowed()) {
|
||||||
error(_("You are not allowed to sign up for this shift. Maybe shift is full or already running."));
|
error(_('You are not allowed to sign up for this shift. Maybe shift is full or already running.'));
|
||||||
redirect(shift_link($shift));
|
redirect(shift_link($shift));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,26 +143,26 @@ function shift_entry_add_controller()
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_source = User($user_id);
|
$user_source = User($user_id);
|
||||||
engelsystem_log("User " . User_Nick_render($user_source) . " signed up for shift " . $shift['name'] . " from " . date("Y-m-d H:i",
|
engelsystem_log('User ' . User_Nick_render($user_source) . ' signed up for shift ' . $shift['name'] . ' from ' . date('Y-m-d H:i',
|
||||||
$shift['start']) . " to " . date("Y-m-d H:i", $shift['end']));
|
$shift['start']) . ' to ' . date('Y-m-d H:i', $shift['end']));
|
||||||
success(_("You are subscribed. Thank you!") . ' <a href="' . page_link_to('user_myshifts') . '">' . _("My shifts") . ' »</a>');
|
success(_('You are subscribed. Thank you!') . ' <a href="' . page_link_to('user_myshifts') . '">' . _('My shifts') . ' »</a>');
|
||||||
redirect(shift_link($shift));
|
redirect(shift_link($shift));
|
||||||
}
|
}
|
||||||
|
|
||||||
$angeltype_select = '';
|
$angeltype_select = '';
|
||||||
if (in_array('user_shifts_admin', $privileges)) {
|
if (in_array('user_shifts_admin', $privileges)) {
|
||||||
$users = sql_select("
|
$users = sql_select('
|
||||||
SELECT *, (SELECT count(*) FROM `ShiftEntry` WHERE `freeloaded`=1 AND `ShiftEntry`.`UID`=`User`.`UID`) AS `freeloaded`
|
SELECT *, (SELECT count(*) FROM `ShiftEntry` WHERE `freeloaded`=1 AND `ShiftEntry`.`UID`=`User`.`UID`) AS `freeloaded`
|
||||||
FROM `User`
|
FROM `User`
|
||||||
ORDER BY `Nick`
|
ORDER BY `Nick`
|
||||||
");
|
');
|
||||||
$users_select = [];
|
$users_select = [];
|
||||||
foreach ($users as $usr) {
|
foreach ($users as $usr) {
|
||||||
$users_select[$usr['UID']] = $usr['Nick'] . ($usr['freeloaded'] == 0 ? "" : " (" . _("Freeloader") . ")");
|
$users_select[$usr['UID']] = $usr['Nick'] . ($usr['freeloaded'] == 0 ? '' : ' (' . _('Freeloader') . ')');
|
||||||
}
|
}
|
||||||
$user_text = html_select_key('user_id', 'user_id', $users_select, $user['UID']);
|
$user_text = html_select_key('user_id', 'user_id', $users_select, $user['UID']);
|
||||||
|
|
||||||
$angeltypes_source = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`");
|
$angeltypes_source = sql_select('SELECT * FROM `AngelTypes` ORDER BY `name`');
|
||||||
$angeltypes = [];
|
$angeltypes = [];
|
||||||
foreach ($angeltypes_source as $angeltype) {
|
foreach ($angeltypes_source as $angeltype) {
|
||||||
$angeltypes[$angeltype['id']] = $angeltype['name'];
|
$angeltypes[$angeltype['id']] = $angeltype['name'];
|
||||||
|
@ -193,13 +193,13 @@ function shift_entry_add_controller()
|
||||||
|
|
||||||
return ShiftEntry_edit_view(
|
return ShiftEntry_edit_view(
|
||||||
$user_text,
|
$user_text,
|
||||||
date("Y-m-d H:i", $shift['start'])
|
date('Y-m-d H:i', $shift['start'])
|
||||||
. ' – '
|
. ' – '
|
||||||
. date('Y-m-d H:i', $shift['end'])
|
. date('Y-m-d H:i', $shift['end'])
|
||||||
. ' (' . shift_length($shift) . ')',
|
. ' (' . shift_length($shift) . ')',
|
||||||
$shift['Name'],
|
$shift['Name'],
|
||||||
$shift['name'],
|
$shift['name'],
|
||||||
$angeltype_select, "",
|
$angeltype_select, '',
|
||||||
false,
|
false,
|
||||||
null,
|
null,
|
||||||
in_array('user_shifts_admin', $privileges)
|
in_array('user_shifts_admin', $privileges)
|
||||||
|
@ -250,15 +250,15 @@ function shift_entry_delete_controller()
|
||||||
}
|
}
|
||||||
|
|
||||||
engelsystem_log(
|
engelsystem_log(
|
||||||
"Deleted " . User_Nick_render($shift_entry_source) . "'s shift: " . $shift_entry_source['name']
|
'Deleted ' . User_Nick_render($shift_entry_source) . '\'s shift: ' . $shift_entry_source['name']
|
||||||
. " at " . $shift_entry_source['Name']
|
. ' at ' . $shift_entry_source['Name']
|
||||||
. " from " . date("Y-m-d H:i", $shift_entry_source['start'])
|
. ' from ' . date('Y-m-d H:i', $shift_entry_source['start'])
|
||||||
. " to " . date("Y-m-d H:i", $shift_entry_source['end'])
|
. ' to ' . date('Y-m-d H:i', $shift_entry_source['end'])
|
||||||
. " as " . $shift_entry_source['angel_type']
|
. ' as ' . $shift_entry_source['angel_type']
|
||||||
);
|
);
|
||||||
success(_("Shift entry deleted."));
|
success(_('Shift entry deleted.'));
|
||||||
} else {
|
} else {
|
||||||
error(_("Entry not found."));
|
error(_('Entry not found.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect(shift_link($shift_entry_source));
|
redirect(shift_link($shift_entry_source));
|
||||||
|
|
|
@ -38,7 +38,7 @@ function shift_edit_controller()
|
||||||
global $privileges;
|
global $privileges;
|
||||||
|
|
||||||
// Schicht bearbeiten
|
// Schicht bearbeiten
|
||||||
$msg = "";
|
$msg = '';
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
if (!in_array('admin_shifts', $privileges)) {
|
if (!in_array('admin_shifts', $privileges)) {
|
||||||
|
@ -74,11 +74,11 @@ function shift_edit_controller()
|
||||||
$title = strip_request_item('title');
|
$title = strip_request_item('title');
|
||||||
|
|
||||||
// Auswahl der sichtbaren Locations für die Schichten
|
// Auswahl der sichtbaren Locations für die Schichten
|
||||||
if (isset($_REQUEST['rid']) && preg_match("/^[0-9]+$/", $_REQUEST['rid']) && isset($room[$_REQUEST['rid']])) {
|
if (isset($_REQUEST['rid']) && preg_match('/^[0-9]+$/', $_REQUEST['rid']) && isset($room[$_REQUEST['rid']])) {
|
||||||
$rid = $_REQUEST['rid'];
|
$rid = $_REQUEST['rid'];
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(_("Please select a room."), true);
|
$msg .= error(_('Please select a room.'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['shifttype_id']) && isset($shifttypes[$_REQUEST['shifttype_id']])) {
|
if (isset($_REQUEST['shifttype_id']) && isset($shifttypes[$_REQUEST['shifttype_id']])) {
|
||||||
|
@ -88,23 +88,23 @@ function shift_edit_controller()
|
||||||
$msg .= error(_('Please select a shifttype.'), true);
|
$msg .= error(_('Please select a shifttype.'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['start']) && $tmp = parse_date("Y-m-d H:i", $_REQUEST['start'])) {
|
if (isset($_REQUEST['start']) && $tmp = parse_date('Y-m-d H:i', $_REQUEST['start'])) {
|
||||||
$start = $tmp;
|
$start = $tmp;
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(_("Please enter a valid starting time for the shifts."), true);
|
$msg .= error(_('Please enter a valid starting time for the shifts.'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['end']) && $tmp = parse_date("Y-m-d H:i", $_REQUEST['end'])) {
|
if (isset($_REQUEST['end']) && $tmp = parse_date('Y-m-d H:i', $_REQUEST['end'])) {
|
||||||
$end = $tmp;
|
$end = $tmp;
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(_("Please enter a valid ending time for the shifts."), true);
|
$msg .= error(_('Please enter a valid ending time for the shifts.'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($start >= $end) {
|
if ($start >= $end) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(_("The ending time has to be after the starting time."), true);
|
$msg .= error(_('The ending time has to be after the starting time.'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($needed_angel_types as $needed_angeltype_id => $needed_angeltype_name) {
|
foreach ($needed_angel_types as $needed_angeltype_id => $needed_angeltype_name) {
|
||||||
|
@ -113,7 +113,7 @@ function shift_edit_controller()
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(sprintf(
|
$msg .= error(sprintf(
|
||||||
_("Please check your input for needed angels of type %s."),
|
_('Please check your input for needed angels of type %s.'),
|
||||||
$needed_angeltype_name
|
$needed_angeltype_name
|
||||||
), true);
|
), true);
|
||||||
}
|
}
|
||||||
|
@ -134,16 +134,16 @@ function shift_edit_controller()
|
||||||
$needed_angel_types_info = [];
|
$needed_angel_types_info = [];
|
||||||
foreach ($needed_angel_types as $type_id => $count) {
|
foreach ($needed_angel_types as $type_id => $count) {
|
||||||
NeededAngelType_add($shift_id, $type_id, null, $count);
|
NeededAngelType_add($shift_id, $type_id, null, $count);
|
||||||
$needed_angel_types_info[] = $angeltypes[$type_id] . ": " . $count;
|
$needed_angel_types_info[] = $angeltypes[$type_id] . ': ' . $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
engelsystem_log(
|
engelsystem_log(
|
||||||
"Updated shift '" . $shifttypes[$shifttype_id] . ", " . $title
|
'Updated shift \'' . $shifttypes[$shifttype_id] . ', ' . $title
|
||||||
. "' from " . date("Y-m-d H:i", $start)
|
. '\' from ' . date('Y-m-d H:i', $start)
|
||||||
. " to " . date("Y-m-d H:i", $end)
|
. ' to ' . date('Y-m-d H:i', $end)
|
||||||
. " with angel types " . join(", ", $needed_angel_types_info)
|
. ' with angel types ' . join(', ', $needed_angel_types_info)
|
||||||
);
|
);
|
||||||
success(_("Shift updated."));
|
success(_('Shift updated.'));
|
||||||
|
|
||||||
redirect(shift_link([
|
redirect(shift_link([
|
||||||
'SID' => $shift_id
|
'SID' => $shift_id
|
||||||
|
@ -151,7 +151,7 @@ function shift_edit_controller()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$angel_types_spinner = "";
|
$angel_types_spinner = '';
|
||||||
foreach ($angeltypes as $angeltype_id => $angeltype_name) {
|
foreach ($angeltypes as $angeltype_id => $angeltype_name) {
|
||||||
$angel_types_spinner .= form_spinner('type_' . $angeltype_id, $angeltype_name,
|
$angel_types_spinner .= form_spinner('type_' . $angeltype_id, $angeltype_name,
|
||||||
$needed_angel_types[$angeltype_id]);
|
$needed_angel_types[$angeltype_id]);
|
||||||
|
@ -161,16 +161,16 @@ function shift_edit_controller()
|
||||||
shifts_title(),
|
shifts_title(),
|
||||||
[
|
[
|
||||||
msg(),
|
msg(),
|
||||||
'<noscript>' . info(_("This page is much more comfortable with javascript."), true) . '</noscript>',
|
'<noscript>' . info(_('This page is much more comfortable with javascript.'), true) . '</noscript>',
|
||||||
form([
|
form([
|
||||||
form_select('shifttype_id', _('Shifttype'), $shifttypes, $shifttype_id),
|
form_select('shifttype_id', _('Shifttype'), $shifttypes, $shifttype_id),
|
||||||
form_text('title', _("Title"), $title),
|
form_text('title', _('Title'), $title),
|
||||||
form_select('rid', _("Room:"), $room, $rid),
|
form_select('rid', _('Room:'), $room, $rid),
|
||||||
form_text('start', _("Start:"), date("Y-m-d H:i", $start)),
|
form_text('start', _('Start:'), date('Y-m-d H:i', $start)),
|
||||||
form_text('end', _("End:"), date("Y-m-d H:i", $end)),
|
form_text('end', _('End:'), date('Y-m-d H:i', $end)),
|
||||||
'<h2>' . _("Needed angels") . '</h2>',
|
'<h2>' . _('Needed angels') . '</h2>',
|
||||||
$angel_types_spinner,
|
$angel_types_spinner,
|
||||||
form_submit('submit', _("Save"))
|
form_submit('submit', _('Save'))
|
||||||
])
|
])
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -188,7 +188,7 @@ function shift_delete_controller()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Schicht komplett löschen (nur für admins/user mit user_shifts_admin privileg)
|
// Schicht komplett löschen (nur für admins/user mit user_shifts_admin privileg)
|
||||||
if (!isset($_REQUEST['delete_shift']) || !preg_match("/^[0-9]*$/", $_REQUEST['delete_shift'])) {
|
if (!isset($_REQUEST['delete_shift']) || !preg_match('/^[0-9]*$/', $_REQUEST['delete_shift'])) {
|
||||||
redirect(page_link_to('user_shifts'));
|
redirect(page_link_to('user_shifts'));
|
||||||
}
|
}
|
||||||
$shift_id = $_REQUEST['delete_shift'];
|
$shift_id = $_REQUEST['delete_shift'];
|
||||||
|
@ -203,22 +203,22 @@ function shift_delete_controller()
|
||||||
Shift_delete($shift_id);
|
Shift_delete($shift_id);
|
||||||
|
|
||||||
engelsystem_log(
|
engelsystem_log(
|
||||||
"Deleted shift " . $shift['name']
|
'Deleted shift ' . $shift['name']
|
||||||
. " from " . date("Y-m-d H:i", $shift['start'])
|
. ' from ' . date('Y-m-d H:i', $shift['start'])
|
||||||
. " to " . date("Y-m-d H:i", $shift['end'])
|
. ' to ' . date('Y-m-d H:i', $shift['end'])
|
||||||
);
|
);
|
||||||
success(_("Shift deleted."));
|
success(_('Shift deleted.'));
|
||||||
redirect(page_link_to('user_shifts'));
|
redirect(page_link_to('user_shifts'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return page_with_title(shifts_title(), [
|
return page_with_title(shifts_title(), [
|
||||||
error(sprintf(
|
error(sprintf(
|
||||||
_("Do you want to delete the shift %s from %s to %s?"),
|
_('Do you want to delete the shift %s from %s to %s?'),
|
||||||
$shift['name'],
|
$shift['name'],
|
||||||
date("Y-m-d H:i", $shift['start']),
|
date('Y-m-d H:i', $shift['start']),
|
||||||
date("H:i", $shift['end'])
|
date('H:i', $shift['end'])
|
||||||
), true),
|
), true),
|
||||||
'<a class="button" href="?p=user_shifts&delete_shift=' . $shift_id . '&delete">' . _("delete") . '</a>'
|
'<a class="button" href="?p=user_shifts&delete_shift=' . $shift_id . '&delete">' . _('delete') . '</a>'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ function shift_controller()
|
||||||
|
|
||||||
$shift = Shift($_REQUEST['shift_id']);
|
$shift = Shift($_REQUEST['shift_id']);
|
||||||
if ($shift == null) {
|
if ($shift == null) {
|
||||||
error(_("Shift could not be found."));
|
error(_('Shift could not be found.'));
|
||||||
redirect(page_link_to('user_shifts'));
|
redirect(page_link_to('user_shifts'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,24 +323,24 @@ function shifts_json_export_all_controller()
|
||||||
{
|
{
|
||||||
global $api_key;
|
global $api_key;
|
||||||
|
|
||||||
if ($api_key == "") {
|
if ($api_key == '') {
|
||||||
engelsystem_error("Config contains empty apikey.");
|
engelsystem_error('Config contains empty apikey.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($_REQUEST['api_key'])) {
|
if (!isset($_REQUEST['api_key'])) {
|
||||||
engelsystem_error("Missing parameter api_key.");
|
engelsystem_error('Missing parameter api_key.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_REQUEST['api_key'] != $api_key) {
|
if ($_REQUEST['api_key'] != $api_key) {
|
||||||
engelsystem_error("Invalid api_key.");
|
engelsystem_error('Invalid api_key.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$shifts_source = Shifts();
|
$shifts_source = Shifts();
|
||||||
if ($shifts_source === false) {
|
if ($shifts_source === false) {
|
||||||
engelsystem_error("Unable to load shifts.");
|
engelsystem_error('Unable to load shifts.');
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Content-Type: application/json; charset=utf-8");
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
raw_output(json_encode($shifts_source));
|
raw_output(json_encode($shifts_source));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,23 +352,23 @@ function shifts_json_export_controller()
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
if (!isset($_REQUEST['key']) || !preg_match("/^[0-9a-f]{32}$/", $_REQUEST['key'])) {
|
if (!isset($_REQUEST['key']) || !preg_match('/^[0-9a-f]{32}$/', $_REQUEST['key'])) {
|
||||||
engelsystem_error("Missing key.");
|
engelsystem_error('Missing key.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = $_REQUEST['key'];
|
$key = $_REQUEST['key'];
|
||||||
|
|
||||||
$user = User_by_api_key($key);
|
$user = User_by_api_key($key);
|
||||||
if ($user == null) {
|
if ($user == null) {
|
||||||
engelsystem_error("Key invalid.");
|
engelsystem_error('Key invalid.');
|
||||||
}
|
}
|
||||||
if (!in_array('shifts_json_export', privileges_for_user($user['UID']))) {
|
if (!in_array('shifts_json_export', privileges_for_user($user['UID']))) {
|
||||||
engelsystem_error("No privilege for shifts_json_export.");
|
engelsystem_error('No privilege for shifts_json_export.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$shifts = load_ical_shifts();
|
$shifts = load_ical_shifts();
|
||||||
|
|
||||||
header("Content-Type: application/json; charset=utf-8");
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
raw_output(json_encode($shifts));
|
raw_output(json_encode($shifts));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ function shifttype_delete_controller()
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
sprintf(_("Delete shifttype %s"), $shifttype['name']),
|
sprintf(_('Delete shifttype %s'), $shifttype['name']),
|
||||||
ShiftType_delete_view($shifttype)
|
ShiftType_delete_view($shifttype)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -54,9 +54,9 @@ function shifttype_delete_controller()
|
||||||
function shifttype_edit_controller()
|
function shifttype_edit_controller()
|
||||||
{
|
{
|
||||||
$shifttype_id = null;
|
$shifttype_id = null;
|
||||||
$name = "";
|
$name = '';
|
||||||
$angeltype_id = null;
|
$angeltype_id = null;
|
||||||
$description = "";
|
$description = '';
|
||||||
|
|
||||||
$angeltypes = AngelTypes();
|
$angeltypes = AngelTypes();
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ function shifttype_edit_controller()
|
||||||
error(_('Please enter a name.'));
|
error(_('Please enter a name.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['angeltype_id']) && preg_match("/^[0-9]+$/", $_REQUEST['angeltype_id'])) {
|
if (isset($_REQUEST['angeltype_id']) && preg_match('/^[0-9]+$/', $_REQUEST['angeltype_id'])) {
|
||||||
$angeltype_id = $_REQUEST['angeltype_id'];
|
$angeltype_id = $_REQUEST['angeltype_id'];
|
||||||
} else {
|
} else {
|
||||||
$angeltype_id = null;
|
$angeltype_id = null;
|
||||||
|
@ -157,7 +157,7 @@ function shifttypes_list_controller()
|
||||||
{
|
{
|
||||||
$shifttypes = ShiftTypes();
|
$shifttypes = ShiftTypes();
|
||||||
if ($shifttypes === false) {
|
if ($shifttypes === false) {
|
||||||
engelsystem_error("Unable to load shifttypes.");
|
engelsystem_error('Unable to load shifttypes.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -173,7 +173,7 @@ function shifttypes_list_controller()
|
||||||
*/
|
*/
|
||||||
function shifttypes_title()
|
function shifttypes_title()
|
||||||
{
|
{
|
||||||
return _("Shifttypes");
|
return _('Shifttypes');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,9 +24,9 @@ function user_angeltypes_unconfirmed_hint()
|
||||||
. '</a>';
|
. '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf(ngettext("There is %d unconfirmed angeltype.", "There are %d unconfirmed angeltypes.",
|
return sprintf(ngettext('There is %d unconfirmed angeltype.', 'There are %d unconfirmed angeltypes.',
|
||||||
count($unconfirmed_user_angeltypes)),
|
count($unconfirmed_user_angeltypes)),
|
||||||
count($unconfirmed_user_angeltypes)) . " " . _('Angel types which need approvals:') . ' ' . join(', ',
|
count($unconfirmed_user_angeltypes)) . ' ' . _('Angel types which need approvals:') . ' ' . join(', ',
|
||||||
$unconfirmed_links);
|
$unconfirmed_links);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,31 +40,31 @@ function user_angeltypes_delete_all_controller()
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
if (!isset($_REQUEST['angeltype_id'])) {
|
if (!isset($_REQUEST['angeltype_id'])) {
|
||||||
error(_("Angeltype doesn't exist."));
|
error(_('Angeltype doesn\'t exist.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$angeltype = AngelType($_REQUEST['angeltype_id']);
|
$angeltype = AngelType($_REQUEST['angeltype_id']);
|
||||||
if ($angeltype == null) {
|
if ($angeltype == null) {
|
||||||
error(_("Angeltype doesn't exist."));
|
error(_('Angeltype doesn\'t exist.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!User_is_AngelType_supporter($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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['confirmed'])) {
|
if (isset($_REQUEST['confirmed'])) {
|
||||||
UserAngelTypes_delete_all($angeltype['id']);
|
UserAngelTypes_delete_all($angeltype['id']);
|
||||||
|
|
||||||
engelsystem_log(sprintf("Denied all users for angeltype %s", AngelType_name_render($angeltype)));
|
engelsystem_log(sprintf('Denied all users for angeltype %s', AngelType_name_render($angeltype)));
|
||||||
success(sprintf(_("Denied all users for angeltype %s."), AngelType_name_render($angeltype)));
|
success(sprintf(_('Denied all users for angeltype %s.'), AngelType_name_render($angeltype)));
|
||||||
redirect(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id']);
|
redirect(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
_("Deny all users"),
|
_('Deny all users'),
|
||||||
UserAngelTypes_delete_all_view($angeltype)
|
UserAngelTypes_delete_all_view($angeltype)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -79,37 +79,37 @@ function user_angeltypes_confirm_all_controller()
|
||||||
global $user, $privileges;
|
global $user, $privileges;
|
||||||
|
|
||||||
if (!isset($_REQUEST['angeltype_id'])) {
|
if (!isset($_REQUEST['angeltype_id'])) {
|
||||||
error(_("Angeltype doesn't exist."));
|
error(_('Angeltype doesn\'t exist.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$angeltype = AngelType($_REQUEST['angeltype_id']);
|
$angeltype = AngelType($_REQUEST['angeltype_id']);
|
||||||
if ($angeltype == null) {
|
if ($angeltype == null) {
|
||||||
error(_("Angeltype doesn't exist."));
|
error(_('Angeltype doesn\'t exist.'));
|
||||||
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 == null) {
|
if ($user_angeltype == null) {
|
||||||
error(_("User angeltype doesn't exist."));
|
error(_('User angeltype doesn\'t exist.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array('admin_user_angeltypes', $privileges) && !$user_angeltype['supporter']) {
|
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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['confirmed'])) {
|
if (isset($_REQUEST['confirmed'])) {
|
||||||
UserAngelTypes_confirm_all($angeltype['id'], $user);
|
UserAngelTypes_confirm_all($angeltype['id'], $user);
|
||||||
|
|
||||||
engelsystem_log(sprintf("Confirmed all users for angeltype %s", AngelType_name_render($angeltype)));
|
engelsystem_log(sprintf('Confirmed all users for angeltype %s', AngelType_name_render($angeltype)));
|
||||||
success(sprintf(_("Confirmed all users for angeltype %s."), AngelType_name_render($angeltype)));
|
success(sprintf(_('Confirmed all users for angeltype %s.'), AngelType_name_render($angeltype)));
|
||||||
redirect(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id']);
|
redirect(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
_("Confirm all users"),
|
_('Confirm all users'),
|
||||||
UserAngelTypes_confirm_all_view($angeltype)
|
UserAngelTypes_confirm_all_view($angeltype)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -124,46 +124,46 @@ function user_angeltype_confirm_controller()
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
if (!isset($_REQUEST['user_angeltype_id'])) {
|
if (!isset($_REQUEST['user_angeltype_id'])) {
|
||||||
error(_("User angeltype doesn't exist."));
|
error(_('User angeltype doesn\'t exist.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_angeltype = UserAngelType($_REQUEST['user_angeltype_id']);
|
$user_angeltype = UserAngelType($_REQUEST['user_angeltype_id']);
|
||||||
if ($user_angeltype == null) {
|
if ($user_angeltype == null) {
|
||||||
error(_("User angeltype doesn't exist."));
|
error(_('User angeltype doesn\'t exist.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$angeltype = AngelType($user_angeltype['angeltype_id']);
|
$angeltype = AngelType($user_angeltype['angeltype_id']);
|
||||||
if ($angeltype == null) {
|
if ($angeltype == null) {
|
||||||
error(_("Angeltype doesn't exist."));
|
error(_('Angeltype doesn\'t exist.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!User_is_AngelType_supporter($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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_source = User($user_angeltype['user_id']);
|
$user_source = User($user_angeltype['user_id']);
|
||||||
if ($user_source == null) {
|
if ($user_source == null) {
|
||||||
error(_("User doesn't exist."));
|
error(_('User doesn\'t exist.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['confirmed'])) {
|
if (isset($_REQUEST['confirmed'])) {
|
||||||
$result = UserAngelType_confirm($user_angeltype['id'], $user);
|
$result = UserAngelType_confirm($user_angeltype['id'], $user);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to confirm user angeltype.");
|
engelsystem_error('Unable to confirm user angeltype.');
|
||||||
}
|
}
|
||||||
|
|
||||||
engelsystem_log(sprintf(
|
engelsystem_log(sprintf(
|
||||||
"%s confirmed for angeltype %s",
|
'%s confirmed for angeltype %s',
|
||||||
User_Nick_render($user_source),
|
User_Nick_render($user_source),
|
||||||
AngelType_name_render($angeltype)
|
AngelType_name_render($angeltype)
|
||||||
));
|
));
|
||||||
success(sprintf(
|
success(sprintf(
|
||||||
_("%s confirmed for angeltype %s."),
|
_('%s confirmed for angeltype %s.'),
|
||||||
User_Nick_render($user_source),
|
User_Nick_render($user_source),
|
||||||
AngelType_name_render($angeltype)
|
AngelType_name_render($angeltype)
|
||||||
));
|
));
|
||||||
|
@ -171,7 +171,7 @@ function user_angeltype_confirm_controller()
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
_("Confirm angeltype for user"),
|
_('Confirm angeltype for user'),
|
||||||
UserAngelType_confirm_view($user_angeltype, $user_source, $angeltype)
|
UserAngelType_confirm_view($user_angeltype, $user_source, $angeltype)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -186,40 +186,40 @@ function user_angeltype_delete_controller()
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
if (!isset($_REQUEST['user_angeltype_id'])) {
|
if (!isset($_REQUEST['user_angeltype_id'])) {
|
||||||
error(_("User angeltype doesn't exist."));
|
error(_('User angeltype doesn\'t exist.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_angeltype = UserAngelType($_REQUEST['user_angeltype_id']);
|
$user_angeltype = UserAngelType($_REQUEST['user_angeltype_id']);
|
||||||
if ($user_angeltype == null) {
|
if ($user_angeltype == null) {
|
||||||
error(_("User angeltype doesn't exist."));
|
error(_('User angeltype doesn\'t exist.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$angeltype = AngelType($user_angeltype['angeltype_id']);
|
$angeltype = AngelType($user_angeltype['angeltype_id']);
|
||||||
if ($angeltype == null) {
|
if ($angeltype == null) {
|
||||||
error(_("Angeltype doesn't exist."));
|
error(_('Angeltype doesn\'t exist.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_source = User($user_angeltype['user_id']);
|
$user_source = User($user_angeltype['user_id']);
|
||||||
if ($user_source == null) {
|
if ($user_source == null) {
|
||||||
error(_("User doesn't exist."));
|
error(_('User doesn\'t exist.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user['UID'] != $user_angeltype['user_id'] && !User_is_AngelType_supporter($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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['confirmed'])) {
|
if (isset($_REQUEST['confirmed'])) {
|
||||||
$result = UserAngelType_delete($user_angeltype);
|
$result = UserAngelType_delete($user_angeltype);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to delete user angeltype.");
|
engelsystem_error('Unable to delete user angeltype.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$success_message = sprintf(_("User %s removed from %s."), User_Nick_render($user_source), $angeltype['name']);
|
$success_message = sprintf(_('User %s removed from %s.'), User_Nick_render($user_source), $angeltype['name']);
|
||||||
engelsystem_log($success_message);
|
engelsystem_log($success_message);
|
||||||
success($success_message);
|
success($success_message);
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ function user_angeltype_delete_controller()
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
_("Remove angeltype"),
|
_('Remove angeltype'),
|
||||||
UserAngelType_delete_view($user_angeltype, $user_source, $angeltype)
|
UserAngelType_delete_view($user_angeltype, $user_source, $angeltype)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -243,37 +243,37 @@ function user_angeltype_update_controller()
|
||||||
$supporter = false;
|
$supporter = false;
|
||||||
|
|
||||||
if (!in_array('admin_angel_types', $privileges)) {
|
if (!in_array('admin_angel_types', $privileges)) {
|
||||||
error(_("You are not allowed to set supporter rights."));
|
error(_('You are not allowed to set supporter rights.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($_REQUEST['user_angeltype_id'])) {
|
if (!isset($_REQUEST['user_angeltype_id'])) {
|
||||||
error(_("User angeltype doesn't exist."));
|
error(_('User angeltype doesn\'t exist.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['supporter']) && preg_match("/^[01]$/", $_REQUEST['supporter'])) {
|
if (isset($_REQUEST['supporter']) && preg_match('/^[01]$/', $_REQUEST['supporter'])) {
|
||||||
$supporter = $_REQUEST['supporter'] == "1";
|
$supporter = $_REQUEST['supporter'] == '1';
|
||||||
} else {
|
} else {
|
||||||
error(_("No supporter update given."));
|
error(_('No supporter update given.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_angeltype = UserAngelType($_REQUEST['user_angeltype_id']);
|
$user_angeltype = UserAngelType($_REQUEST['user_angeltype_id']);
|
||||||
if ($user_angeltype == null) {
|
if ($user_angeltype == null) {
|
||||||
error(_("User angeltype doesn't exist."));
|
error(_('User angeltype doesn\'t exist.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$angeltype = AngelType($user_angeltype['angeltype_id']);
|
$angeltype = AngelType($user_angeltype['angeltype_id']);
|
||||||
if ($angeltype == null) {
|
if ($angeltype == null) {
|
||||||
error(_("Angeltype doesn't exist."));
|
error(_('Angeltype doesn\'t exist.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_source = User($user_angeltype['user_id']);
|
$user_source = User($user_angeltype['user_id']);
|
||||||
if ($user_source == null) {
|
if ($user_source == null) {
|
||||||
error(_("User doesn't exist."));
|
error(_('User doesn\'t exist.'));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ function user_angeltype_update_controller()
|
||||||
UserAngelType_update($user_angeltype['id'], $supporter);
|
UserAngelType_update($user_angeltype['id'], $supporter);
|
||||||
|
|
||||||
$success_message = sprintf(
|
$success_message = sprintf(
|
||||||
$supporter ? _("Added supporter rights for %s to %s.") : _("Removed supporter rights for %s from %s."),
|
$supporter ? _('Added supporter rights for %s to %s.') : _('Removed supporter rights for %s from %s.'),
|
||||||
AngelType_name_render($angeltype),
|
AngelType_name_render($angeltype),
|
||||||
User_Nick_render($user_source)
|
User_Nick_render($user_source)
|
||||||
);
|
);
|
||||||
|
@ -292,7 +292,7 @@ function user_angeltype_update_controller()
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
$supporter ? _("Add supporter rights") : _("Remove supporter rights"),
|
$supporter ? _('Add supporter rights') : _('Remove supporter rights'),
|
||||||
UserAngelType_update_view($user_angeltype, $user_source, $angeltype, $supporter)
|
UserAngelType_update_view($user_angeltype, $user_source, $angeltype, $supporter)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -326,19 +326,19 @@ function user_angeltype_add_controller()
|
||||||
$user_angeltype_id = UserAngelType_create($user_source, $angeltype);
|
$user_angeltype_id = UserAngelType_create($user_source, $angeltype);
|
||||||
|
|
||||||
engelsystem_log(sprintf(
|
engelsystem_log(sprintf(
|
||||||
"User %s added to %s.",
|
'User %s added to %s.',
|
||||||
User_Nick_render($user_source),
|
User_Nick_render($user_source),
|
||||||
AngelType_name_render($angeltype)
|
AngelType_name_render($angeltype)
|
||||||
));
|
));
|
||||||
success(sprintf(
|
success(sprintf(
|
||||||
_("User %s added to %s."),
|
_('User %s added to %s.'),
|
||||||
User_Nick_render($user_source),
|
User_Nick_render($user_source),
|
||||||
AngelType_name_render($angeltype)
|
AngelType_name_render($angeltype)
|
||||||
));
|
));
|
||||||
|
|
||||||
UserAngelType_confirm($user_angeltype_id, $user_source);
|
UserAngelType_confirm($user_angeltype_id, $user_source);
|
||||||
engelsystem_log(sprintf(
|
engelsystem_log(sprintf(
|
||||||
"User %s confirmed as %s.",
|
'User %s confirmed as %s.',
|
||||||
User_Nick_render($user),
|
User_Nick_render($user),
|
||||||
AngelType_name_render($angeltype)
|
AngelType_name_render($angeltype)
|
||||||
));
|
));
|
||||||
|
@ -348,7 +348,7 @@ function user_angeltype_add_controller()
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
_("Add user to angeltype"),
|
_('Add user to angeltype'),
|
||||||
UserAngelType_add_view($angeltype, $users_source, $user_source['UID'])
|
UserAngelType_add_view($angeltype, $users_source, $user_source['UID'])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -365,21 +365,21 @@ function user_angeltype_join_controller($angeltype)
|
||||||
|
|
||||||
$user_angeltype = UserAngelType_by_User_and_AngelType($user, $angeltype);
|
$user_angeltype = UserAngelType_by_User_and_AngelType($user, $angeltype);
|
||||||
if ($user_angeltype != null) {
|
if ($user_angeltype != null) {
|
||||||
error(sprintf(_("You are already a %s."), $angeltype['name']));
|
error(sprintf(_('You are already a %s.'), $angeltype['name']));
|
||||||
redirect(page_link_to('angeltypes'));
|
redirect(page_link_to('angeltypes'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['confirmed'])) {
|
if (isset($_REQUEST['confirmed'])) {
|
||||||
$user_angeltype_id = UserAngelType_create($user, $angeltype);
|
$user_angeltype_id = UserAngelType_create($user, $angeltype);
|
||||||
|
|
||||||
$success_message = sprintf(_("You joined %s."), $angeltype['name']);
|
$success_message = sprintf(_('You joined %s.'), $angeltype['name']);
|
||||||
engelsystem_log(sprintf("User %s joined %s.", User_Nick_render($user), AngelType_name_render($angeltype)));
|
engelsystem_log(sprintf('User %s joined %s.', User_Nick_render($user), AngelType_name_render($angeltype)));
|
||||||
success($success_message);
|
success($success_message);
|
||||||
|
|
||||||
if (in_array('admin_user_angeltypes', $privileges)) {
|
if (in_array('admin_user_angeltypes', $privileges)) {
|
||||||
UserAngelType_confirm($user_angeltype_id, $user);
|
UserAngelType_confirm($user_angeltype_id, $user);
|
||||||
engelsystem_log(sprintf(
|
engelsystem_log(sprintf(
|
||||||
"User %s confirmed as %s.",
|
'User %s confirmed as %s.',
|
||||||
User_Nick_render($user),
|
User_Nick_render($user),
|
||||||
AngelType_name_render($angeltype)
|
AngelType_name_render($angeltype)
|
||||||
));
|
));
|
||||||
|
@ -389,7 +389,7 @@ function user_angeltype_join_controller($angeltype)
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
sprintf(_("Become a %s"), $angeltype['name']),
|
sprintf(_('Become a %s'), $angeltype['name']),
|
||||||
UserAngelType_join_view($user, $angeltype)
|
UserAngelType_join_view($user, $angeltype)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@ function user_driver_license_required_hint()
|
||||||
foreach ($angeltypes as $angeltype) {
|
foreach ($angeltypes as $angeltype) {
|
||||||
if ($angeltype['requires_driver_license']) {
|
if ($angeltype['requires_driver_license']) {
|
||||||
return sprintf(
|
return sprintf(
|
||||||
_("You joined an angeltype which requires a driving license. Please edit your driving license information here: %s."),
|
_('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>'
|
'<a href="' . user_driver_license_edit_link() . '">' . _('driving license information') . '</a>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,22 +127,22 @@ function user_driver_license_edit_controller()
|
||||||
} else {
|
} else {
|
||||||
UserDriverLicenses_update($user_driver_license);
|
UserDriverLicenses_update($user_driver_license);
|
||||||
}
|
}
|
||||||
engelsystem_log("Driver license information updated.");
|
engelsystem_log('Driver license information updated.');
|
||||||
success(_("Your driver license information has been saved."));
|
success(_('Your driver license information has been saved.'));
|
||||||
redirect(user_link($user_source));
|
redirect(user_link($user_source));
|
||||||
} else {
|
} else {
|
||||||
error(_("Please select at least one driving license."));
|
error(_('Please select at least one driving license.'));
|
||||||
}
|
}
|
||||||
} elseif ($user_driver_license['id'] != null) {
|
} elseif ($user_driver_license['id'] != null) {
|
||||||
UserDriverLicenses_delete($user_source['UID']);
|
UserDriverLicenses_delete($user_source['UID']);
|
||||||
engelsystem_log("Driver license information removed.");
|
engelsystem_log('Driver license information removed.');
|
||||||
success(_("Your driver license information has been removed."));
|
success(_('Your driver license information has been removed.'));
|
||||||
redirect(user_link($user_source));
|
redirect(user_link($user_source));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
sprintf(_("Edit %s driving license information"), $user_source['Nick']),
|
sprintf(_('Edit %s driving license information'), $user_source['Nick']),
|
||||||
UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver_license)
|
UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver_license)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ function user_delete_controller()
|
||||||
|
|
||||||
// You cannot delete yourself
|
// You cannot delete yourself
|
||||||
if ($user['UID'] == $user_source['UID']) {
|
if ($user['UID'] == $user_source['UID']) {
|
||||||
error(_("You cannot delete yourself."));
|
error(_('You cannot delete yourself.'));
|
||||||
redirect(user_link($user));
|
redirect(user_link($user));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ function user_delete_controller()
|
||||||
$user['UID']))
|
$user['UID']))
|
||||||
) {
|
) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Your password is incorrect. Please try it again."));
|
error(_('Your password is incorrect. Please try it again.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
@ -74,15 +74,15 @@ function user_delete_controller()
|
||||||
}
|
}
|
||||||
|
|
||||||
mail_user_delete($user_source);
|
mail_user_delete($user_source);
|
||||||
success(_("User deleted."));
|
success(_('User deleted.'));
|
||||||
engelsystem_log(sprintf("Deleted %s", User_Nick_render($user_source)));
|
engelsystem_log(sprintf('Deleted %s', User_Nick_render($user_source)));
|
||||||
|
|
||||||
redirect(users_link());
|
redirect(users_link());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
sprintf(_("Delete %s"), $user_source['Nick']),
|
sprintf(_('Delete %s'), $user_source['Nick']),
|
||||||
User_delete_view($user_source)
|
User_delete_view($user_source)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ function user_edit_vouchers_controller()
|
||||||
$vouchers = trim($_REQUEST['vouchers']);
|
$vouchers = trim($_REQUEST['vouchers']);
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Please enter a valid number of vouchers."));
|
error(_('Please enter a valid number of vouchers.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
@ -158,8 +158,8 @@ function user_edit_vouchers_controller()
|
||||||
engelsystem_error('Unable to update user.');
|
engelsystem_error('Unable to update user.');
|
||||||
}
|
}
|
||||||
|
|
||||||
success(_("Saved the number of vouchers."));
|
success(_('Saved the number of vouchers.'));
|
||||||
engelsystem_log(User_Nick_render($user_source) . ': ' . sprintf("Got %s vouchers",
|
engelsystem_log(User_Nick_render($user_source) . ': ' . sprintf('Got %s vouchers',
|
||||||
$user_source['got_voucher']));
|
$user_source['got_voucher']));
|
||||||
|
|
||||||
redirect(user_link($user_source));
|
redirect(user_link($user_source));
|
||||||
|
@ -167,7 +167,7 @@ function user_edit_vouchers_controller()
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
sprintf(_("%s's vouchers"), $user_source['Nick']),
|
sprintf(_('%s\'s vouchers'), $user_source['Nick']),
|
||||||
User_edit_vouchers_view($user_source)
|
User_edit_vouchers_view($user_source)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -183,12 +183,12 @@ function user_controller()
|
||||||
if (isset($_REQUEST['user_id'])) {
|
if (isset($_REQUEST['user_id'])) {
|
||||||
$user_source = User($_REQUEST['user_id']);
|
$user_source = User($_REQUEST['user_id']);
|
||||||
if ($user_source == null) {
|
if ($user_source == null) {
|
||||||
error(_("User not found."));
|
error(_('User not found.'));
|
||||||
redirect('?');
|
redirect('?');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$shifts = Shifts_by_user($user_source, in_array("user_shifts_admin", $privileges));
|
$shifts = Shifts_by_user($user_source, in_array('user_shifts_admin', $privileges));
|
||||||
foreach ($shifts as &$shift) {
|
foreach ($shifts as &$shift) {
|
||||||
// TODO: Move queries to model
|
// TODO: Move queries to model
|
||||||
$shift['needed_angeltypes'] = sql_select("
|
$shift['needed_angeltypes'] = sql_select("
|
||||||
|
@ -208,7 +208,7 @@ function user_controller()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_source['api_key'] == "") {
|
if ($user_source['api_key'] == '') {
|
||||||
User_reset_api_key($user_source, false);
|
User_reset_api_key($user_source, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ function user_password_recovery_set_new_controller()
|
||||||
global $min_password_length;
|
global $min_password_length;
|
||||||
$user_source = User_by_password_recovery_token($_REQUEST['token']);
|
$user_source = User_by_password_recovery_token($_REQUEST['token']);
|
||||||
if ($user_source == null) {
|
if ($user_source == null) {
|
||||||
error(_("Token is not correct."));
|
error(_('Token is not correct.'));
|
||||||
redirect(page_link_to('login'));
|
redirect(page_link_to('login'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,16 +288,16 @@ function user_password_recovery_set_new_controller()
|
||||||
if (isset($_REQUEST['password']) && strlen($_REQUEST['password']) >= $min_password_length) {
|
if (isset($_REQUEST['password']) && strlen($_REQUEST['password']) >= $min_password_length) {
|
||||||
if ($_REQUEST['password'] != $_REQUEST['password2']) {
|
if ($_REQUEST['password'] != $_REQUEST['password2']) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Your passwords don't match."));
|
error(_('Your passwords don\'t match.'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Your password is to short (please use at least 6 characters)."));
|
error(_('Your password is to short (please use at least 6 characters).'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
set_password($user_source['UID'], $_REQUEST['password']);
|
set_password($user_source['UID'], $_REQUEST['password']);
|
||||||
success(_("Password saved."));
|
success(_('Password saved.'));
|
||||||
redirect(page_link_to('login'));
|
redirect(page_link_to('login'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -321,28 +321,28 @@ function user_password_recovery_start_controller()
|
||||||
$user_source = User_by_email($email);
|
$user_source = User_by_email($email);
|
||||||
if ($user_source == null) {
|
if ($user_source == null) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("E-mail address is not correct."));
|
error(_('E-mail address is not correct.'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("E-mail address is not correct."));
|
error(_('E-mail address is not correct.'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Please enter your e-mail."));
|
error(_('Please enter your e-mail.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
$token = User_generate_password_recovery_token($user_source);
|
$token = User_generate_password_recovery_token($user_source);
|
||||||
engelsystem_email_to_user(
|
engelsystem_email_to_user(
|
||||||
$user_source,
|
$user_source,
|
||||||
_("Password recovery"),
|
_('Password recovery'),
|
||||||
sprintf(
|
sprintf(
|
||||||
_("Please visit %s to recover your password."),
|
_('Please visit %s to recover your password.'),
|
||||||
page_link_to_absolute('user_password_recovery') . '&token=' . $token
|
page_link_to_absolute('user_password_recovery') . '&token=' . $token
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
success(_("We sent an email containing your password recovery link."));
|
success(_('We sent an email containing your password recovery link.'));
|
||||||
redirect(page_link_to('login'));
|
redirect(page_link_to('login'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,7 @@ function user_password_recovery_controller()
|
||||||
*/
|
*/
|
||||||
function user_password_recovery_title()
|
function user_password_recovery_title()
|
||||||
{
|
{
|
||||||
return _("Password recovery");
|
return _('Password recovery');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -388,11 +388,11 @@ function load_user()
|
||||||
|
|
||||||
$user = User($_REQUEST['user_id']);
|
$user = User($_REQUEST['user_id']);
|
||||||
if ($user === false) {
|
if ($user === false) {
|
||||||
engelsystem_error("Unable to load user.");
|
engelsystem_error('Unable to load user.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user == null) {
|
if ($user == null) {
|
||||||
error(_("User doesn't exist."));
|
error(_('User doesn\'t exist.'));
|
||||||
redirect(page_link_to());
|
redirect(page_link_to());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,10 @@ function engelsystem_email_to_user($recipient_user, $title, $message, $not_if_it
|
||||||
|
|
||||||
gettext_locale($recipient_user['Sprache']);
|
gettext_locale($recipient_user['Sprache']);
|
||||||
|
|
||||||
$message = sprintf(_("Hi %s,"), $recipient_user['Nick']) . "\n\n"
|
$message = sprintf(_('Hi %s,'), $recipient_user['Nick']) . "\n\n"
|
||||||
. _("here is a message for you from the engelsystem:") . "\n\n"
|
. _('here is a message for you from the engelsystem:') . "\n\n"
|
||||||
. $message . "\n\n"
|
. $message . "\n\n"
|
||||||
. _("This email is autogenerated and has not to be signed. You got this email because you are registered in the engelsystem.");
|
. _('This email is autogenerated and has not to be signed. You got this email because you are registered in the engelsystem.');
|
||||||
|
|
||||||
gettext_locale();
|
gettext_locale();
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
$locales = [
|
$locales = [
|
||||||
'de_DE.UTF-8' => "Deutsch",
|
'de_DE.UTF-8' => 'Deutsch',
|
||||||
'en_US.UTF-8' => "English"
|
'en_US.UTF-8' => 'English'
|
||||||
];
|
];
|
||||||
|
|
||||||
$default_locale = 'en_US.UTF-8';
|
$default_locale = 'en_US.UTF-8';
|
||||||
|
@ -68,12 +68,12 @@ function gettext_locale($locale = null)
|
||||||
function make_langselect()
|
function make_langselect()
|
||||||
{
|
{
|
||||||
global $locales;
|
global $locales;
|
||||||
$URL = $_SERVER["REQUEST_URI"] . (strpos($_SERVER["REQUEST_URI"], "?") > 0 ? '&' : '?') . "set_locale=";
|
$url = $_SERVER['REQUEST_URI'] . (strpos($_SERVER['REQUEST_URI'], '?') > 0 ? '&' : '?') . 'set_locale=';
|
||||||
|
|
||||||
$items = [];
|
$items = [];
|
||||||
foreach ($locales as $locale => $name) {
|
foreach ($locales as $locale => $name) {
|
||||||
$items[] = toolbar_item_link(
|
$items[] = toolbar_item_link(
|
||||||
htmlspecialchars($URL) . $locale,
|
htmlspecialchars($url) . $locale,
|
||||||
'',
|
'',
|
||||||
'<img src="pic/flag/' . $locale . '.png" alt="' . $name . '" title="' . $name . '"> ' . $name
|
'<img src="pic/flag/' . $locale . '.png" alt="' . $name . '" title="' . $name . '"> ' . $name
|
||||||
);
|
);
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
function msg()
|
function msg()
|
||||||
{
|
{
|
||||||
if (!isset($_SESSION['msg'])) {
|
if (!isset($_SESSION['msg'])) {
|
||||||
return "";
|
return '';
|
||||||
}
|
}
|
||||||
$msg = $_SESSION['msg'];
|
$msg = $_SESSION['msg'];
|
||||||
$_SESSION['msg'] = "";
|
$_SESSION['msg'] = '';
|
||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,14 +62,14 @@ function success($msg, $immediately = false)
|
||||||
function alert($class, $msg, $immediately = false)
|
function alert($class, $msg, $immediately = false)
|
||||||
{
|
{
|
||||||
if ($immediately) {
|
if ($immediately) {
|
||||||
if ($msg == "") {
|
if ($msg == '') {
|
||||||
return "";
|
return '';
|
||||||
}
|
}
|
||||||
return '<div class="alert alert-' . $class . '">' . $msg . '</div>';
|
return '<div class="alert alert-' . $class . '">' . $msg . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($_SESSION['msg'])) {
|
if (!isset($_SESSION['msg'])) {
|
||||||
$_SESSION['msg'] = "";
|
$_SESSION['msg'] = '';
|
||||||
}
|
}
|
||||||
$_SESSION['msg'] .= alert($class, $msg, true);
|
$_SESSION['msg'] .= alert($class, $msg, true);
|
||||||
|
|
||||||
|
|
|
@ -6,45 +6,45 @@
|
||||||
*/
|
*/
|
||||||
function mail_shift_change($old_shift, $new_shift)
|
function mail_shift_change($old_shift, $new_shift)
|
||||||
{
|
{
|
||||||
$users = ShiftEntries_by_shift($old_shift["SID"]);
|
$users = ShiftEntries_by_shift($old_shift['SID']);
|
||||||
$old_room = Room($old_shift["RID"]);
|
$old_room = Room($old_shift['RID']);
|
||||||
$new_room = Room($new_shift["RID"]);
|
$new_room = Room($new_shift['RID']);
|
||||||
|
|
||||||
$noticeable_changes = false;
|
$noticeable_changes = false;
|
||||||
|
|
||||||
$message = _("A Shift you are registered on has changed:");
|
$message = _('A Shift you are registered on has changed:');
|
||||||
$message .= "\n";
|
$message .= "\n";
|
||||||
|
|
||||||
if ($old_shift["name"] != $new_shift["name"]) {
|
if ($old_shift['name'] != $new_shift['name']) {
|
||||||
$message .= sprintf(_("* Shift type changed from %s to %s"), $old_shift["name"], $new_shift["name"]) . "\n";
|
$message .= sprintf(_('* Shift type changed from %s to %s'), $old_shift['name'], $new_shift['name']) . "\n";
|
||||||
$noticeable_changes = true;
|
$noticeable_changes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($old_shift["title"] != $new_shift["title"]) {
|
if ($old_shift['title'] != $new_shift['title']) {
|
||||||
$message .= sprintf(_("* Shift title changed from %s to %s"), $old_shift["title"], $new_shift["title"]) . "\n";
|
$message .= sprintf(_('* Shift title changed from %s to %s'), $old_shift['title'], $new_shift['title']) . "\n";
|
||||||
$noticeable_changes = true;
|
$noticeable_changes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($old_shift["start"] != $new_shift["start"]) {
|
if ($old_shift['start'] != $new_shift['start']) {
|
||||||
$message .= sprintf(
|
$message .= sprintf(
|
||||||
_("* Shift Start changed from %s to %s"),
|
_('* Shift Start changed from %s to %s'),
|
||||||
date("Y-m-d H:i", $old_shift["start"]),
|
date('Y-m-d H:i', $old_shift['start']),
|
||||||
date("Y-m-d H:i", $new_shift["start"])
|
date('Y-m-d H:i', $new_shift['start'])
|
||||||
) . "\n";
|
) . "\n";
|
||||||
$noticeable_changes = true;
|
$noticeable_changes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($old_shift["end"] != $new_shift["end"]) {
|
if ($old_shift['end'] != $new_shift['end']) {
|
||||||
$message .= sprintf(
|
$message .= sprintf(
|
||||||
_("* Shift End changed from %s to %s"),
|
_('* Shift End changed from %s to %s'),
|
||||||
date("Y-m-d H:i", $old_shift["end"]),
|
date('Y-m-d H:i', $old_shift['end']),
|
||||||
date("Y-m-d H:i", $new_shift["end"])
|
date('Y-m-d H:i', $new_shift['end'])
|
||||||
) . "\n";
|
) . "\n";
|
||||||
$noticeable_changes = true;
|
$noticeable_changes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($old_shift["RID"] != $new_shift["RID"]) {
|
if ($old_shift['RID'] != $new_shift['RID']) {
|
||||||
$message .= sprintf(_("* Shift Location changed from %s to %s"), $old_room["Name"], $new_room["Name"]) . "\n";
|
$message .= sprintf(_('* Shift Location changed from %s to %s'), $old_room['Name'], $new_room['Name']) . "\n";
|
||||||
$noticeable_changes = true;
|
$noticeable_changes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,16 +54,16 @@ function mail_shift_change($old_shift, $new_shift)
|
||||||
}
|
}
|
||||||
|
|
||||||
$message .= "\n";
|
$message .= "\n";
|
||||||
$message .= _("The updated Shift:") . "\n";
|
$message .= _('The updated Shift:') . "\n";
|
||||||
|
|
||||||
$message .= $new_shift["name"] . "\n";
|
$message .= $new_shift['name'] . "\n";
|
||||||
$message .= $new_shift["title"] . "\n";
|
$message .= $new_shift['title'] . "\n";
|
||||||
$message .= date("Y-m-d H:i", $new_shift["start"]) . " - " . date("H:i", $new_shift["end"]) . "\n";
|
$message .= date('Y-m-d H:i', $new_shift['start']) . ' - ' . date('H:i', $new_shift['end']) . "\n";
|
||||||
$message .= $new_room["Name"] . "\n";
|
$message .= $new_room['Name'] . "\n";
|
||||||
|
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
if ($user["email_shiftinfo"]) {
|
if ($user['email_shiftinfo']) {
|
||||||
engelsystem_email_to_user($user, '[engelsystem] ' . _("Your Shift has changed"), $message, true);
|
engelsystem_email_to_user($user, '[engelsystem] ' . _('Your Shift has changed'), $message, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,19 +73,19 @@ function mail_shift_change($old_shift, $new_shift)
|
||||||
*/
|
*/
|
||||||
function mail_shift_delete($shift)
|
function mail_shift_delete($shift)
|
||||||
{
|
{
|
||||||
$users = ShiftEntries_by_shift($shift["SID"]);
|
$users = ShiftEntries_by_shift($shift['SID']);
|
||||||
$room = Room($shift["RID"]);
|
$room = Room($shift['RID']);
|
||||||
|
|
||||||
$message = _("A Shift you are registered on was deleted:") . "\n";
|
$message = _('A Shift you are registered on was deleted:') . "\n";
|
||||||
|
|
||||||
$message .= $shift["name"] . "\n";
|
$message .= $shift['name'] . "\n";
|
||||||
$message .= $shift["title"] . "\n";
|
$message .= $shift['title'] . "\n";
|
||||||
$message .= date("Y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n";
|
$message .= date('Y-m-d H:i', $shift['start']) . ' - ' . date('H:i', $shift['end']) . "\n";
|
||||||
$message .= $room["Name"] . "\n";
|
$message .= $room['Name'] . "\n";
|
||||||
|
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
if ($user["email_shiftinfo"]) {
|
if ($user['email_shiftinfo']) {
|
||||||
engelsystem_email_to_user($user, '[engelsystem] ' . _("Your Shift was deleted"), $message, true);
|
engelsystem_email_to_user($user, '[engelsystem] ' . _('Your Shift was deleted'), $message, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,34 +96,34 @@ function mail_shift_delete($shift)
|
||||||
*/
|
*/
|
||||||
function mail_shift_assign($user, $shift)
|
function mail_shift_assign($user, $shift)
|
||||||
{
|
{
|
||||||
if (!$user["email_shiftinfo"]) {
|
if (!$user['email_shiftinfo']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$room = Room($shift["RID"]);
|
$room = Room($shift['RID']);
|
||||||
|
|
||||||
$message = _("You have been assigned to a Shift:") . "\n";
|
$message = _('You have been assigned to a Shift:') . "\n";
|
||||||
$message .= $shift["name"] . "\n";
|
$message .= $shift['name'] . "\n";
|
||||||
$message .= $shift["title"] . "\n";
|
$message .= $shift['title'] . "\n";
|
||||||
$message .= date("Y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n";
|
$message .= date('Y-m-d H:i', $shift['start']) . ' - ' . date('H:i', $shift['end']) . "\n";
|
||||||
$message .= $room["Name"] . "\n";
|
$message .= $room['Name'] . "\n";
|
||||||
|
|
||||||
engelsystem_email_to_user($user, '[engelsystem] ' . _("Assigned to Shift"), $message, true);
|
engelsystem_email_to_user($user, '[engelsystem] ' . _('Assigned to Shift'), $message, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mail_shift_removed($user, $shift)
|
function mail_shift_removed($user, $shift)
|
||||||
{
|
{
|
||||||
if (!$user["email_shiftinfo"]) {
|
if (!$user['email_shiftinfo']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$room = Room($shift["RID"]);
|
$room = Room($shift['RID']);
|
||||||
|
|
||||||
$message = _("You have been removed from a Shift:") . "\n";
|
$message = _('You have been removed from a Shift:') . "\n";
|
||||||
$message .= $shift["name"] . "\n";
|
$message .= $shift['name'] . "\n";
|
||||||
$message .= $shift["title"] . "\n";
|
$message .= $shift['title'] . "\n";
|
||||||
$message .= date("Y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n";
|
$message .= date('Y-m-d H:i', $shift['start']) . ' - ' . date('H:i', $shift['end']) . "\n";
|
||||||
$message .= $room["Name"] . "\n";
|
$message .= $room['Name'] . "\n";
|
||||||
|
|
||||||
engelsystem_email_to_user($user, '[engelsystem] ' . _("Removed from Shift"), $message, true);
|
engelsystem_email_to_user($user, '[engelsystem] ' . _('Removed from Shift'), $message, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ function mail_user_delete($user)
|
||||||
{
|
{
|
||||||
return engelsystem_email_to_user(
|
return engelsystem_email_to_user(
|
||||||
$user,
|
$user,
|
||||||
'[engelsystem] ' . _("Your account has been deleted"),
|
'[engelsystem] ' . _('Your account has been deleted'),
|
||||||
_("Your angelsystem account has been deleted. If you have any questions regarding your account deletion, please contact heaven.")
|
_('Your angelsystem account has been deleted. If you have any questions regarding your account deletion, please contact heaven.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ function AngelType_new()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => null,
|
'id' => null,
|
||||||
'name' => "",
|
'name' => '',
|
||||||
'restricted' => false,
|
'restricted' => false,
|
||||||
'no_self_signup' => false,
|
'no_self_signup' => false,
|
||||||
'description' => '',
|
'description' => '',
|
||||||
|
@ -82,11 +82,12 @@ function AngelType_delete($angeltype)
|
||||||
$result = sql_query("
|
$result = sql_query("
|
||||||
DELETE FROM `AngelTypes`
|
DELETE FROM `AngelTypes`
|
||||||
WHERE `id`='" . sql_escape($angeltype['id']) . "'
|
WHERE `id`='" . sql_escape($angeltype['id']) . "'
|
||||||
LIMIT 1");
|
LIMIT 1
|
||||||
|
");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to delete angeltype.");
|
engelsystem_error('Unable to delete angeltype.');
|
||||||
}
|
}
|
||||||
engelsystem_log("Deleted angeltype: " . AngelType_name_render($angeltype));
|
engelsystem_log('Deleted angeltype: ' . AngelType_name_render($angeltype));
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,9 +112,13 @@ function AngelType_update($angeltype)
|
||||||
`contact_email`=" . sql_null($angeltype['contact_email']) . "
|
`contact_email`=" . sql_null($angeltype['contact_email']) . "
|
||||||
WHERE `id`='" . sql_escape($angeltype['id']) . "'");
|
WHERE `id`='" . sql_escape($angeltype['id']) . "'");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to update angeltype.");
|
engelsystem_error('Unable to update angeltype.');
|
||||||
}
|
}
|
||||||
engelsystem_log("Updated angeltype: " . $angeltype['name'] . ($angeltype['restricted'] ? ", restricted" : "") . ($angeltype['no_self_signup'] ? ", no_self_signup" : "") . ($angeltype['requires_driver_license'] ? ", requires driver license" : ""));
|
engelsystem_log(
|
||||||
|
'Updated angeltype: ' . $angeltype['name'] . ($angeltype['restricted'] ? ', restricted' : '')
|
||||||
|
. ($angeltype['no_self_signup'] ? ', no_self_signup' : '')
|
||||||
|
. ($angeltype['requires_driver_license'] ? ', requires driver license' : '')
|
||||||
|
);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +145,9 @@ function AngelType_create($angeltype)
|
||||||
engelsystem_error("Unable to create angeltype.");
|
engelsystem_error("Unable to create angeltype.");
|
||||||
}
|
}
|
||||||
$angeltype['id'] = sql_id();
|
$angeltype['id'] = sql_id();
|
||||||
engelsystem_log("Created angeltype: " . $angeltype['name'] . ($angeltype['restricted'] ? ", restricted" : "") . ($angeltype['requires_driver_license'] ? ", requires driver license" : ""));
|
engelsystem_log(
|
||||||
|
'Created angeltype: ' . $angeltype['name'] . ($angeltype['restricted'] ? ', restricted' : '')
|
||||||
|
. ($angeltype['requires_driver_license'] ? ', requires driver license' : ''));
|
||||||
return $angeltype;
|
return $angeltype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,8 +163,8 @@ function AngelType_create($angeltype)
|
||||||
function AngelType_validate_name($name, $angeltype)
|
function AngelType_validate_name($name, $angeltype)
|
||||||
{
|
{
|
||||||
$name = strip_item($name);
|
$name = strip_item($name);
|
||||||
if ($name == "") {
|
if ($name == '') {
|
||||||
return new ValidationResult(false, "");
|
return new ValidationResult(false, '');
|
||||||
}
|
}
|
||||||
if ($angeltype != null && isset($angeltype['id'])) {
|
if ($angeltype != null && isset($angeltype['id'])) {
|
||||||
$valid = sql_num_query("
|
$valid = sql_num_query("
|
||||||
|
@ -194,7 +201,7 @@ function AngelTypes_with_user($user)
|
||||||
AND `UserAngelTypes`.`user_id`=" . $user['UID'] . "
|
AND `UserAngelTypes`.`user_id`=" . $user['UID'] . "
|
||||||
ORDER BY `name`");
|
ORDER BY `name`");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to load angeltypes.");
|
engelsystem_error('Unable to load angeltypes.');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -211,7 +218,7 @@ function AngelTypes()
|
||||||
FROM `AngelTypes`
|
FROM `AngelTypes`
|
||||||
ORDER BY `name`");
|
ORDER BY `name`");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to load angeltypes.");
|
engelsystem_error('Unable to load angeltypes.');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -225,7 +232,7 @@ function AngelType_ids()
|
||||||
{
|
{
|
||||||
$result = sql_select("SELECT `id` FROM `AngelTypes`");
|
$result = sql_select("SELECT `id` FROM `AngelTypes`");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to load angeltypes.");
|
engelsystem_error('Unable to load angeltypes.');
|
||||||
}
|
}
|
||||||
return select_array($result, 'id', 'id');
|
return select_array($result, 'id', 'id');
|
||||||
}
|
}
|
||||||
|
@ -240,7 +247,7 @@ function AngelType($angeltype_id)
|
||||||
{
|
{
|
||||||
$angelType_source = sql_select("SELECT * FROM `AngelTypes` WHERE `id`='" . sql_escape($angeltype_id) . "'");
|
$angelType_source = sql_select("SELECT * FROM `AngelTypes` WHERE `id`='" . sql_escape($angeltype_id) . "'");
|
||||||
if ($angelType_source === false) {
|
if ($angelType_source === false) {
|
||||||
engelsystem_error("Unable to load angeltype.");
|
engelsystem_error('Unable to load angeltype.');
|
||||||
}
|
}
|
||||||
if (count($angelType_source) > 0) {
|
if (count($angelType_source) > 0) {
|
||||||
return $angelType_source[0];
|
return $angelType_source[0];
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
*/
|
*/
|
||||||
function EventConfig()
|
function EventConfig()
|
||||||
{
|
{
|
||||||
$event_config = sql_select("SELECT * FROM `EventConfig` LIMIT 1");
|
$event_config = sql_select('SELECT * FROM `EventConfig` LIMIT 1');
|
||||||
if ($event_config === false) {
|
if ($event_config === false) {
|
||||||
engelsystem_error("Unable to load event config.");
|
engelsystem_error('Unable to load event config.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (count($event_config) > 0) {
|
if (count($event_config) > 0) {
|
||||||
|
|
|
@ -9,7 +9,13 @@
|
||||||
*/
|
*/
|
||||||
function LogEntry_create($nick, $message)
|
function LogEntry_create($nick, $message)
|
||||||
{
|
{
|
||||||
return sql_query("INSERT INTO `LogEntries` SET `timestamp`='" . sql_escape(time()) . "', `nick`='" . sql_escape($nick) . "', `message`='" . sql_escape($message) . "'");
|
return sql_query("
|
||||||
|
INSERT INTO `LogEntries`
|
||||||
|
SET
|
||||||
|
`timestamp`='" . sql_escape(time()) . "',
|
||||||
|
`nick`='" . sql_escape($nick) . "',
|
||||||
|
`message`='" . sql_escape($message) . "'
|
||||||
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,7 +25,7 @@ function LogEntry_create($nick, $message)
|
||||||
*/
|
*/
|
||||||
function LogEntries()
|
function LogEntries()
|
||||||
{
|
{
|
||||||
return sql_select("SELECT * FROM `LogEntries` ORDER BY `timestamp` DESC LIMIT 10000");
|
return sql_select('SELECT * FROM `LogEntries` ORDER BY `timestamp` DESC LIMIT 10000');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,10 +36,16 @@ function LogEntries()
|
||||||
*/
|
*/
|
||||||
function LogEntries_filter($keyword)
|
function LogEntries_filter($keyword)
|
||||||
{
|
{
|
||||||
if ($keyword == "") {
|
if ($keyword == '') {
|
||||||
return LogEntries();
|
return LogEntries();
|
||||||
}
|
}
|
||||||
return sql_select("SELECT * FROM `LogEntries` WHERE `nick` LIKE '%" . sql_escape($keyword) . "%' OR `message` LIKE '%" . sql_escape($keyword) . "%' ORDER BY `timestamp` DESC");
|
return sql_select("
|
||||||
|
SELECT *
|
||||||
|
FROM `LogEntries`
|
||||||
|
WHERE `nick` LIKE '%" . sql_escape($keyword) . "%'
|
||||||
|
OR `message` LIKE '%" . sql_escape($keyword) . "%'
|
||||||
|
ORDER BY `timestamp` DESC
|
||||||
|
");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,5 +55,5 @@ function LogEntries_filter($keyword)
|
||||||
*/
|
*/
|
||||||
function LogEntries_clear_all()
|
function LogEntries_clear_all()
|
||||||
{
|
{
|
||||||
return sql_query("TRUNCATE `LogEntries`");
|
return sql_query('TRUNCATE `LogEntries`');
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
function Message_ids()
|
function Message_ids()
|
||||||
{
|
{
|
||||||
return sql_select("SELECT `id` FROM `Messages`");
|
return sql_select('SELECT `id` FROM `Messages`');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,10 +42,10 @@ function Message_send($receiver_user_id, $text)
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$text = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($text));
|
$text = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($text));
|
||||||
$receiver_user_id = preg_replace("/([^0-9]{1,})/ui", '', strip_tags($receiver_user_id));
|
$receiver_user_id = preg_replace('/([^0-9]{1,})/ui', '', strip_tags($receiver_user_id));
|
||||||
|
|
||||||
if (
|
if (
|
||||||
($text != "" && is_numeric($receiver_user_id))
|
($text != '' && is_numeric($receiver_user_id))
|
||||||
&& (sql_num_query("
|
&& (sql_num_query("
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `User`
|
FROM `User`
|
||||||
|
|
|
@ -70,7 +70,7 @@ function NeededAngelTypes_by_shift($shiftId)
|
||||||
ORDER BY `room_id` DESC
|
ORDER BY `room_id` DESC
|
||||||
");
|
");
|
||||||
if ($needed_angeltypes_source === false) {
|
if ($needed_angeltypes_source === false) {
|
||||||
engelsystem_error("Unable to load needed angeltypes.");
|
engelsystem_error('Unable to load needed angeltypes.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use settings from room
|
// Use settings from room
|
||||||
|
@ -85,7 +85,7 @@ function NeededAngelTypes_by_shift($shiftId)
|
||||||
ORDER BY `room_id` DESC
|
ORDER BY `room_id` DESC
|
||||||
");
|
");
|
||||||
if ($needed_angeltypes_source === false) {
|
if ($needed_angeltypes_source === false) {
|
||||||
engelsystem_error("Unable to load needed angeltypes.");
|
engelsystem_error('Unable to load needed angeltypes.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ function Rooms($show_all = false)
|
||||||
*/
|
*/
|
||||||
function Room_delete($room_id)
|
function Room_delete($room_id)
|
||||||
{
|
{
|
||||||
return sql_query("DELETE FROM `Room` WHERE `RID`=" . sql_escape($room_id));
|
return sql_query('DELETE FROM `Room` WHERE `RID`=' . sql_escape($room_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -26,7 +26,7 @@ function ShiftEntry_new()
|
||||||
*/
|
*/
|
||||||
function ShiftEntries_freeleaded_count()
|
function ShiftEntries_freeleaded_count()
|
||||||
{
|
{
|
||||||
return (int)sql_select_single_cell("SELECT COUNT(*) FROM `ShiftEntry` WHERE `freeloaded` = 1");
|
return (int)sql_select_single_cell('SELECT COUNT(*) FROM `ShiftEntry` WHERE `freeloaded` = 1');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -175,7 +175,7 @@ function ShiftEntries_by_shift_and_angeltype($shift_id, $angeltype_id)
|
||||||
AND `TID`=" . sql_escape($angeltype_id) . "
|
AND `TID`=" . sql_escape($angeltype_id) . "
|
||||||
");
|
");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to load shift entries.");
|
engelsystem_error('Unable to load shift entries.');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,5 +78,5 @@ function ShiftType($shifttype_id)
|
||||||
*/
|
*/
|
||||||
function ShiftTypes()
|
function ShiftTypes()
|
||||||
{
|
{
|
||||||
return sql_select("SELECT * FROM `ShiftTypes` ORDER BY `name`");
|
return sql_select('SELECT * FROM `ShiftTypes` ORDER BY `name`');
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,9 @@ use Engelsystem\ShiftSignupState;
|
||||||
*/
|
*/
|
||||||
function Shifts_by_room($room)
|
function Shifts_by_room($room)
|
||||||
{
|
{
|
||||||
$result = sql_select("SELECT * FROM `Shifts` WHERE `RID`=" . sql_escape($room['RID']) . " ORDER BY `start`");
|
$result = sql_select('SELECT * FROM `Shifts` WHERE `RID`=' . sql_escape($room['RID']) . ' ORDER BY `start`');
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to load shifts.");
|
engelsystem_error('Unable to load shifts.');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
||||||
ORDER BY `start`";
|
ORDER BY `start`";
|
||||||
$result = sql_select($SQL);
|
$result = sql_select($SQL);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to load shifts by filter.");
|
engelsystem_error('Unable to load shifts by filter.');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
||||||
AND NOT `Shifts`.`PSID` IS NULL";
|
AND NOT `Shifts`.`PSID` IS NULL";
|
||||||
$result = sql_select($SQL);
|
$result = sql_select($SQL);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to load needed angeltypes by filter.");
|
engelsystem_error('Unable to load needed angeltypes by filter.');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ function NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype)
|
||||||
AND `AngelTypes`.`id`=" . sql_escape($angeltype['id']) . "
|
AND `AngelTypes`.`id`=" . sql_escape($angeltype['id']) . "
|
||||||
AND NOT `Shifts`.`PSID` IS NULL");
|
AND NOT `Shifts`.`PSID` IS NULL");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to load needed angeltypes by filter.");
|
engelsystem_error('Unable to load needed angeltypes by filter.');
|
||||||
}
|
}
|
||||||
if (count($result) == 0) {
|
if (count($result) == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -169,7 +169,7 @@ function ShiftEntries_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
||||||
ORDER BY `Shifts`.`start`";
|
ORDER BY `Shifts`.`start`";
|
||||||
$result = sql_select($SQL);
|
$result = sql_select($SQL);
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to load shift entries by filter.");
|
engelsystem_error('Unable to load shift entries by filter.');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -486,18 +486,18 @@ function Shift_create($shift)
|
||||||
*/
|
*/
|
||||||
function Shifts_by_user($user, $include_freeload_comments = false)
|
function Shifts_by_user($user, $include_freeload_comments = false)
|
||||||
{
|
{
|
||||||
$result = sql_select("
|
$result = sql_select('
|
||||||
SELECT `ShiftTypes`.`id` AS `shifttype_id`, `ShiftTypes`.`name`,
|
SELECT `ShiftTypes`.`id` AS `shifttype_id`, `ShiftTypes`.`name`,
|
||||||
`ShiftEntry`.`id`, `ShiftEntry`.`SID`, `ShiftEntry`.`TID`, `ShiftEntry`.`UID`, `ShiftEntry`.`freeloaded`, `ShiftEntry`.`Comment`,
|
`ShiftEntry`.`id`, `ShiftEntry`.`SID`, `ShiftEntry`.`TID`, `ShiftEntry`.`UID`, `ShiftEntry`.`freeloaded`, `ShiftEntry`.`Comment`,
|
||||||
" . ($include_freeload_comments ? "`ShiftEntry`.`freeload_comment`, " : "") . "
|
' . ($include_freeload_comments ? '`ShiftEntry`.`freeload_comment`, ' : '') . '
|
||||||
`Shifts`.*, `Room`.*
|
`Shifts`.*, `Room`.*
|
||||||
FROM `ShiftEntry`
|
FROM `ShiftEntry`
|
||||||
JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`)
|
JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`)
|
||||||
JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
|
JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
|
||||||
JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`)
|
JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`)
|
||||||
WHERE `UID`='" . sql_escape($user['UID']) . "'
|
WHERE `UID`=\'' . sql_escape($user['UID']) . '\'
|
||||||
ORDER BY `start`
|
ORDER BY `start`
|
||||||
");
|
');
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error('Unable to load users shifts.');
|
engelsystem_error('Unable to load users shifts.');
|
||||||
}
|
}
|
||||||
|
@ -552,12 +552,12 @@ function Shift($shift_id)
|
||||||
*/
|
*/
|
||||||
function Shifts()
|
function Shifts()
|
||||||
{
|
{
|
||||||
$shifts_source = sql_select("
|
$shifts_source = sql_select('
|
||||||
SELECT `ShiftTypes`.`name`, `Shifts`.*, `Room`.`RID`, `Room`.`Name` AS `room_name`
|
SELECT `ShiftTypes`.`name`, `Shifts`.*, `Room`.`RID`, `Room`.`Name` AS `room_name`
|
||||||
FROM `Shifts`
|
FROM `Shifts`
|
||||||
JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
|
JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
|
||||||
JOIN `Room` ON `Room`.`RID` = `Shifts`.`RID`
|
JOIN `Room` ON `Room`.`RID` = `Shifts`.`RID`
|
||||||
");
|
');
|
||||||
if ($shifts_source === false) {
|
if ($shifts_source === false) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ function User_angeltypes($user)
|
||||||
WHERE `UserAngelTypes`.`user_id`='" . sql_escape($user['UID']) . "'
|
WHERE `UserAngelTypes`.`user_id`='" . sql_escape($user['UID']) . "'
|
||||||
");
|
");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to load user angeltypes.");
|
engelsystem_error('Unable to load user angeltypes.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
@ -66,7 +66,7 @@ function User_unconfirmed_AngelTypes($user)
|
||||||
ORDER BY `AngelTypes`.`name`
|
ORDER BY `AngelTypes`.`name`
|
||||||
");
|
");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to load user angeltypes.");
|
engelsystem_error('Unable to load user angeltypes.');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ function UserAngelType_update($user_angeltype_id, $supporter)
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
");
|
");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to update supporter rights.");
|
engelsystem_error('Unable to update supporter rights.');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ function UserAngelTypes_delete_all($angeltype_id)
|
||||||
AND `confirm_user_id` IS NULL
|
AND `confirm_user_id` IS NULL
|
||||||
");
|
");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to delete all unconfirmed users.");
|
engelsystem_error('Unable to delete all unconfirmed users.');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ function UserAngelTypes_confirm_all($angeltype_id, $confirm_user)
|
||||||
AND `confirm_user_id` IS NULL
|
AND `confirm_user_id` IS NULL
|
||||||
");
|
");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to confirm all users.");
|
engelsystem_error('Unable to confirm all users.');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ function UserAngelType_confirm($user_angeltype_id, $confirm_user)
|
||||||
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 confirm user angeltype.");
|
engelsystem_error('Unable to confirm user angeltype.');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ function UserAngelType_create($user, $angeltype)
|
||||||
`user_id`='" . sql_escape($user['UID']) . "',
|
`user_id`='" . sql_escape($user['UID']) . "',
|
||||||
`angeltype_id`='" . sql_escape($angeltype['id']) . "'");
|
`angeltype_id`='" . sql_escape($angeltype['id']) . "'");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to create user angeltype.");
|
engelsystem_error('Unable to create user angeltype.');
|
||||||
}
|
}
|
||||||
return sql_id();
|
return sql_id();
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ function UserAngelType($user_angeltype_id)
|
||||||
WHERE `id`='" . sql_escape($user_angeltype_id) . "'
|
WHERE `id`='" . sql_escape($user_angeltype_id) . "'
|
||||||
LIMIT 1");
|
LIMIT 1");
|
||||||
if ($angeltype === false) {
|
if ($angeltype === false) {
|
||||||
engelsystem_error("Unable to load user angeltype.");
|
engelsystem_error('Unable to load user angeltype.');
|
||||||
}
|
}
|
||||||
if (count($angeltype) == 0) {
|
if (count($angeltype) == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -245,7 +245,7 @@ function UserAngelType_by_User_and_AngelType($user, $angeltype)
|
||||||
AND `angeltype_id`='" . sql_escape($angeltype['id']) . "'
|
AND `angeltype_id`='" . sql_escape($angeltype['id']) . "'
|
||||||
LIMIT 1");
|
LIMIT 1");
|
||||||
if ($angeltype === false) {
|
if ($angeltype === false) {
|
||||||
engelsystem_error("Unable to load user angeltype.");
|
engelsystem_error('Unable to load user angeltype.');
|
||||||
}
|
}
|
||||||
if (count($angeltype) == 0) {
|
if (count($angeltype) == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -98,7 +98,7 @@ function UserDriverLicenses_update($user_driver_license)
|
||||||
`has_license_forklift`=" . sql_bool($user_driver_license['has_license_forklift']) . "
|
`has_license_forklift`=" . sql_bool($user_driver_license['has_license_forklift']) . "
|
||||||
WHERE `user_id`='" . sql_escape($user_driver_license['user_id']) . "'");
|
WHERE `user_id`='" . sql_escape($user_driver_license['user_id']) . "'");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to update user driver license information");
|
engelsystem_error('Unable to update user driver license information');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ function UserDriverLicenses_delete($user_id)
|
||||||
{
|
{
|
||||||
$result = sql_query("DELETE FROM `UserDriverLicenses` WHERE `user_id`=" . sql_escape($user_id));
|
$result = sql_query("DELETE FROM `UserDriverLicenses` WHERE `user_id`=" . sql_escape($user_id));
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to remove user driver license information");
|
engelsystem_error('Unable to remove user driver license information');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
*/
|
*/
|
||||||
function User_groups($user)
|
function User_groups($user)
|
||||||
{
|
{
|
||||||
return sql_select("
|
return sql_select('
|
||||||
SELECT `Groups`.*
|
SELECT `Groups`.*
|
||||||
FROM `UserGroups`
|
FROM `UserGroups`
|
||||||
JOIN `Groups` ON `Groups`.`UID`=`UserGroups`.`group_id`
|
JOIN `Groups` ON `Groups`.`UID`=`UserGroups`.`group_id`
|
||||||
WHERE `UserGroups`.`uid`='" . sql_escape($user['UID']) . "'
|
WHERE `UserGroups`.`uid`=\'' . sql_escape($user['UID']) . '\'
|
||||||
ORDER BY `UserGroups`.`group_id`
|
ORDER BY `UserGroups`.`group_id`
|
||||||
");
|
');
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ function User_update($user)
|
||||||
*/
|
*/
|
||||||
function User_force_active_count()
|
function User_force_active_count()
|
||||||
{
|
{
|
||||||
return sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `force_active` = 1");
|
return sql_select_single_cell('SELECT COUNT(*) FROM `User` WHERE `force_active` = 1');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,7 +68,7 @@ function User_force_active_count()
|
||||||
*/
|
*/
|
||||||
function User_active_count()
|
function User_active_count()
|
||||||
{
|
{
|
||||||
return sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Aktiv` = 1");
|
return sql_select_single_cell('SELECT COUNT(*) FROM `User` WHERE `Aktiv` = 1');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,7 +76,7 @@ function User_active_count()
|
||||||
*/
|
*/
|
||||||
function User_got_voucher_count()
|
function User_got_voucher_count()
|
||||||
{
|
{
|
||||||
return sql_select_single_cell("SELECT SUM(`got_voucher`) FROM `User`");
|
return sql_select_single_cell('SELECT SUM(`got_voucher`) FROM `User`');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,7 +84,7 @@ function User_got_voucher_count()
|
||||||
*/
|
*/
|
||||||
function User_arrived_count()
|
function User_arrived_count()
|
||||||
{
|
{
|
||||||
return sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Gekommen` = 1");
|
return sql_select_single_cell('SELECT COUNT(*) FROM `User` WHERE `Gekommen` = 1');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,7 +92,7 @@ function User_arrived_count()
|
||||||
*/
|
*/
|
||||||
function User_tshirts_count()
|
function User_tshirts_count()
|
||||||
{
|
{
|
||||||
return sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Tshirt` = 1");
|
return sql_select_single_cell('SELECT COUNT(*) FROM `User` WHERE `Tshirt` = 1');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -184,7 +184,7 @@ function Users_by_angeltype($angeltype)
|
||||||
WHERE `UserAngelTypes`.`angeltype_id`='" . sql_escape($angeltype['id']) . "'
|
WHERE `UserAngelTypes`.`angeltype_id`='" . sql_escape($angeltype['id']) . "'
|
||||||
ORDER BY `Nick`");
|
ORDER BY `Nick`");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to load members.");
|
engelsystem_error('Unable to load members.');
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ function Users_by_angeltype($angeltype)
|
||||||
*/
|
*/
|
||||||
function User_ids()
|
function User_ids()
|
||||||
{
|
{
|
||||||
return sql_select("SELECT `UID` FROM `User`");
|
return sql_select('SELECT `UID` FROM `User`');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -207,7 +207,7 @@ function User_ids()
|
||||||
*/
|
*/
|
||||||
function User_validate_Nick($nick)
|
function User_validate_Nick($nick)
|
||||||
{
|
{
|
||||||
return preg_replace("/([^a-z0-9üöäß. _+*-]{1,})/ui", '', $nick);
|
return preg_replace('/([^a-z0-9üöäß. _+*-]{1,})/ui', '', $nick);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -313,7 +313,7 @@ function User($user_id)
|
||||||
{
|
{
|
||||||
$user_source = sql_select("SELECT * FROM `User` WHERE `UID`='" . sql_escape($user_id) . "' LIMIT 1");
|
$user_source = sql_select("SELECT * FROM `User` WHERE `UID`='" . sql_escape($user_id) . "' LIMIT 1");
|
||||||
if ($user_source === false) {
|
if ($user_source === false) {
|
||||||
engelsystem_error("Unable to load user.");
|
engelsystem_error('Unable to load user.');
|
||||||
}
|
}
|
||||||
if (count($user_source) > 0) {
|
if (count($user_source) > 0) {
|
||||||
return $user_source[0];
|
return $user_source[0];
|
||||||
|
@ -332,7 +332,7 @@ function User_by_api_key($api_key)
|
||||||
{
|
{
|
||||||
$user = sql_select("SELECT * FROM `User` WHERE `api_key`='" . sql_escape($api_key) . "' LIMIT 1");
|
$user = sql_select("SELECT * FROM `User` WHERE `api_key`='" . sql_escape($api_key) . "' LIMIT 1");
|
||||||
if ($user === false) {
|
if ($user === false) {
|
||||||
engelsystem_error("Unable to find user by api key.");
|
engelsystem_error('Unable to find user by api key.');
|
||||||
}
|
}
|
||||||
if (count($user) == 0) {
|
if (count($user) == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -350,7 +350,7 @@ function User_by_email($email)
|
||||||
{
|
{
|
||||||
$user = sql_select("SELECT * FROM `User` WHERE `email`='" . sql_escape($email) . "' LIMIT 1");
|
$user = sql_select("SELECT * FROM `User` WHERE `email`='" . sql_escape($email) . "' LIMIT 1");
|
||||||
if ($user === false) {
|
if ($user === false) {
|
||||||
engelsystem_error("Unable to load user.");
|
engelsystem_error('Unable to load user.');
|
||||||
}
|
}
|
||||||
if (count($user) == 0) {
|
if (count($user) == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -368,7 +368,7 @@ function User_by_password_recovery_token($token)
|
||||||
{
|
{
|
||||||
$user = sql_select("SELECT * FROM `User` WHERE `password_recovery_token`='" . sql_escape($token) . "' LIMIT 1");
|
$user = sql_select("SELECT * FROM `User` WHERE `password_recovery_token`='" . sql_escape($token) . "' LIMIT 1");
|
||||||
if ($user === false) {
|
if ($user === false) {
|
||||||
engelsystem_error("Unable to load user.");
|
engelsystem_error('Unable to load user.');
|
||||||
}
|
}
|
||||||
if (count($user) == 0) {
|
if (count($user) == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -392,7 +392,7 @@ function User_reset_api_key(&$user, $log = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($log) {
|
if ($log) {
|
||||||
engelsystem_log(sprintf("API key resetted (%s).", User_Nick_render($user)));
|
engelsystem_log(sprintf('API key resetted (%s).', User_Nick_render($user)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -407,11 +407,16 @@ function User_reset_api_key(&$user, $log = true)
|
||||||
function User_generate_password_recovery_token(&$user)
|
function User_generate_password_recovery_token(&$user)
|
||||||
{
|
{
|
||||||
$user['password_recovery_token'] = md5($user['Nick'] . time() . rand());
|
$user['password_recovery_token'] = md5($user['Nick'] . time() . rand());
|
||||||
$result = sql_query("UPDATE `User` SET `password_recovery_token`='" . sql_escape($user['password_recovery_token']) . "' WHERE `UID`='" . sql_escape($user['UID']) . "' LIMIT 1");
|
$result = sql_query("
|
||||||
|
UPDATE `User`
|
||||||
|
SET `password_recovery_token`='" . sql_escape($user['password_recovery_token']) . "'
|
||||||
|
WHERE `UID`='" . sql_escape($user['UID']) . "'
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error("Unable to generate password recovery token.");
|
engelsystem_error('Unable to generate password recovery token.');
|
||||||
}
|
}
|
||||||
engelsystem_log("Password recovery for " . User_Nick_render($user) . " started.");
|
engelsystem_log('Password recovery for ' . User_Nick_render($user) . ' started.');
|
||||||
return $user['password_recovery_token'];
|
return $user['password_recovery_token'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ function sql_transaction_start()
|
||||||
global $sql_nested_transaction_level;
|
global $sql_nested_transaction_level;
|
||||||
|
|
||||||
if ($sql_nested_transaction_level++ == 0) {
|
if ($sql_nested_transaction_level++ == 0) {
|
||||||
return sql_query("BEGIN");
|
return sql_query('BEGIN');
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -51,7 +51,7 @@ function sql_transaction_commit()
|
||||||
global $sql_nested_transaction_level;
|
global $sql_nested_transaction_level;
|
||||||
|
|
||||||
if (--$sql_nested_transaction_level == 0) {
|
if (--$sql_nested_transaction_level == 0) {
|
||||||
return sql_query("COMMIT");
|
return sql_query('COMMIT');
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -67,7 +67,7 @@ function sql_transaction_rollback()
|
||||||
global $sql_nested_transaction_level;
|
global $sql_nested_transaction_level;
|
||||||
|
|
||||||
if (--$sql_nested_transaction_level == 0) {
|
if (--$sql_nested_transaction_level == 0) {
|
||||||
return sql_query("ROLLBACK");
|
return sql_query('ROLLBACK');
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -107,18 +107,18 @@ function sql_connect($host, $user, $pass, $db_name)
|
||||||
|
|
||||||
$sql_connection = new mysqli($host, $user, $pass, $db_name);
|
$sql_connection = new mysqli($host, $user, $pass, $db_name);
|
||||||
if ($sql_connection->connect_errno) {
|
if ($sql_connection->connect_errno) {
|
||||||
error("Unable to connect to MySQL: " . $sql_connection->connect_error);
|
error('Unable to connect to MySQL: ' . $sql_connection->connect_error);
|
||||||
return sql_error("Unable to connect to MySQL: " . $sql_connection->connect_error);
|
return sql_error('Unable to connect to MySQL: ' . $sql_connection->connect_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $sql_connection->query("SET CHARACTER SET utf8;");
|
$result = $sql_connection->query('SET CHARACTER SET utf8;');
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
return sql_error("Unable to set utf8 character set (" . $sql_connection->errno . ") " . $sql_connection->error);
|
return sql_error('Unable to set utf8 character set (' . $sql_connection->errno . ') ' . $sql_connection->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $sql_connection->set_charset('utf8');
|
$result = $sql_connection->set_charset('utf8');
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
return sql_error("Unable to set utf8 names (" . $sql_connection->errno . ") " . $sql_connection->error);
|
return sql_error('Unable to set utf8 names (' . $sql_connection->errno . ') ' . $sql_connection->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $sql_connection;
|
return $sql_connection;
|
||||||
|
@ -134,7 +134,7 @@ function sql_select_db($db_name)
|
||||||
{
|
{
|
||||||
global $sql_connection;
|
global $sql_connection;
|
||||||
if (!$sql_connection->select_db($db_name)) {
|
if (!$sql_connection->select_db($db_name)) {
|
||||||
return sql_error("No database selected.");
|
return sql_error('No database selected.');
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ function sql_select($query)
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sql_error("MySQL-query error: " . $query . " (" . $sql_connection->errno . ") " . $sql_connection->error);
|
return sql_error('MySQL-query error: ' . $query . ' (' . $sql_connection->errno . ') ' . $sql_connection->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,7 +176,7 @@ function sql_query($query)
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return sql_error("MySQL-query error: " . $query . " (" . $sql_connection->errno . ") " . $sql_connection->error);
|
return sql_error('MySQL-query error: ' . $query . ' (' . $sql_connection->errno . ') ' . $sql_connection->error);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function admin_active_title()
|
function admin_active_title()
|
||||||
{
|
{
|
||||||
return _("Active angels");
|
return _('Active angels');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,12 +15,12 @@ function admin_active()
|
||||||
{
|
{
|
||||||
global $tshirt_sizes, $shift_sum_formula;
|
global $tshirt_sizes, $shift_sum_formula;
|
||||||
|
|
||||||
$msg = "";
|
$msg = '';
|
||||||
$search = "";
|
$search = '';
|
||||||
$forced_count = sql_num_query("SELECT * FROM `User` WHERE `force_active`=1");
|
$forced_count = sql_num_query('SELECT * FROM `User` WHERE `force_active`=1');
|
||||||
$count = $forced_count;
|
$count = $forced_count;
|
||||||
$limit = "";
|
$limit = '';
|
||||||
$set_active = "";
|
$set_active = '';
|
||||||
|
|
||||||
if (isset($_REQUEST['search'])) {
|
if (isset($_REQUEST['search'])) {
|
||||||
$search = strip_request_item('search');
|
$search = strip_request_item('search');
|
||||||
|
@ -31,87 +31,92 @@ function admin_active()
|
||||||
if (isset($_REQUEST['set_active'])) {
|
if (isset($_REQUEST['set_active'])) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
if (isset($_REQUEST['count']) && preg_match("/^[0-9]+$/", $_REQUEST['count'])) {
|
if (isset($_REQUEST['count']) && preg_match('/^[0-9]+$/', $_REQUEST['count'])) {
|
||||||
$count = strip_request_item('count');
|
$count = strip_request_item('count');
|
||||||
if ($count < $forced_count) {
|
if ($count < $forced_count) {
|
||||||
error(sprintf(
|
error(sprintf(
|
||||||
_("At least %s angels are forced to be active. The number has to be greater."),
|
_('At least %s angels are forced to be active. The number has to be greater.'),
|
||||||
$forced_count
|
$forced_count
|
||||||
));
|
));
|
||||||
redirect(page_link_to('admin_active'));
|
redirect(page_link_to('admin_active'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(_("Please enter a number of angels to be marked as active."), true);
|
$msg .= error(_('Please enter a number of angels to be marked as active.'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
$limit = " LIMIT " . $count;
|
$limit = ' LIMIT ' . $count;
|
||||||
}
|
}
|
||||||
if (isset($_REQUEST['ack'])) {
|
if (isset($_REQUEST['ack'])) {
|
||||||
sql_query("UPDATE `User` SET `Aktiv` = 0 WHERE `Tshirt` = 0");
|
sql_query('UPDATE `User` SET `Aktiv` = 0 WHERE `Tshirt` = 0');
|
||||||
$users = sql_select("
|
$users = sql_select("
|
||||||
SELECT `User`.*, COUNT(`ShiftEntry`.`id`) as `shift_count`, $shift_sum_formula as `shift_length`
|
SELECT `User`.*, COUNT(`ShiftEntry`.`id`) as `shift_count`, $shift_sum_formula as `shift_length`
|
||||||
FROM `User`
|
FROM `User`
|
||||||
LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
|
LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
|
||||||
LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID`
|
LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID`
|
||||||
WHERE `User`.`Gekommen` = 1 AND `User`.`force_active`=0
|
WHERE `User`.`Gekommen` = 1 AND `User`.`force_active`=0
|
||||||
GROUP BY `User`.`UID`
|
GROUP BY `User`.`UID`
|
||||||
ORDER BY `force_active` DESC, `shift_length` DESC" . $limit);
|
ORDER BY `force_active` DESC, `shift_length` DESC" . $limit
|
||||||
|
);
|
||||||
$user_nicks = [];
|
$user_nicks = [];
|
||||||
foreach ($users as $usr) {
|
foreach ($users as $usr) {
|
||||||
sql_query("UPDATE `User` SET `Aktiv` = 1 WHERE `UID`='" . sql_escape($usr['UID']) . "'");
|
sql_query('UPDATE `User` SET `Aktiv` = 1 WHERE `UID`=\'' . sql_escape($usr['UID']) . '\'');
|
||||||
$user_nicks[] = User_Nick_render($usr);
|
$user_nicks[] = User_Nick_render($usr);
|
||||||
}
|
}
|
||||||
sql_query("UPDATE `User` SET `Aktiv`=1 WHERE `force_active`=TRUE");
|
sql_query('UPDATE `User` SET `Aktiv`=1 WHERE `force_active`=TRUE');
|
||||||
engelsystem_log("These angels are active now: " . join(", ", $user_nicks));
|
engelsystem_log('These angels are active now: ' . join(', ', $user_nicks));
|
||||||
|
|
||||||
$limit = "";
|
$limit = '';
|
||||||
$msg = success(_("Marked angels."), true);
|
$msg = success(_('Marked angels.'), true);
|
||||||
} else {
|
} else {
|
||||||
$set_active = '<a href="' . page_link_to('admin_active') . '&serach=' . $search . '">« ' . _("back") . '</a> | <a href="' . page_link_to('admin_active') . '&search=' . $search . '&count=' . $count . '&set_active&ack">' . _("apply") . '</a>';
|
$set_active = '<a href="' . page_link_to('admin_active') . '&serach=' . $search . '">« '
|
||||||
|
. _('back') . '</a> | <a href="'
|
||||||
|
. page_link_to('admin_active') . '&search=' . $search . '&count=' . $count . '&set_active&ack">'
|
||||||
|
. _('apply')
|
||||||
|
. '</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['active']) && preg_match("/^[0-9]+$/", $_REQUEST['active'])) {
|
if (isset($_REQUEST['active']) && preg_match('/^[0-9]+$/', $_REQUEST['active'])) {
|
||||||
$user_id = $_REQUEST['active'];
|
$user_id = $_REQUEST['active'];
|
||||||
$user_source = User($user_id);
|
$user_source = User($user_id);
|
||||||
if ($user_source != null) {
|
if ($user_source != null) {
|
||||||
sql_query("UPDATE `User` SET `Aktiv`=1 WHERE `UID`='" . sql_escape($user_id) . "' LIMIT 1");
|
sql_query('UPDATE `User` SET `Aktiv`=1 WHERE `UID`=\'' . sql_escape($user_id) . '\' LIMIT 1');
|
||||||
engelsystem_log("User " . User_Nick_render($user_source) . " is active now.");
|
engelsystem_log('User ' . User_Nick_render($user_source) . ' is active now.');
|
||||||
$msg = success(_("Angel has been marked as active."), true);
|
$msg = success(_('Angel has been marked as active.'), true);
|
||||||
} else {
|
} else {
|
||||||
$msg = error(_("Angel not found."), true);
|
$msg = error(_('Angel not found.'), true);
|
||||||
}
|
}
|
||||||
} elseif (isset($_REQUEST['not_active']) && preg_match("/^[0-9]+$/", $_REQUEST['not_active'])) {
|
} elseif (isset($_REQUEST['not_active']) && preg_match('/^[0-9]+$/', $_REQUEST['not_active'])) {
|
||||||
$user_id = $_REQUEST['not_active'];
|
$user_id = $_REQUEST['not_active'];
|
||||||
$user_source = User($user_id);
|
$user_source = User($user_id);
|
||||||
if ($user_source != null) {
|
if ($user_source != null) {
|
||||||
sql_query("UPDATE `User` SET `Aktiv`=0 WHERE `UID`='" . sql_escape($user_id) . "' LIMIT 1");
|
sql_query("UPDATE `User` SET `Aktiv`=0 WHERE `UID`='" . sql_escape($user_id) . "' LIMIT 1");
|
||||||
engelsystem_log("User " . User_Nick_render($user_source) . " is NOT active now.");
|
engelsystem_log('User ' . User_Nick_render($user_source) . ' is NOT active now.');
|
||||||
$msg = success(_("Angel has been marked as not active."), true);
|
$msg = success(_('Angel has been marked as not active.'), true);
|
||||||
} else {
|
} else {
|
||||||
$msg = error(_("Angel not found."), true);
|
$msg = error(_('Angel not found.'), true);
|
||||||
}
|
}
|
||||||
} elseif (isset($_REQUEST['tshirt']) && preg_match("/^[0-9]+$/", $_REQUEST['tshirt'])) {
|
} elseif (isset($_REQUEST['tshirt']) && preg_match('/^[0-9]+$/', $_REQUEST['tshirt'])) {
|
||||||
$user_id = $_REQUEST['tshirt'];
|
$user_id = $_REQUEST['tshirt'];
|
||||||
$user_source = User($user_id);
|
$user_source = User($user_id);
|
||||||
if ($user_source != null) {
|
if ($user_source != null) {
|
||||||
sql_query("UPDATE `User` SET `Tshirt`=1 WHERE `UID`='" . sql_escape($user_id) . "' LIMIT 1");
|
sql_query("UPDATE `User` SET `Tshirt`=1 WHERE `UID`='" . sql_escape($user_id) . "' LIMIT 1");
|
||||||
engelsystem_log("User " . User_Nick_render($user_source) . " has tshirt now.");
|
engelsystem_log('User ' . User_Nick_render($user_source) . ' has tshirt now.');
|
||||||
$msg = success(_("Angel has got a t-shirt."), true);
|
$msg = success(_('Angel has got a t-shirt.'), true);
|
||||||
} else {
|
} else {
|
||||||
$msg = error("Angel not found.", true);
|
$msg = error('Angel not found.', true);
|
||||||
}
|
}
|
||||||
} elseif (isset($_REQUEST['not_tshirt']) && preg_match("/^[0-9]+$/", $_REQUEST['not_tshirt'])) {
|
} elseif (isset($_REQUEST['not_tshirt']) && preg_match('/^[0-9]+$/', $_REQUEST['not_tshirt'])) {
|
||||||
$user_id = $_REQUEST['not_tshirt'];
|
$user_id = $_REQUEST['not_tshirt'];
|
||||||
$user_source = User($user_id);
|
$user_source = User($user_id);
|
||||||
if ($user_source != null) {
|
if ($user_source != null) {
|
||||||
sql_query("UPDATE `User` SET `Tshirt`=0 WHERE `UID`='" . sql_escape($user_id) . "' LIMIT 1");
|
sql_query("UPDATE `User` SET `Tshirt`=0 WHERE `UID`='" . sql_escape($user_id) . "' LIMIT 1");
|
||||||
engelsystem_log("User " . User_Nick_render($user_source) . " has NO tshirt.");
|
engelsystem_log('User ' . User_Nick_render($user_source) . ' has NO tshirt.');
|
||||||
$msg = success(_("Angel has got no t-shirt."), true);
|
$msg = success(_('Angel has got no t-shirt.'), true);
|
||||||
} else {
|
} else {
|
||||||
$msg = error(_("Angel not found."), true);
|
$msg = error(_('Angel not found.'), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,16 +126,17 @@ function admin_active()
|
||||||
COUNT(`ShiftEntry`.`id`) AS `shift_count`,
|
COUNT(`ShiftEntry`.`id`) AS `shift_count`,
|
||||||
${shift_sum_formula} AS `shift_length`
|
${shift_sum_formula} AS `shift_length`
|
||||||
FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
|
FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
|
||||||
LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` " . ($show_all_shifts ? "" : "AND (`Shifts`.`end` < " . time() . " OR `Shifts`.`end` IS NULL)") . "
|
LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` "
|
||||||
|
. ($show_all_shifts ? "" : "AND (`Shifts`.`end` < " . time() . " OR `Shifts`.`end` IS NULL)") . "
|
||||||
WHERE `User`.`Gekommen` = 1
|
WHERE `User`.`Gekommen` = 1
|
||||||
GROUP BY `User`.`UID`
|
GROUP BY `User`.`UID`
|
||||||
ORDER BY `force_active` DESC, `shift_length` DESC" . $limit
|
ORDER BY `force_active` DESC, `shift_length` DESC" . $limit
|
||||||
);
|
);
|
||||||
$matched_users = [];
|
$matched_users = [];
|
||||||
if ($search == "") {
|
if ($search == '') {
|
||||||
$tokens = [];
|
$tokens = [];
|
||||||
} else {
|
} else {
|
||||||
$tokens = explode(" ", $search);
|
$tokens = explode(' ', $search);
|
||||||
}
|
}
|
||||||
foreach ($users as &$usr) {
|
foreach ($users as &$usr) {
|
||||||
if (count($tokens) > 0) {
|
if (count($tokens) > 0) {
|
||||||
|
@ -154,14 +160,30 @@ function admin_active()
|
||||||
|
|
||||||
$actions = [];
|
$actions = [];
|
||||||
if ($usr['Aktiv'] == 0) {
|
if ($usr['Aktiv'] == 0) {
|
||||||
$actions[] = '<a href="' . page_link_to('admin_active') . '&active=' . $usr['UID'] . ($show_all_shifts ? '&show_all_shifts=' : '') . '&search=' . $search . '">' . _("set active") . '</a>';
|
$actions[] = '<a href="'
|
||||||
|
. page_link_to('admin_active') . '&active=' . $usr['UID']
|
||||||
|
. ($show_all_shifts ? '&show_all_shifts=' : '') . '&search=' . $search . '">'
|
||||||
|
. _('set active')
|
||||||
|
. '</a>';
|
||||||
}
|
}
|
||||||
if ($usr['Aktiv'] == 1 && $usr['Tshirt'] == 0) {
|
if ($usr['Aktiv'] == 1 && $usr['Tshirt'] == 0) {
|
||||||
$actions[] = '<a href="' . page_link_to('admin_active') . '&not_active=' . $usr['UID'] . ($show_all_shifts ? '&show_all_shifts=' : '') . '&search=' . $search . '">' . _("remove active") . '</a>';
|
$actions[] = '<a href="'
|
||||||
$actions[] = '<a href="' . page_link_to('admin_active') . '&tshirt=' . $usr['UID'] . ($show_all_shifts ? '&show_all_shifts=' : '') . '&search=' . $search . '">' . _("got t-shirt") . '</a>';
|
. page_link_to('admin_active') . '&not_active=' . $usr['UID']
|
||||||
|
. ($show_all_shifts ? '&show_all_shifts=' : '') . '&search=' . $search . '">'
|
||||||
|
. _('remove active')
|
||||||
|
. '</a>';
|
||||||
|
$actions[] = '<a href="'
|
||||||
|
. page_link_to('admin_active') . '&tshirt=' . $usr['UID']
|
||||||
|
. ($show_all_shifts ? '&show_all_shifts=' : '') . '&search=' . $search . '">'
|
||||||
|
. _('got t-shirt')
|
||||||
|
. '</a>';
|
||||||
}
|
}
|
||||||
if ($usr['Tshirt'] == 1) {
|
if ($usr['Tshirt'] == 1) {
|
||||||
$actions[] = '<a href="' . page_link_to('admin_active') . '&not_tshirt=' . $usr['UID'] . ($show_all_shifts ? '&show_all_shifts=' : '') . '&search=' . $search . '">' . _("remove t-shirt") . '</a>';
|
$actions[] = '<a href="'
|
||||||
|
. page_link_to('admin_active') . '&not_tshirt=' . $usr['UID']
|
||||||
|
. ($show_all_shifts ? '&show_all_shifts=' : '') . '&search=' . $search . '">'
|
||||||
|
. _('remove t-shirt')
|
||||||
|
. '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$usr['actions'] = join(' ', $actions);
|
$usr['actions'] = join(' ', $actions);
|
||||||
|
@ -174,43 +196,47 @@ function admin_active()
|
||||||
if ($size != '') {
|
if ($size != '') {
|
||||||
$shirt_statistics[] = [
|
$shirt_statistics[] = [
|
||||||
'size' => $size,
|
'size' => $size,
|
||||||
'needed' => sql_select_single_cell("SELECT count(*) FROM `User` WHERE `Size`='" . sql_escape($size) . "' AND `Gekommen`=1"),
|
'needed' => sql_select_single_cell(
|
||||||
'given' => sql_select_single_cell("SELECT count(*) FROM `User` WHERE `Size`='" . sql_escape($size) . "' AND `Tshirt`=1")
|
"SELECT count(*) FROM `User` WHERE `Size`='" . sql_escape($size) . "' AND `Gekommen`=1"
|
||||||
|
),
|
||||||
|
'given' => sql_select_single_cell(
|
||||||
|
"SELECT count(*) FROM `User` WHERE `Size`='" . sql_escape($size) . "' AND `Tshirt`=1"
|
||||||
|
)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$shirt_statistics[] = [
|
$shirt_statistics[] = [
|
||||||
'size' => '<b>' . _("Sum") . '</b>',
|
'size' => '<b>' . _('Sum') . '</b>',
|
||||||
'needed' => '<b>' . User_arrived_count() . '</b>',
|
'needed' => '<b>' . User_arrived_count() . '</b>',
|
||||||
'given' => '<b>' . sql_select_single_cell("SELECT count(*) FROM `User` WHERE `Tshirt`=1") . '</b>'
|
'given' => '<b>' . sql_select_single_cell('SELECT count(*) FROM `User` WHERE `Tshirt`=1') . '</b>'
|
||||||
];
|
];
|
||||||
|
|
||||||
return page_with_title(admin_active_title(), [
|
return page_with_title(admin_active_title(), [
|
||||||
form([
|
form([
|
||||||
form_text('search', _("Search angel:"), $search),
|
form_text('search', _('Search angel:'), $search),
|
||||||
form_checkbox('show_all_shifts', _("Show all shifts"), $show_all_shifts),
|
form_checkbox('show_all_shifts', _('Show all shifts'), $show_all_shifts),
|
||||||
form_submit('submit', _("Search"))
|
form_submit('submit', _('Search'))
|
||||||
], page_link_to('admin_active')),
|
], page_link_to('admin_active')),
|
||||||
$set_active == "" ? form([
|
$set_active == '' ? form([
|
||||||
form_text('count', _("How much angels should be active?"), $count),
|
form_text('count', _('How much angels should be active?'), $count),
|
||||||
form_submit('set_active', _("Preview"))
|
form_submit('set_active', _('Preview'))
|
||||||
]) : $set_active,
|
]) : $set_active,
|
||||||
$msg . msg(),
|
$msg . msg(),
|
||||||
table([
|
table([
|
||||||
'nick' => _("Nickname"),
|
'nick' => _('Nickname'),
|
||||||
'shirt_size' => _("Size"),
|
'shirt_size' => _('Size'),
|
||||||
'shift_count' => _("Shifts"),
|
'shift_count' => _('Shifts'),
|
||||||
'work_time' => _("Length"),
|
'work_time' => _('Length'),
|
||||||
'active' => _("Active?"),
|
'active' => _('Active?'),
|
||||||
'force_active' => _("Forced"),
|
'force_active' => _('Forced'),
|
||||||
'tshirt' => _("T-shirt?"),
|
'tshirt' => _('T-shirt?'),
|
||||||
'actions' => ""
|
'actions' => ''
|
||||||
], $matched_users),
|
], $matched_users),
|
||||||
'<h2>' . _("Shirt statistics") . '</h2>',
|
'<h2>' . _('Shirt statistics') . '</h2>',
|
||||||
table([
|
table([
|
||||||
'size' => _("Size"),
|
'size' => _('Size'),
|
||||||
'needed' => _("Needed shirts"),
|
'needed' => _('Needed shirts'),
|
||||||
'given' => _("Given shirts")
|
'given' => _('Given shirts')
|
||||||
], $shirt_statistics)
|
], $shirt_statistics)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function admin_arrive_title()
|
function admin_arrive_title()
|
||||||
{
|
{
|
||||||
return _("Arrived angels");
|
return _('Arrived angels');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,50 +13,60 @@ function admin_arrive_title()
|
||||||
*/
|
*/
|
||||||
function admin_arrive()
|
function admin_arrive()
|
||||||
{
|
{
|
||||||
$msg = "";
|
$msg = '';
|
||||||
$search = "";
|
$search = '';
|
||||||
if (isset($_REQUEST['search'])) {
|
if (isset($_REQUEST['search'])) {
|
||||||
$search = strip_request_item('search');
|
$search = strip_request_item('search');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['reset']) && preg_match("/^[0-9]*$/", $_REQUEST['reset'])) {
|
if (isset($_REQUEST['reset']) && preg_match('/^[0-9]*$/', $_REQUEST['reset'])) {
|
||||||
$user_id = $_REQUEST['reset'];
|
$user_id = $_REQUEST['reset'];
|
||||||
$user_source = User($user_id);
|
$user_source = User($user_id);
|
||||||
if ($user_source != null) {
|
if ($user_source != null) {
|
||||||
sql_query("UPDATE `User` SET `Gekommen`=0, `arrival_date` = NULL WHERE `UID`='" . sql_escape($user_id) . "' LIMIT 1");
|
sql_query("
|
||||||
engelsystem_log("User set to not arrived: " . User_Nick_render($user_source));
|
UPDATE `User`
|
||||||
success(_("Reset done. Angel has not arrived."));
|
SET `Gekommen`=0, `arrival_date` = NULL
|
||||||
|
WHERE `UID`='" . sql_escape($user_id) . "'
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
engelsystem_log('User set to not arrived: ' . User_Nick_render($user_source));
|
||||||
|
success(_('Reset done. Angel has not arrived.'));
|
||||||
redirect(user_link($user_source));
|
redirect(user_link($user_source));
|
||||||
} else {
|
} else {
|
||||||
$msg = error(_("Angel not found."), true);
|
$msg = error(_('Angel not found.'), true);
|
||||||
}
|
}
|
||||||
} elseif (isset($_REQUEST['arrived']) && preg_match("/^[0-9]*$/", $_REQUEST['arrived'])) {
|
} elseif (isset($_REQUEST['arrived']) && preg_match('/^[0-9]*$/', $_REQUEST['arrived'])) {
|
||||||
$user_id = $_REQUEST['arrived'];
|
$user_id = $_REQUEST['arrived'];
|
||||||
$user_source = User($user_id);
|
$user_source = User($user_id);
|
||||||
if ($user_source != null) {
|
if ($user_source != null) {
|
||||||
sql_query("UPDATE `User` SET `Gekommen`=1, `arrival_date`='" . time() . "' WHERE `UID`='" . sql_escape($user_id) . "' LIMIT 1");
|
sql_query("
|
||||||
engelsystem_log("User set has arrived: " . User_Nick_render($user_source));
|
UPDATE `User`
|
||||||
success(_("Angel has been marked as arrived."));
|
SET `Gekommen`=1, `arrival_date`='" . time() . "'
|
||||||
|
WHERE `UID`='" . sql_escape($user_id) . "'
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
engelsystem_log('User set has arrived: ' . User_Nick_render($user_source));
|
||||||
|
success(_('Angel has been marked as arrived.'));
|
||||||
redirect(user_link($user_source));
|
redirect(user_link($user_source));
|
||||||
} else {
|
} else {
|
||||||
$msg = error(_("Angel not found."), true);
|
$msg = error(_('Angel not found.'), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$users = sql_select("SELECT * FROM `User` ORDER BY `Nick`");
|
$users = sql_select('SELECT * FROM `User` ORDER BY `Nick`');
|
||||||
$arrival_count_at_day = [];
|
$arrival_count_at_day = [];
|
||||||
$planned_arrival_count_at_day = [];
|
$planned_arrival_count_at_day = [];
|
||||||
$planned_departure_count_at_day = [];
|
$planned_departure_count_at_day = [];
|
||||||
$users_matched = [];
|
$users_matched = [];
|
||||||
if ($search == "") {
|
if ($search == '') {
|
||||||
$tokens = [];
|
$tokens = [];
|
||||||
} else {
|
} else {
|
||||||
$tokens = explode(" ", $search);
|
$tokens = explode(' ', $search);
|
||||||
}
|
}
|
||||||
foreach ($users as $usr) {
|
foreach ($users as $usr) {
|
||||||
if (count($tokens) > 0) {
|
if (count($tokens) > 0) {
|
||||||
$match = false;
|
$match = false;
|
||||||
$index = join(" ", $usr);
|
$index = join(' ', $usr);
|
||||||
foreach ($tokens as $t) {
|
foreach ($tokens as $t) {
|
||||||
if (stristr($index, trim($t))) {
|
if (stristr($index, trim($t))) {
|
||||||
$match = true;
|
$match = true;
|
||||||
|
@ -75,9 +85,11 @@ function admin_arrive()
|
||||||
$usr['rendered_planned_departure_date'] = '-';
|
$usr['rendered_planned_departure_date'] = '-';
|
||||||
}
|
}
|
||||||
$usr['rendered_planned_arrival_date'] = date('Y-m-d', $usr['planned_arrival_date']);
|
$usr['rendered_planned_arrival_date'] = date('Y-m-d', $usr['planned_arrival_date']);
|
||||||
$usr['rendered_arrival_date'] = $usr['arrival_date'] > 0 ? date('Y-m-d', $usr['arrival_date']) : "-";
|
$usr['rendered_arrival_date'] = $usr['arrival_date'] > 0 ? date('Y-m-d', $usr['arrival_date']) : '-';
|
||||||
$usr['arrived'] = $usr['Gekommen'] == 1 ? _("yes") : "";
|
$usr['arrived'] = $usr['Gekommen'] == 1 ? _('yes') : '';
|
||||||
$usr['actions'] = $usr['Gekommen'] == 1 ? '<a href="' . page_link_to('admin_arrive') . '&reset=' . $usr['UID'] . '&search=' . $search . '">' . _("reset") . '</a>' : '<a href="' . page_link_to('admin_arrive') . '&arrived=' . $usr['UID'] . '&search=' . $search . '">' . _("arrived") . '</a>';
|
$usr['actions'] = $usr['Gekommen'] == 1
|
||||||
|
? '<a href="' . page_link_to('admin_arrive') . '&reset=' . $usr['UID'] . '&search=' . $search . '">' . _('reset') . '</a>'
|
||||||
|
: '<a href="' . page_link_to('admin_arrive') . '&arrived=' . $usr['UID'] . '&search=' . $search . '">' . _('arrived') . '</a>';
|
||||||
|
|
||||||
if ($usr['arrival_date'] > 0) {
|
if ($usr['arrival_date'] > 0) {
|
||||||
$day = date('Y-m-d', $usr['arrival_date']);
|
$day = date('Y-m-d', $usr['arrival_date']);
|
||||||
|
@ -146,61 +158,61 @@ function admin_arrive()
|
||||||
return page_with_title(admin_arrive_title(), [
|
return page_with_title(admin_arrive_title(), [
|
||||||
$msg . msg(),
|
$msg . msg(),
|
||||||
form([
|
form([
|
||||||
form_text('search', _("Search"), $search),
|
form_text('search', _('Search'), $search),
|
||||||
form_submit('submit', _("Search"))
|
form_submit('submit', _('Search'))
|
||||||
]),
|
]),
|
||||||
table([
|
table([
|
||||||
'nick' => _("Nickname"),
|
'nick' => _('Nickname'),
|
||||||
'rendered_planned_arrival_date' => _("Planned arrival"),
|
'rendered_planned_arrival_date' => _('Planned arrival'),
|
||||||
'arrived' => _("Arrived?"),
|
'arrived' => _('Arrived?'),
|
||||||
'rendered_arrival_date' => _("Arrival date"),
|
'rendered_arrival_date' => _('Arrival date'),
|
||||||
'rendered_planned_departure_date' => _("Planned departure"),
|
'rendered_planned_departure_date' => _('Planned departure'),
|
||||||
'actions' => ""
|
'actions' => ''
|
||||||
], $users_matched),
|
], $users_matched),
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-md-4', [
|
div('col-md-4', [
|
||||||
heading(_("Planned arrival statistics"), 2),
|
heading(_('Planned arrival statistics'), 2),
|
||||||
bargraph('planned_arrives', 'day', [
|
bargraph('planned_arrives', 'day', [
|
||||||
'count' => _("arrived"),
|
'count' => _('arrived'),
|
||||||
'sum' => _("arrived sum")
|
'sum' => _('arrived sum')
|
||||||
], [
|
], [
|
||||||
'count' => '#090',
|
'count' => '#090',
|
||||||
'sum' => '#888'
|
'sum' => '#888'
|
||||||
], $planned_arrival_at_day),
|
], $planned_arrival_at_day),
|
||||||
table([
|
table([
|
||||||
'day' => _("Date"),
|
'day' => _('Date'),
|
||||||
'count' => _("Count"),
|
'count' => _('Count'),
|
||||||
'sum' => _("Sum")
|
'sum' => _('Sum')
|
||||||
], $planned_arrival_at_day)
|
], $planned_arrival_at_day)
|
||||||
]),
|
]),
|
||||||
div('col-md-4', [
|
div('col-md-4', [
|
||||||
heading(_("Arrival statistics"), 2),
|
heading(_('Arrival statistics'), 2),
|
||||||
bargraph('arrives', 'day', [
|
bargraph('arrives', 'day', [
|
||||||
'count' => _("arrived"),
|
'count' => _('arrived'),
|
||||||
'sum' => _("arrived sum")
|
'sum' => _('arrived sum')
|
||||||
], [
|
], [
|
||||||
'count' => '#090',
|
'count' => '#090',
|
||||||
'sum' => '#888'
|
'sum' => '#888'
|
||||||
], $arrival_at_day),
|
], $arrival_at_day),
|
||||||
table([
|
table([
|
||||||
'day' => _("Date"),
|
'day' => _('Date'),
|
||||||
'count' => _("Count"),
|
'count' => _('Count'),
|
||||||
'sum' => _("Sum")
|
'sum' => _('Sum')
|
||||||
], $arrival_at_day)
|
], $arrival_at_day)
|
||||||
]),
|
]),
|
||||||
div('col-md-4', [
|
div('col-md-4', [
|
||||||
heading(_("Planned departure statistics"), 2),
|
heading(_('Planned departure statistics'), 2),
|
||||||
bargraph('planned_departures', 'day', [
|
bargraph('planned_departures', 'day', [
|
||||||
'count' => _("arrived"),
|
'count' => _('arrived'),
|
||||||
'sum' => _("arrived sum")
|
'sum' => _('arrived sum')
|
||||||
], [
|
], [
|
||||||
'count' => '#090',
|
'count' => '#090',
|
||||||
'sum' => '#888'
|
'sum' => '#888'
|
||||||
], $planned_departure_at_day),
|
], $planned_departure_at_day),
|
||||||
table([
|
table([
|
||||||
'day' => _("Date"),
|
'day' => _('Date'),
|
||||||
'count' => _("Count"),
|
'count' => _('Count'),
|
||||||
'sum' => _("Sum")
|
'sum' => _('Sum')
|
||||||
], $planned_departure_at_day)
|
], $planned_departure_at_day)
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function admin_free_title()
|
function admin_free_title()
|
||||||
{
|
{
|
||||||
return _("Free angels");
|
return _('Free angels');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,23 +15,24 @@ function admin_free()
|
||||||
{
|
{
|
||||||
global $privileges;
|
global $privileges;
|
||||||
|
|
||||||
$search = "";
|
$search = '';
|
||||||
if (isset($_REQUEST['search'])) {
|
if (isset($_REQUEST['search'])) {
|
||||||
$search = strip_request_item('search');
|
$search = strip_request_item('search');
|
||||||
}
|
}
|
||||||
|
|
||||||
$angeltypesearch = "";
|
$angeltypesearch = '';
|
||||||
if (empty($_REQUEST['angeltype'])) {
|
if (empty($_REQUEST['angeltype'])) {
|
||||||
$_REQUEST['angeltype'] = '';
|
$_REQUEST['angeltype'] = '';
|
||||||
} else {
|
} else {
|
||||||
$angeltypesearch = " INNER JOIN `UserAngelTypes` ON (`UserAngelTypes`.`angeltype_id` = '" . sql_escape($_REQUEST['angeltype']) . "' AND `UserAngelTypes`.`user_id` = `User`.`UID`";
|
$angeltypesearch = ' INNER JOIN `UserAngelTypes` ON (`UserAngelTypes`.`angeltype_id` = \''
|
||||||
|
. sql_escape($_REQUEST['angeltype']) . "' AND `UserAngelTypes`.`user_id` = `User`.`UID`";
|
||||||
if (isset($_REQUEST['confirmed_only'])) {
|
if (isset($_REQUEST['confirmed_only'])) {
|
||||||
$angeltypesearch .= " AND `UserAngelTypes`.`confirm_user_id`";
|
$angeltypesearch .= ' AND `UserAngelTypes`.`confirm_user_id`';
|
||||||
}
|
}
|
||||||
$angeltypesearch .= ") ";
|
$angeltypesearch .= ') ';
|
||||||
}
|
}
|
||||||
|
|
||||||
$angel_types_source = sql_select("SELECT `id`, `name` FROM `AngelTypes` ORDER BY `name`");
|
$angel_types_source = sql_select('SELECT `id`, `name` FROM `AngelTypes` ORDER BY `name`');
|
||||||
$angel_types = [
|
$angel_types = [
|
||||||
'' => 'alle Typen'
|
'' => 'alle Typen'
|
||||||
];
|
];
|
||||||
|
@ -44,21 +45,26 @@ function admin_free()
|
||||||
FROM `User`
|
FROM `User`
|
||||||
${angeltypesearch}
|
${angeltypesearch}
|
||||||
LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
|
LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
|
||||||
LEFT JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID` AND `Shifts`.`start` < '" . sql_escape(time()) . "' AND `Shifts`.`end` > '" . sql_escape(time()) . "')
|
LEFT JOIN `Shifts`
|
||||||
|
ON (
|
||||||
|
`ShiftEntry`.`SID` = `Shifts`.`SID`
|
||||||
|
AND `Shifts`.`start` < '" . sql_escape(time()) . "'
|
||||||
|
AND `Shifts`.`end` > '" . sql_escape(time()) . "'
|
||||||
|
)
|
||||||
WHERE `User`.`Gekommen` = 1 AND `Shifts`.`SID` IS NULL
|
WHERE `User`.`Gekommen` = 1 AND `Shifts`.`SID` IS NULL
|
||||||
GROUP BY `User`.`UID`
|
GROUP BY `User`.`UID`
|
||||||
ORDER BY `Nick`");
|
ORDER BY `Nick`");
|
||||||
|
|
||||||
$free_users_table = [];
|
$free_users_table = [];
|
||||||
if ($search == "") {
|
if ($search == '') {
|
||||||
$tokens = [];
|
$tokens = [];
|
||||||
} else {
|
} else {
|
||||||
$tokens = explode(" ", $search);
|
$tokens = explode(' ', $search);
|
||||||
}
|
}
|
||||||
foreach ($users as $usr) {
|
foreach ($users as $usr) {
|
||||||
if (count($tokens) > 0) {
|
if (count($tokens) > 0) {
|
||||||
$match = false;
|
$match = false;
|
||||||
$index = join("", $usr);
|
$index = join('', $usr);
|
||||||
foreach ($tokens as $t) {
|
foreach ($tokens as $t) {
|
||||||
if (stristr($index, trim($t))) {
|
if (stristr($index, trim($t))) {
|
||||||
$match = true;
|
$match = true;
|
||||||
|
@ -78,7 +84,7 @@ function admin_free()
|
||||||
'email' => $usr['email_by_human_allowed'] ? $usr['email'] : glyph('eye-close'),
|
'email' => $usr['email_by_human_allowed'] ? $usr['email'] : glyph('eye-close'),
|
||||||
'actions' =>
|
'actions' =>
|
||||||
in_array('admin_user', $privileges)
|
in_array('admin_user', $privileges)
|
||||||
? button(page_link_to('admin_user') . '&id=' . $usr['UID'], _("edit"), 'btn-xs')
|
? button(page_link_to('admin_user') . '&id=' . $usr['UID'], _('edit'), 'btn-xs')
|
||||||
: ''
|
: ''
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -86,25 +92,25 @@ function admin_free()
|
||||||
form([
|
form([
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-md-4', [
|
div('col-md-4', [
|
||||||
form_text('search', _("Search"), $search)
|
form_text('search', _('Search'), $search)
|
||||||
]),
|
]),
|
||||||
div('col-md-4', [
|
div('col-md-4', [
|
||||||
form_select('angeltype', _("Angeltype"), $angel_types, $_REQUEST['angeltype'])
|
form_select('angeltype', _('Angeltype'), $angel_types, $_REQUEST['angeltype'])
|
||||||
]),
|
]),
|
||||||
div('col-md-2', [
|
div('col-md-2', [
|
||||||
form_checkbox('confirmed_only', _("Only confirmed"), isset($_REQUEST['confirmed_only']))
|
form_checkbox('confirmed_only', _('Only confirmed'), isset($_REQUEST['confirmed_only']))
|
||||||
]),
|
]),
|
||||||
div('col-md-2', [
|
div('col-md-2', [
|
||||||
form_submit('submit', _("Search"))
|
form_submit('submit', _('Search'))
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
table([
|
table([
|
||||||
'name' => _("Nick"),
|
'name' => _('Nick'),
|
||||||
'shift_state' => '',
|
'shift_state' => '',
|
||||||
'dect' => _("DECT"),
|
'dect' => _('DECT'),
|
||||||
'jabber' => _("Jabber"),
|
'jabber' => _('Jabber'),
|
||||||
'email' => _("E-Mail"),
|
'email' => _('E-Mail'),
|
||||||
'actions' => ''
|
'actions' => ''
|
||||||
], $free_users_table)
|
], $free_users_table)
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function admin_groups_title()
|
function admin_groups_title()
|
||||||
{
|
{
|
||||||
return _("Grouprights");
|
return _('Grouprights');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,9 +13,9 @@ function admin_groups_title()
|
||||||
*/
|
*/
|
||||||
function admin_groups()
|
function admin_groups()
|
||||||
{
|
{
|
||||||
$html = "";
|
$html = '';
|
||||||
$groups = sql_select("SELECT * FROM `Groups` ORDER BY `Name`");
|
$groups = sql_select('SELECT * FROM `Groups` ORDER BY `Name`');
|
||||||
if (!isset($_REQUEST["action"])) {
|
if (!isset($_REQUEST['action'])) {
|
||||||
$groups_table = [];
|
$groups_table = [];
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
$privileges = sql_select("
|
$privileges = sql_select("
|
||||||
|
@ -35,7 +35,7 @@ function admin_groups()
|
||||||
'privileges' => join(', ', $privileges_html),
|
'privileges' => join(', ', $privileges_html),
|
||||||
'actions' => button(
|
'actions' => button(
|
||||||
page_link_to('admin_groups') . '&action=edit&id=' . $group['UID'],
|
page_link_to('admin_groups') . '&action=edit&id=' . $group['UID'],
|
||||||
_("edit"),
|
_('edit'),
|
||||||
'btn-xs'
|
'btn-xs'
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
|
@ -43,18 +43,18 @@ function admin_groups()
|
||||||
|
|
||||||
return page_with_title(admin_groups_title(), [
|
return page_with_title(admin_groups_title(), [
|
||||||
table([
|
table([
|
||||||
'name' => _("Name"),
|
'name' => _('Name'),
|
||||||
'privileges' => _("Privileges"),
|
'privileges' => _('Privileges'),
|
||||||
'actions' => ''
|
'actions' => ''
|
||||||
], $groups_table)
|
], $groups_table)
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
switch ($_REQUEST["action"]) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'edit':
|
case 'edit':
|
||||||
if (isset($_REQUEST['id']) && preg_match("/^-[0-9]{1,11}$/", $_REQUEST['id'])) {
|
if (isset($_REQUEST['id']) && preg_match('/^-[0-9]{1,11}$/', $_REQUEST['id'])) {
|
||||||
$group_id = $_REQUEST['id'];
|
$group_id = $_REQUEST['id'];
|
||||||
} else {
|
} else {
|
||||||
return error("Incomplete call, missing Groups ID.", true);
|
return error('Incomplete call, missing Groups ID.', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$group = sql_select("SELECT * FROM `Groups` WHERE `UID`='" . sql_escape($group_id) . "' LIMIT 1");
|
$group = sql_select("SELECT * FROM `Groups` WHERE `UID`='" . sql_escape($group_id) . "' LIMIT 1");
|
||||||
|
@ -69,38 +69,38 @@ function admin_groups()
|
||||||
)
|
)
|
||||||
ORDER BY `Privileges`.`name`
|
ORDER BY `Privileges`.`name`
|
||||||
");
|
");
|
||||||
$privileges_html = "";
|
$privileges_html = '';
|
||||||
$privileges_form = [];
|
$privileges_form = [];
|
||||||
foreach ($privileges as $priv) {
|
foreach ($privileges as $priv) {
|
||||||
$privileges_form[] = form_checkbox(
|
$privileges_form[] = form_checkbox(
|
||||||
'privileges[]',
|
'privileges[]',
|
||||||
$priv['desc'] . ' (' . $priv['name'] . ')',
|
$priv['desc'] . ' (' . $priv['name'] . ')',
|
||||||
$priv['group_id'] != "",
|
$priv['group_id'] != '',
|
||||||
$priv['id']
|
$priv['id']
|
||||||
);
|
);
|
||||||
$privileges_html .= sprintf(
|
$privileges_html .= sprintf(
|
||||||
'<tr><td><input type="checkbox" name="privileges[]" value="%s" %s /></td> <td>%s</td> <td>%s</td></tr>',
|
'<tr><td><input type="checkbox" name="privileges[]" value="%s" %s /></td> <td>%s</td> <td>%s</td></tr>',
|
||||||
$priv['id'],
|
$priv['id'],
|
||||||
($priv['group_id'] != "" ? 'checked="checked"' : ''),
|
($priv['group_id'] != '' ? 'checked="checked"' : ''),
|
||||||
$priv['name'],
|
$priv['name'],
|
||||||
$priv['desc']
|
$priv['desc']
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$privileges_form[] = form_submit('submit', _("Save"));
|
$privileges_form[] = form_submit('submit', _('Save'));
|
||||||
$html .= page_with_title(_("Edit group"), [
|
$html .= page_with_title(_('Edit group'), [
|
||||||
form($privileges_form, page_link_to('admin_groups') . '&action=save&id=' . $group_id)
|
form($privileges_form, page_link_to('admin_groups') . '&action=save&id=' . $group_id)
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
return error("No Group found.", true);
|
return error('No Group found.', true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'save':
|
case 'save':
|
||||||
if (isset($_REQUEST['id']) && preg_match("/^-[0-9]{1,11}$/", $_REQUEST['id'])) {
|
if (isset($_REQUEST['id']) && preg_match('/^-[0-9]{1,11}$/', $_REQUEST['id'])) {
|
||||||
$group_id = $_REQUEST['id'];
|
$group_id = $_REQUEST['id'];
|
||||||
} else {
|
} else {
|
||||||
return error("Incomplete call, missing Groups ID.", true);
|
return error('Incomplete call, missing Groups ID.', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$group = sql_select("SELECT * FROM `Groups` WHERE `UID`='" . sql_escape($group_id) . "' LIMIT 1");
|
$group = sql_select("SELECT * FROM `Groups` WHERE `UID`='" . sql_escape($group_id) . "' LIMIT 1");
|
||||||
|
@ -121,12 +121,12 @@ function admin_groups()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
engelsystem_log(
|
engelsystem_log(
|
||||||
"Group privileges of group " . $group['Name']
|
'Group privileges of group ' . $group['Name']
|
||||||
. " edited: " . join(", ", $privilege_names)
|
. ' edited: ' . join(', ', $privilege_names)
|
||||||
);
|
);
|
||||||
redirect(page_link_to("admin_groups"));
|
redirect(page_link_to('admin_groups'));
|
||||||
} else {
|
} else {
|
||||||
return error("No Group found.", true);
|
return error('No Group found.', true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function admin_import_title()
|
function admin_import_title()
|
||||||
{
|
{
|
||||||
return _("Frab import");
|
return _('Frab import');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,10 +15,10 @@ function admin_import()
|
||||||
{
|
{
|
||||||
global $rooms_import;
|
global $rooms_import;
|
||||||
global $user;
|
global $user;
|
||||||
$html = "";
|
$html = '';
|
||||||
$import_dir = __DIR__ . '/../../import';
|
$import_dir = __DIR__ . '/../../import';
|
||||||
|
|
||||||
$step = "input";
|
$step = 'input';
|
||||||
if (
|
if (
|
||||||
isset($_REQUEST['step'])
|
isset($_REQUEST['step'])
|
||||||
&& in_array($step, [
|
&& in_array($step, [
|
||||||
|
@ -69,14 +69,14 @@ function admin_import()
|
||||||
$add_minutes_start = trim($_REQUEST['add_minutes_start']);
|
$add_minutes_start = trim($_REQUEST['add_minutes_start']);
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Please enter an amount of minutes to add to a talk's begin."));
|
error(_('Please enter an amount of minutes to add to a talk\'s begin.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['add_minutes_end']) && is_numeric(trim($_REQUEST['add_minutes_end']))) {
|
if (isset($_REQUEST['add_minutes_end']) && is_numeric(trim($_REQUEST['add_minutes_end']))) {
|
||||||
$add_minutes_end = trim($_REQUEST['add_minutes_end']);
|
$add_minutes_end = trim($_REQUEST['add_minutes_end']);
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Please enter an amount of minutes to add to a talk's end."));
|
error(_('Please enter an amount of minutes to add to a talk\'s end.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_FILES['xcal_file']) && ($_FILES['xcal_file']['error'] == 0)) {
|
if (isset($_FILES['xcal_file']) && ($_FILES['xcal_file']['error'] == 0)) {
|
||||||
|
@ -98,7 +98,12 @@ function admin_import()
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
redirect(page_link_to('admin_import') . "&step=check&shifttype_id=" . $shifttype_id . "&add_minutes_end=" . $add_minutes_end . "&add_minutes_start=" . $add_minutes_start);
|
redirect(
|
||||||
|
page_link_to('admin_import')
|
||||||
|
. '&step=check&shifttype_id=' . $shifttype_id
|
||||||
|
. '&add_minutes_end=' . $add_minutes_end
|
||||||
|
. '&add_minutes_start=' . $add_minutes_start
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$html .= div('well well-sm text-center', [
|
$html .= div('well well-sm text-center', [
|
||||||
_('File Upload') . mute(glyph('arrow-right')) . mute(_('Validation')) . mute(glyph('arrow-right')) . mute(_('Import'))
|
_('File Upload') . mute(glyph('arrow-right')) . mute(_('Validation')) . mute(glyph('arrow-right')) . mute(_('Import'))
|
||||||
|
@ -107,13 +112,13 @@ function admin_import()
|
||||||
form([
|
form([
|
||||||
form_info(
|
form_info(
|
||||||
'',
|
'',
|
||||||
_("This import will create/update/delete rooms and shifts by given FRAB-export file. The needed file format is xcal.")
|
_('This import will create/update/delete rooms and shifts by given FRAB-export file. The needed file format is xcal.')
|
||||||
),
|
),
|
||||||
form_select('shifttype_id', _('Shifttype'), $shifttypes, $shifttype_id),
|
form_select('shifttype_id', _('Shifttype'), $shifttypes, $shifttype_id),
|
||||||
form_spinner('add_minutes_start', _("Add minutes to start"), $add_minutes_start),
|
form_spinner('add_minutes_start', _('Add minutes to start'), $add_minutes_start),
|
||||||
form_spinner('add_minutes_end', _("Add minutes to end"), $add_minutes_end),
|
form_spinner('add_minutes_end', _('Add minutes to end'), $add_minutes_end),
|
||||||
form_file('xcal_file', _("xcal-File (.xcal)")),
|
form_file('xcal_file', _('xcal-File (.xcal)')),
|
||||||
form_submit('submit', _("Import"))
|
form_submit('submit', _('Import'))
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
@ -136,14 +141,14 @@ function admin_import()
|
||||||
if (isset($_REQUEST['add_minutes_start']) && is_numeric(trim($_REQUEST['add_minutes_start']))) {
|
if (isset($_REQUEST['add_minutes_start']) && is_numeric(trim($_REQUEST['add_minutes_start']))) {
|
||||||
$add_minutes_start = trim($_REQUEST['add_minutes_start']);
|
$add_minutes_start = trim($_REQUEST['add_minutes_start']);
|
||||||
} else {
|
} else {
|
||||||
error(_("Please enter an amount of minutes to add to a talk's begin."));
|
error(_('Please enter an amount of minutes to add to a talk\'s begin.'));
|
||||||
redirect(page_link_to('admin_import'));
|
redirect(page_link_to('admin_import'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['add_minutes_end']) && is_numeric(trim($_REQUEST['add_minutes_end']))) {
|
if (isset($_REQUEST['add_minutes_end']) && is_numeric(trim($_REQUEST['add_minutes_end']))) {
|
||||||
$add_minutes_end = trim($_REQUEST['add_minutes_end']);
|
$add_minutes_end = trim($_REQUEST['add_minutes_end']);
|
||||||
} else {
|
} else {
|
||||||
error(_("Please enter an amount of minutes to add to a talk's end."));
|
error(_('Please enter an amount of minutes to add to a talk\'s end.'));
|
||||||
redirect(page_link_to('admin_import'));
|
redirect(page_link_to('admin_import'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,53 +163,55 @@ function admin_import()
|
||||||
$html .= div(
|
$html .= div(
|
||||||
'well well-sm text-center',
|
'well well-sm text-center',
|
||||||
[
|
[
|
||||||
'<span class="text-success">' . _('File Upload') . glyph('ok-circle') . '</span>' . mute(glyph('arrow-right')) . _('Validation') . mute(glyph('arrow-right')) . mute(_('Import'))
|
'<span class="text-success">' . _('File Upload') . glyph('ok-circle') . '</span>'
|
||||||
])
|
. mute(glyph('arrow-right')) . _('Validation') . mute(glyph('arrow-right')) . mute(_('Import'))
|
||||||
|
]
|
||||||
|
)
|
||||||
. form(
|
. form(
|
||||||
[
|
[
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-sm-6', [
|
div('col-sm-6', [
|
||||||
'<h3>' . _("Rooms to create") . '</h3>',
|
'<h3>' . _('Rooms to create') . '</h3>',
|
||||||
table(_("Name"), $rooms_new)
|
table(_('Name'), $rooms_new)
|
||||||
]),
|
]),
|
||||||
div('col-sm-6', [
|
div('col-sm-6', [
|
||||||
'<h3>' . _("Rooms to delete") . '</h3>',
|
'<h3>' . _('Rooms to delete') . '</h3>',
|
||||||
table(_("Name"), $rooms_deleted)
|
table(_('Name'), $rooms_deleted)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
'<h3>' . _("Shifts to create") . '</h3>',
|
'<h3>' . _('Shifts to create') . '</h3>',
|
||||||
table([
|
table([
|
||||||
'day' => _("Day"),
|
'day' => _('Day'),
|
||||||
'start' => _("Start"),
|
'start' => _('Start'),
|
||||||
'end' => _("End"),
|
'end' => _('End'),
|
||||||
'shifttype' => _('Shift type'),
|
'shifttype' => _('Shift type'),
|
||||||
'title' => _("Title"),
|
'title' => _('Title'),
|
||||||
'room' => _("Room")
|
'room' => _('Room')
|
||||||
], shifts_printable($events_new, $shifttypes)),
|
], shifts_printable($events_new, $shifttypes)),
|
||||||
'<h3>' . _("Shifts to update") . '</h3>',
|
'<h3>' . _('Shifts to update') . '</h3>',
|
||||||
table([
|
table([
|
||||||
'day' => _("Day"),
|
'day' => _('Day'),
|
||||||
'start' => _("Start"),
|
'start' => _('Start'),
|
||||||
'end' => _("End"),
|
'end' => _('End'),
|
||||||
'shifttype' => _('Shift type'),
|
'shifttype' => _('Shift type'),
|
||||||
'title' => _("Title"),
|
'title' => _('Title'),
|
||||||
'room' => _("Room")
|
'room' => _('Room')
|
||||||
], shifts_printable($events_updated, $shifttypes)),
|
], shifts_printable($events_updated, $shifttypes)),
|
||||||
'<h3>' . _("Shifts to delete") . '</h3>',
|
'<h3>' . _('Shifts to delete') . '</h3>',
|
||||||
table([
|
table([
|
||||||
'day' => _("Day"),
|
'day' => _('Day'),
|
||||||
'start' => _("Start"),
|
'start' => _('Start'),
|
||||||
'end' => _("End"),
|
'end' => _('End'),
|
||||||
'shifttype' => _('Shift type'),
|
'shifttype' => _('Shift type'),
|
||||||
'title' => _("Title"),
|
'title' => _('Title'),
|
||||||
'room' => _("Room")
|
'room' => _('Room')
|
||||||
], shifts_printable($events_deleted, $shifttypes)),
|
], shifts_printable($events_deleted, $shifttypes)),
|
||||||
form_submit('submit', _("Import"))
|
form_submit('submit', _('Import'))
|
||||||
],
|
],
|
||||||
page_link_to('admin_import')
|
page_link_to('admin_import')
|
||||||
. '&step=import&shifttype_id=' . $shifttype_id
|
. '&step=import&shifttype_id=' . $shifttype_id
|
||||||
. "&add_minutes_end=" . $add_minutes_end
|
. '&add_minutes_end=' . $add_minutes_end
|
||||||
. "&add_minutes_start=" . $add_minutes_start
|
. '&add_minutes_start=' . $add_minutes_start
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -228,14 +235,14 @@ function admin_import()
|
||||||
if (isset($_REQUEST['add_minutes_start']) && is_numeric(trim($_REQUEST['add_minutes_start']))) {
|
if (isset($_REQUEST['add_minutes_start']) && is_numeric(trim($_REQUEST['add_minutes_start']))) {
|
||||||
$add_minutes_start = trim($_REQUEST['add_minutes_start']);
|
$add_minutes_start = trim($_REQUEST['add_minutes_start']);
|
||||||
} else {
|
} else {
|
||||||
error(_("Please enter an amount of minutes to add to a talk's begin."));
|
error(_('Please enter an amount of minutes to add to a talk\'s begin.'));
|
||||||
redirect(page_link_to('admin_import'));
|
redirect(page_link_to('admin_import'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['add_minutes_end']) && is_numeric(trim($_REQUEST['add_minutes_end']))) {
|
if (isset($_REQUEST['add_minutes_end']) && is_numeric(trim($_REQUEST['add_minutes_end']))) {
|
||||||
$add_minutes_end = trim($_REQUEST['add_minutes_end']);
|
$add_minutes_end = trim($_REQUEST['add_minutes_end']);
|
||||||
} else {
|
} else {
|
||||||
error(_("Please enter an amount of minutes to add to a talk's end."));
|
error(_('Please enter an amount of minutes to add to a talk\'s end.'));
|
||||||
redirect(page_link_to('admin_import'));
|
redirect(page_link_to('admin_import'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,13 +285,17 @@ function admin_import()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
engelsystem_log("Frab import done");
|
engelsystem_log('Frab import done');
|
||||||
|
|
||||||
unlink($import_file);
|
unlink($import_file);
|
||||||
|
|
||||||
$html .= div('well well-sm text-center', [
|
$html .= div('well well-sm text-center', [
|
||||||
'<span class="text-success">' . _('File Upload') . glyph('ok-circle') . '</span>' . mute(glyph('arrow-right')) . '<span class="text-success">' . _('Validation') . glyph('ok-circle') . '</span>' . mute(glyph('arrow-right')) . '<span class="text-success">' . _('Import') . glyph('ok-circle') . '</span>'
|
'<span class="text-success">' . _('File Upload') . glyph('ok-circle') . '</span>'
|
||||||
]) . success(_("It's done!"), true);
|
. mute(glyph('arrow-right'))
|
||||||
|
. '<span class="text-success">' . _('Validation') . glyph('ok-circle') . '</span>'
|
||||||
|
. mute(glyph('arrow-right'))
|
||||||
|
. '<span class="text-success">' . _('Import') . glyph('ok-circle') . '</span>'
|
||||||
|
]) . success(_('It\'s done!'), true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
redirect(page_link_to('admin_import'));
|
redirect(page_link_to('admin_import'));
|
||||||
|
@ -306,7 +317,7 @@ function prepare_rooms($file)
|
||||||
$data = read_xml($file);
|
$data = read_xml($file);
|
||||||
|
|
||||||
// Load rooms from db for compare with input
|
// Load rooms from db for compare with input
|
||||||
$rooms = sql_select("SELECT * FROM `Room` WHERE `FromPentabarf`='Y'");
|
$rooms = sql_select('SELECT * FROM `Room` WHERE `FromPentabarf`=\'Y\'');
|
||||||
$rooms_db = [];
|
$rooms_db = [];
|
||||||
$rooms_import = [];
|
$rooms_import = [];
|
||||||
foreach ($rooms as $room) {
|
foreach ($rooms as $room) {
|
||||||
|
@ -345,7 +356,7 @@ function prepare_events($file, $shifttype_id, $add_minutes_start, $add_minutes_e
|
||||||
global $rooms_import;
|
global $rooms_import;
|
||||||
$data = read_xml($file);
|
$data = read_xml($file);
|
||||||
|
|
||||||
$rooms = sql_select("SELECT * FROM `Room`");
|
$rooms = sql_select('SELECT * FROM `Room`');
|
||||||
$rooms_db = [];
|
$rooms_db = [];
|
||||||
foreach ($rooms as $room) {
|
foreach ($rooms as $room) {
|
||||||
$rooms_db[$room['Name']] = $room['RID'];
|
$rooms_db[$room['Name']] = $room['RID'];
|
||||||
|
@ -354,9 +365,8 @@ function prepare_events($file, $shifttype_id, $add_minutes_start, $add_minutes_e
|
||||||
$events = $data->vcalendar->vevent;
|
$events = $data->vcalendar->vevent;
|
||||||
$shifts_pb = [];
|
$shifts_pb = [];
|
||||||
foreach ($events as $event) {
|
foreach ($events as $event) {
|
||||||
$event_pb = $event->children("http://pentabarf.org");
|
$event_pb = $event->children('http://pentabarf.org');
|
||||||
$event_id = trim($event_pb->{
|
$event_id = trim($event_pb->{'event-id'});
|
||||||
'event-id'});
|
|
||||||
$shifts_pb[$event_id] = [
|
$shifts_pb[$event_id] = [
|
||||||
'shifttype_id' => $shifttype_id,
|
'shifttype_id' => $shifttype_id,
|
||||||
'start' => parse_date("Ymd\THis", $event->dtstart) - $add_minutes_start * 60,
|
'start' => parse_date("Ymd\THis", $event->dtstart) - $add_minutes_start * 60,
|
||||||
|
@ -368,7 +378,7 @@ function prepare_events($file, $shifttype_id, $add_minutes_start, $add_minutes_e
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$shifts = sql_select("SELECT * FROM `Shifts` WHERE `PSID` IS NOT NULL ORDER BY `start`");
|
$shifts = sql_select('SELECT * FROM `Shifts` WHERE `PSID` IS NOT NULL ORDER BY `start`');
|
||||||
$shifts_db = [];
|
$shifts_db = [];
|
||||||
foreach ($shifts as $shift) {
|
foreach ($shifts as $shift) {
|
||||||
$shifts_db[$shift['PSID']] = $shift;
|
$shifts_db[$shift['PSID']] = $shift;
|
||||||
|
@ -381,7 +391,14 @@ function prepare_events($file, $shifttype_id, $add_minutes_start, $add_minutes_e
|
||||||
$shifts_new[] = $shift;
|
$shifts_new[] = $shift;
|
||||||
} else {
|
} else {
|
||||||
$tmp = $shifts_db[$shift['PSID']];
|
$tmp = $shifts_db[$shift['PSID']];
|
||||||
if ($shift['shifttype_id'] != $tmp['shifttype_id'] || $shift['title'] != $tmp['title'] || $shift['start'] != $tmp['start'] || $shift['end'] != $tmp['end'] || $shift['RID'] != $tmp['RID'] || $shift['URL'] != $tmp['URL']) {
|
if (
|
||||||
|
$shift['shifttype_id'] != $tmp['shifttype_id']
|
||||||
|
|| $shift['title'] != $tmp['title']
|
||||||
|
|| $shift['start'] != $tmp['start']
|
||||||
|
|| $shift['end'] != $tmp['end']
|
||||||
|
|| $shift['RID'] != $tmp['RID']
|
||||||
|
|| $shift['URL'] != $tmp['URL']
|
||||||
|
) {
|
||||||
$shifts_updated[] = $shift;
|
$shifts_updated[] = $shift;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -429,14 +446,14 @@ function shifts_printable($shifts, $shifttypes)
|
||||||
$shifts_printable = [];
|
$shifts_printable = [];
|
||||||
foreach ($shifts as $shift) {
|
foreach ($shifts as $shift) {
|
||||||
$shifts_printable[] = [
|
$shifts_printable[] = [
|
||||||
'day' => date("l, Y-m-d", $shift['start']),
|
'day' => date('l, Y-m-d', $shift['start']),
|
||||||
'start' => date("H:i", $shift['start']),
|
'start' => date('H:i', $shift['start']),
|
||||||
'shifttype' => ShiftType_name_render([
|
'shifttype' => ShiftType_name_render([
|
||||||
'id' => $shift['shifttype_id'],
|
'id' => $shift['shifttype_id'],
|
||||||
'name' => $shifttypes[$shift['shifttype_id']]
|
'name' => $shifttypes[$shift['shifttype_id']]
|
||||||
]),
|
]),
|
||||||
'title' => shorten($shift['title']),
|
'title' => shorten($shift['title']),
|
||||||
'end' => date("H:i", $shift['end']),
|
'end' => date('H:i', $shift['end']),
|
||||||
'room' => $rooms[$shift['RID']]
|
'room' => $rooms[$shift['RID']]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function admin_log_title()
|
function admin_log_title()
|
||||||
{
|
{
|
||||||
return _("Log");
|
return _('Log');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,7 +13,7 @@ function admin_log_title()
|
||||||
*/
|
*/
|
||||||
function admin_log()
|
function admin_log()
|
||||||
{
|
{
|
||||||
$filter = "";
|
$filter = '';
|
||||||
if (isset($_REQUEST['keyword'])) {
|
if (isset($_REQUEST['keyword'])) {
|
||||||
$filter = strip_request_item('keyword');
|
$filter = strip_request_item('keyword');
|
||||||
}
|
}
|
||||||
|
@ -21,20 +21,20 @@ function admin_log()
|
||||||
|
|
||||||
$log_entries = [];
|
$log_entries = [];
|
||||||
foreach ($log_entries_source as $log_entry) {
|
foreach ($log_entries_source as $log_entry) {
|
||||||
$log_entry['date'] = date("d.m.Y H:i", $log_entry['timestamp']);
|
$log_entry['date'] = date('d.m.Y H:i', $log_entry['timestamp']);
|
||||||
$log_entries[] = $log_entry;
|
$log_entries[] = $log_entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
return page_with_title(admin_log_title(), [
|
return page_with_title(admin_log_title(), [
|
||||||
msg(),
|
msg(),
|
||||||
form([
|
form([
|
||||||
form_text('keyword', _("Search"), $filter),
|
form_text('keyword', _('Search'), $filter),
|
||||||
form_submit(_("Search"), "Go")
|
form_submit(_('Search'), 'Go')
|
||||||
]),
|
]),
|
||||||
table([
|
table([
|
||||||
'date' => "Time",
|
'date' => 'Time',
|
||||||
'nick' => "Angel",
|
'nick' => 'Angel',
|
||||||
'message' => "Log Entry"
|
'message' => 'Log Entry'
|
||||||
], $log_entries)
|
], $log_entries)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,34 +7,34 @@ function admin_news()
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
if (!isset($_GET["action"])) {
|
if (!isset($_GET['action'])) {
|
||||||
redirect(page_link_to("news"));
|
redirect(page_link_to('news'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = '<div class="col-md-12"><h1>' . _("Edit news entry") . '</h1>' . msg();
|
$html = '<div class="col-md-12"><h1>' . _("Edit news entry") . '</h1>' . msg();
|
||||||
if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) {
|
if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) {
|
||||||
$news_id = $_REQUEST['id'];
|
$news_id = $_REQUEST['id'];
|
||||||
} else {
|
} else {
|
||||||
return error("Incomplete call, missing News ID.", true);
|
return error('Incomplete call, missing News ID.', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$news = sql_select("SELECT * FROM `News` WHERE `ID`='" . sql_escape($news_id) . "' LIMIT 1");
|
$news = sql_select("SELECT * FROM `News` WHERE `ID`='" . sql_escape($news_id) . "' LIMIT 1");
|
||||||
if (empty($news)) {
|
if (empty($news)) {
|
||||||
return error("No News found.", true);
|
return error('No News found.', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($_REQUEST["action"]) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'edit':
|
case 'edit':
|
||||||
list($news) = $news;
|
list($news) = $news;
|
||||||
$user_source = User($news['UID']);
|
$user_source = User($news['UID']);
|
||||||
|
|
||||||
$html .= form([
|
$html .= form([
|
||||||
form_info(_("Date"), date("Y-m-d H:i", $news['Datum'])),
|
form_info(_('Date'), date('Y-m-d H:i', $news['Datum'])),
|
||||||
form_info(_("Author"), User_Nick_render($user_source)),
|
form_info(_('Author'), User_Nick_render($user_source)),
|
||||||
form_text('eBetreff', _("Subject"), $news['Betreff']),
|
form_text('eBetreff', _('Subject'), $news['Betreff']),
|
||||||
form_textarea('eText', _("Message"), $news['Text']),
|
form_textarea('eText', _('Message'), $news['Text']),
|
||||||
form_checkbox('eTreffen', _("Meeting"), $news['Treffen'] == 1, 1),
|
form_checkbox('eTreffen', _('Meeting'), $news['Treffen'] == 1, 1),
|
||||||
form_submit('submit', _("Save"))
|
form_submit('submit', _('Save'))
|
||||||
], page_link_to('admin_news&action=save&id=' . $news_id));
|
], page_link_to('admin_news&action=save&id=' . $news_id));
|
||||||
|
|
||||||
$html .= '<a class="btn btn-danger" href="' . page_link_to('admin_news&action=delete&id=' . $news_id) . '">'
|
$html .= '<a class="btn btn-danger" href="' . page_link_to('admin_news&action=delete&id=' . $news_id) . '">'
|
||||||
|
@ -50,17 +50,17 @@ function admin_news()
|
||||||
`UID`='" . sql_escape($user['UID']) . "',
|
`UID`='" . sql_escape($user['UID']) . "',
|
||||||
`Treffen`='" . sql_escape($_POST["eTreffen"]) . "'
|
`Treffen`='" . sql_escape($_POST["eTreffen"]) . "'
|
||||||
WHERE `ID`='" . sql_escape($news_id) . "'");
|
WHERE `ID`='" . sql_escape($news_id) . "'");
|
||||||
engelsystem_log("News updated: " . $_POST["eBetreff"]);
|
engelsystem_log('News updated: ' . $_POST['eBetreff']);
|
||||||
success(_("News entry updated."));
|
success(_('News entry updated.'));
|
||||||
redirect(page_link_to("news"));
|
redirect(page_link_to('news'));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
list($news) = $news;
|
list($news) = $news;
|
||||||
sql_query("DELETE FROM `News` WHERE `ID`='" . sql_escape($news_id) . "' LIMIT 1");
|
sql_query("DELETE FROM `News` WHERE `ID`='" . sql_escape($news_id) . "' LIMIT 1");
|
||||||
engelsystem_log("News deleted: " . $news['Betreff']);
|
engelsystem_log('News deleted: ' . $news['Betreff']);
|
||||||
success(_("News entry deleted."));
|
success(_('News entry deleted.'));
|
||||||
redirect(page_link_to("news"));
|
redirect(page_link_to('news'));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
redirect(page_link_to('news'));
|
redirect(page_link_to('news'));
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function admin_questions_title()
|
function admin_questions_title()
|
||||||
{
|
{
|
||||||
return _("Answer questions");
|
return _('Answer questions');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,9 +17,9 @@ function admin_new_questions()
|
||||||
{
|
{
|
||||||
global $privileges, $page;
|
global $privileges, $page;
|
||||||
|
|
||||||
if ($page != "admin_questions") {
|
if ($page != 'admin_questions') {
|
||||||
if (in_array("admin_questions", $privileges)) {
|
if (in_array('admin_questions', $privileges)) {
|
||||||
$new_messages = sql_num_query("SELECT * FROM `Questions` WHERE `AID` IS NULL");
|
$new_messages = sql_num_query('SELECT * FROM `Questions` WHERE `AID` IS NULL');
|
||||||
|
|
||||||
if ($new_messages > 0) {
|
if ($new_messages > 0) {
|
||||||
return '<a href="' . page_link_to("admin_questions") . '">' . _('There are unanswered questions!') . '</a>';
|
return '<a href="' . page_link_to("admin_questions") . '">' . _('There are unanswered questions!') . '</a>';
|
||||||
|
@ -45,14 +45,14 @@ function admin_questions()
|
||||||
|
|
||||||
$unanswered_questions_table[] = [
|
$unanswered_questions_table[] = [
|
||||||
'from' => User_Nick_render($user_source),
|
'from' => User_Nick_render($user_source),
|
||||||
'question' => str_replace("\n", "<br />", $question['Question']),
|
'question' => str_replace("\n", '<br />', $question['Question']),
|
||||||
'answer' => form([
|
'answer' => form([
|
||||||
form_textarea('answer', '', ''),
|
form_textarea('answer', '', ''),
|
||||||
form_submit('submit', _("Save"))
|
form_submit('submit', _('Save'))
|
||||||
], page_link_to('admin_questions') . '&action=answer&id=' . $question['QID']),
|
], page_link_to('admin_questions') . '&action=answer&id=' . $question['QID']),
|
||||||
'actions' => button(
|
'actions' => button(
|
||||||
page_link_to("admin_questions") . '&action=delete&id=' . $question['QID'],
|
page_link_to('admin_questions') . '&action=delete&id=' . $question['QID'],
|
||||||
_("delete"),
|
_('delete'),
|
||||||
'btn-xs'
|
'btn-xs'
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
|
@ -65,41 +65,41 @@ function admin_questions()
|
||||||
$answer_user_source = User($question['AID']);
|
$answer_user_source = User($question['AID']);
|
||||||
$answered_questions_table[] = [
|
$answered_questions_table[] = [
|
||||||
'from' => User_Nick_render($user_source),
|
'from' => User_Nick_render($user_source),
|
||||||
'question' => str_replace("\n", "<br />", $question['Question']),
|
'question' => str_replace("\n", '<br />', $question['Question']),
|
||||||
'answered_by' => User_Nick_render($answer_user_source),
|
'answered_by' => User_Nick_render($answer_user_source),
|
||||||
'answer' => str_replace("\n", "<br />", $question['Answer']),
|
'answer' => str_replace("\n", '<br />', $question['Answer']),
|
||||||
'actions' => button(
|
'actions' => button(
|
||||||
page_link_to("admin_questions") . '&action=delete&id=' . $question['QID'],
|
page_link_to('admin_questions') . '&action=delete&id=' . $question['QID'],
|
||||||
_("delete"),
|
_('delete'),
|
||||||
'btn-xs'
|
'btn-xs'
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return page_with_title(admin_questions_title(), [
|
return page_with_title(admin_questions_title(), [
|
||||||
'<h2>' . _("Unanswered questions") . '</h2>',
|
'<h2>' . _('Unanswered questions') . '</h2>',
|
||||||
table([
|
table([
|
||||||
'from' => _("From"),
|
'from' => _('From'),
|
||||||
'question' => _("Question"),
|
'question' => _('Question'),
|
||||||
'answer' => _("Answer"),
|
'answer' => _('Answer'),
|
||||||
'actions' => ''
|
'actions' => ''
|
||||||
], $unanswered_questions_table),
|
], $unanswered_questions_table),
|
||||||
'<h2>' . _("Answered questions") . '</h2>',
|
'<h2>' . _('Answered questions') . '</h2>',
|
||||||
table([
|
table([
|
||||||
'from' => _("From"),
|
'from' => _('From'),
|
||||||
'question' => _("Question"),
|
'question' => _('Question'),
|
||||||
'answered_by' => _("Answered by"),
|
'answered_by' => _('Answered by'),
|
||||||
'answer' => _("Answer"),
|
'answer' => _('Answer'),
|
||||||
'actions' => ''
|
'actions' => ''
|
||||||
], $answered_questions_table)
|
], $answered_questions_table)
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'answer':
|
case 'answer':
|
||||||
if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) {
|
if (isset($_REQUEST['id']) && preg_match('/^[0-9]{1,11}$/', $_REQUEST['id'])) {
|
||||||
$question_id = $_REQUEST['id'];
|
$question_id = $_REQUEST['id'];
|
||||||
} else {
|
} else {
|
||||||
return error("Incomplete call, missing Question ID.", true);
|
return error('Incomplete call, missing Question ID.', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$question = sql_select("SELECT * FROM `Questions` WHERE `QID`='" . sql_escape($question_id) . "' LIMIT 1");
|
$question = sql_select("SELECT * FROM `Questions` WHERE `QID`='" . sql_escape($question_id) . "' LIMIT 1");
|
||||||
|
@ -110,36 +110,36 @@ function admin_questions()
|
||||||
strip_tags($_REQUEST['answer'])
|
strip_tags($_REQUEST['answer'])
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($answer != "") {
|
if ($answer != '') {
|
||||||
sql_query("
|
sql_query("
|
||||||
UPDATE `Questions`
|
UPDATE `Questions`
|
||||||
SET `AID`='" . sql_escape($user['UID']) . "', `Answer`='" . sql_escape($answer) . "'
|
SET `AID`='" . sql_escape($user['UID']) . "', `Answer`='" . sql_escape($answer) . "'
|
||||||
WHERE `QID`='" . sql_escape($question_id) . "'
|
WHERE `QID`='" . sql_escape($question_id) . "'
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
");
|
");
|
||||||
engelsystem_log("Question " . $question[0]['Question'] . " answered: " . $answer);
|
engelsystem_log('Question ' . $question[0]['Question'] . ' answered: ' . $answer);
|
||||||
redirect(page_link_to("admin_questions"));
|
redirect(page_link_to('admin_questions'));
|
||||||
} else {
|
} else {
|
||||||
return error("Enter an answer!", true);
|
return error('Enter an answer!', true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return error("No question found.", true);
|
return error('No question found.', true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) {
|
if (isset($_REQUEST['id']) && preg_match('/^[0-9]{1,11}$/', $_REQUEST['id'])) {
|
||||||
$question_id = $_REQUEST['id'];
|
$question_id = $_REQUEST['id'];
|
||||||
} else {
|
} else {
|
||||||
return error("Incomplete call, missing Question ID.", true);
|
return error('Incomplete call, missing Question ID.', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$question = sql_select("SELECT * FROM `Questions` WHERE `QID`='" . sql_escape($question_id) . "' LIMIT 1");
|
$question = sql_select("SELECT * FROM `Questions` WHERE `QID`='" . sql_escape($question_id) . "' LIMIT 1");
|
||||||
if (count($question) > 0) {
|
if (count($question) > 0) {
|
||||||
sql_query("DELETE FROM `Questions` WHERE `QID`='" . sql_escape($question_id) . "' LIMIT 1");
|
sql_query("DELETE FROM `Questions` WHERE `QID`='" . sql_escape($question_id) . "' LIMIT 1");
|
||||||
engelsystem_log("Question deleted: " . $question[0]['Question']);
|
engelsystem_log('Question deleted: ' . $question[0]['Question']);
|
||||||
redirect(page_link_to("admin_questions"));
|
redirect(page_link_to('admin_questions'));
|
||||||
} else {
|
} else {
|
||||||
return error("No question found.", true);
|
return error('No question found.', true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function admin_rooms_title()
|
function admin_rooms_title()
|
||||||
{
|
{
|
||||||
return _("Rooms");
|
return _('Rooms');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,7 +13,7 @@ function admin_rooms_title()
|
||||||
*/
|
*/
|
||||||
function admin_rooms()
|
function admin_rooms()
|
||||||
{
|
{
|
||||||
$rooms_source = sql_select("SELECT * FROM `Room` ORDER BY `Name`");
|
$rooms_source = sql_select('SELECT * FROM `Room` ORDER BY `Name`');
|
||||||
$rooms = [];
|
$rooms = [];
|
||||||
foreach ($rooms_source as $room) {
|
foreach ($rooms_source as $room) {
|
||||||
$rooms[] = [
|
$rooms[] = [
|
||||||
|
@ -21,22 +21,22 @@ function admin_rooms()
|
||||||
'from_pentabarf' => $room['FromPentabarf'] == 'Y' ? '✓' : '',
|
'from_pentabarf' => $room['FromPentabarf'] == 'Y' ? '✓' : '',
|
||||||
'public' => $room['show'] == 'Y' ? '✓' : '',
|
'public' => $room['show'] == 'Y' ? '✓' : '',
|
||||||
'actions' => table_buttons([
|
'actions' => table_buttons([
|
||||||
button(page_link_to('admin_rooms') . '&show=edit&id=' . $room['RID'], _("edit"), 'btn-xs'),
|
button(page_link_to('admin_rooms') . '&show=edit&id=' . $room['RID'], _('edit'), 'btn-xs'),
|
||||||
button(page_link_to('admin_rooms') . '&show=delete&id=' . $room['RID'], _("delete"), 'btn-xs')
|
button(page_link_to('admin_rooms') . '&show=delete&id=' . $room['RID'], _('delete'), 'btn-xs')
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$room = null;
|
$room = null;
|
||||||
|
|
||||||
if (isset($_REQUEST['show'])) {
|
if (isset($_REQUEST['show'])) {
|
||||||
$msg = "";
|
$msg = '';
|
||||||
$name = "";
|
$name = '';
|
||||||
$from_pentabarf = "";
|
$from_pentabarf = '';
|
||||||
$public = 'Y';
|
$public = 'Y';
|
||||||
$number = "";
|
$number = '';
|
||||||
$room_id = 0;
|
$room_id = 0;
|
||||||
|
|
||||||
$angeltypes_source = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`");
|
$angeltypes_source = sql_select('SELECT * FROM `AngelTypes` ORDER BY `name`');
|
||||||
$angeltypes = [];
|
$angeltypes = [];
|
||||||
$angeltypes_count = [];
|
$angeltypes_count = [];
|
||||||
foreach ($angeltypes_source as $angeltype) {
|
foreach ($angeltypes_source as $angeltype) {
|
||||||
|
@ -47,7 +47,7 @@ function admin_rooms()
|
||||||
if (test_request_int('id')) {
|
if (test_request_int('id')) {
|
||||||
$room = Room($_REQUEST['id']);
|
$room = Room($_REQUEST['id']);
|
||||||
if ($room === false) {
|
if ($room === false) {
|
||||||
engelsystem_error("Unable to load room.");
|
engelsystem_error('Unable to load room.');
|
||||||
}
|
}
|
||||||
if ($room == null) {
|
if ($room == null) {
|
||||||
redirect(page_link_to('admin_rooms'));
|
redirect(page_link_to('admin_rooms'));
|
||||||
|
@ -73,11 +73,11 @@ function admin_rooms()
|
||||||
$name = strip_request_item('name');
|
$name = strip_request_item('name');
|
||||||
if (isset($room) && sql_num_query("SELECT * FROM `Room` WHERE `Name`='" . sql_escape($name) . "' AND NOT `RID`=" . sql_escape($room_id)) > 0) {
|
if (isset($room) && sql_num_query("SELECT * FROM `Room` WHERE `Name`='" . sql_escape($name) . "' AND NOT `RID`=" . sql_escape($room_id)) > 0) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(_("This name is already in use."), true);
|
$msg .= error(_('This name is already in use.'), true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(_("Please enter a name."), true);
|
$msg .= error(_('Please enter a name.'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['from_pentabarf'])) {
|
if (isset($_REQUEST['from_pentabarf'])) {
|
||||||
|
@ -101,25 +101,45 @@ function admin_rooms()
|
||||||
foreach ($angeltypes as $angeltype_id => $angeltype) {
|
foreach ($angeltypes as $angeltype_id => $angeltype) {
|
||||||
if (
|
if (
|
||||||
isset($_REQUEST['angeltype_count_' . $angeltype_id])
|
isset($_REQUEST['angeltype_count_' . $angeltype_id])
|
||||||
&& preg_match("/^[0-9]{1,4}$/", $_REQUEST['angeltype_count_' . $angeltype_id])
|
&& preg_match('/^[0-9]{1,4}$/', $_REQUEST['angeltype_count_' . $angeltype_id])
|
||||||
) {
|
) {
|
||||||
$angeltypes_count[$angeltype_id] = $_REQUEST['angeltype_count_' . $angeltype_id];
|
$angeltypes_count[$angeltype_id] = $_REQUEST['angeltype_count_' . $angeltype_id];
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(sprintf(_("Please enter needed angels for type %s."), $angeltype), true);
|
$msg .= error(sprintf(_('Please enter needed angels for type %s.'), $angeltype), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
if (isset($room_id)) {
|
if (isset($room_id)) {
|
||||||
sql_query("UPDATE `Room` SET `Name`='" . sql_escape($name) . "', `FromPentabarf`='" . sql_escape($from_pentabarf) . "', `show`='" . sql_escape($public) . "', `Number`='" . sql_escape($number) . "' WHERE `RID`='" . sql_escape($room_id) . "' LIMIT 1");
|
sql_query("
|
||||||
engelsystem_log("Room updated: " . $name . ", pentabarf import: " . $from_pentabarf . ", public: " . $public . ", number: " . $number);
|
UPDATE `Room`
|
||||||
|
SET
|
||||||
|
`Name`='" . sql_escape($name) . "',
|
||||||
|
`FromPentabarf`='" . sql_escape($from_pentabarf) . "',
|
||||||
|
`show`='" . sql_escape($public) . "',
|
||||||
|
`Number`='" . sql_escape($number) . "'
|
||||||
|
WHERE `RID`='" . sql_escape($room_id) . "'
|
||||||
|
LIMIT 1
|
||||||
|
");
|
||||||
|
engelsystem_log(
|
||||||
|
'Room updated: ' . $name
|
||||||
|
. ', pentabarf import: ' . $from_pentabarf
|
||||||
|
. ', public: ' . $public
|
||||||
|
. ', number: ' . $number
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$room_id = Room_create($name, $from_pentabarf, $public, $number);
|
$room_id = Room_create($name, $from_pentabarf, $public, $number);
|
||||||
if ($room_id === false) {
|
if ($room_id === false) {
|
||||||
engelsystem_error("Unable to create room.");
|
engelsystem_error('Unable to create room.');
|
||||||
}
|
}
|
||||||
engelsystem_log("Room created: " . $name . ", pentabarf import: " . $from_pentabarf . ", public: " . $public . ", number: " . $number);
|
engelsystem_log(
|
||||||
|
'Room created: ' . $name
|
||||||
|
. ', pentabarf import: '
|
||||||
|
. $from_pentabarf
|
||||||
|
. ', public: ' . $public
|
||||||
|
. ', number: ' . $number
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
NeededAngelTypes_delete_by_room($room_id);
|
NeededAngelTypes_delete_by_room($room_id);
|
||||||
|
@ -128,16 +148,16 @@ function admin_rooms()
|
||||||
$angeltype = AngelType($angeltype_id);
|
$angeltype = AngelType($angeltype_id);
|
||||||
if ($angeltype != null) {
|
if ($angeltype != null) {
|
||||||
NeededAngelType_add(null, $angeltype_id, $room_id, $angeltype_count);
|
NeededAngelType_add(null, $angeltype_id, $room_id, $angeltype_count);
|
||||||
$needed_angeltype_info[] = $angeltype['name'] . ": " . $angeltype_count;
|
$needed_angeltype_info[] = $angeltype['name'] . ': ' . $angeltype_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
engelsystem_log(
|
engelsystem_log(
|
||||||
"Set needed angeltypes of room " . $name
|
'Set needed angeltypes of room ' . $name
|
||||||
. " to: " . join(", ", $needed_angeltype_info)
|
. ' to: ' . join(', ', $needed_angeltype_info)
|
||||||
);
|
);
|
||||||
success(_("Room saved."));
|
success(_('Room saved.'));
|
||||||
redirect(page_link_to("admin_rooms"));
|
redirect(page_link_to('admin_rooms'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$angeltypes_count_form = [];
|
$angeltypes_count_form = [];
|
||||||
|
@ -149,47 +169,47 @@ function admin_rooms()
|
||||||
|
|
||||||
return page_with_title(admin_rooms_title(), [
|
return page_with_title(admin_rooms_title(), [
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('admin_rooms'), _("back"), 'back')
|
button(page_link_to('admin_rooms'), _('back'), 'back')
|
||||||
]),
|
]),
|
||||||
$msg,
|
$msg,
|
||||||
form([
|
form([
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-md-6', [
|
div('col-md-6', [
|
||||||
form_text('name', _("Name"), $name),
|
form_text('name', _('Name'), $name),
|
||||||
form_checkbox('from_pentabarf', _("Frab import"), $from_pentabarf),
|
form_checkbox('from_pentabarf', _('Frab import'), $from_pentabarf),
|
||||||
form_checkbox('public', _("Public"), $public),
|
form_checkbox('public', _('Public'), $public),
|
||||||
form_text('number', _("Room number"), $number)
|
form_text('number', _('Room number'), $number)
|
||||||
]),
|
]),
|
||||||
div('col-md-6', [
|
div('col-md-6', [
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-md-12', [
|
div('col-md-12', [
|
||||||
form_info(_("Needed angels:"))
|
form_info(_('Needed angels:'))
|
||||||
]),
|
]),
|
||||||
join($angeltypes_count_form)
|
join($angeltypes_count_form)
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
form_submit('submit', _("Save"))
|
form_submit('submit', _('Save'))
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
} elseif ($_REQUEST['show'] == 'delete') {
|
} elseif ($_REQUEST['show'] == 'delete') {
|
||||||
if (isset($_REQUEST['ack'])) {
|
if (isset($_REQUEST['ack'])) {
|
||||||
if (!Room_delete($room_id)) {
|
if (!Room_delete($room_id)) {
|
||||||
engelsystem_error("Unable to delete room.");
|
engelsystem_error('Unable to delete room.');
|
||||||
}
|
}
|
||||||
|
|
||||||
engelsystem_log("Room deleted: " . $name);
|
engelsystem_log('Room deleted: ' . $name);
|
||||||
success(sprintf(_("Room %s deleted."), $name));
|
success(sprintf(_('Room %s deleted.'), $name));
|
||||||
redirect(page_link_to('admin_rooms'));
|
redirect(page_link_to('admin_rooms'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return page_with_title(admin_rooms_title(), [
|
return page_with_title(admin_rooms_title(), [
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('admin_rooms'), _("back"), 'back')
|
button(page_link_to('admin_rooms'), _('back'), 'back')
|
||||||
]),
|
]),
|
||||||
sprintf(_("Do you want to delete room %s?"), $name),
|
sprintf(_('Do you want to delete room %s?'), $name),
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('admin_rooms') . '&show=delete&id=' . $room_id . '&ack', _("Delete"), 'delete')
|
button(page_link_to('admin_rooms') . '&show=delete&id=' . $room_id . '&ack', _('Delete'), 'delete')
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -197,14 +217,14 @@ function admin_rooms()
|
||||||
|
|
||||||
return page_with_title(admin_rooms_title(), [
|
return page_with_title(admin_rooms_title(), [
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('admin_rooms') . '&show=edit', _("add"))
|
button(page_link_to('admin_rooms') . '&show=edit', _('add'))
|
||||||
]),
|
]),
|
||||||
msg(),
|
msg(),
|
||||||
table([
|
table([
|
||||||
'name' => _("Name"),
|
'name' => _('Name'),
|
||||||
'from_pentabarf' => _("Frab import"),
|
'from_pentabarf' => _('Frab import'),
|
||||||
'public' => _("Public"),
|
'public' => _('Public'),
|
||||||
'actions' => ""
|
'actions' => ''
|
||||||
], $rooms)
|
], $rooms)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function admin_shifts_title()
|
function admin_shifts_title()
|
||||||
{
|
{
|
||||||
return _("Create shifts");
|
return _('Create shifts');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,24 +17,24 @@ function admin_shifts()
|
||||||
{
|
{
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
$start = parse_date("Y-m-d H:i", date("Y-m-d") . " 00:00");
|
$start = parse_date('Y-m-d H:i', date('Y-m-d') . ' 00:00');
|
||||||
$end = $start;
|
$end = $start;
|
||||||
$mode = 'single';
|
$mode = 'single';
|
||||||
$angelmode = 'manually';
|
$angelmode = 'manually';
|
||||||
$length = '';
|
$length = '';
|
||||||
$change_hours = [];
|
$change_hours = [];
|
||||||
$title = "";
|
$title = '';
|
||||||
$shifttype_id = null;
|
$shifttype_id = null;
|
||||||
|
|
||||||
// Locations laden (auch unsichtbare - fuer Erzengel ist das ok)
|
// Locations laden (auch unsichtbare - fuer Erzengel ist das ok)
|
||||||
$rooms = sql_select("SELECT * FROM `Room` ORDER BY `Name`");
|
$rooms = sql_select('SELECT * FROM `Room` ORDER BY `Name`');
|
||||||
$room_array = [];
|
$room_array = [];
|
||||||
foreach ($rooms as $room) {
|
foreach ($rooms as $room) {
|
||||||
$room_array[$room['RID']] = $room['Name'];
|
$room_array[$room['RID']] = $room['Name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Engeltypen laden
|
// Engeltypen laden
|
||||||
$types = sql_select("SELECT * FROM `AngelTypes` ORDER BY `name`");
|
$types = sql_select('SELECT * FROM `AngelTypes` ORDER BY `name`');
|
||||||
$needed_angel_types = [];
|
$needed_angel_types = [];
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
$needed_angel_types[$type['id']] = 0;
|
$needed_angel_types[$type['id']] = 0;
|
||||||
|
@ -73,7 +73,7 @@ function admin_shifts()
|
||||||
// Auswahl der sichtbaren Locations für die Schichten
|
// Auswahl der sichtbaren Locations für die Schichten
|
||||||
if (
|
if (
|
||||||
isset($_REQUEST['rid'])
|
isset($_REQUEST['rid'])
|
||||||
&& preg_match("/^[0-9]+$/", $_REQUEST['rid'])
|
&& preg_match('/^[0-9]+$/', $_REQUEST['rid'])
|
||||||
&& isset($room_array[$_REQUEST['rid']])
|
&& isset($room_array[$_REQUEST['rid']])
|
||||||
) {
|
) {
|
||||||
$rid = $_REQUEST['rid'];
|
$rid = $_REQUEST['rid'];
|
||||||
|
@ -83,14 +83,14 @@ function admin_shifts()
|
||||||
error(_('Please select a location.'));
|
error(_('Please select a location.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['start']) && $tmp = parse_date("Y-m-d H:i", $_REQUEST['start'])) {
|
if (isset($_REQUEST['start']) && $tmp = parse_date('Y-m-d H:i', $_REQUEST['start'])) {
|
||||||
$start = $tmp;
|
$start = $tmp;
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_('Please select a start time.'));
|
error(_('Please select a start time.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['end']) && $tmp = parse_date("Y-m-d H:i", $_REQUEST['end'])) {
|
if (isset($_REQUEST['end']) && $tmp = parse_date('Y-m-d H:i', $_REQUEST['end'])) {
|
||||||
$end = $tmp;
|
$end = $tmp;
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
|
@ -106,7 +106,7 @@ function admin_shifts()
|
||||||
if ($_REQUEST['mode'] == 'single') {
|
if ($_REQUEST['mode'] == 'single') {
|
||||||
$mode = 'single';
|
$mode = 'single';
|
||||||
} elseif ($_REQUEST['mode'] == 'multi') {
|
} elseif ($_REQUEST['mode'] == 'multi') {
|
||||||
if (isset($_REQUEST['length']) && preg_match("/^[0-9]+$/", trim($_REQUEST['length']))) {
|
if (isset($_REQUEST['length']) && preg_match('/^[0-9]+$/', trim($_REQUEST['length']))) {
|
||||||
$mode = 'multi';
|
$mode = 'multi';
|
||||||
$length = trim($_REQUEST['length']);
|
$length = trim($_REQUEST['length']);
|
||||||
} else {
|
} else {
|
||||||
|
@ -116,10 +116,10 @@ function admin_shifts()
|
||||||
} elseif ($_REQUEST['mode'] == 'variable') {
|
} elseif ($_REQUEST['mode'] == 'variable') {
|
||||||
if (
|
if (
|
||||||
isset($_REQUEST['change_hours'])
|
isset($_REQUEST['change_hours'])
|
||||||
&& preg_match("/^([0-9]{2}(,|$))/", trim(str_replace(" ", "", $_REQUEST['change_hours'])))
|
&& preg_match('/^([0-9]{2}(,|$))/', trim(str_replace(' ', '', $_REQUEST['change_hours'])))
|
||||||
) {
|
) {
|
||||||
$mode = 'variable';
|
$mode = 'variable';
|
||||||
$change_hours = array_map('trim', explode(",", $_REQUEST['change_hours']));
|
$change_hours = array_map('trim', explode(',', $_REQUEST['change_hours']));
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_('Please split the shift-change hours by colons.'));
|
error(_('Please split the shift-change hours by colons.'));
|
||||||
|
@ -138,7 +138,7 @@ function admin_shifts()
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
if (
|
if (
|
||||||
isset($_REQUEST['type_' . $type['id']])
|
isset($_REQUEST['type_' . $type['id']])
|
||||||
&& preg_match("/^[0-9]+$/", trim($_REQUEST['type_' . $type['id']]))
|
&& preg_match('/^[0-9]+$/', trim($_REQUEST['type_' . $type['id']]))
|
||||||
) {
|
) {
|
||||||
$needed_angel_types[$type['id']] = trim($_REQUEST['type_' . $type['id']]);
|
$needed_angel_types[$type['id']] = trim($_REQUEST['type_' . $type['id']]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -206,7 +206,7 @@ function admin_shifts()
|
||||||
} while ($shift_end < $end);
|
} while ($shift_end < $end);
|
||||||
} elseif ($mode == 'variable') {
|
} elseif ($mode == 'variable') {
|
||||||
rsort($change_hours);
|
rsort($change_hours);
|
||||||
$day = parse_date("Y-m-d H:i", date("Y-m-d", $start) . " 00:00");
|
$day = parse_date('Y-m-d H:i', date('Y-m-d', $start) . ' 00:00');
|
||||||
$change_index = 0;
|
$change_index = 0;
|
||||||
// Ersten/nächsten passenden Schichtwechsel suchen
|
// Ersten/nächsten passenden Schichtwechsel suchen
|
||||||
foreach ($change_hours as $i => $change_hour) {
|
foreach ($change_hours as $i => $change_hour) {
|
||||||
|
@ -223,7 +223,7 @@ function admin_shifts()
|
||||||
|
|
||||||
$shift_start = $start;
|
$shift_start = $start;
|
||||||
do {
|
do {
|
||||||
$day = parse_date("Y-m-d H:i", date("Y-m-d", $shift_start) . " 00:00");
|
$day = parse_date('Y-m-d H:i', date('Y-m-d', $shift_start) . ' 00:00');
|
||||||
$shift_end = $day + $change_hours[$change_index] * 60 * 60;
|
$shift_end = $day + $change_hours[$change_index] * 60 * 60;
|
||||||
|
|
||||||
if ($shift_end > $end) {
|
if ($shift_end > $end) {
|
||||||
|
@ -251,9 +251,9 @@ function admin_shifts()
|
||||||
$shifts_table_entry = [
|
$shifts_table_entry = [
|
||||||
'timeslot' =>
|
'timeslot' =>
|
||||||
'<span class="glyphicon glyphicon-time"></span> '
|
'<span class="glyphicon glyphicon-time"></span> '
|
||||||
. date("Y-m-d H:i", $shift['start'])
|
. date('Y-m-d H:i', $shift['start'])
|
||||||
. ' - '
|
. ' - '
|
||||||
. date("H:i", $shift['end'])
|
. date('H:i', $shift['end'])
|
||||||
. '<br />'
|
. '<br />'
|
||||||
. Room_name_render(Room($shift['RID'])),
|
. Room_name_render(Room($shift['RID'])),
|
||||||
'title' =>
|
'title' =>
|
||||||
|
@ -273,29 +273,29 @@ function admin_shifts()
|
||||||
$_SESSION['admin_shifts_shifts'] = $shifts;
|
$_SESSION['admin_shifts_shifts'] = $shifts;
|
||||||
$_SESSION['admin_shifts_types'] = $needed_angel_types;
|
$_SESSION['admin_shifts_types'] = $needed_angel_types;
|
||||||
|
|
||||||
$hidden_types = "";
|
$hidden_types = '';
|
||||||
foreach ($needed_angel_types as $type_id => $count) {
|
foreach ($needed_angel_types as $type_id => $count) {
|
||||||
$hidden_types .= form_hidden('type_' . $type_id, $count);
|
$hidden_types .= form_hidden('type_' . $type_id, $count);
|
||||||
}
|
}
|
||||||
return page_with_title(_("Preview"), [
|
return page_with_title(_('Preview'), [
|
||||||
form([
|
form([
|
||||||
$hidden_types,
|
$hidden_types,
|
||||||
form_hidden('shifttype_id', $shifttype_id),
|
form_hidden('shifttype_id', $shifttype_id),
|
||||||
form_hidden('title', $title),
|
form_hidden('title', $title),
|
||||||
form_hidden('rid', $rid),
|
form_hidden('rid', $rid),
|
||||||
form_hidden('start', date("Y-m-d H:i", $start)),
|
form_hidden('start', date('Y-m-d H:i', $start)),
|
||||||
form_hidden('end', date("Y-m-d H:i", $end)),
|
form_hidden('end', date('Y-m-d H:i', $end)),
|
||||||
form_hidden('mode', $mode),
|
form_hidden('mode', $mode),
|
||||||
form_hidden('length', $length),
|
form_hidden('length', $length),
|
||||||
form_hidden('change_hours', implode(', ', $change_hours)),
|
form_hidden('change_hours', implode(', ', $change_hours)),
|
||||||
form_hidden('angelmode', $angelmode),
|
form_hidden('angelmode', $angelmode),
|
||||||
form_submit('back', _("back")),
|
form_submit('back', _('back')),
|
||||||
table([
|
table([
|
||||||
'timeslot' => _('Time and location'),
|
'timeslot' => _('Time and location'),
|
||||||
'title' => _('Type and title'),
|
'title' => _('Type and title'),
|
||||||
'needed_angels' => _('Needed angels')
|
'needed_angels' => _('Needed angels')
|
||||||
], $shifts_table),
|
], $shifts_table),
|
||||||
form_submit('submit', _("Save"))
|
form_submit('submit', _('Save'))
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -314,10 +314,10 @@ function admin_shifts()
|
||||||
}
|
}
|
||||||
|
|
||||||
engelsystem_log(
|
engelsystem_log(
|
||||||
"Shift created: " . $shifttypes[$shift['shifttype_id']]
|
'Shift created: ' . $shifttypes[$shift['shifttype_id']]
|
||||||
. " with title " . $shift['title']
|
. ' with title ' . $shift['title']
|
||||||
. " from " . date("Y-m-d H:i", $shift['start'])
|
. ' from ' . date('Y-m-d H:i', $shift['start'])
|
||||||
. " to " . date("Y-m-d H:i", $shift['end'])
|
. ' to ' . date('Y-m-d H:i', $shift['end'])
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($_SESSION['admin_shifts_types'] as $type_id => $count) {
|
foreach ($_SESSION['admin_shifts_types'] as $type_id => $count) {
|
||||||
|
@ -329,8 +329,8 @@ function admin_shifts()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
engelsystem_log("Shift needs following angel types: " . join(", ", $needed_angel_types_info));
|
engelsystem_log('Shift needs following angel types: ' . join(', ', $needed_angel_types_info));
|
||||||
success("Schichten angelegt.");
|
success('Schichten angelegt.');
|
||||||
redirect(page_link_to('admin_shifts'));
|
redirect(page_link_to('admin_shifts'));
|
||||||
} else {
|
} else {
|
||||||
unset($_SESSION['admin_shifts_shifts']);
|
unset($_SESSION['admin_shifts_shifts']);
|
||||||
|
@ -340,7 +340,7 @@ function admin_shifts()
|
||||||
if (!isset($_REQUEST['rid'])) {
|
if (!isset($_REQUEST['rid'])) {
|
||||||
$_REQUEST['rid'] = null;
|
$_REQUEST['rid'] = null;
|
||||||
}
|
}
|
||||||
$angel_types = "";
|
$angel_types = '';
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
$angel_types .= '<div class="col-md-4">' . form_spinner(
|
$angel_types .= '<div class="col-md-4">' . form_spinner(
|
||||||
'type_' . $type['id'],
|
'type_' . $type['id'],
|
||||||
|
@ -354,43 +354,43 @@ function admin_shifts()
|
||||||
msg(),
|
msg(),
|
||||||
form([
|
form([
|
||||||
form_select('shifttype_id', _('Shifttype'), $shifttypes, $shifttype_id),
|
form_select('shifttype_id', _('Shifttype'), $shifttypes, $shifttype_id),
|
||||||
form_text('title', _("Title"), $title),
|
form_text('title', _('Title'), $title),
|
||||||
form_select('rid', _("Room"), $room_array, $_REQUEST['rid']),
|
form_select('rid', _('Room'), $room_array, $_REQUEST['rid']),
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-md-6', [
|
div('col-md-6', [
|
||||||
form_text('start', _("Start"), date("Y-m-d H:i", $start)),
|
form_text('start', _('Start'), date('Y-m-d H:i', $start)),
|
||||||
form_text('end', _("End"), date("Y-m-d H:i", $end)),
|
form_text('end', _('End'), date('Y-m-d H:i', $end)),
|
||||||
form_info(_("Mode"), ''),
|
form_info(_('Mode'), ''),
|
||||||
form_radio('mode', _("Create one shift"), $mode == 'single', 'single'),
|
form_radio('mode', _('Create one shift'), $mode == 'single', 'single'),
|
||||||
form_radio('mode', _("Create multiple shifts"), $mode == 'multi', 'multi'),
|
form_radio('mode', _('Create multiple shifts'), $mode == 'multi', 'multi'),
|
||||||
form_text('length', _("Length"), !empty($_REQUEST['length']) ? $_REQUEST['length'] : '120'),
|
form_text('length', _('Length'), !empty($_REQUEST['length']) ? $_REQUEST['length'] : '120'),
|
||||||
form_radio(
|
form_radio(
|
||||||
'mode',
|
'mode',
|
||||||
_("Create multiple shifts with variable length"),
|
_('Create multiple shifts with variable length'),
|
||||||
$mode == 'variable',
|
$mode == 'variable',
|
||||||
'variable'
|
'variable'
|
||||||
),
|
),
|
||||||
form_text(
|
form_text(
|
||||||
'change_hours',
|
'change_hours',
|
||||||
_("Shift change hours"),
|
_('Shift change hours'),
|
||||||
!empty($_REQUEST['change_hours']) ? $_REQUEST['change_hours'] : '00, 04, 08, 10, 12, 14, 16, 18, 20, 22'
|
!empty($_REQUEST['change_hours']) ? $_REQUEST['change_hours'] : '00, 04, 08, 10, 12, 14, 16, 18, 20, 22'
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
div('col-md-6', [
|
div('col-md-6', [
|
||||||
form_info(_("Needed angels"), ''),
|
form_info(_('Needed angels'), ''),
|
||||||
form_radio(
|
form_radio(
|
||||||
'angelmode',
|
'angelmode',
|
||||||
_("Take needed angels from room settings"),
|
_('Take needed angels from room settings'),
|
||||||
$angelmode == 'location',
|
$angelmode == 'location',
|
||||||
'location'
|
'location'
|
||||||
),
|
),
|
||||||
form_radio('angelmode', _("The following angels are needed"), $angelmode == 'manually', 'manually'),
|
form_radio('angelmode', _('The following angels are needed'), $angelmode == 'manually', 'manually'),
|
||||||
div('row', [
|
div('row', [
|
||||||
$angel_types
|
$angel_types
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
form_submit('preview', _("Preview"))
|
form_submit('preview', _('Preview'))
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function admin_user_title()
|
function admin_user_title()
|
||||||
{
|
{
|
||||||
return _("All Angels");
|
return _('All Angels');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,75 +29,80 @@ function admin_user()
|
||||||
redirect(users_link());
|
redirect(users_link());
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= "Hallo,<br />" . "hier kannst du den Eintrag ändern. Unter dem Punkt 'Gekommen' " . "wird der Engel als anwesend markiert, ein Ja bei Aktiv bedeutet, " . "dass der Engel aktiv war und damit ein Anspruch auf ein T-Shirt hat. " . "Wenn T-Shirt ein 'Ja' enthält, bedeutet dies, dass der Engel " . "bereits sein T-Shirt erhalten hat.<br /><br />\n";
|
$html .= 'Hallo,<br />'
|
||||||
|
. 'hier kannst du den Eintrag ändern. Unter dem Punkt \'Gekommen\' '
|
||||||
|
. 'wird der Engel als anwesend markiert, ein Ja bei Aktiv bedeutet, '
|
||||||
|
. 'dass der Engel aktiv war und damit ein Anspruch auf ein T-Shirt hat. '
|
||||||
|
. 'Wenn T-Shirt ein \'Ja\' enthält, bedeutet dies, dass der Engel '
|
||||||
|
. 'bereits sein T-Shirt erhalten hat.<br /><br />' . "\n";
|
||||||
|
|
||||||
$html .= "<form action=\"" . page_link_to("admin_user") . "&action=save&id=$user_id\" method=\"post\">\n";
|
$html .= '<form action="' . page_link_to('admin_user') . '&action=save&id=$user_id" method="post">' . "\n";
|
||||||
$html .= "<table border=\"0\">\n";
|
$html .= '<table border="0">' . "\n";
|
||||||
$html .= "<input type=\"hidden\" name=\"Type\" value=\"Normal\">\n";
|
$html .= '<input type="hidden" name="Type" value="Normal">' . "\n";
|
||||||
$html .= "<tr><td>\n";
|
$html .= '<tr><td>' . "\n";
|
||||||
$html .= "<table>\n";
|
$html .= '<table>' . "\n";
|
||||||
$html .= " <tr><td>Nick</td><td>" . "<input type=\"text\" size=\"40\" name=\"eNick\" value=\"" . $user_source['Nick'] . "\"></td></tr>\n";
|
$html .= ' <tr><td>Nick</td><td>' . '<input type="text" size="40" name="eNick" value="' . $user_source['Nick'] . '"></td></tr>' . "\n";
|
||||||
$html .= " <tr><td>lastLogIn</td><td>" . date("Y-m-d H:i", $user_source['lastLogIn']) . "</td></tr>\n";
|
$html .= ' <tr><td>lastLogIn</td><td>' . date('Y-m-d H:i', $user_source['lastLogIn']) . '</td></tr>' . "\n";
|
||||||
$html .= " <tr><td>Name</td><td>" . "<input type=\"text\" size=\"40\" name=\"eName\" value=\"" . $user_source['Name'] . "\"></td></tr>\n";
|
$html .= ' <tr><td>Name</td><td>' . '<input type="text" size="40" name="eName" value="' . $user_source['Name'] . '"></td></tr>' . "\n";
|
||||||
$html .= " <tr><td>Vorname</td><td>" . "<input type=\"text\" size=\"40\" name=\"eVorname\" value=\"" . $user_source['Vorname'] . "\"></td></tr>\n";
|
$html .= ' <tr><td>Vorname</td><td>' . '<input type="text" size="40" name="eVorname" value="' . $user_source['Vorname'] . '"></td></tr>' . "\n";
|
||||||
$html .= " <tr><td>Alter</td><td>" . "<input type=\"text\" size=\"5\" name=\"eAlter\" value=\"" . $user_source['Alter'] . "\"></td></tr>\n";
|
$html .= ' <tr><td>Alter</td><td>' . '<input type="text" size="5" name="eAlter" value="' . $user_source['Alter'] . '"></td></tr>' . "\n";
|
||||||
$html .= " <tr><td>Telefon</td><td>" . "<input type=\"text\" size=\"40\" name=\"eTelefon\" value=\"" . $user_source['Telefon'] . "\"></td></tr>\n";
|
$html .= ' <tr><td>Telefon</td><td>' . '<input type="text" size="40" name="eTelefon" value="' . $user_source['Telefon'] . '"></td></tr>' . "\n";
|
||||||
$html .= " <tr><td>Handy</td><td>" . "<input type=\"text\" size=\"40\" name=\"eHandy\" value=\"" . $user_source['Handy'] . "\"></td></tr>\n";
|
$html .= ' <tr><td>Handy</td><td>' . '<input type="text" size="40" name="eHandy" value="' . $user_source['Handy'] . '"></td></tr>' . "\n";
|
||||||
$html .= " <tr><td>DECT</td><td>" . "<input type=\"text\" size=\"4\" name=\"eDECT\" value=\"" . $user_source['DECT'] . "\"></td></tr>\n";
|
$html .= ' <tr><td>DECT</td><td>' . '<input type="text" size="4" name="eDECT" value="' . $user_source['DECT'] . '"></td></tr>' . "\n";
|
||||||
if ($user_source['email_by_human_allowed']) {
|
if ($user_source['email_by_human_allowed']) {
|
||||||
$html .= " <tr><td>email</td><td>" . "<input type=\"text\" size=\"40\" name=\"eemail\" value=\"" . $user_source['email'] . "\"></td></tr>\n";
|
$html .= " <tr><td>email</td><td>" . '<input type="text" size="40" name="eemail" value="' . $user_source['email'] . '"></td></tr>' . "\n";
|
||||||
}
|
}
|
||||||
$html .= " <tr><td>jabber</td><td>" . "<input type=\"text\" size=\"40\" name=\"ejabber\" value=\"" . $user_source['jabber'] . "\"></td></tr>\n";
|
$html .= " <tr><td>jabber</td><td>" . '<input type="text" size="40" name="ejabber" value="' . $user_source['jabber'] . '"></td></tr>' . "\n";
|
||||||
$html .= " <tr><td>Size</td><td>"
|
$html .= ' <tr><td>Size</td><td>'
|
||||||
. html_select_key('size', 'eSize', $tshirt_sizes, $user_source['Size'])
|
. html_select_key('size', 'eSize', $tshirt_sizes, $user_source['Size']) . '</td></tr>' . "\n";
|
||||||
. "</td></tr>\n";
|
|
||||||
|
|
||||||
$options = [
|
$options = [
|
||||||
'1' => _("Yes"),
|
'1' => _('Yes'),
|
||||||
'0' => _("No")
|
'0' => _('No')
|
||||||
];
|
];
|
||||||
|
|
||||||
// Gekommen?
|
// Gekommen?
|
||||||
$html .= " <tr><td>Gekommen</td><td>\n";
|
$html .= ' <tr><td>Gekommen</td><td>' . "\n";
|
||||||
$html .= html_options('eGekommen', $options, $user_source['Gekommen']) . "</td></tr>\n";
|
$html .= html_options('eGekommen', $options, $user_source['Gekommen']) . '</td></tr>' . "\n";
|
||||||
|
|
||||||
// Aktiv?
|
// Aktiv?
|
||||||
$html .= " <tr><td>Aktiv</td><td>\n";
|
$html .= ' <tr><td>Aktiv</td><td>' . "\n";
|
||||||
$html .= html_options('eAktiv', $options, $user_source['Aktiv']) . "</td></tr>\n";
|
$html .= html_options('eAktiv', $options, $user_source['Aktiv']) . '</td></tr>' . "\n";
|
||||||
|
|
||||||
// Aktiv erzwingen
|
// Aktiv erzwingen
|
||||||
if (in_array('admin_active', $privileges)) {
|
if (in_array('admin_active', $privileges)) {
|
||||||
$html .= " <tr><td>" . _("Force active") . "</td><td>\n";
|
$html .= ' <tr><td>' . _('Force active') . '</td><td>' . "\n";
|
||||||
$html .= html_options('force_active', $options, $user_source['force_active']) . "</td></tr>\n";
|
$html .= html_options('force_active', $options, $user_source['force_active']) . '</td></tr>' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// T-Shirt bekommen?
|
// T-Shirt bekommen?
|
||||||
$html .= " <tr><td>T-Shirt</td><td>\n";
|
$html .= ' <tr><td>T-Shirt</td><td>' . "\n";
|
||||||
$html .= html_options('eTshirt', $options, $user_source['Tshirt']) . "</td></tr>\n";
|
$html .= html_options('eTshirt', $options, $user_source['Tshirt']) . '</td></tr>' . "\n";
|
||||||
|
|
||||||
$html .= " <tr><td>Hometown</td><td>" . "<input type=\"text\" size=\"40\" name=\"Hometown\" value=\"" . $user_source['Hometown'] . "\"></td></tr>\n";
|
$html .= ' <tr><td>Hometown</td><td>' . '<input type="text" size="40" name="Hometown" value="' . $user_source['Hometown'] . '"></td></tr>' . "\n";
|
||||||
|
|
||||||
$html .= "</table>\n</td><td valign=\"top\"></td></tr>";
|
$html .= '</table>' . "\n" . '</td><td valign="top"></td></tr>';
|
||||||
|
|
||||||
$html .= "</td></tr>\n";
|
$html .= '</td></tr>' . "\n";
|
||||||
$html .= "</table>\n<br />\n";
|
$html .= '</table>' . "\n" . '<br />' . "\n";
|
||||||
$html .= "<input type=\"submit\" value=\"Speichern\">\n";
|
$html .= '<input type="submit" value="Speichern">';
|
||||||
$html .= "</form>";
|
$html .= '</form>';
|
||||||
|
|
||||||
$html .= "<hr />";
|
$html .= '<hr />';
|
||||||
|
|
||||||
$html .= form_info('', _('Please visit the angeltypes page or the users profile to manage users angeltypes.'));
|
$html .= form_info('', _('Please visit the angeltypes page or the users profile to manage users angeltypes.'));
|
||||||
|
|
||||||
$html .= "Hier kannst Du das Passwort dieses Engels neu setzen:<form action=\"" . page_link_to("admin_user") . "&action=change_pw&id=$user_id\" method=\"post\">\n";
|
$html .= 'Hier kannst Du das Passwort dieses Engels neu setzen:<form action="'
|
||||||
$html .= "<table>\n";
|
. page_link_to('admin_user') . '&action=change_pw&id=' . $user_id . '" method="post">' . "\n";
|
||||||
$html .= " <tr><td>Passwort</td><td>" . "<input type=\"password\" size=\"40\" name=\"new_pw\" value=\"\"></td></tr>\n";
|
$html .= '<table>' . "\n";
|
||||||
$html .= " <tr><td>Wiederholung</td><td>" . "<input type=\"password\" size=\"40\" name=\"new_pw2\" value=\"\"></td></tr>\n";
|
$html .= ' <tr><td>Passwort</td><td>' . '<input type="password" size="40" name="new_pw" value=""></td></tr>' . "\n";
|
||||||
|
$html .= ' <tr><td>Wiederholung</td><td>' . '<input type="password" size="40" name="new_pw2" value=""></td></tr>' . "\n";
|
||||||
|
|
||||||
$html .= "</table>";
|
$html .= '</table>';
|
||||||
$html .= "<input type=\"submit\" value=\"Speichern\">\n";
|
$html .= '<input type="submit" value="Speichern">' . "\n";
|
||||||
$html .= "</form>";
|
$html .= '</form>';
|
||||||
|
|
||||||
$html .= "<hr />";
|
$html .= '<hr />';
|
||||||
|
|
||||||
$my_highest_group = sql_select("SELECT * FROM `UserGroups` WHERE `uid`='" . sql_escape($user['UID']) . "' ORDER BY `group_id` LIMIT 1");
|
$my_highest_group = sql_select("SELECT * FROM `UserGroups` WHERE `uid`='" . sql_escape($user['UID']) . "' ORDER BY `group_id` LIMIT 1");
|
||||||
if (count($my_highest_group) > 0) {
|
if (count($my_highest_group) > 0) {
|
||||||
|
@ -110,24 +115,36 @@ function admin_user()
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_id != $user['UID'] && $my_highest_group <= $his_highest_group) {
|
if ($user_id != $user['UID'] && $my_highest_group <= $his_highest_group) {
|
||||||
$html .= "Hier kannst Du die Benutzergruppen des Engels festlegen:<form action=\"" . page_link_to("admin_user") . "&action=save_groups&id=" . $user_id . "\" method=\"post\">\n";
|
$html .= 'Hier kannst Du die Benutzergruppen des Engels festlegen:<form action="'
|
||||||
|
. page_link_to('admin_user') . '&action=save_groups&id=' . $user_id . '" method="post">' . "\n";
|
||||||
$html .= '<table>';
|
$html .= '<table>';
|
||||||
|
|
||||||
$groups = sql_select("SELECT * FROM `Groups` LEFT OUTER JOIN `UserGroups` ON (`UserGroups`.`group_id` = `Groups`.`UID` AND `UserGroups`.`uid` = '" . sql_escape($user_id) . "') WHERE `Groups`.`UID` >= '" . sql_escape($my_highest_group) . "' ORDER BY `Groups`.`Name`");
|
$groups = sql_select("
|
||||||
|
SELECT *
|
||||||
|
FROM `Groups`
|
||||||
|
LEFT OUTER JOIN `UserGroups` ON (
|
||||||
|
`UserGroups`.`group_id` = `Groups`.`UID`
|
||||||
|
AND `UserGroups`.`uid` = '" . sql_escape($user_id) . "'
|
||||||
|
)
|
||||||
|
WHERE `Groups`.`UID` >= '" . sql_escape($my_highest_group) . "'
|
||||||
|
ORDER BY `Groups`.`Name`
|
||||||
|
");
|
||||||
foreach ($groups as $group) {
|
foreach ($groups as $group) {
|
||||||
$html .= '<tr><td><input type="checkbox" name="groups[]" value="' . $group['UID'] . '" ' . ($group['group_id'] != "" ? ' checked="checked"' : '') . ' /></td><td>' . $group['Name'] . '</td></tr>';
|
$html .= '<tr><td><input type="checkbox" name="groups[]" value="' . $group['UID'] . '" '
|
||||||
|
. ($group['group_id'] != '' ? ' checked="checked"' : '')
|
||||||
|
. ' /></td><td>' . $group['Name'] . '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= '</table>';
|
$html .= '</table>';
|
||||||
|
|
||||||
$html .= "<input type=\"submit\" value=\"Speichern\">\n";
|
$html .= '<input type="submit" value="Speichern">' . "\n";
|
||||||
$html .= "</form>";
|
$html .= '</form>';
|
||||||
|
|
||||||
$html .= "<hr />";
|
$html .= '<hr />';
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= buttons([
|
$html .= buttons([
|
||||||
button(user_delete_link($user_source), glyph('lock') . _("delete"), 'btn-danger')
|
button(user_delete_link($user_source), glyph('lock') . _('delete'), 'btn-danger')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$html .= "<hr />";
|
$html .= "<hr />";
|
||||||
|
@ -139,7 +156,16 @@ function admin_user()
|
||||||
$his_highest_group = sql_select("SELECT * FROM `UserGroups` WHERE `uid`='" . sql_escape($user_id) . "' ORDER BY `group_id`");
|
$his_highest_group = sql_select("SELECT * FROM `UserGroups` WHERE `uid`='" . sql_escape($user_id) . "' ORDER BY `group_id`");
|
||||||
|
|
||||||
if (count($my_highest_group) > 0 && (count($his_highest_group) == 0 || ($my_highest_group[0]['group_id'] <= $his_highest_group[0]['group_id']))) {
|
if (count($my_highest_group) > 0 && (count($his_highest_group) == 0 || ($my_highest_group[0]['group_id'] <= $his_highest_group[0]['group_id']))) {
|
||||||
$groups_source = sql_select("SELECT * FROM `Groups` LEFT OUTER JOIN `UserGroups` ON (`UserGroups`.`group_id` = `Groups`.`UID` AND `UserGroups`.`uid` = '" . sql_escape($user_id) . "') WHERE `Groups`.`UID` >= '" . sql_escape($my_highest_group[0]['group_id']) . "' ORDER BY `Groups`.`Name`");
|
$groups_source = sql_select("
|
||||||
|
SELECT *
|
||||||
|
FROM `Groups`
|
||||||
|
LEFT OUTER JOIN `UserGroups` ON (
|
||||||
|
`UserGroups`.`group_id` = `Groups`.`UID`
|
||||||
|
AND `UserGroups`.`uid` = '" . sql_escape($user_id) . "'
|
||||||
|
)
|
||||||
|
WHERE `Groups`.`UID` >= '" . sql_escape($my_highest_group[0]['group_id']) . "'
|
||||||
|
ORDER BY `Groups`.`Name`
|
||||||
|
");
|
||||||
$groups = [];
|
$groups = [];
|
||||||
$grouplist = [];
|
$grouplist = [];
|
||||||
foreach ($groups_source as $group) {
|
foreach ($groups_source as $group) {
|
||||||
|
@ -160,14 +186,15 @@ function admin_user()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$user_source = User($user_id);
|
$user_source = User($user_id);
|
||||||
engelsystem_log("Set groups of " . User_Nick_render($user_source) . " to: " . join(", ",
|
engelsystem_log(
|
||||||
$user_groups_info));
|
'Set groups of ' . User_Nick_render($user_source) . ' to: ' . join(', ', $user_groups_info)
|
||||||
$html .= success("Benutzergruppen gespeichert.", true);
|
);
|
||||||
|
$html .= success('Benutzergruppen gespeichert.', true);
|
||||||
} else {
|
} else {
|
||||||
$html .= error("Du kannst keine Engel mit mehr Rechten bearbeiten.", true);
|
$html .= error('Du kannst keine Engel mit mehr Rechten bearbeiten.', true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$html .= error("Du kannst Deine eigenen Rechte nicht bearbeiten.", true);
|
$html .= error('Du kannst Deine eigenen Rechte nicht bearbeiten.', true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -196,24 +223,29 @@ function admin_user()
|
||||||
WHERE `UID` = '" . sql_escape($user_id) . "'
|
WHERE `UID` = '" . sql_escape($user_id) . "'
|
||||||
LIMIT 1";
|
LIMIT 1";
|
||||||
sql_query($SQL);
|
sql_query($SQL);
|
||||||
engelsystem_log("Updated user: " . $_POST["eNick"] . ", " . $_POST["eSize"] . ", arrived: " . $_POST["eGekommen"] . ", active: " . $_POST["eAktiv"] . ", tshirt: " . $_POST["eTshirt"]);
|
engelsystem_log(
|
||||||
$html .= success("Änderung wurde gespeichert...\n", true);
|
'Updated user: ' . $_POST['eNick'] . ', ' . $_POST['eSize']
|
||||||
|
. ', arrived: ' . $_POST['eGekommen']
|
||||||
|
. ', active: ' . $_POST['eAktiv']
|
||||||
|
. ', tshirt: ' . $_POST['eTshirt']
|
||||||
|
);
|
||||||
|
$html .= success('Änderung wurde gespeichert...' . '\n', true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'change_pw':
|
case 'change_pw':
|
||||||
if ($_REQUEST['new_pw'] != "" && $_REQUEST['new_pw'] == $_REQUEST['new_pw2']) {
|
if ($_REQUEST['new_pw'] != '' && $_REQUEST['new_pw'] == $_REQUEST['new_pw2']) {
|
||||||
set_password($user_id, $_REQUEST['new_pw']);
|
set_password($user_id, $_REQUEST['new_pw']);
|
||||||
$user_source = User($user_id);
|
$user_source = User($user_id);
|
||||||
engelsystem_log("Set new password for " . User_Nick_render($user_source));
|
engelsystem_log('Set new password for ' . User_Nick_render($user_source));
|
||||||
$html .= success("Passwort neu gesetzt.", true);
|
$html .= success('Passwort neu gesetzt.', true);
|
||||||
} else {
|
} else {
|
||||||
$html .= error("Die Eingaben müssen übereinstimmen und dürfen nicht leer sein!", true);
|
$html .= error('Die Eingaben müssen übereinstimmen und dürfen nicht leer sein!', true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return page_with_title(_("Edit user"), [
|
return page_with_title(_('Edit user'), [
|
||||||
$html
|
$html
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function credits_title()
|
function credits_title()
|
||||||
{
|
{
|
||||||
return _("Credits");
|
return _('Credits');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function login_title()
|
function login_title()
|
||||||
{
|
{
|
||||||
return _("Login");
|
return _('Login');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,7 +13,7 @@ function login_title()
|
||||||
*/
|
*/
|
||||||
function register_title()
|
function register_title()
|
||||||
{
|
{
|
||||||
return _("Register");
|
return _('Register');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,7 +21,7 @@ function register_title()
|
||||||
*/
|
*/
|
||||||
function logout_title()
|
function logout_title()
|
||||||
{
|
{
|
||||||
return _("Logout");
|
return _('Logout');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,29 +35,29 @@ function guest_register()
|
||||||
|
|
||||||
$event_config = EventConfig();
|
$event_config = EventConfig();
|
||||||
|
|
||||||
$msg = "";
|
$msg = '';
|
||||||
$nick = "";
|
$nick = '';
|
||||||
$lastname = "";
|
$lastname = '';
|
||||||
$prename = "";
|
$prename = '';
|
||||||
$age = "";
|
$age = '';
|
||||||
$tel = "";
|
$tel = '';
|
||||||
$dect = "";
|
$dect = '';
|
||||||
$mobile = "";
|
$mobile = '';
|
||||||
$mail = "";
|
$mail = '';
|
||||||
$email_shiftinfo = false;
|
$email_shiftinfo = false;
|
||||||
$email_by_human_allowed = false;
|
$email_by_human_allowed = false;
|
||||||
$jabber = "";
|
$jabber = '';
|
||||||
$hometown = "";
|
$hometown = '';
|
||||||
$comment = "";
|
$comment = '';
|
||||||
$tshirt_size = '';
|
$tshirt_size = '';
|
||||||
$password_hash = "";
|
$password_hash = '';
|
||||||
$selected_angel_types = [];
|
$selected_angel_types = [];
|
||||||
$planned_arrival_date = null;
|
$planned_arrival_date = null;
|
||||||
|
|
||||||
$angel_types_source = AngelTypes();
|
$angel_types_source = AngelTypes();
|
||||||
$angel_types = [];
|
$angel_types = [];
|
||||||
foreach ($angel_types_source as $angel_type) {
|
foreach ($angel_types_source as $angel_type) {
|
||||||
$angel_types[$angel_type['id']] = $angel_type['name'] . ($angel_type['restricted'] ? " (restricted)" : "");
|
$angel_types[$angel_type['id']] = $angel_type['name'] . ($angel_type['restricted'] ? ' (restricted)' : '');
|
||||||
if (!$angel_type['restricted']) {
|
if (!$angel_type['restricted']) {
|
||||||
$selected_angel_types[] = $angel_type['id'];
|
$selected_angel_types[] = $angel_type['id'];
|
||||||
}
|
}
|
||||||
|
@ -70,12 +70,12 @@ function guest_register()
|
||||||
$nick = User_validate_Nick($_REQUEST['nick']);
|
$nick = User_validate_Nick($_REQUEST['nick']);
|
||||||
if (sql_num_query("SELECT * FROM `User` WHERE `Nick`='" . sql_escape($nick) . "' LIMIT 1") > 0) {
|
if (sql_num_query("SELECT * FROM `User` WHERE `Nick`='" . sql_escape($nick) . "' LIMIT 1") > 0) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(sprintf(_("Your nick "%s" already exists."), $nick), true);
|
$msg .= error(sprintf(_('Your nick "%s" already exists.'), $nick), true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(sprintf(
|
$msg .= error(sprintf(
|
||||||
_("Your nick "%s" is too short (min. 2 characters)."),
|
_('Your nick "%s" is too short (min. 2 characters).'),
|
||||||
User_validate_Nick($_REQUEST['nick'])
|
User_validate_Nick($_REQUEST['nick'])
|
||||||
), true);
|
), true);
|
||||||
}
|
}
|
||||||
|
@ -84,11 +84,11 @@ function guest_register()
|
||||||
$mail = strip_request_item('mail');
|
$mail = strip_request_item('mail');
|
||||||
if (!check_email($mail)) {
|
if (!check_email($mail)) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(_("E-mail address is not correct."), true);
|
$msg .= error(_('E-mail address is not correct.'), true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(_("Please enter your e-mail."), true);
|
$msg .= error(_('Please enter your e-mail.'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['email_shiftinfo'])) {
|
if (isset($_REQUEST['email_shiftinfo'])) {
|
||||||
|
@ -103,7 +103,7 @@ function guest_register()
|
||||||
$jabber = strip_request_item('jabber');
|
$jabber = strip_request_item('jabber');
|
||||||
if (!check_email($jabber)) {
|
if (!check_email($jabber)) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(_("Please check your jabber account information."), true);
|
$msg .= error(_('Please check your jabber account information.'), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,30 +112,30 @@ function guest_register()
|
||||||
$tshirt_size = $_REQUEST['tshirt_size'];
|
$tshirt_size = $_REQUEST['tshirt_size'];
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(_("Please select your shirt size."), true);
|
$msg .= error(_('Please select your shirt size.'), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['password']) && strlen($_REQUEST['password']) >= $min_password_length) {
|
if (isset($_REQUEST['password']) && strlen($_REQUEST['password']) >= $min_password_length) {
|
||||||
if ($_REQUEST['password'] != $_REQUEST['password2']) {
|
if ($_REQUEST['password'] != $_REQUEST['password2']) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(_("Your passwords don't match."), true);
|
$msg .= error(_('Your passwords don\'t match.'), true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(sprintf(
|
$msg .= error(sprintf(
|
||||||
_("Your password is too short (please use at least %s characters)."),
|
_('Your password is too short (please use at least %s characters).'),
|
||||||
$min_password_length
|
$min_password_length
|
||||||
), true);
|
), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['planned_arrival_date'])) {
|
if (isset($_REQUEST['planned_arrival_date'])) {
|
||||||
$tmp = parse_date("Y-m-d H:i", $_REQUEST['planned_arrival_date'] . " 00:00");
|
$tmp = parse_date('Y-m-d H:i', $_REQUEST['planned_arrival_date'] . ' 00:00');
|
||||||
$result = User_validate_planned_arrival_date($tmp);
|
$result = User_validate_planned_arrival_date($tmp);
|
||||||
$planned_arrival_date = $result->getValue();
|
$planned_arrival_date = $result->getValue();
|
||||||
if (!$result->isValid()) {
|
if (!$result->isValid()) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Please enter your planned date of arrival. It should be after the buildup start date and before teardown end date."));
|
error(_('Please enter your planned date of arrival. It should be after the buildup start date and before teardown end date.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,10 +209,10 @@ function guest_register()
|
||||||
}
|
}
|
||||||
|
|
||||||
engelsystem_log(
|
engelsystem_log(
|
||||||
"User " . User_Nick_render(User($user_id))
|
'User ' . User_Nick_render(User($user_id))
|
||||||
. " signed up as: " . join(", ", $user_angel_types_info)
|
. ' signed up as: ' . join(', ', $user_angel_types_info)
|
||||||
);
|
);
|
||||||
success(_("Angel registration successful!"));
|
success(_('Angel registration successful!'));
|
||||||
|
|
||||||
// User is already logged in - that means a supporter 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)) {
|
||||||
|
@ -240,7 +240,7 @@ function guest_register()
|
||||||
}
|
}
|
||||||
|
|
||||||
return page_with_title(register_title(), [
|
return page_with_title(register_title(), [
|
||||||
_("By completing this form you're registering as a Chaos-Angel. This script will create you an account in the angel task scheduler."),
|
_('By completing this form you\'re registering as a Chaos-Angel. This script will create you an account in the angel task scheduler.'),
|
||||||
$msg,
|
$msg,
|
||||||
msg(),
|
msg(),
|
||||||
form([
|
form([
|
||||||
|
@ -248,18 +248,18 @@ function guest_register()
|
||||||
div('col-md-6', [
|
div('col-md-6', [
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-sm-4', [
|
div('col-sm-4', [
|
||||||
form_text('nick', _("Nick") . ' ' . entry_required(), $nick)
|
form_text('nick', _('Nick') . ' ' . entry_required(), $nick)
|
||||||
]),
|
]),
|
||||||
div('col-sm-8', [
|
div('col-sm-8', [
|
||||||
form_email('mail', _("E-Mail") . ' ' . entry_required(), $mail),
|
form_email('mail', _('E-Mail') . ' ' . entry_required(), $mail),
|
||||||
form_checkbox(
|
form_checkbox(
|
||||||
'email_shiftinfo',
|
'email_shiftinfo',
|
||||||
_("The engelsystem is allowed to send me an email (e.g. when my shifts change)"),
|
_('The engelsystem is allowed to send me an email (e.g. when my shifts change)'),
|
||||||
$email_shiftinfo
|
$email_shiftinfo
|
||||||
),
|
),
|
||||||
form_checkbox(
|
form_checkbox(
|
||||||
'email_by_human_allowed',
|
'email_by_human_allowed',
|
||||||
_("Humans are allowed to send me an email (e.g. for ticket vouchers)"),
|
_('Humans are allowed to send me an email (e.g. for ticket vouchers)'),
|
||||||
$email_by_human_allowed
|
$email_by_human_allowed
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
@ -268,22 +268,22 @@ function guest_register()
|
||||||
div('col-sm-6', [
|
div('col-sm-6', [
|
||||||
form_date(
|
form_date(
|
||||||
'planned_arrival_date',
|
'planned_arrival_date',
|
||||||
_("Planned date of arrival") . ' ' . entry_required(),
|
_('Planned date of arrival') . ' ' . entry_required(),
|
||||||
$planned_arrival_date, $buildup_start_date, $teardown_end_date
|
$planned_arrival_date, $buildup_start_date, $teardown_end_date
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
div('col-sm-6', [
|
div('col-sm-6', [
|
||||||
$enable_tshirt_size ? form_select('tshirt_size',
|
$enable_tshirt_size ? form_select('tshirt_size',
|
||||||
_("Shirt size") . ' ' . entry_required(),
|
_('Shirt size') . ' ' . entry_required(),
|
||||||
$tshirt_sizes, $tshirt_size) : ''
|
$tshirt_sizes, $tshirt_size) : ''
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-sm-6', [
|
div('col-sm-6', [
|
||||||
form_password('password', _("Password") . ' ' . entry_required())
|
form_password('password', _('Password') . ' ' . entry_required())
|
||||||
]),
|
]),
|
||||||
div('col-sm-6', [
|
div('col-sm-6', [
|
||||||
form_password('password2', _("Confirm password") . ' ' . entry_required())
|
form_password('password2', _('Confirm password') . ' ' . entry_required())
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
form_checkboxes(
|
form_checkboxes(
|
||||||
|
@ -291,50 +291,50 @@ function guest_register()
|
||||||
_("What do you want to do?") . sprintf(
|
_("What do you want to do?") . sprintf(
|
||||||
" (<a href=\"%s\">%s</a>)",
|
" (<a href=\"%s\">%s</a>)",
|
||||||
page_link_to('angeltypes') . '&action=about',
|
page_link_to('angeltypes') . '&action=about',
|
||||||
_("Description of job types")
|
_('Description of job types')
|
||||||
),
|
),
|
||||||
$angel_types,
|
$angel_types,
|
||||||
$selected_angel_types
|
$selected_angel_types
|
||||||
),
|
),
|
||||||
form_info(
|
form_info(
|
||||||
"",
|
'',
|
||||||
_("Restricted angel types need will be confirmed later by a supporter. You can change your selection in the options section.")
|
_('Restricted angel types need will be confirmed later by a supporter. You can change your selection in the options section.')
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
div('col-md-6', [
|
div('col-md-6', [
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-sm-4', [
|
div('col-sm-4', [
|
||||||
form_text('dect', _("DECT"), $dect)
|
form_text('dect', _('DECT'), $dect)
|
||||||
]),
|
]),
|
||||||
div('col-sm-4', [
|
div('col-sm-4', [
|
||||||
form_text('mobile', _("Mobile"), $mobile)
|
form_text('mobile', _('Mobile'), $mobile)
|
||||||
]),
|
]),
|
||||||
div('col-sm-4', [
|
div('col-sm-4', [
|
||||||
form_text('tel', _("Phone"), $tel)
|
form_text('tel', _('Phone'), $tel)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
form_text('jabber', _("Jabber"), $jabber),
|
form_text('jabber', _('Jabber'), $jabber),
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-sm-6', [
|
div('col-sm-6', [
|
||||||
form_text('prename', _("First name"), $prename)
|
form_text('prename', _('First name'), $prename)
|
||||||
]),
|
]),
|
||||||
div('col-sm-6', [
|
div('col-sm-6', [
|
||||||
form_text('lastname', _("Last name"), $lastname)
|
form_text('lastname', _('Last name'), $lastname)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-sm-3', [
|
div('col-sm-3', [
|
||||||
form_text('age', _("Age"), $age)
|
form_text('age', _('Age'), $age)
|
||||||
]),
|
]),
|
||||||
div('col-sm-9', [
|
div('col-sm-9', [
|
||||||
form_text('hometown', _("Hometown"), $hometown)
|
form_text('hometown', _('Hometown'), $hometown)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
form_info(entry_required() . ' = ' . _("Entry required!"))
|
form_info(entry_required() . ' = ' . _('Entry required!'))
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
// form_textarea('comment', _("Did you help at former CCC events and which tasks have you performed then?"), $comment),
|
// form_textarea('comment', _('Did you help at former CCC events and which tasks have you performed then?'), $comment),
|
||||||
form_submit('submit', _("Register"))
|
form_submit('submit', _('Register'))
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -347,13 +347,13 @@ function entry_required()
|
||||||
function guest_logout()
|
function guest_logout()
|
||||||
{
|
{
|
||||||
session_destroy();
|
session_destroy();
|
||||||
redirect(page_link_to("start"));
|
redirect(page_link_to('start'));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function guest_login()
|
function guest_login()
|
||||||
{
|
{
|
||||||
$nick = "";
|
$nick = '';
|
||||||
|
|
||||||
unset($_SESSION['uid']);
|
unset($_SESSION['uid']);
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
@ -367,19 +367,19 @@ function guest_login()
|
||||||
if (isset($_REQUEST['password'])) {
|
if (isset($_REQUEST['password'])) {
|
||||||
if (!verify_password($_REQUEST['password'], $login_user['Passwort'], $login_user['UID'])) {
|
if (!verify_password($_REQUEST['password'], $login_user['Passwort'], $login_user['UID'])) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Your password is incorrect. Please try it again."));
|
error(_('Your password is incorrect. Please try it again.'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Please enter a password."));
|
error(_('Please enter a password.'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("No user was found with that Nickname. Please try again. If you are still having problems, ask a Dispatcher."));
|
error(_('No user was found with that Nickname. Please try again. If you are still having problems, ask a Dispatcher.'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Please enter a nickname."));
|
error(_('Please enter a nickname.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($valid && !empty($login_user)) {
|
if ($valid && !empty($login_user)) {
|
||||||
|
@ -401,21 +401,21 @@ function guest_login()
|
||||||
div('col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4', [
|
div('col-sm-6 col-sm-offset-3 col-md-4 col-md-offset-4', [
|
||||||
div('panel panel-primary first', [
|
div('panel panel-primary first', [
|
||||||
div('panel-heading', [
|
div('panel-heading', [
|
||||||
'<span class="icon-icon_angel"></span> ' . _("Login")
|
'<span class="icon-icon_angel"></span> ' . _('Login')
|
||||||
]),
|
]),
|
||||||
div('panel-body', [
|
div('panel-body', [
|
||||||
msg(),
|
msg(),
|
||||||
form([
|
form([
|
||||||
form_text_placeholder('nick', _("Nick"), $nick),
|
form_text_placeholder('nick', _('Nick'), $nick),
|
||||||
form_password_placeholder('password', _("Password")),
|
form_password_placeholder('password', _('Password')),
|
||||||
form_submit('submit', _("Login")),
|
form_submit('submit', _('Login')),
|
||||||
!$valid ? buttons([
|
!$valid ? buttons([
|
||||||
button(page_link_to('user_password_recovery'), _("I forgot my password"))
|
button(page_link_to('user_password_recovery'), _('I forgot my password'))
|
||||||
]) : ''
|
]) : ''
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
div('panel-footer', [
|
div('panel-footer', [
|
||||||
glyph('info-sign') . _("Please note: You have to activate cookies!")
|
glyph('info-sign') . _('Please note: You have to activate cookies!')
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
@ -426,10 +426,10 @@ function guest_login()
|
||||||
get_register_hint()
|
get_register_hint()
|
||||||
]),
|
]),
|
||||||
div('col-sm-6 text-center', [
|
div('col-sm-6 text-center', [
|
||||||
heading(_("What can I do?"), 2),
|
heading(_('What can I do?'), 2),
|
||||||
'<p>' . _("Please read about the jobs you can do to help us.") . '</p>',
|
'<p>' . _('Please read about the jobs you can do to help us.') . '</p>',
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description") . ' »')
|
button(page_link_to('angeltypes') . '&action=about', _('Teams/Job description') . ' »')
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
@ -443,13 +443,13 @@ function get_register_hint()
|
||||||
|
|
||||||
if (in_array('register', $privileges)) {
|
if (in_array('register', $privileges)) {
|
||||||
return join('', [
|
return join('', [
|
||||||
'<p>' . _("Please sign up, if you want to help us!") . '</p>',
|
'<p>' . _('Please sign up, if you want to help us!') . '</p>',
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('register'), register_title() . ' »')
|
button(page_link_to('register'), register_title() . ' »')
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME: return error(_("Registration is disabled."), true);
|
//FIXME: return error(_('Registration is disabled.'), true);
|
||||||
return error("Registration is <a href='https://engelsystem.de/33c3/overwhelmed.html'>disabled</a>.", true);
|
return error('Registration is <a href="https://engelsystem.de/33c3/overwhelmed.html">disabled</a>.', true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,27 +8,37 @@ function guest_stats()
|
||||||
if ($_REQUEST['api_key'] == $api_key) {
|
if ($_REQUEST['api_key'] == $api_key) {
|
||||||
$stats = [];
|
$stats = [];
|
||||||
|
|
||||||
list($user_count) = sql_select("SELECT count(*) AS `user_count` FROM `User`");
|
list($user_count) = sql_select('SELECT count(*) AS `user_count` FROM `User`');
|
||||||
$stats['user_count'] = $user_count['user_count'];
|
$stats['user_count'] = $user_count['user_count'];
|
||||||
|
|
||||||
list($arrived_user_count) = sql_select("SELECT count(*) AS `user_count` FROM `User` WHERE `Gekommen`=1");
|
list($arrived_user_count) = sql_select('SELECT count(*) AS `user_count` FROM `User` WHERE `Gekommen`=1');
|
||||||
$stats['arrived_user_count'] = $arrived_user_count['user_count'];
|
$stats['arrived_user_count'] = $arrived_user_count['user_count'];
|
||||||
|
|
||||||
$done_shifts_seconds = sql_select_single_cell("SELECT SUM(`Shifts`.`end` - `Shifts`.`start`) FROM `ShiftEntry` JOIN `Shifts` USING (`SID`) WHERE `Shifts`.`end` < UNIX_TIMESTAMP()");
|
$done_shifts_seconds = sql_select_single_cell('
|
||||||
|
SELECT SUM(`Shifts`.`end` - `Shifts`.`start`)
|
||||||
|
FROM `ShiftEntry`
|
||||||
|
JOIN `Shifts` USING (`SID`)
|
||||||
|
WHERE `Shifts`.`end` < UNIX_TIMESTAMP()
|
||||||
|
');
|
||||||
$stats['done_work_hours'] = round($done_shifts_seconds / (60 * 60), 0);
|
$stats['done_work_hours'] = round($done_shifts_seconds / (60 * 60), 0);
|
||||||
|
|
||||||
$users_in_action = sql_select("SELECT `Shifts`.`start`, `Shifts`.`end` FROM `ShiftEntry` JOIN `Shifts` ON `Shifts`.`SID`=`ShiftEntry`.`SID` WHERE UNIX_TIMESTAMP() BETWEEN `Shifts`.`start` AND `Shifts`.`end`");
|
$users_in_action = sql_select('
|
||||||
|
SELECT `Shifts`.`start`, `Shifts`.`end`
|
||||||
|
FROM `ShiftEntry`
|
||||||
|
JOIN `Shifts` ON `Shifts`.`SID`=`ShiftEntry`.`SID`
|
||||||
|
WHERE UNIX_TIMESTAMP() BETWEEN `Shifts`.`start` AND `Shifts`.`end`
|
||||||
|
');
|
||||||
$stats['users_in_action'] = count($users_in_action);
|
$stats['users_in_action'] = count($users_in_action);
|
||||||
|
|
||||||
header("Content-Type: application/json");
|
header('Content-Type: application/json');
|
||||||
raw_output(json_encode($stats));
|
raw_output(json_encode($stats));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
raw_output(json_encode([
|
raw_output(json_encode([
|
||||||
'error' => "Wrong api_key."
|
'error' => 'Wrong api_key.'
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
raw_output(json_encode([
|
raw_output(json_encode([
|
||||||
'error' => "Missing parameter api_key."
|
'error' => 'Missing parameter api_key.'
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,17 +7,17 @@ function user_atom()
|
||||||
{
|
{
|
||||||
global $user, $display_news;
|
global $user, $display_news;
|
||||||
|
|
||||||
if (!isset($_REQUEST['key']) || !preg_match("/^[0-9a-f]{32}$/", $_REQUEST['key'])) {
|
if (!isset($_REQUEST['key']) || !preg_match('/^[0-9a-f]{32}$/', $_REQUEST['key'])) {
|
||||||
engelsystem_error("Missing key.");
|
engelsystem_error('Missing key.');
|
||||||
}
|
}
|
||||||
$key = $_REQUEST['key'];
|
$key = $_REQUEST['key'];
|
||||||
|
|
||||||
$user = User_by_api_key($key);
|
$user = User_by_api_key($key);
|
||||||
if ($user == null) {
|
if ($user == null) {
|
||||||
engelsystem_error("Key invalid.");
|
engelsystem_error('Key invalid.');
|
||||||
}
|
}
|
||||||
if (!in_array('atom', privileges_for_user($user['UID']))) {
|
if (!in_array('atom', privileges_for_user($user['UID']))) {
|
||||||
engelsystem_error("No privilege for atom.");
|
engelsystem_error('No privilege for atom.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$news = sql_select("
|
$news = sql_select("
|
||||||
|
@ -31,7 +31,7 @@ function user_atom()
|
||||||
$output = make_atom_entries_from_news($news);
|
$output = make_atom_entries_from_news($news);
|
||||||
|
|
||||||
header('Content-Type: application/atom+xml; charset=utf-8');
|
header('Content-Type: application/atom+xml; charset=utf-8');
|
||||||
header("Content-Length: " . strlen($output));
|
header('Content-Length: ' . strlen($output));
|
||||||
raw_output($output);
|
raw_output($output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,21 +51,21 @@ function make_atom_entries_from_news($news_entries)
|
||||||
$_SERVER['REQUEST_URI']
|
$_SERVER['REQUEST_URI']
|
||||||
))
|
))
|
||||||
. '</id>
|
. '</id>
|
||||||
<updated>' . date('Y-m-d\TH:i:sP', $news_entries[0]['Datum']) . "</updated>\n";
|
<updated>' . date('Y-m-d\TH:i:sP', $news_entries[0]['Datum']) . '</updated>' . "\n";
|
||||||
foreach ($news_entries as $news_entry) {
|
foreach ($news_entries as $news_entry) {
|
||||||
$html .= make_atom_entry_from_news($news_entry);
|
$html .= make_atom_entry_from_news($news_entry);
|
||||||
}
|
}
|
||||||
$html .= "</feed>";
|
$html .= '</feed>';
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function make_atom_entry_from_news($news_entry)
|
function make_atom_entry_from_news($news_entry)
|
||||||
{
|
{
|
||||||
return " <entry>
|
return ' <entry>
|
||||||
<title>" . htmlspecialchars($news_entry['Betreff']) . "</title>
|
<title>' . htmlspecialchars($news_entry['Betreff']) . '</title>
|
||||||
<link href=\"" . page_link_to_absolute("news_comments&nid=") . "${news_entry['ID']}\"/>
|
<link href="' . page_link_to_absolute('news_comments&nid=') . $news_entry['ID'] . '"/>
|
||||||
<id>" . preg_replace('#^https?://#', '', page_link_to_absolute("news")) . "-${news_entry['ID']}</id>
|
<id>' . preg_replace('#^https?://#', '', page_link_to_absolute('news')) . '-' . $news_entry['ID'] . '</id>
|
||||||
<updated>" . date('Y-m-d\TH:i:sP', $news_entry['Datum']) . "</updated>
|
<updated>' . date('Y-m-d\TH:i:sP', $news_entry['Datum']) . '</updated>
|
||||||
<summary type=\"html\">" . htmlspecialchars($news_entry['Text']) . "</summary>
|
<summary type="html">' . htmlspecialchars($news_entry['Text']) . '</summary>
|
||||||
</entry>\n";
|
</entry>' . "\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,18 +7,18 @@ function user_ical()
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
if (!isset($_REQUEST['key']) || !preg_match("/^[0-9a-f]{32}$/", $_REQUEST['key'])) {
|
if (!isset($_REQUEST['key']) || !preg_match('/^[0-9a-f]{32}$/', $_REQUEST['key'])) {
|
||||||
engelsystem_error("Missing key.");
|
engelsystem_error('Missing key.');
|
||||||
}
|
}
|
||||||
$key = $_REQUEST['key'];
|
$key = $_REQUEST['key'];
|
||||||
|
|
||||||
$user = User_by_api_key($key);
|
$user = User_by_api_key($key);
|
||||||
if ($user == null) {
|
if ($user == null) {
|
||||||
engelsystem_error("Key invalid.");
|
engelsystem_error('Key invalid.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array('ical', privileges_for_user($user['UID']))) {
|
if (!in_array('ical', privileges_for_user($user['UID']))) {
|
||||||
engelsystem_error("No privilege for ical.");
|
engelsystem_error('No privilege for ical.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$ical_shifts = load_ical_shifts();
|
$ical_shifts = load_ical_shifts();
|
||||||
|
@ -33,14 +33,14 @@ function user_ical()
|
||||||
*/
|
*/
|
||||||
function send_ical_from_shifts($shifts)
|
function send_ical_from_shifts($shifts)
|
||||||
{
|
{
|
||||||
header("Content-Type: text/calendar; charset=utf-8");
|
header('Content-Type: text/calendar; charset=utf-8');
|
||||||
$output = "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//-//Engelsystem//DE\r\nCALSCALE:GREGORIAN\r\n";
|
$output = "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//-//Engelsystem//DE\r\nCALSCALE:GREGORIAN\r\n";
|
||||||
foreach ($shifts as $shift) {
|
foreach ($shifts as $shift) {
|
||||||
$output .= make_ical_entry_from_shift($shift);
|
$output .= make_ical_entry_from_shift($shift);
|
||||||
}
|
}
|
||||||
$output .= "END:VCALENDAR\r\n";
|
$output .= "END:VCALENDAR\r\n";
|
||||||
$output = trim($output, "\x0A");
|
$output = trim($output, "\x0A");
|
||||||
header("Content-Length: " . strlen($output));
|
header('Content-Length: ' . strlen($output));
|
||||||
raw_output($output);
|
raw_output($output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,15 +53,15 @@ function send_ical_from_shifts($shifts)
|
||||||
function make_ical_entry_from_shift($shift)
|
function make_ical_entry_from_shift($shift)
|
||||||
{
|
{
|
||||||
$output = "BEGIN:VEVENT\r\n";
|
$output = "BEGIN:VEVENT\r\n";
|
||||||
$output .= "UID:" . md5($shift['start'] . $shift['end'] . $shift['name']) . "\r\n";
|
$output .= 'UID:' . md5($shift['start'] . $shift['end'] . $shift['name']) . "\r\n";
|
||||||
$output .= "SUMMARY:" . str_replace("\n", "\\n", $shift['name'])
|
$output .= 'SUMMARY:' . str_replace("\n", "\\n", $shift['name'])
|
||||||
. " (" . str_replace("\n", "\\n", $shift['title']) . ")\r\n";
|
. ' (' . str_replace("\n", "\\n", $shift['title']) . ")\r\n";
|
||||||
if (isset($shift['Comment'])) {
|
if (isset($shift['Comment'])) {
|
||||||
$output .= "DESCRIPTION:" . str_replace("\n", "\\n", $shift['Comment']) . "\r\n";
|
$output .= 'DESCRIPTION:' . str_replace("\n", "\\n", $shift['Comment']) . "\r\n";
|
||||||
}
|
}
|
||||||
$output .= "DTSTART;TZID=Europe/Berlin:" . date("Ymd\THis", $shift['start']) . "\r\n";
|
$output .= 'DTSTART;TZID=Europe/Berlin:' . date("Ymd\THis", $shift['start']) . "\r\n";
|
||||||
$output .= "DTEND;TZID=Europe/Berlin:" . date("Ymd\THis", $shift['end']) . "\r\n";
|
$output .= 'DTEND;TZID=Europe/Berlin:' . date("Ymd\THis", $shift['end']) . "\r\n";
|
||||||
$output .= "LOCATION:" . $shift['Name'] . "\r\n";
|
$output .= 'LOCATION:' . $shift['Name'] . "\r\n";
|
||||||
$output .= "END:VEVENT\r\n";
|
$output .= "END:VEVENT\r\n";
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function messages_title()
|
function messages_title()
|
||||||
{
|
{
|
||||||
return _("Messages");
|
return _('Messages');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +35,7 @@ function user_messages()
|
||||||
$users = sql_select("SELECT * FROM `User` WHERE NOT `UID`='" . sql_escape($user['UID']) . "' ORDER BY `Nick`");
|
$users = sql_select("SELECT * FROM `User` WHERE NOT `UID`='" . sql_escape($user['UID']) . "' ORDER BY `Nick`");
|
||||||
|
|
||||||
$to_select_data = [
|
$to_select_data = [
|
||||||
"" => _("Select recipient...")
|
'' => _('Select recipient...')
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($users as $u) {
|
foreach ($users as $u) {
|
||||||
|
@ -44,16 +44,22 @@ function user_messages()
|
||||||
|
|
||||||
$to_select = html_select_key('to', 'to', $to_select_data, '');
|
$to_select = html_select_key('to', 'to', $to_select_data, '');
|
||||||
|
|
||||||
$messages = sql_select("SELECT * FROM `Messages` WHERE `SUID`='" . sql_escape($user['UID']) . "' OR `RUID`='" . sql_escape($user['UID']) . "' ORDER BY `isRead`,`Datum` DESC");
|
$messages = sql_select("
|
||||||
|
SELECT *
|
||||||
|
FROM `Messages`
|
||||||
|
WHERE `SUID`='" . sql_escape($user['UID']) . "'
|
||||||
|
OR `RUID`='" . sql_escape($user['UID']) . "'
|
||||||
|
ORDER BY `isRead`,`Datum` DESC
|
||||||
|
");
|
||||||
|
|
||||||
$messages_table = [
|
$messages_table = [
|
||||||
[
|
[
|
||||||
'news' => '',
|
'news' => '',
|
||||||
'timestamp' => date("Y-m-d H:i"),
|
'timestamp' => date('Y-m-d H:i'),
|
||||||
'from' => User_Nick_render($user),
|
'from' => User_Nick_render($user),
|
||||||
'to' => $to_select,
|
'to' => $to_select,
|
||||||
'text' => form_textarea('text', '', ''),
|
'text' => form_textarea('text', '', ''),
|
||||||
'actions' => form_submit('submit', _("Save"))
|
'actions' => form_submit('submit', _('Save'))
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -63,7 +69,7 @@ function user_messages()
|
||||||
|
|
||||||
$messages_table_entry = [
|
$messages_table_entry = [
|
||||||
'new' => $message['isRead'] == 'N' ? '<span class="glyphicon glyphicon-envelope"></span>' : '',
|
'new' => $message['isRead'] == 'N' ? '<span class="glyphicon glyphicon-envelope"></span>' : '',
|
||||||
'timestamp' => date("Y-m-d H:i", $message['Datum']),
|
'timestamp' => date('Y-m-d H:i', $message['Datum']),
|
||||||
'from' => User_Nick_render($sender_user_source),
|
'from' => User_Nick_render($sender_user_source),
|
||||||
'to' => User_Nick_render($receiver_user_source),
|
'to' => User_Nick_render($receiver_user_source),
|
||||||
'text' => str_replace("\n", '<br />', $message['Text'])
|
'text' => str_replace("\n", '<br />', $message['Text'])
|
||||||
|
@ -72,15 +78,15 @@ function user_messages()
|
||||||
if ($message['RUID'] == $user['UID']) {
|
if ($message['RUID'] == $user['UID']) {
|
||||||
if ($message['isRead'] == 'N') {
|
if ($message['isRead'] == 'N') {
|
||||||
$messages_table_entry['actions'] = button(
|
$messages_table_entry['actions'] = button(
|
||||||
page_link_to("user_messages") . '&action=read&id=' . $message['id'],
|
page_link_to('user_messages') . '&action=read&id=' . $message['id'],
|
||||||
_("mark as read"),
|
_('mark as read'),
|
||||||
'btn-xs'
|
'btn-xs'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$messages_table_entry['actions'] = button(
|
$messages_table_entry['actions'] = button(
|
||||||
page_link_to("user_messages") . '&action=delete&id=' . $message['id'],
|
page_link_to('user_messages') . '&action=delete&id=' . $message['id'],
|
||||||
_("delete message"),
|
_('delete message'),
|
||||||
'btn-xs'
|
'btn-xs'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -89,62 +95,62 @@ function user_messages()
|
||||||
|
|
||||||
return page_with_title(messages_title(), [
|
return page_with_title(messages_title(), [
|
||||||
msg(),
|
msg(),
|
||||||
sprintf(_("Hello %s, here can you leave messages for other angels"), User_Nick_render($user)),
|
sprintf(_('Hello %s, here can you leave messages for other angels'), User_Nick_render($user)),
|
||||||
form([
|
form([
|
||||||
table([
|
table([
|
||||||
'new' => _("New"),
|
'new' => _('New'),
|
||||||
'timestamp' => _("Date"),
|
'timestamp' => _('Date'),
|
||||||
'from' => _("Transmitted"),
|
'from' => _('Transmitted'),
|
||||||
'to' => _("Recipient"),
|
'to' => _('Recipient'),
|
||||||
'text' => _("Message"),
|
'text' => _('Message'),
|
||||||
'actions' => ''
|
'actions' => ''
|
||||||
], $messages_table)
|
], $messages_table)
|
||||||
], page_link_to('user_messages') . '&action=send')
|
], page_link_to('user_messages') . '&action=send')
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case "read":
|
case 'read':
|
||||||
if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) {
|
if (isset($_REQUEST['id']) && preg_match('/^[0-9]{1,11}$/', $_REQUEST['id'])) {
|
||||||
$message_id = $_REQUEST['id'];
|
$message_id = $_REQUEST['id'];
|
||||||
} else {
|
} else {
|
||||||
return error(_("Incomplete call, missing Message ID."), true);
|
return error(_('Incomplete call, missing Message ID.'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = sql_select("SELECT * FROM `Messages` WHERE `id`='" . sql_escape($message_id) . "' LIMIT 1");
|
$message = sql_select("SELECT * FROM `Messages` WHERE `id`='" . sql_escape($message_id) . "' LIMIT 1");
|
||||||
if (count($message) > 0 && $message[0]['RUID'] == $user['UID']) {
|
if (count($message) > 0 && $message[0]['RUID'] == $user['UID']) {
|
||||||
sql_query("UPDATE `Messages` SET `isRead`='Y' WHERE `id`='" . sql_escape($message_id) . "' LIMIT 1");
|
sql_query("UPDATE `Messages` SET `isRead`='Y' WHERE `id`='" . sql_escape($message_id) . "' LIMIT 1");
|
||||||
redirect(page_link_to("user_messages"));
|
redirect(page_link_to('user_messages'));
|
||||||
} else {
|
} else {
|
||||||
return error(_("No Message found."), true);
|
return error(_('No Message found.'), true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "delete":
|
case 'delete':
|
||||||
if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) {
|
if (isset($_REQUEST['id']) && preg_match('/^[0-9]{1,11}$/', $_REQUEST['id'])) {
|
||||||
$message_id = $_REQUEST['id'];
|
$message_id = $_REQUEST['id'];
|
||||||
} else {
|
} else {
|
||||||
return error(_("Incomplete call, missing Message ID."), true);
|
return error(_('Incomplete call, missing Message ID.'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = sql_select("SELECT * FROM `Messages` WHERE `id`='" . sql_escape($message_id) . "' LIMIT 1");
|
$message = sql_select("SELECT * FROM `Messages` WHERE `id`='" . sql_escape($message_id) . "' LIMIT 1");
|
||||||
if (count($message) > 0 && $message[0]['SUID'] == $user['UID']) {
|
if (count($message) > 0 && $message[0]['SUID'] == $user['UID']) {
|
||||||
sql_query("DELETE FROM `Messages` WHERE `id`='" . sql_escape($message_id) . "' LIMIT 1");
|
sql_query("DELETE FROM `Messages` WHERE `id`='" . sql_escape($message_id) . "' LIMIT 1");
|
||||||
redirect(page_link_to("user_messages"));
|
redirect(page_link_to('user_messages'));
|
||||||
} else {
|
} else {
|
||||||
return error(_("No Message found."), true);
|
return error(_('No Message found.'), true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "send":
|
case 'send':
|
||||||
if (Message_send($_REQUEST['to'], $_REQUEST['text']) === true) {
|
if (Message_send($_REQUEST['to'], $_REQUEST['text']) === true) {
|
||||||
redirect(page_link_to("user_messages"));
|
redirect(page_link_to('user_messages'));
|
||||||
} else {
|
} else {
|
||||||
return error(_("Transmitting was terminated with an Error."), true);
|
return error(_('Transmitting was terminated with an Error.'), true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return error(_("Wrong action."), true);
|
return error(_('Wrong action.'), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function myshifts_title()
|
function myshifts_title()
|
||||||
{
|
{
|
||||||
return _("My shifts");
|
return _('My shifts');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,8 +20,8 @@ function user_myshifts()
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isset($_REQUEST['id'])
|
isset($_REQUEST['id'])
|
||||||
&& in_array("user_shifts_admin", $privileges)
|
&& in_array('user_shifts_admin', $privileges)
|
||||||
&& preg_match("/^[0-9]{1,}$/", $_REQUEST['id'])
|
&& preg_match('/^[0-9]{1,}$/', $_REQUEST['id'])
|
||||||
&& sql_num_query("SELECT * FROM `User` WHERE `UID`='" . sql_escape($_REQUEST['id']) . "'") > 0
|
&& sql_num_query("SELECT * FROM `User` WHERE `UID`='" . sql_escape($_REQUEST['id']) . "'") > 0
|
||||||
) {
|
) {
|
||||||
$user_id = $_REQUEST['id'];
|
$user_id = $_REQUEST['id'];
|
||||||
|
@ -32,19 +32,19 @@ function user_myshifts()
|
||||||
list($shifts_user) = sql_select("SELECT * FROM `User` WHERE `UID`='" . sql_escape($user_id) . "' LIMIT 1");
|
list($shifts_user) = sql_select("SELECT * FROM `User` WHERE `UID`='" . sql_escape($user_id) . "' LIMIT 1");
|
||||||
|
|
||||||
if (isset($_REQUEST['reset'])) {
|
if (isset($_REQUEST['reset'])) {
|
||||||
if ($_REQUEST['reset'] == "ack") {
|
if ($_REQUEST['reset'] == 'ack') {
|
||||||
User_reset_api_key($user);
|
User_reset_api_key($user);
|
||||||
success(_("Key changed."));
|
success(_('Key changed.'));
|
||||||
redirect(page_link_to('users') . '&action=view&user_id=' . $shifts_user['UID']);
|
redirect(page_link_to('users') . '&action=view&user_id=' . $shifts_user['UID']);
|
||||||
}
|
}
|
||||||
return page_with_title(_("Reset API key"), [
|
return page_with_title(_('Reset API key'), [
|
||||||
error(
|
error(
|
||||||
_("If you reset the key, the url to your iCal- and JSON-export and your atom feed changes! You have to update it in every application using one of these exports."),
|
_('If you reset the key, the url to your iCal- and JSON-export and your atom feed changes! You have to update it in every application using one of these exports.'),
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
button(page_link_to('user_myshifts') . '&reset=ack', _("Continue"), 'btn-danger')
|
button(page_link_to('user_myshifts') . '&reset=ack', _('Continue'), 'btn-danger')
|
||||||
]);
|
]);
|
||||||
} elseif (isset($_REQUEST['edit']) && preg_match("/^[0-9]*$/", $_REQUEST['edit'])) {
|
} elseif (isset($_REQUEST['edit']) && preg_match('/^[0-9]*$/', $_REQUEST['edit'])) {
|
||||||
$user_id = $_REQUEST['edit'];
|
$user_id = $_REQUEST['edit'];
|
||||||
$shift = sql_select("SELECT
|
$shift = sql_select("SELECT
|
||||||
`ShiftEntry`.`freeloaded`,
|
`ShiftEntry`.`freeloaded`,
|
||||||
|
@ -69,12 +69,12 @@ function user_myshifts()
|
||||||
|
|
||||||
if (isset($_REQUEST['submit'])) {
|
if (isset($_REQUEST['submit'])) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
if (in_array("user_shifts_admin", $privileges)) {
|
if (in_array('user_shifts_admin', $privileges)) {
|
||||||
$freeloaded = isset($_REQUEST['freeloaded']);
|
$freeloaded = isset($_REQUEST['freeloaded']);
|
||||||
$freeload_comment = strip_request_item_nl('freeload_comment');
|
$freeload_comment = strip_request_item_nl('freeload_comment');
|
||||||
if ($freeloaded && $freeload_comment == '') {
|
if ($freeloaded && $freeload_comment == '') {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Please enter a freeload comment!"));
|
error(_('Please enter a freeload comment!'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,32 +93,32 @@ function user_myshifts()
|
||||||
}
|
}
|
||||||
|
|
||||||
engelsystem_log(
|
engelsystem_log(
|
||||||
"Updated " . User_Nick_render($user_source) . "'s shift " . $shift['name']
|
'Updated ' . User_Nick_render($user_source) . '\'s shift ' . $shift['name']
|
||||||
. " from " . date("Y-m-d H:i", $shift['start'])
|
. ' from ' . date('Y-m-d H:i', $shift['start'])
|
||||||
. " to " . date("Y-m-d H:i", $shift['end'])
|
. ' to ' . date('Y-m-d H:i', $shift['end'])
|
||||||
. " with comment " . $comment
|
. ' with comment ' . $comment
|
||||||
. ". Freeloaded: " . ($freeloaded ? "YES Comment: " . $freeload_comment : "NO")
|
. '. Freeloaded: ' . ($freeloaded ? 'YES Comment: ' . $freeload_comment : 'NO')
|
||||||
);
|
);
|
||||||
success(_("Shift saved."));
|
success(_('Shift saved.'));
|
||||||
redirect(page_link_to('users') . '&action=view&user_id=' . $shifts_user['UID']);
|
redirect(page_link_to('users') . '&action=view&user_id=' . $shifts_user['UID']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ShiftEntry_edit_view(
|
return ShiftEntry_edit_view(
|
||||||
User_Nick_render($shifts_user),
|
User_Nick_render($shifts_user),
|
||||||
date("Y-m-d H:i", $shift['start']) . ', ' . shift_length($shift),
|
date('Y-m-d H:i', $shift['start']) . ', ' . shift_length($shift),
|
||||||
$shift['Name'],
|
$shift['Name'],
|
||||||
$shift['name'],
|
$shift['name'],
|
||||||
$shift['angel_type'],
|
$shift['angel_type'],
|
||||||
$shift['Comment'],
|
$shift['Comment'],
|
||||||
$shift['freeloaded'],
|
$shift['freeloaded'],
|
||||||
$shift['freeload_comment'],
|
$shift['freeload_comment'],
|
||||||
in_array("user_shifts_admin", $privileges)
|
in_array('user_shifts_admin', $privileges)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
redirect(page_link_to('user_myshifts'));
|
redirect(page_link_to('user_myshifts'));
|
||||||
}
|
}
|
||||||
} elseif (isset($_REQUEST['cancel']) && preg_match("/^[0-9]*$/", $_REQUEST['cancel'])) {
|
} elseif (isset($_REQUEST['cancel']) && preg_match('/^[0-9]*$/', $_REQUEST['cancel'])) {
|
||||||
$user_id = $_REQUEST['cancel'];
|
$user_id = $_REQUEST['cancel'];
|
||||||
$shift = sql_select("
|
$shift = sql_select("
|
||||||
SELECT *
|
SELECT *
|
||||||
|
@ -137,15 +137,15 @@ function user_myshifts()
|
||||||
$shifttype = ShiftType($shift['shifttype_id']);
|
$shifttype = ShiftType($shift['shifttype_id']);
|
||||||
|
|
||||||
engelsystem_log(
|
engelsystem_log(
|
||||||
"Deleted own shift: " . $shifttype['name']
|
'Deleted own shift: ' . $shifttype['name']
|
||||||
. " at " . $room['Name']
|
. ' at ' . $room['Name']
|
||||||
. " from " . date("Y-m-d H:i", $shift['start'])
|
. ' from ' . date('Y-m-d H:i', $shift['start'])
|
||||||
. " to " . date("Y-m-d H:i", $shift['end'])
|
. ' to ' . date('Y-m-d H:i', $shift['end'])
|
||||||
. " as " . $angeltype['name']
|
. ' as ' . $angeltype['name']
|
||||||
);
|
);
|
||||||
success(_("Shift canceled."));
|
success(_('Shift canceled.'));
|
||||||
} else {
|
} else {
|
||||||
error(_("It's too late to sign yourself off the shift. If neccessary, ask the dispatcher to do so."));
|
error(_('It\'s too late to sign yourself off the shift. If neccessary, ask the dispatcher to do so.'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
redirect(user_link($shifts_user));
|
redirect(user_link($shifts_user));
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function user_news_comments_title()
|
function user_news_comments_title()
|
||||||
{
|
{
|
||||||
return _("News comments");
|
return _('News comments');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,7 +13,7 @@ function user_news_comments_title()
|
||||||
*/
|
*/
|
||||||
function news_title()
|
function news_title()
|
||||||
{
|
{
|
||||||
return _("News");
|
return _('News');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,7 +21,7 @@ function news_title()
|
||||||
*/
|
*/
|
||||||
function meetings_title()
|
function meetings_title()
|
||||||
{
|
{
|
||||||
return _("Meetings");
|
return _('Meetings');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +33,7 @@ function user_meetings()
|
||||||
|
|
||||||
$html = '<div class="col-md-12"><h1>' . meetings_title() . '</h1>' . msg();
|
$html = '<div class="col-md-12"><h1>' . meetings_title() . '</h1>' . msg();
|
||||||
|
|
||||||
if (isset($_REQUEST['page']) && preg_match("/^[0-9]{1,}$/", $_REQUEST['page'])) {
|
if (isset($_REQUEST['page']) && preg_match('/^[0-9]{1,}$/', $_REQUEST['page'])) {
|
||||||
$page = $_REQUEST['page'];
|
$page = $_REQUEST['page'];
|
||||||
} else {
|
} else {
|
||||||
$page = 0;
|
$page = 0;
|
||||||
|
@ -50,7 +50,7 @@ function user_meetings()
|
||||||
$html .= display_news($entry);
|
$html .= display_news($entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
$dis_rows = ceil(sql_num_query("SELECT * FROM `News`") / $display_news);
|
$dis_rows = ceil(sql_num_query('SELECT * FROM `News`') / $display_news);
|
||||||
$html .= '<div class="text-center">' . '<ul class="pagination">';
|
$html .= '<div class="text-center">' . '<ul class="pagination">';
|
||||||
for ($i = 0; $i < $dis_rows; $i++) {
|
for ($i = 0; $i < $dis_rows; $i++) {
|
||||||
if (isset($_REQUEST['page']) && $i == $_REQUEST['page']) {
|
if (isset($_REQUEST['page']) && $i == $_REQUEST['page']) {
|
||||||
|
@ -60,7 +60,7 @@ function user_meetings()
|
||||||
} else {
|
} else {
|
||||||
$html .= '<li>';
|
$html .= '<li>';
|
||||||
}
|
}
|
||||||
$html .= '<a href="' . page_link_to("user_meetings") . '&page=' . $i . '">' . ($i + 1) . '</a></li>';
|
$html .= '<a href="' . page_link_to('user_meetings') . '&page=' . $i . '">' . ($i + 1) . '</a></li>';
|
||||||
}
|
}
|
||||||
$html .= '</ul></div></div>';
|
$html .= '</ul></div></div>';
|
||||||
|
|
||||||
|
@ -83,20 +83,20 @@ function display_news($news)
|
||||||
$html .= '<div class="panel-body">' . ReplaceSmilies(nl2br($news['Text'])) . '</div>';
|
$html .= '<div class="panel-body">' . ReplaceSmilies(nl2br($news['Text'])) . '</div>';
|
||||||
|
|
||||||
$html .= '<div class="panel-footer text-muted">';
|
$html .= '<div class="panel-footer text-muted">';
|
||||||
if (in_array("admin_news", $privileges)) {
|
if (in_array('admin_news', $privileges)) {
|
||||||
$html .= '<div class="pull-right">'
|
$html .= '<div class="pull-right">'
|
||||||
. button_glyph(page_link_to("admin_news") . '&action=edit&id=' . $news['ID'], 'edit', 'btn-xs')
|
. button_glyph(page_link_to('admin_news') . '&action=edit&id=' . $news['ID'], 'edit', 'btn-xs')
|
||||||
. '</div>';
|
. '</div>';
|
||||||
}
|
}
|
||||||
$html .= '<span class="glyphicon glyphicon-time"></span> ' . date("Y-m-d H:i", $news['Datum']) . ' ';
|
$html .= '<span class="glyphicon glyphicon-time"></span> ' . date('Y-m-d H:i', $news['Datum']) . ' ';
|
||||||
|
|
||||||
$user_source = User($news['UID']);
|
$user_source = User($news['UID']);
|
||||||
|
|
||||||
$html .= User_Nick_render($user_source);
|
$html .= User_Nick_render($user_source);
|
||||||
if ($page != "news_comments") {
|
if ($page != 'news_comments') {
|
||||||
$html .= ' <a href="' . page_link_to("news_comments") . '&nid=' . $news['ID'] . '">'
|
$html .= ' <a href="' . page_link_to('news_comments') . '&nid=' . $news['ID'] . '">'
|
||||||
. '<span class="glyphicon glyphicon-comment"></span> '
|
. '<span class="glyphicon glyphicon-comment"></span> '
|
||||||
. _("Comments") . ' »</a> '
|
. _('Comments') . ' »</a> '
|
||||||
. '<span class="badge">'
|
. '<span class="badge">'
|
||||||
. sql_num_query("SELECT * FROM `NewsComments` WHERE `Refid`='" . sql_escape($news['ID']) . "'")
|
. sql_num_query("SELECT * FROM `NewsComments` WHERE `Refid`='" . sql_escape($news['ID']) . "'")
|
||||||
. '</span>';
|
. '</span>';
|
||||||
|
@ -115,13 +115,13 @@ function user_news_comments()
|
||||||
|
|
||||||
$html = '<div class="col-md-12"><h1>' . user_news_comments_title() . '</h1>';
|
$html = '<div class="col-md-12"><h1>' . user_news_comments_title() . '</h1>';
|
||||||
if (
|
if (
|
||||||
isset($_REQUEST["nid"])
|
isset($_REQUEST['nid'])
|
||||||
&& preg_match("/^[0-9]{1,}$/", $_REQUEST['nid'])
|
&& preg_match('/^[0-9]{1,}$/', $_REQUEST['nid'])
|
||||||
&& sql_num_query("SELECT * FROM `News` WHERE `ID`='" . sql_escape($_REQUEST['nid']) . "' LIMIT 1") > 0
|
&& sql_num_query("SELECT * FROM `News` WHERE `ID`='" . sql_escape($_REQUEST['nid']) . "' LIMIT 1") > 0
|
||||||
) {
|
) {
|
||||||
$nid = $_REQUEST["nid"];
|
$nid = $_REQUEST['nid'];
|
||||||
list($news) = sql_select("SELECT * FROM `News` WHERE `ID`='" . sql_escape($nid) . "' LIMIT 1");
|
list($news) = sql_select("SELECT * FROM `News` WHERE `ID`='" . sql_escape($nid) . "' LIMIT 1");
|
||||||
if (isset($_REQUEST["text"])) {
|
if (isset($_REQUEST['text'])) {
|
||||||
$text = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($_REQUEST['text']));
|
$text = preg_replace("/([^\p{L}\p{P}\p{Z}\p{N}\n]{1,})/ui", '', strip_tags($_REQUEST['text']));
|
||||||
sql_query("
|
sql_query("
|
||||||
INSERT INTO `NewsComments` (`Refid`, `Datum`, `Text`, `UID`)
|
INSERT INTO `NewsComments` (`Refid`, `Datum`, `Text`, `UID`)
|
||||||
|
@ -132,8 +132,8 @@ function user_news_comments()
|
||||||
'" . sql_escape($user["UID"]) . "'
|
'" . sql_escape($user["UID"]) . "'
|
||||||
)
|
)
|
||||||
");
|
");
|
||||||
engelsystem_log("Created news_comment: " . $text);
|
engelsystem_log('Created news_comment: ' . $text);
|
||||||
$html .= success(_("Entry saved."), true);
|
$html .= success(_('Entry saved.'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= display_news($news);
|
$html .= display_news($news);
|
||||||
|
@ -151,13 +151,13 @@ function user_news_comments()
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$html .= '<hr /><h2>' . _("New Comment:") . '</h2>';
|
$html .= '<hr /><h2>' . _('New Comment:') . '</h2>';
|
||||||
$html .= form([
|
$html .= form([
|
||||||
form_textarea('text', _("Message"), ''),
|
form_textarea('text', _('Message'), ''),
|
||||||
form_submit('submit', _("Save"))
|
form_submit('submit', _('Save'))
|
||||||
], page_link_to('news_comments') . '&nid=' . $news['ID']);
|
], page_link_to('news_comments') . '&nid=' . $news['ID']);
|
||||||
} else {
|
} else {
|
||||||
$html .= _("Invalid request.");
|
$html .= _('Invalid request.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $html . '</div>';
|
return $html . '</div>';
|
||||||
|
@ -172,9 +172,9 @@ function user_news()
|
||||||
|
|
||||||
$html = '<div class="col-md-12"><h1>' . news_title() . '</h1>' . msg();
|
$html = '<div class="col-md-12"><h1>' . news_title() . '</h1>' . msg();
|
||||||
|
|
||||||
if (isset($_POST["text"]) && isset($_POST["betreff"]) && in_array("admin_news", $privileges)) {
|
if (isset($_POST['text']) && isset($_POST['betreff']) && in_array('admin_news', $privileges)) {
|
||||||
if (!isset($_POST["treffen"]) || !in_array("admin_news", $privileges)) {
|
if (!isset($_POST['treffen']) || !in_array('admin_news', $privileges)) {
|
||||||
$_POST["treffen"] = 0;
|
$_POST['treffen'] = 0;
|
||||||
}
|
}
|
||||||
sql_query("
|
sql_query("
|
||||||
INSERT INTO `News` (`Datum`, `Betreff`, `Text`, `UID`, `Treffen`)
|
INSERT INTO `News` (`Datum`, `Betreff`, `Text`, `UID`, `Treffen`)
|
||||||
|
@ -186,12 +186,12 @@ function user_news()
|
||||||
'" . sql_escape($_POST["treffen"]) . "'
|
'" . sql_escape($_POST["treffen"]) . "'
|
||||||
)
|
)
|
||||||
");
|
");
|
||||||
engelsystem_log("Created news: " . $_POST["betreff"] . ", treffen: " . $_POST["treffen"]);
|
engelsystem_log('Created news: ' . $_POST['betreff'] . ', treffen: ' . $_POST['treffen']);
|
||||||
success(_("Entry saved."));
|
success(_('Entry saved.'));
|
||||||
redirect(page_link_to('news'));
|
redirect(page_link_to('news'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['page']) && preg_match("/^[0-9]{1,}$/", $_REQUEST['page'])) {
|
if (isset($_REQUEST['page']) && preg_match('/^[0-9]{1,}$/', $_REQUEST['page'])) {
|
||||||
$page = $_REQUEST['page'];
|
$page = $_REQUEST['page'];
|
||||||
} else {
|
} else {
|
||||||
$page = 0;
|
$page = 0;
|
||||||
|
@ -207,7 +207,7 @@ function user_news()
|
||||||
$html .= display_news($entry);
|
$html .= display_news($entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
$dis_rows = ceil(sql_num_query("SELECT * FROM `News`") / $display_news);
|
$dis_rows = ceil(sql_num_query('SELECT * FROM `News`') / $display_news);
|
||||||
$html .= '<div class="text-center">' . '<ul class="pagination">';
|
$html .= '<div class="text-center">' . '<ul class="pagination">';
|
||||||
for ($i = 0; $i < $dis_rows; $i++) {
|
for ($i = 0; $i < $dis_rows; $i++) {
|
||||||
if (isset($_REQUEST['page']) && $i == $_REQUEST['page']) {
|
if (isset($_REQUEST['page']) && $i == $_REQUEST['page']) {
|
||||||
|
@ -217,19 +217,19 @@ function user_news()
|
||||||
} else {
|
} else {
|
||||||
$html .= '<li>';
|
$html .= '<li>';
|
||||||
}
|
}
|
||||||
$html .= '<a href="' . page_link_to("news") . '&page=' . $i . '">' . ($i + 1) . '</a></li>';
|
$html .= '<a href="' . page_link_to('news') . '&page=' . $i . '">' . ($i + 1) . '</a></li>';
|
||||||
}
|
}
|
||||||
$html .= '</ul></div>';
|
$html .= '</ul></div>';
|
||||||
|
|
||||||
if (in_array("admin_news", $privileges)) {
|
if (in_array('admin_news', $privileges)) {
|
||||||
$html .= '<hr />';
|
$html .= '<hr />';
|
||||||
$html .= '<h2>' . _("Create news:") . '</h2>';
|
$html .= '<h2>' . _('Create news:') . '</h2>';
|
||||||
|
|
||||||
$html .= form([
|
$html .= form([
|
||||||
form_text('betreff', _("Subject"), ''),
|
form_text('betreff', _('Subject'), ''),
|
||||||
form_textarea('text', _("Message"), ''),
|
form_textarea('text', _('Message'), ''),
|
||||||
form_checkbox('treffen', _("Meeting"), false, 1),
|
form_checkbox('treffen', _('Meeting'), false, 1),
|
||||||
form_submit('submit', _("Save"))
|
form_submit('submit', _('Save'))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
return $html . '</div>';
|
return $html . '</div>';
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function questions_title()
|
function questions_title()
|
||||||
{
|
{
|
||||||
return _("Ask the Heaven");
|
return _('Ask the Heaven');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,41 +28,41 @@ function user_questions()
|
||||||
$question['answer_user'] = User_Nick_render($answer_user_source);
|
$question['answer_user'] = User_Nick_render($answer_user_source);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Questions_view($open_questions, $answered_questions, page_link_to("user_questions") . '&action=ask');
|
return Questions_view($open_questions, $answered_questions, page_link_to('user_questions') . '&action=ask');
|
||||||
} else {
|
} else {
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'ask':
|
case 'ask':
|
||||||
$question = strip_request_item_nl('question');
|
$question = strip_request_item_nl('question');
|
||||||
if ($question != "") {
|
if ($question != '') {
|
||||||
$result = sql_query("
|
$result = sql_query("
|
||||||
INSERT INTO `Questions`
|
INSERT INTO `Questions`
|
||||||
SET `UID`='" . sql_escape($user['UID']) . "', `Question`='" . sql_escape($question) . "'
|
SET `UID`='" . sql_escape($user['UID']) . "', `Question`='" . sql_escape($question) . "'
|
||||||
");
|
");
|
||||||
if ($result === false) {
|
if ($result === false) {
|
||||||
engelsystem_error(_("Unable to save question."));
|
engelsystem_error(_('Unable to save question.'));
|
||||||
}
|
}
|
||||||
success(_("You question was saved."));
|
success(_('You question was saved.'));
|
||||||
redirect(page_link_to("user_questions"));
|
redirect(page_link_to('user_questions'));
|
||||||
} else {
|
} else {
|
||||||
return page_with_title(questions_title(), [
|
return page_with_title(questions_title(), [
|
||||||
error(_("Please enter a question!"), true)
|
error(_('Please enter a question!'), true)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if (isset($_REQUEST['id']) && preg_match("/^[0-9]{1,11}$/", $_REQUEST['id'])) {
|
if (isset($_REQUEST['id']) && preg_match('/^[0-9]{1,11}$/', $_REQUEST['id'])) {
|
||||||
$question_id = $_REQUEST['id'];
|
$question_id = $_REQUEST['id'];
|
||||||
} else {
|
} else {
|
||||||
return error(_("Incomplete call, missing Question ID."), true);
|
return error(_('Incomplete call, missing Question ID.'), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$question = sql_select("SELECT * FROM `Questions` WHERE `QID`='" . sql_escape($question_id) . "' LIMIT 1");
|
$question = sql_select("SELECT * FROM `Questions` WHERE `QID`='" . sql_escape($question_id) . "' LIMIT 1");
|
||||||
if (count($question) > 0 && $question[0]['UID'] == $user['UID']) {
|
if (count($question) > 0 && $question[0]['UID'] == $user['UID']) {
|
||||||
sql_query("DELETE FROM `Questions` WHERE `QID`='" . sql_escape($question_id) . "' LIMIT 1");
|
sql_query("DELETE FROM `Questions` WHERE `QID`='" . sql_escape($question_id) . "' LIMIT 1");
|
||||||
redirect(page_link_to("user_questions"));
|
redirect(page_link_to('user_questions'));
|
||||||
} else {
|
} else {
|
||||||
return page_with_title(questions_title(), [
|
return page_with_title(questions_title(), [
|
||||||
error(_("No question found."), true)
|
error(_('No question found.'), true)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
*/
|
*/
|
||||||
function settings_title()
|
function settings_title()
|
||||||
{
|
{
|
||||||
return _("Settings");
|
return _('Settings');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,11 +25,11 @@ function user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes)
|
||||||
$user_source['email'] = $result->getValue();
|
$user_source['email'] = $result->getValue();
|
||||||
if (!$result->isValid()) {
|
if (!$result->isValid()) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("E-mail address is not correct."));
|
error(_('E-mail address is not correct.'));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Please enter your e-mail."));
|
error(_('Please enter your e-mail.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_source['email_shiftinfo'] = isset($_REQUEST['email_shiftinfo']);
|
$user_source['email_shiftinfo'] = isset($_REQUEST['email_shiftinfo']);
|
||||||
|
@ -40,7 +40,7 @@ function user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes)
|
||||||
$user_source['jabber'] = $result->getValue();
|
$user_source['jabber'] = $result->getValue();
|
||||||
if (!$result->isValid()) {
|
if (!$result->isValid()) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Please check your jabber account information."));
|
error(_('Please check your jabber account information.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,22 +51,22 @@ function user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['planned_arrival_date'])) {
|
if (isset($_REQUEST['planned_arrival_date'])) {
|
||||||
$tmp = parse_date("Y-m-d H:i", $_REQUEST['planned_arrival_date'] . " 00:00");
|
$tmp = parse_date('Y-m-d H:i', $_REQUEST['planned_arrival_date'] . ' 00:00');
|
||||||
$result = User_validate_planned_arrival_date($tmp);
|
$result = User_validate_planned_arrival_date($tmp);
|
||||||
$user_source['planned_arrival_date'] = $result->getValue();
|
$user_source['planned_arrival_date'] = $result->getValue();
|
||||||
if (!$result->isValid()) {
|
if (!$result->isValid()) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Please enter your planned date of arrival. It should be after the buildup start date and before teardown end date."));
|
error(_('Please enter your planned date of arrival. It should be after the buildup start date and before teardown end date.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['planned_departure_date'])) {
|
if (isset($_REQUEST['planned_departure_date'])) {
|
||||||
$tmp = parse_date("Y-m-d H:i", $_REQUEST['planned_departure_date'] . " 00:00");
|
$tmp = parse_date('Y-m-d H:i', $_REQUEST['planned_departure_date'] . ' 00:00');
|
||||||
$result = User_validate_planned_departure_date($user_source['planned_arrival_date'], $tmp);
|
$result = User_validate_planned_departure_date($user_source['planned_arrival_date'], $tmp);
|
||||||
$user_source['planned_departure_date'] = $result->getValue();
|
$user_source['planned_departure_date'] = $result->getValue();
|
||||||
if (!$result->isValid()) {
|
if (!$result->isValid()) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(_("Please enter your planned date of departure. It should be after your planned arrival date and after buildup start date and before teardown end date."));
|
error(_('Please enter your planned date of departure. It should be after your planned arrival date and after buildup start date and before teardown end date.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ function user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes)
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
User_update($user_source);
|
User_update($user_source);
|
||||||
success(_("Settings saved."));
|
success(_('Settings saved.'));
|
||||||
redirect(page_link_to('user_settings'));
|
redirect(page_link_to('user_settings'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,15 +100,15 @@ function user_settings_password($user_source)
|
||||||
!isset($_REQUEST['password'])
|
!isset($_REQUEST['password'])
|
||||||
|| !verify_password($_REQUEST['password'], $user_source['Passwort'], $user_source['UID'])
|
|| !verify_password($_REQUEST['password'], $user_source['Passwort'], $user_source['UID'])
|
||||||
) {
|
) {
|
||||||
error(_("-> not OK. Please try again."));
|
error(_('-> not OK. Please try again.'));
|
||||||
} elseif (strlen($_REQUEST['new_password']) < $min_password_length) {
|
} elseif (strlen($_REQUEST['new_password']) < $min_password_length) {
|
||||||
error(_("Your password is to short (please use at least 6 characters)."));
|
error(_('Your password is to short (please use at least 6 characters).'));
|
||||||
} elseif ($_REQUEST['new_password'] != $_REQUEST['new_password2']) {
|
} elseif ($_REQUEST['new_password'] != $_REQUEST['new_password2']) {
|
||||||
error(_("Your passwords don't match."));
|
error(_('Your passwords don\'t match.'));
|
||||||
} elseif (set_password($user_source['UID'], $_REQUEST['new_password'])) {
|
} elseif (set_password($user_source['UID'], $_REQUEST['new_password'])) {
|
||||||
success(_("Password saved."));
|
success(_('Password saved.'));
|
||||||
} else {
|
} else {
|
||||||
error(_("Failed setting password."));
|
error(_('Failed setting password.'));
|
||||||
}
|
}
|
||||||
redirect(page_link_to('user_settings'));
|
redirect(page_link_to('user_settings'));
|
||||||
}
|
}
|
||||||
|
@ -131,9 +131,13 @@ function user_settings_theme($user_source, $themes)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
sql_query("UPDATE `User` SET `color`='" . sql_escape($user_source['color']) . "' WHERE `UID`='" . sql_escape($user_source['UID']) . "'");
|
sql_query("
|
||||||
|
UPDATE `User`
|
||||||
|
SET `color`='" . sql_escape($user_source['color']) . "'
|
||||||
|
WHERE `UID`='" . sql_escape($user_source['UID']) . "'
|
||||||
|
");
|
||||||
|
|
||||||
success(_("Theme changed."));
|
success(_('Theme changed.'));
|
||||||
redirect(page_link_to('user_settings'));
|
redirect(page_link_to('user_settings'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,10 +162,14 @@ function user_settings_locale($user_source, $locales)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
sql_query("UPDATE `User` SET `Sprache`='" . sql_escape($user_source['Sprache']) . "' WHERE `UID`='" . sql_escape($user_source['UID']) . "'");
|
sql_query("
|
||||||
|
UPDATE `User`
|
||||||
|
SET `Sprache`='" . sql_escape($user_source['Sprache']) . "'
|
||||||
|
WHERE `UID`='" . sql_escape($user_source['UID']) . "'
|
||||||
|
");
|
||||||
$_SESSION['locale'] = $user_source['Sprache'];
|
$_SESSION['locale'] = $user_source['Sprache'];
|
||||||
|
|
||||||
success("Language changed.");
|
success('Language changed.');
|
||||||
redirect(page_link_to('user_settings'));
|
redirect(page_link_to('user_settings'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,6 +210,13 @@ function user_settings()
|
||||||
$user_source = user_settings_locale($user_source, $locales);
|
$user_source = user_settings_locale($user_source, $locales);
|
||||||
}
|
}
|
||||||
|
|
||||||
return User_settings_view($user_source, $locales, $themes, $buildup_start_date, $teardown_end_date,
|
return User_settings_view(
|
||||||
$enable_tshirt_size, $tshirt_sizes);
|
$user_source,
|
||||||
|
$locales,
|
||||||
|
$themes,
|
||||||
|
$buildup_start_date,
|
||||||
|
$teardown_end_date,
|
||||||
|
$enable_tshirt_size,
|
||||||
|
$tshirt_sizes
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ use Engelsystem\ShiftsFilter;
|
||||||
*/
|
*/
|
||||||
function shifts_title()
|
function shifts_title()
|
||||||
{
|
{
|
||||||
return _("Shifts");
|
return _('Shifts');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,9 +91,9 @@ function update_ShiftsFilter(ShiftsFilter $shiftsFilter, $user_shifts_admin, $da
|
||||||
*/
|
*/
|
||||||
function load_rooms()
|
function load_rooms()
|
||||||
{
|
{
|
||||||
$rooms = sql_select("SELECT `RID` AS `id`, `Name` AS `name` FROM `Room` WHERE `show`='Y' ORDER BY `Name`");
|
$rooms = sql_select('SELECT `RID` AS `id`, `Name` AS `name` FROM `Room` WHERE `show`=\'Y\' ORDER BY `Name`');
|
||||||
if (!$rooms || count($rooms) == 0) {
|
if (!$rooms || count($rooms) == 0) {
|
||||||
error(_("The administration has not configured any rooms yet."));
|
error(_('The administration has not configured any rooms yet.'));
|
||||||
redirect('?');
|
redirect('?');
|
||||||
}
|
}
|
||||||
return $rooms;
|
return $rooms;
|
||||||
|
@ -104,12 +104,13 @@ function load_rooms()
|
||||||
*/
|
*/
|
||||||
function load_days()
|
function load_days()
|
||||||
{
|
{
|
||||||
$days = sql_select_single_col("
|
$days = sql_select_single_col('
|
||||||
SELECT DISTINCT DATE(FROM_UNIXTIME(`start`)) AS `id`, DATE(FROM_UNIXTIME(`start`)) AS `name`
|
SELECT DISTINCT DATE(FROM_UNIXTIME(`start`)) AS `id`, DATE(FROM_UNIXTIME(`start`)) AS `name`
|
||||||
FROM `Shifts`
|
FROM `Shifts`
|
||||||
ORDER BY `start`");
|
ORDER BY `start`
|
||||||
|
');
|
||||||
if (count($days) == 0) {
|
if (count($days) == 0) {
|
||||||
error(_("The administration has not configured any shifts yet."));
|
error(_('The administration has not configured any shifts yet.'));
|
||||||
redirect('?');
|
redirect('?');
|
||||||
}
|
}
|
||||||
return $days;
|
return $days;
|
||||||
|
@ -122,8 +123,8 @@ function load_types()
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
if (sql_num_query("SELECT `id`, `name` FROM `AngelTypes` WHERE `restricted` = 0") == 0) {
|
if (sql_num_query('SELECT `id`, `name` FROM `AngelTypes` WHERE `restricted` = 0') == 0) {
|
||||||
error(_("The administration has not configured any angeltypes yet - or you are not subscribed to any angeltype."));
|
error(_('The administration has not configured any angeltypes yet - or you are not subscribed to any angeltype.'));
|
||||||
redirect('?');
|
redirect('?');
|
||||||
}
|
}
|
||||||
$types = sql_select("
|
$types = sql_select("
|
||||||
|
@ -146,7 +147,7 @@ function load_types()
|
||||||
ORDER BY `AngelTypes`.`name`
|
ORDER BY `AngelTypes`.`name`
|
||||||
");
|
");
|
||||||
if (empty($types)) {
|
if (empty($types)) {
|
||||||
return sql_select("SELECT `id`, `name` FROM `AngelTypes` WHERE `restricted` = 0");
|
return sql_select('SELECT `id`, `name` FROM `AngelTypes` WHERE `restricted` = 0');
|
||||||
}
|
}
|
||||||
return $types;
|
return $types;
|
||||||
}
|
}
|
||||||
|
@ -175,56 +176,56 @@ function view_user_shifts()
|
||||||
|
|
||||||
$shiftCalendarRenderer = shiftCalendarRendererByShiftFilter($shiftsFilter);
|
$shiftCalendarRenderer = shiftCalendarRendererByShiftFilter($shiftsFilter);
|
||||||
|
|
||||||
if ($user['api_key'] == "") {
|
if ($user['api_key'] == '') {
|
||||||
User_reset_api_key($user, false);
|
User_reset_api_key($user, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$filled = [
|
$filled = [
|
||||||
[
|
[
|
||||||
'id' => '1',
|
'id' => '1',
|
||||||
'name' => _("occupied")
|
'name' => _('occupied')
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'id' => '0',
|
'id' => '0',
|
||||||
'name' => _("free")
|
'name' => _('free')
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
$start_day = date("Y-m-d", $shiftsFilter->getStartTime());
|
$start_day = date('Y-m-d', $shiftsFilter->getStartTime());
|
||||||
$start_time = date("H:i", $shiftsFilter->getStartTime());
|
$start_time = date('H:i', $shiftsFilter->getStartTime());
|
||||||
$end_day = date("Y-m-d", $shiftsFilter->getEndTime());
|
$end_day = date('Y-m-d', $shiftsFilter->getEndTime());
|
||||||
$end_time = date("H:i", $shiftsFilter->getEndTime());
|
$end_time = date('H:i', $shiftsFilter->getEndTime());
|
||||||
|
|
||||||
return page([
|
return page([
|
||||||
div('col-md-12', [
|
div('col-md-12', [
|
||||||
msg(),
|
msg(),
|
||||||
template_render(__DIR__ . '/../../templates/user_shifts.html', [
|
template_render(__DIR__ . '/../../templates/user_shifts.html', [
|
||||||
'title' => shifts_title(),
|
'title' => shifts_title(),
|
||||||
'room_select' => make_select($rooms, $shiftsFilter->getRooms(), "rooms", _("Rooms")),
|
'room_select' => make_select($rooms, $shiftsFilter->getRooms(), 'rooms', _('Rooms')),
|
||||||
'start_select' => html_select_key("start_day", "start_day", array_combine($days, $days), $start_day),
|
'start_select' => html_select_key('start_day', 'start_day', array_combine($days, $days), $start_day),
|
||||||
'start_time' => $start_time,
|
'start_time' => $start_time,
|
||||||
'end_select' => html_select_key("end_day", "end_day", array_combine($days, $days), $end_day),
|
'end_select' => html_select_key('end_day', 'end_day', array_combine($days, $days), $end_day),
|
||||||
'end_time' => $end_time,
|
'end_time' => $end_time,
|
||||||
'type_select' => make_select(
|
'type_select' => make_select(
|
||||||
$types,
|
$types,
|
||||||
$shiftsFilter->getTypes(),
|
$shiftsFilter->getTypes(),
|
||||||
"types",
|
'types',
|
||||||
_("Angeltypes") . '<sup>1</sup>'
|
_('Angeltypes') . '<sup>1</sup>'
|
||||||
),
|
),
|
||||||
'filled_select' => make_select($filled, $shiftsFilter->getFilled(), "filled", _("Occupancy")),
|
'filled_select' => make_select($filled, $shiftsFilter->getFilled(), 'filled', _('Occupancy')),
|
||||||
'task_notice' =>
|
'task_notice' =>
|
||||||
'<sup>1</sup>'
|
'<sup>1</sup>'
|
||||||
. _("The tasks shown here are influenced by the angeltypes you joined already!")
|
. _('The tasks shown here are influenced by the angeltypes you joined already!')
|
||||||
. ' <a href="' . page_link_to('angeltypes') . '&action=about' . '">'
|
. ' <a href="' . page_link_to('angeltypes') . '&action=about' . '">'
|
||||||
. _("Description of the jobs.")
|
. _('Description of the jobs.')
|
||||||
. '</a>',
|
. '</a>',
|
||||||
'shifts_table' => msg() . $shiftCalendarRenderer->render(),
|
'shifts_table' => msg() . $shiftCalendarRenderer->render(),
|
||||||
'ical_text' => '<h2>' . _("iCal export") . '</h2><p>' . sprintf(
|
'ical_text' => '<h2>' . _('iCal export') . '</h2><p>' . sprintf(
|
||||||
_("Export of shown shifts. <a href=\"%s\">iCal format</a> or <a href=\"%s\">JSON format</a> available (please keep secret, otherwise <a href=\"%s\">reset the api key</a>)."),
|
_('Export of shown shifts. <a href="%s">iCal format</a> or <a href="%s">JSON format</a> available (please keep secret, otherwise <a href="%s">reset the api key</a>).'),
|
||||||
page_link_to_absolute('ical') . '&key=' . $user['api_key'],
|
page_link_to_absolute('ical') . '&key=' . $user['api_key'],
|
||||||
page_link_to_absolute('shifts_json_export') . '&key=' . $user['api_key'],
|
page_link_to_absolute('shifts_json_export') . '&key=' . $user['api_key'],
|
||||||
page_link_to('user_myshifts') . '&reset'
|
page_link_to('user_myshifts') . '&reset'
|
||||||
) . '</p>',
|
) . '</p>',
|
||||||
'filter' => _("Filter")
|
'filter' => _('Filter')
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
|
@ -236,7 +237,7 @@ function view_user_shifts()
|
||||||
*/
|
*/
|
||||||
function get_ids_from_array($array)
|
function get_ids_from_array($array)
|
||||||
{
|
{
|
||||||
return $array["id"];
|
return $array['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
function make_select($items, $selected, $name, $title = null)
|
function make_select($items, $selected, $name, $title = null)
|
||||||
|
@ -251,14 +252,14 @@ function make_select($items, $selected, $name, $title = null)
|
||||||
. '<label><input type="checkbox" name="' . $name . '[]" value="' . $i['id'] . '" '
|
. '<label><input type="checkbox" name="' . $name . '[]" value="' . $i['id'] . '" '
|
||||||
. (in_array($i['id'], $selected) ? ' checked="checked"' : '')
|
. (in_array($i['id'], $selected) ? ' checked="checked"' : '')
|
||||||
. ' > ' . $i['name'] . '</label>'
|
. ' > ' . $i['name'] . '</label>'
|
||||||
. (!isset($i['enabled']) || $i['enabled'] ? '' : glyph("lock"))
|
. (!isset($i['enabled']) || $i['enabled'] ? '' : glyph('lock'))
|
||||||
. '</div><br />';
|
. '</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([
|
$html .= buttons([
|
||||||
button("javascript: checkAll('selection_" . $name . "', true)", _("All"), ""),
|
button("javascript: checkAll('selection_" . $name . "', true)", _('All'), ''),
|
||||||
button("javascript: checkAll('selection_" . $name . "', false)", _("None"), "")
|
button("javascript: checkAll('selection_" . $name . "', false)", _('None'), '')
|
||||||
]);
|
]);
|
||||||
$html .= '</div>' . "\n";
|
$html .= '</div>' . "\n";
|
||||||
return $html;
|
return $html;
|
||||||
|
|
|
@ -37,8 +37,8 @@ function load_auth()
|
||||||
*/
|
*/
|
||||||
function generate_salt($length = 16)
|
function generate_salt($length = 16)
|
||||||
{
|
{
|
||||||
$alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
$alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
||||||
$salt = "";
|
$salt = '';
|
||||||
for ($i = 0; $i < $length; $i++) {
|
for ($i = 0; $i < $length; $i++) {
|
||||||
$salt .= $alphabet[rand(0, strlen($alphabet) - 1)];
|
$salt .= $alphabet[rand(0, strlen($alphabet) - 1)];
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,17 +112,17 @@ function form_checkboxes($name, $label, $items, $selected)
|
||||||
*/
|
*/
|
||||||
function form_multi_checkboxes($names, $label, $items, $selected, $disabled = [])
|
function form_multi_checkboxes($names, $label, $items, $selected, $disabled = [])
|
||||||
{
|
{
|
||||||
$html = "<table><thead><tr>";
|
$html = '<table><thead><tr>';
|
||||||
foreach ($names as $title) {
|
foreach ($names as $title) {
|
||||||
$html .= "<th>$title</th>";
|
$html .= '<th>' . $title . '</th>';
|
||||||
}
|
}
|
||||||
$html .= "</tr></thead><tbody>";
|
$html .= '</tr></thead><tbody>';
|
||||||
foreach ($items as $key => $item) {
|
foreach ($items as $key => $item) {
|
||||||
$html .= "<tr>";
|
$html .= '<tr>';
|
||||||
$dom_id = '';
|
$dom_id = '';
|
||||||
foreach ($names as $name => $title) {
|
foreach ($names as $name => $title) {
|
||||||
$dom_id = $name . '_' . $key;
|
$dom_id = $name . '_' . $key;
|
||||||
$sel = array_search($key, $selected[$name]) !== false ? ' checked="checked"' : "";
|
$sel = array_search($key, $selected[$name]) !== false ? ' checked="checked"' : '';
|
||||||
if (!empty($disabled) && !empty($disabled[$name]) && array_search($key, $disabled[$name]) !== false) {
|
if (!empty($disabled) && !empty($disabled[$name]) && array_search($key, $disabled[$name]) !== false) {
|
||||||
$sel .= ' disabled="disabled"';
|
$sel .= ' disabled="disabled"';
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ function form_multi_checkboxes($names, $label, $items, $selected, $disabled = []
|
||||||
}
|
}
|
||||||
$html .= '<td><label for="' . $dom_id . '">' . $item . '</label></td></tr>';
|
$html .= '<td><label for="' . $dom_id . '">' . $item . '</label></td></tr>';
|
||||||
}
|
}
|
||||||
$html .= "</tbody></table>";
|
$html .= '</tbody></table>';
|
||||||
return form_element($label, $html);
|
return form_element($label, $html);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,11 @@ function form_multi_checkboxes($names, $label, $items, $selected, $disabled = []
|
||||||
*/
|
*/
|
||||||
function form_checkbox($name, $label, $selected, $value = 'checked')
|
function form_checkbox($name, $label, $selected, $value = 'checked')
|
||||||
{
|
{
|
||||||
return '<div class="checkbox"><label><input type="checkbox" id="' . $name . '" name="' . $name . '" value="' . $value . '" ' . ($selected ? ' checked="checked"' : '') . ' /> ' . $label . '</label></div>';
|
return '<div class="checkbox"><label>'
|
||||||
|
. '<input type="checkbox" id="' . $name . '" name="' . $name . '" value="' . $value . '" '
|
||||||
|
. ($selected ? ' checked="checked"' : '') . ' /> '
|
||||||
|
. $label
|
||||||
|
. '</label></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -161,7 +165,11 @@ function form_checkbox($name, $label, $selected, $value = 'checked')
|
||||||
*/
|
*/
|
||||||
function form_radio($name, $label, $selected, $value)
|
function form_radio($name, $label, $selected, $value)
|
||||||
{
|
{
|
||||||
return '<div class="radio"><label><input type="radio" id="' . $name . '" name="' . $name . '" value="' . $value . '" ' . ($selected ? ' checked="checked"' : '') . ' /> ' . $label . '</label></div>';
|
return '<div class="radio">'
|
||||||
|
. '<label><input type="radio" id="' . $name . '" name="' . $name . '" value="' . $value . '" '
|
||||||
|
. ($selected ? ' checked="checked"' : '') . ' /> '
|
||||||
|
. $label
|
||||||
|
. '</label></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -171,12 +179,12 @@ function form_radio($name, $label, $selected, $value)
|
||||||
* @param string $text
|
* @param string $text
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function form_info($label, $text = "")
|
function form_info($label, $text = '')
|
||||||
{
|
{
|
||||||
if ($label == "") {
|
if ($label == '') {
|
||||||
return '<span class="help-block">' . glyph('info-sign') . $text . '</span>';
|
return '<span class="help-block">' . glyph('info-sign') . $text . '</span>';
|
||||||
}
|
}
|
||||||
if ($text == "") {
|
if ($text == '') {
|
||||||
return '<h4>' . $label . '</h4>';
|
return '<h4>' . $label . '</h4>';
|
||||||
}
|
}
|
||||||
return form_element($label, '<p class="form-control-static">' . $text . '</p>', '');
|
return form_element($label, '<p class="form-control-static">' . $text . '</p>', '');
|
||||||
|
@ -193,7 +201,7 @@ function form_submit($name, $label)
|
||||||
{
|
{
|
||||||
return form_element(
|
return form_element(
|
||||||
'<input class="btn btn-primary" type="submit" name="' . $name . '" value="' . $label . '" />',
|
'<input class="btn btn-primary" type="submit" name="' . $name . '" value="' . $label . '" />',
|
||||||
""
|
''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +219,8 @@ function form_text($name, $label, $value, $disabled = false)
|
||||||
$disabled = $disabled ? ' disabled="disabled"' : '';
|
$disabled = $disabled ? ' disabled="disabled"' : '';
|
||||||
return form_element(
|
return form_element(
|
||||||
$label,
|
$label,
|
||||||
'<input class="form-control" id="form_' . $name . '" type="text" name="' . $name . '" value="' . htmlspecialchars($value) . '" ' . $disabled . '/>',
|
'<input class="form-control" id="form_' . $name . '" type="text" name="' . $name
|
||||||
|
. '" value="' . htmlspecialchars($value) . '" ' . $disabled . '/>',
|
||||||
'form_' . $name
|
'form_' . $name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -229,7 +238,10 @@ function form_text_placeholder($name, $placeholder, $value, $disabled = false)
|
||||||
{
|
{
|
||||||
$disabled = $disabled ? ' disabled="disabled"' : '';
|
$disabled = $disabled ? ' disabled="disabled"' : '';
|
||||||
return form_element('',
|
return form_element('',
|
||||||
'<input class="form-control" id="form_' . $name . '" type="text" name="' . $name . '" value="' . htmlspecialchars($value) . '" placeholder="' . $placeholder . '" ' . $disabled . '/>');
|
'<input class="form-control" id="form_' . $name . '" type="text" name="' . $name
|
||||||
|
. '" value="' . htmlspecialchars($value) . '" placeholder="' . $placeholder
|
||||||
|
. '" ' . $disabled . '/>'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -246,7 +258,8 @@ function form_email($name, $label, $value, $disabled = false)
|
||||||
$disabled = $disabled ? ' disabled="disabled"' : '';
|
$disabled = $disabled ? ' disabled="disabled"' : '';
|
||||||
return form_element(
|
return form_element(
|
||||||
$label,
|
$label,
|
||||||
'<input class="form-control" id="form_' . $name . '" type="email" name="' . $name . '" value="' . htmlspecialchars($value) . '" ' . $disabled . '/>',
|
'<input class="form-control" id="form_' . $name . '" type="email" name="' . $name . '" value="'
|
||||||
|
. htmlspecialchars($value) . '" ' . $disabled . '/>',
|
||||||
'form_' . $name
|
'form_' . $name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -294,7 +307,8 @@ function form_password_placeholder($name, $placeholder, $disabled = false)
|
||||||
$disabled = $disabled ? ' disabled="disabled"' : '';
|
$disabled = $disabled ? ' disabled="disabled"' : '';
|
||||||
return form_element(
|
return form_element(
|
||||||
'',
|
'',
|
||||||
'<input class="form-control" id="form_' . $name . '" type="password" name="' . $name . '" value="" placeholder="' . $placeholder . '" ' . $disabled . '/>',
|
'<input class="form-control" id="form_' . $name . '" type="password" name="'
|
||||||
|
. $name . '" value="" placeholder="' . $placeholder . '" ' . $disabled . '/>',
|
||||||
'form_' . $name
|
'form_' . $name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -313,7 +327,8 @@ function form_textarea($name, $label, $value, $disabled = false)
|
||||||
$disabled = $disabled ? ' disabled="disabled"' : '';
|
$disabled = $disabled ? ' disabled="disabled"' : '';
|
||||||
return form_element(
|
return form_element(
|
||||||
$label,
|
$label,
|
||||||
'<textarea rows="5" class="form-control" id="form_' . $name . '" type="text" name="' . $name . '" ' . $disabled . '>' . $value . '</textarea>',
|
'<textarea rows="5" class="form-control" id="form_' . $name . '" type="text" name="'
|
||||||
|
. $name . '" ' . $disabled . '>' . $value . '</textarea>',
|
||||||
'form_' . $name
|
'form_' . $name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -340,7 +355,7 @@ function form_select($name, $label, $values, $selected)
|
||||||
* @param string $for
|
* @param string $for
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function form_element($label, $input, $for = "")
|
function form_element($label, $input, $for = '')
|
||||||
{
|
{
|
||||||
if ($label == '') {
|
if ($label == '') {
|
||||||
return '<div class="form-group">' . $input . '</div>';
|
return '<div class="form-group">' . $input . '</div>';
|
||||||
|
@ -356,7 +371,7 @@ function form_element($label, $input, $for = "")
|
||||||
* @param string $action
|
* @param string $action
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function form($elements, $action = "")
|
function form($elements, $action = '')
|
||||||
{
|
{
|
||||||
return '<form role="form" action="' . $action . '" enctype="multipart/form-data" method="post">' . join($elements) . '</form>';
|
return '<form role="form" action="' . $action . '" enctype="multipart/form-data" method="post">' . join($elements) . '</form>';
|
||||||
}
|
}
|
||||||
|
@ -367,11 +382,12 @@ function form($elements, $action = "")
|
||||||
* @param string $selected
|
* @param string $selected
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function html_options($name, $options, $selected = "")
|
function html_options($name, $options, $selected = '')
|
||||||
{
|
{
|
||||||
$html = "";
|
$html = '';
|
||||||
foreach ($options as $value => $label) {
|
foreach ($options as $value => $label) {
|
||||||
$html .= '<input type="radio"' . ($value == $selected ? ' checked="checked"' : '') . ' name="' . $name . '" value="' . $value . '"> ' . $label;
|
$html .= '<input type="radio"' . ($value == $selected ? ' checked="checked"' : '') . ' name="'
|
||||||
|
. $name . '" value="' . $value . '"> ' . $label;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
|
|
|
@ -5,9 +5,9 @@ use Engelsystem\UserHintsRenderer;
|
||||||
* @param string $page
|
* @param string $page
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function page_link_to($page = "")
|
function page_link_to($page = '')
|
||||||
{
|
{
|
||||||
if ($page == "") {
|
if ($page == '') {
|
||||||
return '?';
|
return '?';
|
||||||
}
|
}
|
||||||
return '?p=' . $page;
|
return '?p=' . $page;
|
||||||
|
@ -139,11 +139,11 @@ function make_navigation()
|
||||||
|
|
||||||
$menu = [];
|
$menu = [];
|
||||||
$pages = [
|
$pages = [
|
||||||
"news" => news_title(),
|
'news' => news_title(),
|
||||||
"user_meetings" => meetings_title(),
|
'user_meetings' => meetings_title(),
|
||||||
"user_shifts" => shifts_title(),
|
'user_shifts' => shifts_title(),
|
||||||
"angeltypes" => angeltypes_title(),
|
'angeltypes' => angeltypes_title(),
|
||||||
"user_questions" => questions_title()
|
'user_questions' => questions_title()
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($pages as $menu_page => $title) {
|
foreach ($pages as $menu_page => $title) {
|
||||||
|
@ -156,18 +156,18 @@ function make_navigation()
|
||||||
|
|
||||||
$admin_menu = [];
|
$admin_menu = [];
|
||||||
$admin_pages = [
|
$admin_pages = [
|
||||||
"admin_arrive" => admin_arrive_title(),
|
'admin_arrive' => admin_arrive_title(),
|
||||||
"admin_active" => admin_active_title(),
|
'admin_active' => admin_active_title(),
|
||||||
"admin_user" => admin_user_title(),
|
'admin_user' => admin_user_title(),
|
||||||
"admin_free" => admin_free_title(),
|
'admin_free' => admin_free_title(),
|
||||||
"admin_questions" => admin_questions_title(),
|
'admin_questions' => admin_questions_title(),
|
||||||
"shifttypes" => shifttypes_title(),
|
'shifttypes' => shifttypes_title(),
|
||||||
"admin_shifts" => admin_shifts_title(),
|
'admin_shifts' => admin_shifts_title(),
|
||||||
"admin_rooms" => admin_rooms_title(),
|
'admin_rooms' => admin_rooms_title(),
|
||||||
"admin_groups" => admin_groups_title(),
|
'admin_groups' => admin_groups_title(),
|
||||||
"admin_import" => admin_import_title(),
|
'admin_import' => admin_import_title(),
|
||||||
"admin_log" => admin_log_title(),
|
'admin_log' => admin_log_title(),
|
||||||
"admin_event_config" => event_config_title()
|
'admin_event_config' => event_config_title()
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($admin_pages as $menu_page => $title) {
|
foreach ($admin_pages as $menu_page => $title) {
|
||||||
|
@ -177,7 +177,7 @@ function make_navigation()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($admin_menu) > 0) {
|
if (count($admin_menu) > 0) {
|
||||||
$menu[] = toolbar_dropdown('', _("Admin"), $admin_menu);
|
$menu[] = toolbar_dropdown('', _('Admin'), $admin_menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
return toolbar($menu);
|
return toolbar($menu);
|
||||||
|
@ -200,7 +200,7 @@ function make_room_navigation($menu)
|
||||||
$rooms = Rooms();
|
$rooms = Rooms();
|
||||||
$room_menu = [];
|
$room_menu = [];
|
||||||
if (in_array('admin_rooms', $privileges)) {
|
if (in_array('admin_rooms', $privileges)) {
|
||||||
$room_menu[] = toolbar_item_link(page_link_to('admin_rooms'), 'list', _("Manage rooms"));
|
$room_menu[] = toolbar_item_link(page_link_to('admin_rooms'), 'list', _('Manage rooms'));
|
||||||
}
|
}
|
||||||
if (count($room_menu) > 0) {
|
if (count($room_menu) > 0) {
|
||||||
$room_menu[] = toolbar_item_divider();
|
$room_menu[] = toolbar_item_divider();
|
||||||
|
@ -209,7 +209,7 @@ function make_room_navigation($menu)
|
||||||
$room_menu[] = toolbar_item_link(room_link($room), 'map-marker', $room['Name']);
|
$room_menu[] = toolbar_item_link(room_link($room), 'map-marker', $room['Name']);
|
||||||
}
|
}
|
||||||
if (count($room_menu) > 0) {
|
if (count($room_menu) > 0) {
|
||||||
$menu[] = toolbar_dropdown('map-marker', _("Rooms"), $room_menu);
|
$menu[] = toolbar_dropdown('map-marker', _('Rooms'), $room_menu);
|
||||||
}
|
}
|
||||||
return $menu;
|
return $menu;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,8 @@ use Engelsystem\ValidationResult;
|
||||||
*/
|
*/
|
||||||
function check_request_datetime($date_name, $time_name, $allowed_days, $default_value)
|
function check_request_datetime($date_name, $time_name, $allowed_days, $default_value)
|
||||||
{
|
{
|
||||||
$time = date("H:i", $default_value);
|
$time = date('H:i', $default_value);
|
||||||
$day = date("Y-m-d", $default_value);
|
$day = date('Y-m-d', $default_value);
|
||||||
|
|
||||||
if (isset($_REQUEST[$time_name]) && preg_match('#^\d{1,2}:\d\d$#', trim($_REQUEST[$time_name]))) {
|
if (isset($_REQUEST[$time_name]) && preg_match('#^\d{1,2}:\d\d$#', trim($_REQUEST[$time_name]))) {
|
||||||
$time = trim($_REQUEST[$time_name]);
|
$time = trim($_REQUEST[$time_name]);
|
||||||
|
@ -26,7 +26,7 @@ function check_request_datetime($date_name, $time_name, $allowed_days, $default_
|
||||||
$day = $_REQUEST[$date_name];
|
$day = $_REQUEST[$date_name];
|
||||||
}
|
}
|
||||||
|
|
||||||
return parse_date("Y-m-d H:i", $day . " " . $time);
|
return parse_date('Y-m-d H:i', $day . ' ' . $time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,8 +52,8 @@ function parse_date($pattern, $value)
|
||||||
*/
|
*/
|
||||||
function redirect($url)
|
function redirect($url)
|
||||||
{
|
{
|
||||||
header("Location: " . $url, true, 302);
|
header('Location: ' . $url, true, 302);
|
||||||
raw_output("");
|
raw_output('');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -128,7 +128,7 @@ function check_request_date($name, $error_message = null, $null_allowed = false)
|
||||||
*/
|
*/
|
||||||
function check_date($input, $error_message = null, $null_allowed = false)
|
function check_date($input, $error_message = null, $null_allowed = false)
|
||||||
{
|
{
|
||||||
if ($tmp = parse_date("Y-m-d H:i", trim($input) . " 00:00")) {
|
if ($tmp = parse_date('Y-m-d H:i', trim($input) . ' 00:00')) {
|
||||||
return new ValidationResult(true, $tmp);
|
return new ValidationResult(true, $tmp);
|
||||||
}
|
}
|
||||||
if ($null_allowed) {
|
if ($null_allowed) {
|
||||||
|
@ -164,7 +164,7 @@ function strip_request_item($name, $default_value = null)
|
||||||
function test_request_int($name)
|
function test_request_int($name)
|
||||||
{
|
{
|
||||||
if (isset($_REQUEST[$name])) {
|
if (isset($_REQUEST[$name])) {
|
||||||
return preg_match("/^[0-9]*$/", $_REQUEST[$name]);
|
return preg_match('/^[0-9]*$/', $_REQUEST[$name]);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
* Liste der verfügbaren Themes
|
* Liste der verfügbaren Themes
|
||||||
*/
|
*/
|
||||||
$themes = [
|
$themes = [
|
||||||
'4' => "Engelsystem 33c3 (2016)",
|
'4' => 'Engelsystem 33c3 (2016)',
|
||||||
'3' => "Engelsystem 32c3 (2015)",
|
'3' => 'Engelsystem 32c3 (2015)',
|
||||||
"2" => "Engelsystem cccamp15",
|
'2' => 'Engelsystem cccamp15',
|
||||||
"0" => "Engelsystem light",
|
'0' => 'Engelsystem light',
|
||||||
"1" => "Engelsystem dark"
|
'1' => 'Engelsystem dark'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,7 +82,7 @@ function glyph_bool($boolean)
|
||||||
* @param string $dom_id
|
* @param string $dom_id
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function div($class, $content = [], $dom_id = "")
|
function div($class, $content = [], $dom_id = '')
|
||||||
{
|
{
|
||||||
if (is_array($content)) {
|
if (is_array($content)) {
|
||||||
$content = join("\n", $content);
|
$content = join("\n", $content);
|
||||||
|
@ -98,7 +98,7 @@ function div($class, $content = [], $dom_id = "")
|
||||||
*/
|
*/
|
||||||
function heading($content, $number = 1)
|
function heading($content, $number = 1)
|
||||||
{
|
{
|
||||||
return "<h" . $number . ">" . $content . "</h" . $number . ">";
|
return '<h' . $number . '>' . $content . '</h' . $number . '>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -294,7 +294,7 @@ function render_table($columns, $rows, $data = true)
|
||||||
* @param string $class
|
* @param string $class
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function button($href, $label, $class = "")
|
function button($href, $label, $class = '')
|
||||||
{
|
{
|
||||||
return '<a href="' . $href . '" class="btn btn-default ' . $class . '">' . $label . '</a>';
|
return '<a href="' . $href . '" class="btn btn-default ' . $class . '">' . $label . '</a>';
|
||||||
}
|
}
|
||||||
|
@ -307,7 +307,7 @@ function button($href, $label, $class = "")
|
||||||
* @param string $class
|
* @param string $class
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function button_glyph($href, $glyph, $class = "")
|
function button_glyph($href, $glyph, $class = '')
|
||||||
{
|
{
|
||||||
return button($href, glyph($glyph), $class);
|
return button($href, glyph($glyph), $class);
|
||||||
}
|
}
|
||||||
|
@ -345,12 +345,12 @@ function template_render($file, $data)
|
||||||
$template = file_get_contents($file);
|
$template = file_get_contents($file);
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
foreach ($data as $name => $content) {
|
foreach ($data as $name => $content) {
|
||||||
$template = str_replace("%" . $name . "%", $content, $template);
|
$template = str_replace('%' . $name . '%', $content, $template);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $template;
|
return $template;
|
||||||
}
|
}
|
||||||
engelsystem_error("Cannot find template file «" . $file . "».");
|
engelsystem_error('Cannot find template file «' . $file . '».');
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,17 +375,17 @@ function shorten($str, $length = 50)
|
||||||
*/
|
*/
|
||||||
function table_body($array)
|
function table_body($array)
|
||||||
{
|
{
|
||||||
$html = "";
|
$html = '';
|
||||||
foreach ($array as $line) {
|
foreach ($array as $line) {
|
||||||
$html .= "<tr>";
|
$html .= '<tr>';
|
||||||
if (is_array($line)) {
|
if (is_array($line)) {
|
||||||
foreach ($line as $td) {
|
foreach ($line as $td) {
|
||||||
$html .= "<td>" . $td . "</td>";
|
$html .= '<td>' . $td . '</td>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$html .= "<td>" . $line . "</td>";
|
$html .= '<td>' . $line . '</td>';
|
||||||
}
|
}
|
||||||
$html .= "</tr>";
|
$html .= '</tr>';
|
||||||
}
|
}
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
@ -396,26 +396,26 @@ function table_body($array)
|
||||||
*/
|
*/
|
||||||
function ReplaceSmilies($msg)
|
function ReplaceSmilies($msg)
|
||||||
{
|
{
|
||||||
$msg = str_replace(";o))", "<img src=\"pic/smiles/icon_redface.gif\">", $msg);
|
$msg = str_replace(';o))', '<img src="pic/smiles/icon_redface.gif">', $msg);
|
||||||
$msg = str_replace(":-))", "<img src=\"pic/smiles/icon_redface.gif\">", $msg);
|
$msg = str_replace(':-))', '<img src="pic/smiles/icon_redface.gif">', $msg);
|
||||||
$msg = str_replace(";o)", "<img src=\"pic/smiles/icon_wind.gif\">", $msg);
|
$msg = str_replace(';o)', '<img src="pic/smiles/icon_wind.gif">', $msg);
|
||||||
$msg = str_replace(":)", "<img src=\"pic/smiles/icon_smile.gif\">", $msg);
|
$msg = str_replace(':)', '<img src="pic/smiles/icon_smile.gif">', $msg);
|
||||||
$msg = str_replace(":-)", "<img src=\"pic/smiles/icon_smile.gif\">", $msg);
|
$msg = str_replace(':-)', '<img src="pic/smiles/icon_smile.gif">', $msg);
|
||||||
$msg = str_replace(":(", "<img src=\"pic/smiles/icon_sad.gif\">", $msg);
|
$msg = str_replace(':(', '<img src="pic/smiles/icon_sad.gif">', $msg);
|
||||||
$msg = str_replace(":-(", "<img src=\"pic/smiles/icon_sad.gif\">", $msg);
|
$msg = str_replace(':-(', '<img src="pic/smiles/icon_sad.gif">', $msg);
|
||||||
$msg = str_replace(":o(", "<img src=\"pic/smiles/icon_sad.gif\">", $msg);
|
$msg = str_replace(':o(', '<img src="pic/smiles/icon_sad.gif">', $msg);
|
||||||
$msg = str_replace(":o)", "<img src=\"pic/smiles/icon_lol.gif\">", $msg);
|
$msg = str_replace(':o)', '<img src="pic/smiles/icon_lol.gif">', $msg);
|
||||||
$msg = str_replace(";o(", "<img src=\"pic/smiles/icon_cry.gif\">", $msg);
|
$msg = str_replace(';o(', '<img src="pic/smiles/icon_cry.gif">', $msg);
|
||||||
$msg = str_replace(";(", "<img src=\"pic/smiles/icon_cry.gif\">", $msg);
|
$msg = str_replace(';(', '<img src="pic/smiles/icon_cry.gif">', $msg);
|
||||||
$msg = str_replace(";-(", "<img src=\"pic/smiles/icon_cry.gif\">", $msg);
|
$msg = str_replace(';-(', '<img src="pic/smiles/icon_cry.gif">', $msg);
|
||||||
$msg = str_replace("8)", "<img src=\"pic/smiles/icon_rolleyes.gif\">", $msg);
|
$msg = str_replace('8)', '<img src="pic/smiles/icon_rolleyes.gif">', $msg);
|
||||||
$msg = str_replace("8o)", "<img src=\"pic/smiles/icon_rolleyes.gif\">", $msg);
|
$msg = str_replace('8o)', '<img src="pic/smiles/icon_rolleyes.gif">', $msg);
|
||||||
$msg = str_replace(":P", "<img src=\"pic/smiles/icon_evil.gif\">", $msg);
|
$msg = str_replace(':P', '<img src="pic/smiles/icon_evil.gif">', $msg);
|
||||||
$msg = str_replace(":-P", "<img src=\"pic/smiles/icon_evil.gif\">", $msg);
|
$msg = str_replace(':-P', '<img src="pic/smiles/icon_evil.gif">', $msg);
|
||||||
$msg = str_replace(":oP", "<img src=\"pic/smiles/icon_evil.gif\">", $msg);
|
$msg = str_replace(':oP', '<img src="pic/smiles/icon_evil.gif">', $msg);
|
||||||
$msg = str_replace(";P", "<img src=\"pic/smiles/icon_mad.gif\">", $msg);
|
$msg = str_replace(';P', '<img src="pic/smiles/icon_mad.gif">', $msg);
|
||||||
$msg = str_replace(";oP", "<img src=\"pic/smiles/icon_mad.gif\">", $msg);
|
$msg = str_replace(';oP', '<img src="pic/smiles/icon_mad.gif">', $msg);
|
||||||
$msg = str_replace("?)", "<img src=\"pic/smiles/icon_question.gif\">", $msg);
|
$msg = str_replace('?)', '<img src="pic/smiles/icon_question.gif">', $msg);
|
||||||
|
|
||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,15 +26,15 @@ 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) {
|
||||||
return glyph('lock') . _("Unconfirmed");
|
return glyph('lock') . _('Unconfirmed');
|
||||||
} elseif ($user_angeltype['supporter']) {
|
} elseif ($user_angeltype['supporter']) {
|
||||||
return glyph_bool(true) . _("supporter");
|
return glyph_bool(true) . _('supporter');
|
||||||
}
|
}
|
||||||
return glyph_bool(true) . _("Member");
|
return glyph_bool(true) . _('Member');
|
||||||
} elseif ($user_angeltype['supporter']) {
|
} elseif ($user_angeltype['supporter']) {
|
||||||
return glyph_bool(true) . _("supporter");
|
return glyph_bool(true) . _('supporter');
|
||||||
}
|
}
|
||||||
return glyph_bool(true) . _("Member");
|
return glyph_bool(true) . _('Member');
|
||||||
}
|
}
|
||||||
return glyph_bool(false);
|
return glyph_bool(false);
|
||||||
}
|
}
|
||||||
|
@ -45,13 +45,13 @@ function AngelType_render_membership($user_angeltype)
|
||||||
*/
|
*/
|
||||||
function AngelType_delete_view($angeltype)
|
function AngelType_delete_view($angeltype)
|
||||||
{
|
{
|
||||||
return page_with_title(sprintf(_("Delete angeltype %s"), $angeltype['name']), [
|
return page_with_title(sprintf(_('Delete angeltype %s'), $angeltype['name']), [
|
||||||
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([
|
buttons([
|
||||||
button(page_link_to('angeltypes'), _("cancel"), 'cancel'),
|
button(page_link_to('angeltypes'), _('cancel'), 'cancel'),
|
||||||
button(
|
button(
|
||||||
page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'] . '&confirmed',
|
page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'] . '&confirmed',
|
||||||
_("delete"),
|
_('delete'),
|
||||||
'ok'
|
'ok'
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
@ -68,38 +68,38 @@ function AngelType_delete_view($angeltype)
|
||||||
function AngelType_edit_view($angeltype, $supporter_mode)
|
function AngelType_edit_view($angeltype, $supporter_mode)
|
||||||
{
|
{
|
||||||
$contact_info = AngelType_contact_info($angeltype);
|
$contact_info = AngelType_contact_info($angeltype);
|
||||||
return page_with_title(sprintf(_("Edit %s"), $angeltype['name']), [
|
return page_with_title(sprintf(_('Edit %s'), $angeltype['name']), [
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('angeltypes'), _("Angeltypes"), 'back')
|
button(page_link_to('angeltypes'), _('Angeltypes'), 'back')
|
||||||
]),
|
]),
|
||||||
msg(),
|
msg(),
|
||||||
form([
|
form([
|
||||||
$supporter_mode
|
$supporter_mode
|
||||||
? form_info(_("Name"), $angeltype['name'])
|
? form_info(_('Name'), $angeltype['name'])
|
||||||
: form_text('name', _("Name"), $angeltype['name']),
|
: form_text('name', _('Name'), $angeltype['name']),
|
||||||
$supporter_mode
|
$supporter_mode
|
||||||
? form_info(_("Restricted"), $angeltype['restricted'] ? _("Yes") : _("No"))
|
? form_info(_('Restricted'), $angeltype['restricted'] ? _('Yes') : _('No'))
|
||||||
: form_checkbox('restricted', _("Restricted"), $angeltype['restricted']),
|
: form_checkbox('restricted', _('Restricted'), $angeltype['restricted']),
|
||||||
$supporter_mode
|
$supporter_mode
|
||||||
? form_info(_("No Self Sign Up"), $angeltype['no_self_signup'] ? _("Yes") : _("No"))
|
? form_info(_('No Self Sign Up'), $angeltype['no_self_signup'] ? _('Yes') : _('No'))
|
||||||
: form_checkbox('no_self_signup', _("No Self Sign Up"), $angeltype['no_self_signup']),
|
: form_checkbox('no_self_signup', _('No Self Sign Up'), $angeltype['no_self_signup']),
|
||||||
$supporter_mode
|
$supporter_mode
|
||||||
? form_info(_("Requires driver license"), $angeltype['requires_driver_license'] ? _("Yes") : _("No"))
|
? form_info(_('Requires driver license'), $angeltype['requires_driver_license'] ? _('Yes') : _('No'))
|
||||||
: form_checkbox(
|
: form_checkbox(
|
||||||
'requires_driver_license',
|
'requires_driver_license',
|
||||||
_("Requires driver license"),
|
_('Requires driver license'),
|
||||||
$angeltype['requires_driver_license']
|
$angeltype['requires_driver_license']
|
||||||
),
|
),
|
||||||
//form_text('contact_name', _("Name"), $angeltype['contact_name']),
|
//form_text('contact_name', _('Name'), $angeltype['contact_name']),
|
||||||
//form_text('contact_dect', _("DECT"), $angeltype['contact_dect']),
|
//form_text('contact_dect', _('DECT'), $angeltype['contact_dect']),
|
||||||
//form_text('contact_email', _("E-Mail"), $angeltype['contact_email']),
|
//form_text('contact_email', _('E-Mail'), $angeltype['contact_email']),
|
||||||
form_info(
|
form_info(
|
||||||
"",
|
'',
|
||||||
_("Restricted angel types can only be used by an angel if enabled by a supporter (double opt-in).")
|
_('Restricted angel types can only be used by an angel if enabled by a supporter (double opt-in).')
|
||||||
),
|
),
|
||||||
form_textarea('description', _("Description"), $angeltype['description']),
|
form_textarea('description', _('Description'), $angeltype['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'))
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -118,45 +118,45 @@ function AngelType_edit_view($angeltype, $supporter_mode)
|
||||||
function AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $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')
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($angeltype['requires_driver_license']) {
|
if ($angeltype['requires_driver_license']) {
|
||||||
$buttons[] = button(user_driver_license_edit_link($user), glyph("road") . _("my driving license"));
|
$buttons[] = button(user_driver_license_edit_link($user), glyph('road') . _('my driving license'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_angeltype == null) {
|
if ($user_angeltype == null) {
|
||||||
$buttons[] = button(
|
$buttons[] = button(
|
||||||
page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'],
|
page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'],
|
||||||
_("join"),
|
_('join'),
|
||||||
'add'
|
'add'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if ($angeltype['requires_driver_license'] && $user_driver_license == null) {
|
if ($angeltype['requires_driver_license'] && $user_driver_license == null) {
|
||||||
error(_("This angeltype requires a driver license. Please enter your driver license information!"));
|
error(_('This angeltype requires a driver license. Please enter your driver license information!'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($angeltype['restricted'] && $user_angeltype['confirm_user_id'] == null) {
|
if ($angeltype['restricted'] && $user_angeltype['confirm_user_id'] == null) {
|
||||||
error(sprintf(
|
error(sprintf(
|
||||||
_("You are unconfirmed for this angeltype. Please go to the introduction for %s to get confirmed."),
|
_('You are unconfirmed for this angeltype. Please go to the introduction for %s to get confirmed.'),
|
||||||
$angeltype['name']
|
$angeltype['name']
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
$buttons[] = button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $user_angeltype['id'],
|
$buttons[] = button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $user_angeltype['id'],
|
||||||
_("leave"), 'cancel');
|
_('leave'), 'cancel');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($admin_angeltypes || $supporter) {
|
if ($admin_angeltypes || $supporter) {
|
||||||
$buttons[] = button(
|
$buttons[] = button(
|
||||||
page_link_to('angeltypes') . '&action=edit&angeltype_id=' . $angeltype['id'],
|
page_link_to('angeltypes') . '&action=edit&angeltype_id=' . $angeltype['id'],
|
||||||
_("edit"),
|
_('edit'),
|
||||||
'edit'
|
'edit'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($admin_angeltypes) {
|
if ($admin_angeltypes) {
|
||||||
$buttons[] = button(
|
$buttons[] = button(
|
||||||
page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'],
|
page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'],
|
||||||
_("delete"),
|
_('delete'),
|
||||||
'delete'
|
'delete'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -195,12 +195,12 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a
|
||||||
$member['actions'] = table_buttons([
|
$member['actions'] = table_buttons([
|
||||||
button(
|
button(
|
||||||
page_link_to('user_angeltypes') . '&action=confirm&user_angeltype_id=' . $member['user_angeltype_id'],
|
page_link_to('user_angeltypes') . '&action=confirm&user_angeltype_id=' . $member['user_angeltype_id'],
|
||||||
_("confirm"),
|
_('confirm'),
|
||||||
'btn-xs'
|
'btn-xs'
|
||||||
),
|
),
|
||||||
button(
|
button(
|
||||||
page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $member['user_angeltype_id'],
|
page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $member['user_angeltype_id'],
|
||||||
_("deny"),
|
_('deny'),
|
||||||
'btn-xs'
|
'btn-xs'
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
|
@ -210,7 +210,7 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a
|
||||||
$member['actions'] = table_buttons([
|
$member['actions'] = table_buttons([
|
||||||
button(
|
button(
|
||||||
page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $member['user_angeltype_id'] . '&supporter=0',
|
page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $member['user_angeltype_id'] . '&supporter=0',
|
||||||
_("Remove supporter rights"),
|
_('Remove supporter rights'),
|
||||||
'btn-xs'
|
'btn-xs'
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
|
@ -223,11 +223,11 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a
|
||||||
$member['actions'] = table_buttons([
|
$member['actions'] = table_buttons([
|
||||||
$admin_angeltypes
|
$admin_angeltypes
|
||||||
? button(page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $member['user_angeltype_id'] . '&supporter=1',
|
? button(page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $member['user_angeltype_id'] . '&supporter=1',
|
||||||
_("Add supporter rights"), 'btn-xs')
|
_('Add supporter rights'), 'btn-xs')
|
||||||
: '',
|
: '',
|
||||||
button(
|
button(
|
||||||
page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $member['user_angeltype_id'],
|
page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $member['user_angeltype_id'],
|
||||||
_("remove"),
|
_('remove'),
|
||||||
'btn-xs'
|
'btn-xs'
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
|
@ -255,21 +255,21 @@ function AngelType_view_table_headers($angeltype, $supporter, $admin_angeltypes)
|
||||||
{
|
{
|
||||||
if ($angeltype['requires_driver_license'] && ($supporter || $admin_angeltypes)) {
|
if ($angeltype['requires_driver_license'] && ($supporter || $admin_angeltypes)) {
|
||||||
return [
|
return [
|
||||||
'Nick' => _("Nick"),
|
'Nick' => _('Nick'),
|
||||||
'DECT' => _("DECT"),
|
'DECT' => _('DECT'),
|
||||||
'wants_to_drive' => _("Driver"),
|
'wants_to_drive' => _('Driver'),
|
||||||
'has_car' => _("Has car"),
|
'has_car' => _('Has car'),
|
||||||
'has_license_car' => _("Car"),
|
'has_license_car' => _('Car'),
|
||||||
'has_license_3_5t_transporter' => _("3,5t Transporter"),
|
'has_license_3_5t_transporter' => _('3,5t Transporter'),
|
||||||
'has_license_7_5t_truck' => _("7,5t Truck"),
|
'has_license_7_5t_truck' => _('7,5t Truck'),
|
||||||
'has_license_12_5t_truck' => _("12,5t Truck"),
|
'has_license_12_5t_truck' => _('12,5t Truck'),
|
||||||
'has_license_forklift' => _("Forklift"),
|
'has_license_forklift' => _('Forklift'),
|
||||||
'actions' => ''
|
'actions' => ''
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
'Nick' => _("Nick"),
|
'Nick' => _('Nick'),
|
||||||
'DECT' => _("DECT"),
|
'DECT' => _('DECT'),
|
||||||
'actions' => ''
|
'actions' => ''
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -302,9 +302,9 @@ function AngelType_view(
|
||||||
msg()
|
msg()
|
||||||
];
|
];
|
||||||
|
|
||||||
$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>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ function AngelType_view(
|
||||||
$table_headers = AngelType_view_table_headers($angeltype, $supporter, $admin_angeltypes);
|
$table_headers = AngelType_view_table_headers($angeltype, $supporter, $admin_angeltypes);
|
||||||
|
|
||||||
if (count($supporters) > 0) {
|
if (count($supporters) > 0) {
|
||||||
$page[] = '<h3>' . _("supporters") . '</h3>';
|
$page[] = '<h3>' . _('supporters') . '</h3>';
|
||||||
$page[] = table($table_headers, $supporters);
|
$page[] = table($table_headers, $supporters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,32 +337,32 @@ function AngelType_view(
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$page[] = '<h3>' . _("Members") . '</h3>';
|
$page[] = '<h3>' . _('Members') . '</h3>';
|
||||||
if ($admin_user_angeltypes) {
|
if ($admin_user_angeltypes) {
|
||||||
$page[] = buttons([
|
$page[] = buttons([
|
||||||
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($table_headers, $members_confirmed);
|
$page[] = table($table_headers, $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([
|
$page[] = buttons([
|
||||||
button(
|
button(
|
||||||
page_link_to('user_angeltypes') . '&action=confirm_all&angeltype_id=' . $angeltype['id'],
|
page_link_to('user_angeltypes') . '&action=confirm_all&angeltype_id=' . $angeltype['id'],
|
||||||
_("confirm all"),
|
_('confirm all'),
|
||||||
'ok'
|
'ok'
|
||||||
),
|
),
|
||||||
button(
|
button(
|
||||||
page_link_to('user_angeltypes') . '&action=delete_all&angeltype_id=' . $angeltype['id'],
|
page_link_to('user_angeltypes') . '&action=delete_all&angeltype_id=' . $angeltype['id'],
|
||||||
_("deny all"),
|
_('deny all'),
|
||||||
'cancel'
|
'cancel'
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
$page[] = table($table_headers, $members_unconfirmed);
|
$page[] = table($table_headers, $members_unconfirmed);
|
||||||
}
|
}
|
||||||
|
|
||||||
return page_with_title(sprintf(_("Team %s"), $angeltype['name']), $page);
|
return page_with_title(sprintf(_('Team %s'), $angeltype['name']), $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -377,15 +377,15 @@ function AngelTypes_list_view($angeltypes, $admin_angeltypes)
|
||||||
return page_with_title(angeltypes_title(), [
|
return page_with_title(angeltypes_title(), [
|
||||||
msg(),
|
msg(),
|
||||||
buttons([
|
buttons([
|
||||||
$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([
|
table([
|
||||||
'name' => _("Name"),
|
'name' => _('Name'),
|
||||||
'restricted' => glyph('lock') . _("Restricted"),
|
'restricted' => glyph('lock') . _('Restricted'),
|
||||||
'no_self_signup' => glyph('share') . _("Self Sign Up Allowed"),
|
'no_self_signup' => glyph('share') . _('Self Sign Up Allowed'),
|
||||||
'membership' => _("Membership"),
|
'membership' => _('Membership'),
|
||||||
'actions' => ""
|
'actions' => ''
|
||||||
], $angeltypes)
|
], $angeltypes)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -407,13 +407,13 @@ function AngelTypes_about_view_angeltype($angeltype)
|
||||||
if ($angeltype['user_angeltype_id'] != null) {
|
if ($angeltype['user_angeltype_id'] != null) {
|
||||||
$buttons[] = button(
|
$buttons[] = button(
|
||||||
page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'],
|
page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'],
|
||||||
_("leave"),
|
_('leave'),
|
||||||
'cancel'
|
'cancel'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$buttons[] = button(
|
$buttons[] = button(
|
||||||
page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'],
|
page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'],
|
||||||
_("join"),
|
_('join'),
|
||||||
'add'
|
'add'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -422,11 +422,11 @@ function AngelTypes_about_view_angeltype($angeltype)
|
||||||
|
|
||||||
if ($angeltype['restricted']) {
|
if ($angeltype['restricted']) {
|
||||||
$html .= info(
|
$html .= info(
|
||||||
_("This angeltype is restricted by double-opt-in by a team supporter. Please show up at the according introduction meetings."),
|
_('This angeltype is restricted by double-opt-in by a team supporter. Please show up at the according introduction meetings.'),
|
||||||
true
|
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>';
|
||||||
}
|
}
|
||||||
$html .= '<hr />';
|
$html .= '<hr />';
|
||||||
|
@ -450,14 +450,14 @@ function AngelTypes_about_view($angeltypes, $user_logged_in)
|
||||||
!$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"), "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>',
|
'<p>' . _('Here is the list of teams and their tasks. If you have questions, read the FAQ.') . '</p>',
|
||||||
'<hr />'
|
'<hr />'
|
||||||
];
|
];
|
||||||
foreach ($angeltypes as $angeltype) {
|
foreach ($angeltypes as $angeltype) {
|
||||||
$content[] = AngelTypes_about_view_angeltype($angeltype);
|
$content[] = AngelTypes_about_view_angeltype($angeltype);
|
||||||
}
|
}
|
||||||
|
|
||||||
return page_with_title(_("Teams/Job description"), $content);
|
return page_with_title(_('Teams/Job description'), $content);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ function EventConfig_countdown_page($event_config)
|
||||||
{
|
{
|
||||||
if ($event_config == null) {
|
if ($event_config == null) {
|
||||||
return div('col-md-12 text-center', [
|
return div('col-md-12 text-center', [
|
||||||
heading(sprintf(_("Welcome to the %s!"), '<span class="icon-icon_angel"></span> ENGELSYSTEM'), 2)
|
heading(sprintf(_('Welcome to the %s!'), '<span class="icon-icon_angel"></span> ENGELSYSTEM'), 2)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ function EventConfig_countdown_page($event_config)
|
||||||
if ($event_config['event_name'] != null) {
|
if ($event_config['event_name'] != null) {
|
||||||
$elements[] = div('col-sm-12 text-center', [
|
$elements[] = div('col-sm-12 text-center', [
|
||||||
heading(sprintf(
|
heading(sprintf(
|
||||||
_("Welcome to the %s!"),
|
_('Welcome to the %s!'),
|
||||||
$event_config['event_name'] . ' <span class="icon-icon_angel"></span> ENGELSYSTEM'
|
$event_config['event_name'] . ' <span class="icon-icon_angel"></span> ENGELSYSTEM'
|
||||||
), 2)
|
), 2)
|
||||||
]);
|
]);
|
||||||
|
@ -27,37 +27,37 @@ function EventConfig_countdown_page($event_config)
|
||||||
|
|
||||||
if ($event_config['buildup_start_date'] != null && time() < $event_config['buildup_start_date']) {
|
if ($event_config['buildup_start_date'] != null && time() < $event_config['buildup_start_date']) {
|
||||||
$elements[] = div('col-sm-3 text-center hidden-xs', [
|
$elements[] = div('col-sm-3 text-center hidden-xs', [
|
||||||
heading(_("Buildup starts"), 4),
|
heading(_('Buildup starts'), 4),
|
||||||
'<span class="moment-countdown text-big" data-timestamp="' . $event_config['buildup_start_date'] . '">%c</span>',
|
'<span class="moment-countdown text-big" data-timestamp="' . $event_config['buildup_start_date'] . '">%c</span>',
|
||||||
'<small>' . date(_("Y-m-d"), $event_config['buildup_start_date']) . '</small>'
|
'<small>' . date(_('Y-m-d'), $event_config['buildup_start_date']) . '</small>'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($event_config['event_start_date'] != null && time() < $event_config['event_start_date']) {
|
if ($event_config['event_start_date'] != null && time() < $event_config['event_start_date']) {
|
||||||
$elements[] = div('col-sm-3 text-center hidden-xs', [
|
$elements[] = div('col-sm-3 text-center hidden-xs', [
|
||||||
heading(_("Event starts"), 4),
|
heading(_('Event starts'), 4),
|
||||||
'<span class="moment-countdown text-big" data-timestamp="' . $event_config['event_start_date'] . '">%c</span>',
|
'<span class="moment-countdown text-big" data-timestamp="' . $event_config['event_start_date'] . '">%c</span>',
|
||||||
'<small>' . date(_("Y-m-d"), $event_config['event_start_date']) . '</small>'
|
'<small>' . date(_('Y-m-d'), $event_config['event_start_date']) . '</small>'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($event_config['event_end_date'] != null && time() < $event_config['event_end_date']) {
|
if ($event_config['event_end_date'] != null && time() < $event_config['event_end_date']) {
|
||||||
$elements[] = div('col-sm-3 text-center hidden-xs', [
|
$elements[] = div('col-sm-3 text-center hidden-xs', [
|
||||||
heading(_("Event ends"), 4),
|
heading(_('Event ends'), 4),
|
||||||
'<span class="moment-countdown text-big" data-timestamp="' . $event_config['event_end_date'] . '">%c</span>',
|
'<span class="moment-countdown text-big" data-timestamp="' . $event_config['event_end_date'] . '">%c</span>',
|
||||||
'<small>' . date(_("Y-m-d"), $event_config['event_end_date']) . '</small>'
|
'<small>' . date(_('Y-m-d'), $event_config['event_end_date']) . '</small>'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($event_config['teardown_end_date'] != null && time() < $event_config['teardown_end_date']) {
|
if ($event_config['teardown_end_date'] != null && time() < $event_config['teardown_end_date']) {
|
||||||
$elements[] = div('col-sm-3 text-center hidden-xs', [
|
$elements[] = div('col-sm-3 text-center hidden-xs', [
|
||||||
heading(_("Teardown ends"), 4),
|
heading(_('Teardown ends'), 4),
|
||||||
'<span class="moment-countdown text-big" data-timestamp="' . $event_config['teardown_end_date'] . '">%c</span>',
|
'<span class="moment-countdown text-big" data-timestamp="' . $event_config['teardown_end_date'] . '">%c</span>',
|
||||||
'<small>' . date(_("Y-m-d"), $event_config['teardown_end_date']) . '</small>'
|
'<small>' . date(_('Y-m-d'), $event_config['teardown_end_date']) . '</small>'
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return join("", $elements);
|
return join('', $elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,33 +69,33 @@ function EventConfig_countdown_page($event_config)
|
||||||
function EventConfig_info($event_config)
|
function EventConfig_info($event_config)
|
||||||
{
|
{
|
||||||
if ($event_config == null) {
|
if ($event_config == null) {
|
||||||
return "";
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event name, start+end date are set
|
// Event name, start+end date are set
|
||||||
if ($event_config['event_name'] != null && $event_config['event_start_date'] != null && $event_config['event_end_date'] != null) {
|
if ($event_config['event_name'] != null && $event_config['event_start_date'] != null && $event_config['event_end_date'] != null) {
|
||||||
return sprintf(
|
return sprintf(
|
||||||
_("%s, from %s to %s"),
|
_('%s, from %s to %s'),
|
||||||
$event_config['event_name'],
|
$event_config['event_name'],
|
||||||
date(_("Y-m-d"), $event_config['event_start_date']),
|
date(_('Y-m-d'), $event_config['event_start_date']),
|
||||||
date(_("Y-m-d"), $event_config['event_end_date'])
|
date(_('Y-m-d'), $event_config['event_end_date'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event name, start date are set
|
// Event name, start date are set
|
||||||
if ($event_config['event_name'] != null && $event_config['event_start_date'] != null) {
|
if ($event_config['event_name'] != null && $event_config['event_start_date'] != null) {
|
||||||
return sprintf(
|
return sprintf(
|
||||||
_("%s, starting %s"), $event_config['event_name'],
|
_('%s, starting %s'), $event_config['event_name'],
|
||||||
date(_("Y-m-d"), $event_config['event_start_date'])
|
date(_('Y-m-d'), $event_config['event_start_date'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event start+end date are set
|
// Event start+end date are set
|
||||||
if ($event_config['event_start_date'] != null && $event_config['event_end_date'] != null) {
|
if ($event_config['event_start_date'] != null && $event_config['event_end_date'] != null) {
|
||||||
return sprintf(
|
return sprintf(
|
||||||
_("Event from %s to %s"),
|
_('Event from %s to %s'),
|
||||||
date(_("Y-m-d"), $event_config['event_start_date']),
|
date(_('Y-m-d'), $event_config['event_start_date']),
|
||||||
date(_("Y-m-d"), $event_config['event_end_date'])
|
date(_('Y-m-d'), $event_config['event_end_date'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ function EventConfig_info($event_config)
|
||||||
return sprintf($event_config['event_name']);
|
return sprintf($event_config['event_name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -131,23 +131,23 @@ function EventConfig_edit_view(
|
||||||
form([
|
form([
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-md-6', [
|
div('col-md-6', [
|
||||||
form_text('event_name', _("Event Name"), $event_name),
|
form_text('event_name', _('Event Name'), $event_name),
|
||||||
form_info('', _("Event Name is shown on the start page.")),
|
form_info('', _('Event Name is shown on the start page.')),
|
||||||
form_textarea('event_welcome_msg', _("Event Welcome Message"), $event_welcome_msg),
|
form_textarea('event_welcome_msg', _('Event Welcome Message'), $event_welcome_msg),
|
||||||
form_info('', _("Welcome message is shown after successful registration. You can use markdown."))
|
form_info('', _('Welcome message is shown after successful registration. You can use markdown.'))
|
||||||
]),
|
]),
|
||||||
div('col-md-3 col-xs-6', [
|
div('col-md-3 col-xs-6', [
|
||||||
form_date('buildup_start_date', _("Buildup date"), $buildup_start_date),
|
form_date('buildup_start_date', _('Buildup date'), $buildup_start_date),
|
||||||
form_date('event_start_date', _("Event start date"), $event_start_date)
|
form_date('event_start_date', _('Event start date'), $event_start_date)
|
||||||
]),
|
]),
|
||||||
div('col-md-3 col-xs-6', [
|
div('col-md-3 col-xs-6', [
|
||||||
form_date('teardown_end_date', _("Teardown end date"), $teardown_end_date),
|
form_date('teardown_end_date', _('Teardown end date'), $teardown_end_date),
|
||||||
form_date('event_end_date', _("Event end date"), $event_end_date)
|
form_date('event_end_date', _('Event end date'), $event_end_date)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-md-6', [
|
div('col-md-6', [
|
||||||
form_submit('submit', _("Save"))
|
form_submit('submit', _('Save'))
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
|
@ -9,34 +9,34 @@
|
||||||
function Questions_view($open_questions, $answered_questions, $ask_action)
|
function Questions_view($open_questions, $answered_questions, $ask_action)
|
||||||
{
|
{
|
||||||
foreach ($open_questions as &$question) {
|
foreach ($open_questions as &$question) {
|
||||||
$question['actions'] = '<a href="' . page_link_to("user_questions") . '&action=delete&id=' . $question['QID'] . '">' . _("delete") . '</a>';
|
$question['actions'] = '<a href="' . page_link_to('user_questions') . '&action=delete&id=' . $question['QID'] . '">' . _('delete') . '</a>';
|
||||||
$question['Question'] = str_replace("\n", '<br />', $question['Question']);
|
$question['Question'] = str_replace("\n", '<br />', $question['Question']);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($answered_questions as &$question) {
|
foreach ($answered_questions as &$question) {
|
||||||
$question['Question'] = str_replace("\n", '<br />', $question['Question']);
|
$question['Question'] = str_replace("\n", '<br />', $question['Question']);
|
||||||
$question['Answer'] = str_replace("\n", '<br />', $question['Answer']);
|
$question['Answer'] = str_replace("\n", '<br />', $question['Answer']);
|
||||||
$question['actions'] = '<a href="' . page_link_to("user_questions") . '&action=delete&id=' . $question['QID'] . '">' . _("delete") . '</a>';
|
$question['actions'] = '<a href="' . page_link_to('user_questions') . '&action=delete&id=' . $question['QID'] . '">' . _('delete') . '</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return page_with_title(questions_title(), [
|
return page_with_title(questions_title(), [
|
||||||
msg(),
|
msg(),
|
||||||
heading(_("Open questions"), 2),
|
heading(_('Open questions'), 2),
|
||||||
table([
|
table([
|
||||||
'Question' => _("Question"),
|
'Question' => _('Question'),
|
||||||
'actions' => ""
|
'actions' => ''
|
||||||
], $open_questions),
|
], $open_questions),
|
||||||
heading(_("Answered questions"), 2),
|
heading(_('Answered questions'), 2),
|
||||||
table([
|
table([
|
||||||
'Question' => _("Question"),
|
'Question' => _('Question'),
|
||||||
'answer_user' => _("Answered by"),
|
'answer_user' => _('Answered by'),
|
||||||
'Answer' => _("Answer"),
|
'Answer' => _('Answer'),
|
||||||
'actions' => ""
|
'actions' => ''
|
||||||
], $answered_questions),
|
], $answered_questions),
|
||||||
heading(_("Ask the Heaven"), 2),
|
heading(_('Ask the Heaven'), 2),
|
||||||
form([
|
form([
|
||||||
form_textarea('question', _("Your Question:"), ""),
|
form_textarea('question', _('Your Question:'), ''),
|
||||||
form_submit('submit', _("Save"))
|
form_submit('submit', _('Save'))
|
||||||
], $ask_action)
|
], $ask_action)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ namespace Engelsystem;
|
||||||
|
|
||||||
class ShiftCalendarRenderer
|
class ShiftCalendarRenderer
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 15m * 60s/m = 900s
|
* 15m * 60s/m = 900s
|
||||||
*/
|
*/
|
||||||
|
@ -102,7 +101,7 @@ class ShiftCalendarRenderer
|
||||||
if ($shift_added == false) {
|
if ($shift_added == false) {
|
||||||
$newLane = new ShiftCalendarLane($header, $this->getFirstBlockStartTime(), $this->getBlocksPerSlot());
|
$newLane = new ShiftCalendarLane($header, $this->getFirstBlockStartTime(), $this->getBlocksPerSlot());
|
||||||
if (!$newLane->addShift($shift)) {
|
if (!$newLane->addShift($shift)) {
|
||||||
engelsystem_error("Unable to add shift to new lane.");
|
engelsystem_error('Unable to add shift to new lane.');
|
||||||
}
|
}
|
||||||
$lanes[$room_id][] = $newLane;
|
$lanes[$room_id][] = $newLane;
|
||||||
}
|
}
|
||||||
|
@ -161,7 +160,7 @@ class ShiftCalendarRenderer
|
||||||
*/
|
*/
|
||||||
private function renderShiftLanes()
|
private function renderShiftLanes()
|
||||||
{
|
{
|
||||||
$html = "";
|
$html = '';
|
||||||
foreach ($this->lanes as $room_lanes) {
|
foreach ($this->lanes as $room_lanes) {
|
||||||
foreach ($room_lanes as $lane) {
|
foreach ($room_lanes as $lane) {
|
||||||
$html .= $this->renderLane($lane);
|
$html .= $this->renderLane($lane);
|
||||||
|
@ -182,7 +181,7 @@ class ShiftCalendarRenderer
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
$shift_renderer = new ShiftCalendarShiftRenderer();
|
$shift_renderer = new ShiftCalendarShiftRenderer();
|
||||||
$html = "";
|
$html = '';
|
||||||
$rendered_until = $this->getFirstBlockStartTime();
|
$rendered_until = $this->getFirstBlockStartTime();
|
||||||
|
|
||||||
foreach ($lane->getShifts() as $shift) {
|
foreach ($lane->getShifts() as $shift) {
|
||||||
|
@ -248,7 +247,7 @@ class ShiftCalendarRenderer
|
||||||
{
|
{
|
||||||
$time_slot = [
|
$time_slot = [
|
||||||
div('header', [
|
div('header', [
|
||||||
_("Time")
|
_('Time')
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
for ($block = 0; $block < $this->getBlocksPerSlot(); $block++) {
|
for ($block = 0; $block < $this->getBlocksPerSlot(); $block++) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ class ShiftCalendarShiftRenderer
|
||||||
*/
|
*/
|
||||||
public function render($shift, $needed_angeltypes, $shift_entries, $user)
|
public function render($shift, $needed_angeltypes, $shift_entries, $user)
|
||||||
{
|
{
|
||||||
$info_text = "";
|
$info_text = '';
|
||||||
if ($shift['title'] != '') {
|
if ($shift['title'] != '') {
|
||||||
$info_text = glyph('info-sign') . $shift['title'] . '<br>';
|
$info_text = glyph('info-sign') . $shift['title'] . '<br>';
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ class ShiftCalendarShiftRenderer
|
||||||
|
|
||||||
$class = $this->classForSignupState($shift_signup_state);
|
$class = $this->classForSignupState($shift_signup_state);
|
||||||
|
|
||||||
$blocks = ceil(($shift["end"] - $shift["start"]) / ShiftCalendarRenderer::SECONDS_PER_ROW);
|
$blocks = ceil(($shift['end'] - $shift['start']) / ShiftCalendarRenderer::SECONDS_PER_ROW);
|
||||||
$blocks = max(1, $blocks);
|
$blocks = max(1, $blocks);
|
||||||
return [
|
return [
|
||||||
$blocks,
|
$blocks,
|
||||||
|
@ -100,7 +100,7 @@ class ShiftCalendarShiftRenderer
|
||||||
$shift_entries_filtered[$shift_entry['TID']][] = $shift_entry;
|
$shift_entries_filtered[$shift_entry['TID']][] = $shift_entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = "";
|
$html = '';
|
||||||
/** @var ShiftSignupState $shift_signup_state */
|
/** @var ShiftSignupState $shift_signup_state */
|
||||||
$shift_signup_state = null;
|
$shift_signup_state = null;
|
||||||
foreach ($needed_angeltypes as $angeltype) {
|
foreach ($needed_angeltypes as $angeltype) {
|
||||||
|
@ -126,7 +126,7 @@ class ShiftCalendarShiftRenderer
|
||||||
if (in_array('user_shifts_admin', $privileges)) {
|
if (in_array('user_shifts_admin', $privileges)) {
|
||||||
$html .= '<li class="list-group-item">' . button(
|
$html .= '<li class="list-group-item">' . button(
|
||||||
page_link_to('user_shifts') . '&shift_id=' . $shift['SID'],
|
page_link_to('user_shifts') . '&shift_id=' . $shift['SID'],
|
||||||
_("Add more angels"),
|
_('Add more angels'),
|
||||||
'btn-xs'
|
'btn-xs'
|
||||||
) . '</li>';
|
) . '</li>';
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ class ShiftCalendarShiftRenderer
|
||||||
}
|
}
|
||||||
return [
|
return [
|
||||||
$shift_signup_state,
|
$shift_signup_state,
|
||||||
""
|
''
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,12 +156,12 @@ class ShiftCalendarShiftRenderer
|
||||||
{
|
{
|
||||||
$entry_list = [];
|
$entry_list = [];
|
||||||
foreach ($shift_entries as $entry) {
|
foreach ($shift_entries as $entry) {
|
||||||
$style = $entry['freeloaded'] ? " text-decoration: line-through;" : '';
|
$style = $entry['freeloaded'] ? ' text-decoration: line-through;' : '';
|
||||||
$entry_list[] = "<span style=\"$style\">" . User_Nick_render($entry) . "</span>";
|
$entry_list[] = '<span style="' . $style . '">' . User_Nick_render($entry) . '</span>';
|
||||||
}
|
}
|
||||||
$shift_signup_state = Shift_signup_allowed($user, $shift, $angeltype, null, null, $angeltype, $shift_entries);
|
$shift_signup_state = Shift_signup_allowed($user, $shift, $angeltype, null, null, $angeltype, $shift_entries);
|
||||||
$inner_text = sprintf(
|
$inner_text = sprintf(
|
||||||
ngettext("%d helper needed", "%d helpers needed", $shift_signup_state->getFreeEntries()),
|
ngettext('%d helper needed', '%d helpers needed', $shift_signup_state->getFreeEntries()),
|
||||||
$shift_signup_state->getFreeEntries()
|
$shift_signup_state->getFreeEntries()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ class ShiftCalendarShiftRenderer
|
||||||
|
|
||||||
$shifts_row = '<li class="list-group-item">';
|
$shifts_row = '<li class="list-group-item">';
|
||||||
$shifts_row .= '<strong>' . AngelType_name_render($angeltype) . ':</strong> ';
|
$shifts_row .= '<strong>' . AngelType_name_render($angeltype) . ':</strong> ';
|
||||||
$shifts_row .= join(", ", $entry_list);
|
$shifts_row .= join(', ', $entry_list);
|
||||||
$shifts_row .= '</li>';
|
$shifts_row .= '</li>';
|
||||||
return [
|
return [
|
||||||
$shift_signup_state,
|
$shift_signup_state,
|
||||||
|
@ -229,7 +229,7 @@ class ShiftCalendarShiftRenderer
|
||||||
{
|
{
|
||||||
global $privileges;
|
global $privileges;
|
||||||
|
|
||||||
$header_buttons = "";
|
$header_buttons = '';
|
||||||
if (in_array('admin_shifts', $privileges)) {
|
if (in_array('admin_shifts', $privileges)) {
|
||||||
$header_buttons = '<div class="pull-right">' . table_buttons([
|
$header_buttons = '<div class="pull-right">' . table_buttons([
|
||||||
button(page_link_to('user_shifts') . '&edit_shift=' . $shift['SID'], glyph('edit'), 'btn-xs'),
|
button(page_link_to('user_shifts') . '&edit_shift=' . $shift['SID'], glyph('edit'), 'btn-xs'),
|
||||||
|
|
|
@ -28,21 +28,21 @@ function ShiftEntry_edit_view(
|
||||||
$freeload_form = [];
|
$freeload_form = [];
|
||||||
if ($user_admin_shifts) {
|
if ($user_admin_shifts) {
|
||||||
$freeload_form = [
|
$freeload_form = [
|
||||||
form_checkbox('freeloaded', _("Freeloaded"), $freeloaded),
|
form_checkbox('freeloaded', _('Freeloaded'), $freeloaded),
|
||||||
form_textarea('freeload_comment', _("Freeload comment (Only for shift coordination):"), $freeload_comment)
|
form_textarea('freeload_comment', _('Freeload comment (Only for shift coordination):'), $freeload_comment)
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return page_with_title(_("Edit shift entry"), [
|
return page_with_title(_('Edit shift entry'), [
|
||||||
msg(),
|
msg(),
|
||||||
form([
|
form([
|
||||||
form_info(_("Angel:"), $angel),
|
form_info(_('Angel:'), $angel),
|
||||||
form_info(_("Date, Duration:"), $date),
|
form_info(_('Date, Duration:'), $date),
|
||||||
form_info(_("Location:"), $location),
|
form_info(_('Location:'), $location),
|
||||||
form_info(_("Title:"), $title),
|
form_info(_('Title:'), $title),
|
||||||
form_info(_("Type:"), $type),
|
form_info(_('Type:'), $type),
|
||||||
form_textarea('comment', _("Comment (for your eyes only):"), $comment),
|
form_textarea('comment', _('Comment (for your eyes only):'), $comment),
|
||||||
join("", $freeload_form),
|
join('', $freeload_form),
|
||||||
form_submit('submit', _("Save"))
|
form_submit('submit', _('Save'))
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,13 @@ function ShiftType_name_render($shifttype)
|
||||||
*/
|
*/
|
||||||
function ShiftType_delete_view($shifttype)
|
function ShiftType_delete_view($shifttype)
|
||||||
{
|
{
|
||||||
return page_with_title(sprintf(_("Delete shifttype %s"), $shifttype['name']), [
|
return page_with_title(sprintf(_('Delete shifttype %s'), $shifttype['name']), [
|
||||||
info(sprintf(_("Do you want to delete shifttype %s?"), $shifttype['name']), true),
|
info(sprintf(_('Do you want to delete shifttype %s?'), $shifttype['name']), true),
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('shifttypes'), _("cancel"), 'cancel'),
|
button(page_link_to('shifttypes'), _('cancel'), 'cancel'),
|
||||||
button(
|
button(
|
||||||
page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'] . '&confirmed',
|
page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'] . '&confirmed',
|
||||||
_("delete"),
|
_('delete'),
|
||||||
'ok'
|
'ok'
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
@ -91,7 +91,7 @@ function ShiftType_view($shifttype, $angeltype)
|
||||||
'delete'
|
'delete'
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
heading(_("Description"), 2),
|
heading(_('Description'), 2),
|
||||||
$parsedown->parse($shifttype['description'])
|
$parsedown->parse($shifttype['description'])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ class ShiftsFilterRenderer
|
||||||
{
|
{
|
||||||
$toolbar = [];
|
$toolbar = [];
|
||||||
if ($this->daySelectionEnabled && !empty($this->days)) {
|
if ($this->daySelectionEnabled && !empty($this->days)) {
|
||||||
$selected_day = date("Y-m-d", $this->shiftsFilter->getStartTime());
|
$selected_day = date('Y-m-d', $this->shiftsFilter->getStartTime());
|
||||||
$day_dropdown_items = [];
|
$day_dropdown_items = [];
|
||||||
foreach ($this->days as $day) {
|
foreach ($this->days as $day) {
|
||||||
$day_dropdown_items[] = toolbar_item_link($link_base . '&shifts_filter_day=' . $day, '', $day);
|
$day_dropdown_items[] = toolbar_item_link($link_base . '&shifts_filter_day=' . $day, '', $day);
|
||||||
|
|
|
@ -10,14 +10,14 @@ function Shift_editor_info_render($shift)
|
||||||
$info = [];
|
$info = [];
|
||||||
if ($shift['created_by_user_id'] != null) {
|
if ($shift['created_by_user_id'] != null) {
|
||||||
$info[] = sprintf(
|
$info[] = sprintf(
|
||||||
glyph('plus') . _("created at %s by %s"),
|
glyph('plus') . _('created at %s by %s'),
|
||||||
date('Y-m-d H:i', $shift['created_at_timestamp']),
|
date('Y-m-d H:i', $shift['created_at_timestamp']),
|
||||||
User_Nick_render(User($shift['created_by_user_id']))
|
User_Nick_render(User($shift['created_by_user_id']))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($shift['edited_by_user_id'] != null) {
|
if ($shift['edited_by_user_id'] != null) {
|
||||||
$info[] = sprintf(
|
$info[] = sprintf(
|
||||||
glyph('pencil') . _("edited at %s by %s"),
|
glyph('pencil') . _('edited at %s by %s'),
|
||||||
date('Y-m-d H:i', $shift['edited_at_timestamp']),
|
date('Y-m-d H:i', $shift['edited_at_timestamp']),
|
||||||
User_Nick_render(User($shift['edited_by_user_id']))
|
User_Nick_render(User($shift['edited_by_user_id']))
|
||||||
);
|
);
|
||||||
|
@ -226,7 +226,7 @@ function Shift_view_render_shift_entry($shift_entry, $user_shift_admin, $angelty
|
||||||
*/
|
*/
|
||||||
function shift_length($shift)
|
function shift_length($shift)
|
||||||
{
|
{
|
||||||
$length = floor(($shift['end'] - $shift['start']) / (60 * 60)) . ":";
|
$length = floor(($shift['end'] - $shift['start']) / (60 * 60)) . ':';
|
||||||
$length .= str_pad((($shift['end'] - $shift['start']) % (60 * 60)) / 60, 2, "0", STR_PAD_LEFT) . "h";
|
$length .= str_pad((($shift['end'] - $shift['start']) % (60 * 60)) / 60, 2, '0', STR_PAD_LEFT) . 'h';
|
||||||
return $length;
|
return $length;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,23 +9,23 @@
|
||||||
*/
|
*/
|
||||||
function UserAngelType_update_view($user_angeltype, $user, $angeltype, $supporter)
|
function UserAngelType_update_view($user_angeltype, $user, $angeltype, $supporter)
|
||||||
{
|
{
|
||||||
return page_with_title($supporter ? _("Add supporter rights") : _("Remove supporter rights"), [
|
return page_with_title($supporter ? _('Add supporter rights') : _('Remove supporter rights'), [
|
||||||
msg(),
|
msg(),
|
||||||
info(sprintf(
|
info(sprintf(
|
||||||
$supporter
|
$supporter
|
||||||
? _("Do you really want to add supporter rights for %s to %s?")
|
? _('Do you really want to add supporter rights for %s to %s?')
|
||||||
: _("Do you really want to remove supporter rights for %s from %s?"),
|
: _('Do you really want to remove supporter rights for %s from %s?'),
|
||||||
$angeltype['name'],
|
$angeltype['name'],
|
||||||
User_Nick_render($user)
|
User_Nick_render($user)
|
||||||
), true),
|
), 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(
|
button(
|
||||||
page_link_to('user_angeltypes')
|
page_link_to('user_angeltypes')
|
||||||
. '&action=update&user_angeltype_id=' . $user_angeltype['id']
|
. '&action=update&user_angeltype_id=' . $user_angeltype['id']
|
||||||
. '&supporter=' . ($supporter ? '1' : '0')
|
. '&supporter=' . ($supporter ? '1' : '0')
|
||||||
. '&confirmed',
|
. '&confirmed',
|
||||||
_("yes"),
|
_('yes'),
|
||||||
'ok'
|
'ok'
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
@ -38,14 +38,14 @@ function UserAngelType_update_view($user_angeltype, $user, $angeltype, $supporte
|
||||||
*/
|
*/
|
||||||
function UserAngelTypes_delete_all_view($angeltype)
|
function UserAngelTypes_delete_all_view($angeltype)
|
||||||
{
|
{
|
||||||
return page_with_title(_("Deny all users"), [
|
return page_with_title(_('Deny all users'), [
|
||||||
msg(),
|
msg(),
|
||||||
info(sprintf(_("Do you really want to deny all users for %s?"), $angeltype['name']), true),
|
info(sprintf(_('Do you really want to deny all users for %s?'), $angeltype['name']), 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(
|
button(
|
||||||
page_link_to('user_angeltypes') . '&action=delete_all&angeltype_id=' . $angeltype['id'] . '&confirmed',
|
page_link_to('user_angeltypes') . '&action=delete_all&angeltype_id=' . $angeltype['id'] . '&confirmed',
|
||||||
_("yes"),
|
_('yes'),
|
||||||
'ok'
|
'ok'
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
@ -58,14 +58,14 @@ function UserAngelTypes_delete_all_view($angeltype)
|
||||||
*/
|
*/
|
||||||
function UserAngelTypes_confirm_all_view($angeltype)
|
function UserAngelTypes_confirm_all_view($angeltype)
|
||||||
{
|
{
|
||||||
return page_with_title(_("Confirm all users"), [
|
return page_with_title(_('Confirm all users'), [
|
||||||
msg(),
|
msg(),
|
||||||
info(sprintf(_("Do you really want to confirm all users for %s?"), $angeltype['name']), true),
|
info(sprintf(_('Do you really want to confirm all users for %s?'), $angeltype['name']), 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(
|
button(
|
||||||
page_link_to('user_angeltypes') . '&action=confirm_all&angeltype_id=' . $angeltype['id'] . '&confirmed',
|
page_link_to('user_angeltypes') . '&action=confirm_all&angeltype_id=' . $angeltype['id'] . '&confirmed',
|
||||||
_("yes"),
|
_('yes'),
|
||||||
'ok'
|
'ok'
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
@ -80,14 +80,14 @@ function UserAngelTypes_confirm_all_view($angeltype)
|
||||||
*/
|
*/
|
||||||
function UserAngelType_confirm_view($user_angeltype, $user, $angeltype)
|
function UserAngelType_confirm_view($user_angeltype, $user, $angeltype)
|
||||||
{
|
{
|
||||||
return page_with_title(_("Confirm angeltype for user"), [
|
return page_with_title(_('Confirm angeltype for user'), [
|
||||||
msg(),
|
msg(),
|
||||||
info(sprintf(_("Do you really want to confirm %s for %s?"), User_Nick_render($user), $angeltype['name']), true),
|
info(sprintf(_('Do you really want to confirm %s for %s?'), User_Nick_render($user), $angeltype['name']), 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(
|
button(
|
||||||
page_link_to('user_angeltypes') . '&action=confirm&user_angeltype_id=' . $user_angeltype['id'] . '&confirmed',
|
page_link_to('user_angeltypes') . '&action=confirm&user_angeltype_id=' . $user_angeltype['id'] . '&confirmed',
|
||||||
_("yes"),
|
_('yes'),
|
||||||
'ok'
|
'ok'
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
@ -102,14 +102,14 @@ function UserAngelType_confirm_view($user_angeltype, $user, $angeltype)
|
||||||
*/
|
*/
|
||||||
function UserAngelType_delete_view($user_angeltype, $user, $angeltype)
|
function UserAngelType_delete_view($user_angeltype, $user, $angeltype)
|
||||||
{
|
{
|
||||||
return page_with_title(_("Remove angeltype"), [
|
return page_with_title(_('Remove angeltype'), [
|
||||||
msg(),
|
msg(),
|
||||||
info(sprintf(_("Do you really want to delete %s from %s?"), User_Nick_render($user), $angeltype['name']), true),
|
info(sprintf(_('Do you really want to delete %s from %s?'), User_Nick_render($user), $angeltype['name']), 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(
|
button(
|
||||||
page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $user_angeltype['id'] . '&confirmed',
|
page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $user_angeltype['id'] . '&confirmed',
|
||||||
_("yes"),
|
_('yes'),
|
||||||
'ok'
|
'ok'
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
@ -129,15 +129,15 @@ function UserAngelType_add_view($angeltype, $users_source, $user_id)
|
||||||
$users[$user_source['UID']] = User_Nick_render($user_source);
|
$users[$user_source['UID']] = User_Nick_render($user_source);
|
||||||
}
|
}
|
||||||
|
|
||||||
return page_with_title(_("Add user to angeltype"), [
|
return page_with_title(_('Add user to angeltype'), [
|
||||||
msg(),
|
msg(),
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _("back"), 'back')
|
button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _('back'), 'back')
|
||||||
]),
|
]),
|
||||||
form([
|
form([
|
||||||
form_info(_("Angeltype"), $angeltype['name']),
|
form_info(_('Angeltype'), $angeltype['name']),
|
||||||
form_select('user_id', _("User"), $users, $user_id),
|
form_select('user_id', _('User'), $users, $user_id),
|
||||||
form_submit('submit', _("Add"))
|
form_submit('submit', _('Add'))
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -149,14 +149,14 @@ function UserAngelType_add_view($angeltype, $users_source, $user_id)
|
||||||
*/
|
*/
|
||||||
function UserAngelType_join_view($user, $angeltype)
|
function UserAngelType_join_view($user, $angeltype)
|
||||||
{
|
{
|
||||||
return page_with_title(sprintf(_("Become a %s"), $angeltype['name']), [
|
return page_with_title(sprintf(_('Become a %s'), $angeltype['name']), [
|
||||||
msg(),
|
msg(),
|
||||||
info(sprintf(_("Do you really want to add %s to %s?"), User_Nick_render($user), $angeltype['name']), true),
|
info(sprintf(_('Do you really want to add %s to %s?'), User_Nick_render($user), $angeltype['name']), 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(
|
button(
|
||||||
page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'] . '&user_id=' . $user['UID'] . '&confirmed',
|
page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'] . '&user_id=' . $user['UID'] . '&confirmed',
|
||||||
_("save"),
|
_('save'),
|
||||||
'ok'
|
'ok'
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
|
|
@ -10,42 +10,42 @@
|
||||||
*/
|
*/
|
||||||
function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver_license)
|
function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver_license)
|
||||||
{
|
{
|
||||||
return page_with_title(sprintf(_("Edit %s driving license information"), User_Nick_render($user_source)), [
|
return page_with_title(sprintf(_('Edit %s driving license information'), User_Nick_render($user_source)), [
|
||||||
buttons([
|
buttons([
|
||||||
button(user_link($user_source), _("Back to profile"), 'back')
|
button(user_link($user_source), _('Back to profile'), 'back')
|
||||||
]),
|
]),
|
||||||
msg(),
|
msg(),
|
||||||
form([
|
form([
|
||||||
form_info(_("Privacy"), _("Your driving license information is only visible for supporters 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', [
|
||||||
form_checkbox(
|
form_checkbox(
|
||||||
'has_car',
|
'has_car',
|
||||||
_("I have my own car with me and am willing to use it for the PL (You'll get reimbursed for fuel)"),
|
_('I have my own car with me and am willing to use it for the PL (You\'ll get reimbursed for fuel)'),
|
||||||
$user_driver_license['has_car']
|
$user_driver_license['has_car']
|
||||||
),
|
),
|
||||||
heading(_("Driver license"), 3),
|
heading(_('Driver license'), 3),
|
||||||
form_checkbox('has_license_car', _("Car"), $user_driver_license['has_license_car']),
|
form_checkbox('has_license_car', _('Car'), $user_driver_license['has_license_car']),
|
||||||
form_checkbox(
|
form_checkbox(
|
||||||
'has_license_3_5t_transporter',
|
'has_license_3_5t_transporter',
|
||||||
_("Transporter 3,5t"),
|
_('Transporter 3,5t'),
|
||||||
$user_driver_license['has_license_3_5t_transporter']
|
$user_driver_license['has_license_3_5t_transporter']
|
||||||
),
|
),
|
||||||
form_checkbox(
|
form_checkbox(
|
||||||
'has_license_7_5t_truck',
|
'has_license_7_5t_truck',
|
||||||
_("Truck 7,5t"),
|
_('Truck 7,5t'),
|
||||||
$user_driver_license['has_license_7_5t_truck']
|
$user_driver_license['has_license_7_5t_truck']
|
||||||
),
|
),
|
||||||
form_checkbox(
|
form_checkbox(
|
||||||
'has_license_12_5t_truck',
|
'has_license_12_5t_truck',
|
||||||
_("Truck 12,5t"),
|
_('Truck 12,5t'),
|
||||||
$user_driver_license['has_license_12_5t_truck']
|
$user_driver_license['has_license_12_5t_truck']
|
||||||
),
|
),
|
||||||
form_checkbox('has_license_forklift', _("Forklift"), $user_driver_license['has_license_forklift'])
|
form_checkbox('has_license_forklift', _('Forklift'), $user_driver_license['has_license_forklift'])
|
||||||
])
|
])
|
||||||
], 'driving_license'),
|
], 'driving_license'),
|
||||||
form_submit('submit', _("Save"))
|
form_submit('submit', _('Save'))
|
||||||
]),
|
]),
|
||||||
'<script type="text/javascript">
|
'<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
|
@ -4,19 +4,19 @@
|
||||||
* Available T-Shirt sizes
|
* Available T-Shirt sizes
|
||||||
*/
|
*/
|
||||||
$tshirt_sizes = [
|
$tshirt_sizes = [
|
||||||
'' => _("Please select..."),
|
'' => _('Please select...'),
|
||||||
'S' => "S",
|
'S' => 'S',
|
||||||
'M' => "M",
|
'M' => 'M',
|
||||||
'L' => "L",
|
'L' => 'L',
|
||||||
'XL' => "XL",
|
'XL' => 'XL',
|
||||||
'2XL' => "2XL",
|
'2XL' => '2XL',
|
||||||
'3XL' => "3XL",
|
'3XL' => '3XL',
|
||||||
'4XL' => "4XL",
|
'4XL' => '4XL',
|
||||||
'5XL' => "5XL",
|
'5XL' => '5XL',
|
||||||
'S-G' => "S Girl",
|
'S-G' => 'S Girl',
|
||||||
'M-G' => "M Girl",
|
'M-G' => 'M Girl',
|
||||||
'L-G' => "L Girl",
|
'L-G' => 'L Girl',
|
||||||
'XL-G' => "XL Girl"
|
'XL-G' => 'XL Girl'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,69 +45,69 @@ function User_settings_view(
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-md-6', [
|
div('col-md-6', [
|
||||||
form([
|
form([
|
||||||
form_info('', _("Here you can change your user details.")),
|
form_info('', _('Here you can change your user details.')),
|
||||||
form_info(entry_required() . ' = ' . _("Entry required!")),
|
form_info(entry_required() . ' = ' . _('Entry required!')),
|
||||||
form_text('nick', _("Nick"), $user_source['Nick'], true),
|
form_text('nick', _('Nick'), $user_source['Nick'], true),
|
||||||
form_text('lastname', _("Last name"), $user_source['Name']),
|
form_text('lastname', _('Last name'), $user_source['Name']),
|
||||||
form_text('prename', _("First name"), $user_source['Vorname']),
|
form_text('prename', _('First name'), $user_source['Vorname']),
|
||||||
form_date(
|
form_date(
|
||||||
'planned_arrival_date',
|
'planned_arrival_date',
|
||||||
_("Planned date of arrival") . ' ' . entry_required(),
|
_('Planned date of arrival') . ' ' . entry_required(),
|
||||||
$user_source['planned_arrival_date'],
|
$user_source['planned_arrival_date'],
|
||||||
$buildup_start_date,
|
$buildup_start_date,
|
||||||
$teardown_end_date
|
$teardown_end_date
|
||||||
),
|
),
|
||||||
form_date(
|
form_date(
|
||||||
'planned_departure_date',
|
'planned_departure_date',
|
||||||
_("Planned date of departure"),
|
_('Planned date of departure'),
|
||||||
$user_source['planned_departure_date'],
|
$user_source['planned_departure_date'],
|
||||||
$buildup_start_date,
|
$buildup_start_date,
|
||||||
$teardown_end_date
|
$teardown_end_date
|
||||||
),
|
),
|
||||||
form_text('age', _("Age"), $user_source['Alter']),
|
form_text('age', _('Age'), $user_source['Alter']),
|
||||||
form_text('tel', _("Phone"), $user_source['Telefon']),
|
form_text('tel', _('Phone'), $user_source['Telefon']),
|
||||||
form_text('dect', _("DECT"), $user_source['DECT']),
|
form_text('dect', _('DECT'), $user_source['DECT']),
|
||||||
form_text('mobile', _("Mobile"), $user_source['Handy']),
|
form_text('mobile', _('Mobile'), $user_source['Handy']),
|
||||||
form_text('mail', _("E-Mail") . ' ' . entry_required(), $user_source['email']),
|
form_text('mail', _('E-Mail') . ' ' . entry_required(), $user_source['email']),
|
||||||
form_checkbox(
|
form_checkbox(
|
||||||
'email_shiftinfo',
|
'email_shiftinfo',
|
||||||
_("The engelsystem is allowed to send me an email (e.g. when my shifts change)"),
|
_('The engelsystem is allowed to send me an email (e.g. when my shifts change)'),
|
||||||
$user_source['email_shiftinfo']
|
$user_source['email_shiftinfo']
|
||||||
),
|
),
|
||||||
form_checkbox(
|
form_checkbox(
|
||||||
'email_by_human_allowed',
|
'email_by_human_allowed',
|
||||||
_("Humans are allowed to send me an email (e.g. for ticket vouchers)"),
|
_('Humans are allowed to send me an email (e.g. for ticket vouchers)'),
|
||||||
$user_source['email_by_human_allowed']
|
$user_source['email_by_human_allowed']
|
||||||
),
|
),
|
||||||
form_text('jabber', _("Jabber"), $user_source['jabber']),
|
form_text('jabber', _('Jabber'), $user_source['jabber']),
|
||||||
form_text('hometown', _("Hometown"), $user_source['Hometown']),
|
form_text('hometown', _('Hometown'), $user_source['Hometown']),
|
||||||
$enable_tshirt_size ? form_select(
|
$enable_tshirt_size ? form_select(
|
||||||
'tshirt_size',
|
'tshirt_size',
|
||||||
_("Shirt size"),
|
_('Shirt size'),
|
||||||
$tshirt_sizes,
|
$tshirt_sizes,
|
||||||
$user_source['Size']
|
$user_source['Size']
|
||||||
) : '',
|
) : '',
|
||||||
form_info('', _('Please visit the angeltypes page to manage your angeltypes.')),
|
form_info('', _('Please visit the angeltypes page to manage your angeltypes.')),
|
||||||
form_submit('submit', _("Save"))
|
form_submit('submit', _('Save'))
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
div('col-md-6', [
|
div('col-md-6', [
|
||||||
form([
|
form([
|
||||||
form_info(_("Here you can change your password.")),
|
form_info(_('Here you can change your password.')),
|
||||||
form_password('password', _("Old password:")),
|
form_password('password', _('Old password:')),
|
||||||
form_password('new_password', _("New password:")),
|
form_password('new_password', _('New password:')),
|
||||||
form_password('new_password2', _("Password confirmation:")),
|
form_password('new_password2', _('Password confirmation:')),
|
||||||
form_submit('submit_password', _("Save"))
|
form_submit('submit_password', _('Save'))
|
||||||
]),
|
]),
|
||||||
form([
|
form([
|
||||||
form_info(_("Here you can choose your color settings:")),
|
form_info(_('Here you can choose your color settings:')),
|
||||||
form_select('theme', _("Color settings:"), $themes, $user_source['color']),
|
form_select('theme', _('Color settings:'), $themes, $user_source['color']),
|
||||||
form_submit('submit_theme', _("Save"))
|
form_submit('submit_theme', _('Save'))
|
||||||
]),
|
]),
|
||||||
form([
|
form([
|
||||||
form_info(_("Here you can choose your language:")),
|
form_info(_('Here you can choose your language:')),
|
||||||
form_select('language', _("Language:"), $locales, $user_source['Sprache']),
|
form_select('language', _('Language:'), $locales, $user_source['Sprache']),
|
||||||
form_submit('submit_language', _("Save"))
|
form_submit('submit_language', _('Save'))
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
@ -124,29 +124,29 @@ function User_registration_success_view($event_welcome_message)
|
||||||
{
|
{
|
||||||
$parsedown = new Parsedown();
|
$parsedown = new Parsedown();
|
||||||
$event_welcome_message = $parsedown->text($event_welcome_message);
|
$event_welcome_message = $parsedown->text($event_welcome_message);
|
||||||
return page_with_title(_("Registration successful"), [
|
return page_with_title(_('Registration successful'), [
|
||||||
msg(),
|
msg(),
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-md-4', [
|
div('col-md-4', [
|
||||||
$event_welcome_message
|
$event_welcome_message
|
||||||
]),
|
]),
|
||||||
div('col-md-4', [
|
div('col-md-4', [
|
||||||
'<h2>' . _("Login") . '</h2>',
|
'<h2>' . _('Login') . '</h2>',
|
||||||
form([
|
form([
|
||||||
form_text('nick', _("Nick"), ""),
|
form_text('nick', _('Nick'), ''),
|
||||||
form_password('password', _("Password")),
|
form_password('password', _('Password')),
|
||||||
form_submit('submit', _("Login")),
|
form_submit('submit', _('Login')),
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('user_password_recovery'), _("I forgot my password"))
|
button(page_link_to('user_password_recovery'), _('I forgot my password'))
|
||||||
]),
|
]),
|
||||||
info(_("Please note: You have to activate cookies!"), true)
|
info(_('Please note: You have to activate cookies!'), true)
|
||||||
], page_link_to('login'))
|
], page_link_to('login'))
|
||||||
]),
|
]),
|
||||||
div('col-md-4', [
|
div('col-md-4', [
|
||||||
'<h2>' . _("What can I do?") . '</h2>',
|
'<h2>' . _('What can I do?') . '</h2>',
|
||||||
'<p>' . _("Please read about the jobs you can do to help us.") . '</p>',
|
'<p>' . _('Please read about the jobs you can do to help us.') . '</p>',
|
||||||
buttons([
|
buttons([
|
||||||
button(page_link_to('angeltypes') . '&action=about', _("Teams/Job description") . ' »')
|
button(page_link_to('angeltypes') . '&action=about', _('Teams/Job description') . ' »')
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
@ -161,18 +161,18 @@ function User_registration_success_view($event_welcome_message)
|
||||||
*/
|
*/
|
||||||
function User_delete_view($user)
|
function User_delete_view($user)
|
||||||
{
|
{
|
||||||
return page_with_title(sprintf(_("Delete %s"), User_Nick_render($user)), [
|
return page_with_title(sprintf(_('Delete %s'), User_Nick_render($user)), [
|
||||||
msg(),
|
msg(),
|
||||||
buttons([
|
buttons([
|
||||||
button(user_edit_link($user), glyph('chevron-left') . _("back"))
|
button(user_edit_link($user), glyph('chevron-left') . _('back'))
|
||||||
]),
|
]),
|
||||||
error(
|
error(
|
||||||
_("Do you really want to delete the user including all his shifts and every other piece of his data?"),
|
_('Do you really want to delete the user including all his shifts and every other piece of his data?'),
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
form([
|
form([
|
||||||
form_password('password', _("Your password")),
|
form_password('password', _('Your password')),
|
||||||
form_submit('submit', _("Delete"))
|
form_submit('submit', _('Delete'))
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -185,15 +185,15 @@ function User_delete_view($user)
|
||||||
*/
|
*/
|
||||||
function User_edit_vouchers_view($user)
|
function User_edit_vouchers_view($user)
|
||||||
{
|
{
|
||||||
return page_with_title(sprintf(_("%s's vouchers"), User_Nick_render($user)), [
|
return page_with_title(sprintf(_('%s\'s vouchers'), User_Nick_render($user)), [
|
||||||
msg(),
|
msg(),
|
||||||
buttons([
|
buttons([
|
||||||
button(user_link($user), glyph('chevron-left') . _("back"))
|
button(user_link($user), glyph('chevron-left') . _('back'))
|
||||||
]),
|
]),
|
||||||
info(sprintf(_("Angel should receive at least %d vouchers."), User_get_eligable_voucher_count($user)), true),
|
info(sprintf(_('Angel should receive at least %d vouchers.'), User_get_eligable_voucher_count($user)), true),
|
||||||
form([
|
form([
|
||||||
form_spinner('vouchers', _("Number of vouchers given out"), $user['got_voucher']),
|
form_spinner('vouchers', _('Number of vouchers given out'), $user['got_voucher']),
|
||||||
form_submit('submit', _("Save"))
|
form_submit('submit', _('Save'))
|
||||||
], page_link_to('users') . '&action=edit_vouchers&user_id=' . $user['UID'])
|
], page_link_to('users') . '&action=edit_vouchers&user_id=' . $user['UID'])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -287,21 +287,21 @@ function User_shift_state_render($user)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($upcoming_shifts) == 0) {
|
if (count($upcoming_shifts) == 0) {
|
||||||
return '<span class="text-success">' . _("Free") . '</span>';
|
return '<span class="text-success">' . _('Free') . '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($upcoming_shifts[0]['start'] > time()) {
|
if ($upcoming_shifts[0]['start'] > time()) {
|
||||||
if ($upcoming_shifts[0]['start'] - time() > 3600) {
|
if ($upcoming_shifts[0]['start'] - time() > 3600) {
|
||||||
return '<span class="text-success moment-countdown" data-timestamp="' . $upcoming_shifts[0]['start'] . '">' . _("Next shift %c") . '</span>';
|
return '<span class="text-success moment-countdown" data-timestamp="' . $upcoming_shifts[0]['start'] . '">' . _('Next shift %c') . '</span>';
|
||||||
}
|
}
|
||||||
return '<span class="text-warning moment-countdown" data-timestamp="' . $upcoming_shifts[0]['start'] . '">' . _("Next shift %c") . '</span>';
|
return '<span class="text-warning moment-countdown" data-timestamp="' . $upcoming_shifts[0]['start'] . '">' . _('Next shift %c') . '</span>';
|
||||||
}
|
}
|
||||||
$halfway = ($upcoming_shifts[0]['start'] + $upcoming_shifts[0]['end']) / 2;
|
$halfway = ($upcoming_shifts[0]['start'] + $upcoming_shifts[0]['end']) / 2;
|
||||||
|
|
||||||
if (time() < $halfway) {
|
if (time() < $halfway) {
|
||||||
return '<span class="text-danger moment-countdown" data-timestamp="' . $upcoming_shifts[0]['start'] . '">' . _("Shift starts %c") . '</span>';
|
return '<span class="text-danger moment-countdown" data-timestamp="' . $upcoming_shifts[0]['start'] . '">' . _('Shift starts %c') . '</span>';
|
||||||
}
|
}
|
||||||
return '<span class="text-danger moment-countdown" data-timestamp="' . $upcoming_shifts[0]['end'] . '">' . _("Shift ends %c") . '</span>';
|
return '<span class="text-danger moment-countdown" data-timestamp="' . $upcoming_shifts[0]['end'] . '">' . _('Shift ends %c') . '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -347,18 +347,18 @@ function User_view_myshift($shift, $user_source, $its_me)
|
||||||
}
|
}
|
||||||
|
|
||||||
$myshift = [
|
$myshift = [
|
||||||
'date' => date("Y-m-d", $shift['start']),
|
'date' => date('Y-m-d', $shift['start']),
|
||||||
'time' => date("H:i", $shift['start']) . ' - ' . date("H:i", $shift['end']),
|
'time' => date('H:i', $shift['start']) . ' - ' . date('H:i', $shift['end']),
|
||||||
'room' => $shift['Name'],
|
'room' => $shift['Name'],
|
||||||
'shift_info' => $shift_info,
|
'shift_info' => $shift_info,
|
||||||
'comment' => $shift['Comment']
|
'comment' => $shift['Comment']
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($shift['freeloaded']) {
|
if ($shift['freeloaded']) {
|
||||||
if (in_array("user_shifts_admin", $privileges)) {
|
if (in_array('user_shifts_admin', $privileges)) {
|
||||||
$myshift['comment'] .= '<br /><p class="error">' . _("Freeloaded") . ': ' . $shift['freeload_comment'] . '</p>';
|
$myshift['comment'] .= '<br /><p class="error">' . _('Freeloaded') . ': ' . $shift['freeload_comment'] . '</p>';
|
||||||
} else {
|
} else {
|
||||||
$myshift['comment'] .= '<br /><p class="error">' . _("Freeloaded") . '</p>';
|
$myshift['comment'] .= '<br /><p class="error">' . _('Freeloaded') . '</p>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -408,12 +408,12 @@ function User_view_myshifts($shifts, $user_source, $its_me)
|
||||||
|
|
||||||
if (count($myshifts_table) > 0) {
|
if (count($myshifts_table) > 0) {
|
||||||
$myshifts_table[] = [
|
$myshifts_table[] = [
|
||||||
'date' => '<b>' . _("Sum:") . '</b>',
|
'date' => '<b>' . _('Sum:') . '</b>',
|
||||||
'time' => "<b>" . round($timesum / 3600, 1) . " h</b>",
|
'time' => '<b>' . round($timesum / 3600, 1) . ' h</b>',
|
||||||
'room' => "",
|
'room' => '',
|
||||||
'shift_info' => "",
|
'shift_info' => '',
|
||||||
'comment' => "",
|
'comment' => '',
|
||||||
'actions' => ""
|
'actions' => ''
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
return $myshifts_table;
|
return $myshifts_table;
|
||||||
|
@ -433,7 +433,7 @@ function User_view_myshifts($shifts, $user_source, $its_me)
|
||||||
*/
|
*/
|
||||||
function User_view($user_source, $admin_user_privilege, $freeloader, $user_angeltypes, $user_groups, $shifts, $its_me)
|
function User_view($user_source, $admin_user_privilege, $freeloader, $user_angeltypes, $user_groups, $shifts, $its_me)
|
||||||
{
|
{
|
||||||
$user_name = htmlspecialchars($user_source['Vorname']) . " " . htmlspecialchars($user_source['Name']);
|
$user_name = htmlspecialchars($user_source['Vorname']) . ' ' . htmlspecialchars($user_source['Name']);
|
||||||
$myshifts_table = User_view_myshifts($shifts, $user_source, $its_me);
|
$myshifts_table = User_view_myshifts($shifts, $user_source, $its_me);
|
||||||
|
|
||||||
return page_with_title(
|
return page_with_title(
|
||||||
|
@ -445,28 +445,28 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
|
||||||
buttons([
|
buttons([
|
||||||
$admin_user_privilege ? button(
|
$admin_user_privilege ? button(
|
||||||
page_link_to('admin_user') . '&id=' . $user_source['UID'],
|
page_link_to('admin_user') . '&id=' . $user_source['UID'],
|
||||||
glyph("edit") . _("edit")
|
glyph('edit') . _('edit')
|
||||||
) : '',
|
) : '',
|
||||||
$admin_user_privilege ? button(
|
$admin_user_privilege ? button(
|
||||||
user_driver_license_edit_link($user_source),
|
user_driver_license_edit_link($user_source),
|
||||||
glyph("road") . _("driving license")
|
glyph('road') . _('driving license')
|
||||||
) : '',
|
) : '',
|
||||||
($admin_user_privilege && !$user_source['Gekommen']) ? button(
|
($admin_user_privilege && !$user_source['Gekommen']) ? button(
|
||||||
page_link_to('admin_arrive') . '&arrived=' . $user_source['UID'],
|
page_link_to('admin_arrive') . '&arrived=' . $user_source['UID'],
|
||||||
_("arrived")
|
_('arrived')
|
||||||
) : '',
|
) : '',
|
||||||
$admin_user_privilege ? button(
|
$admin_user_privilege ? button(
|
||||||
page_link_to('users') . '&action=edit_vouchers&user_id=' . $user_source['UID'],
|
page_link_to('users') . '&action=edit_vouchers&user_id=' . $user_source['UID'],
|
||||||
glyph('cutlery') . _('Edit vouchers')
|
glyph('cutlery') . _('Edit vouchers')
|
||||||
) : '',
|
) : '',
|
||||||
$its_me ? button(page_link_to('user_settings'), glyph('list-alt') . _("Settings")) : '',
|
$its_me ? button(page_link_to('user_settings'), glyph('list-alt') . _('Settings')) : '',
|
||||||
$its_me ? button(
|
$its_me ? button(
|
||||||
page_link_to('ical') . '&key=' . $user_source['api_key'],
|
page_link_to('ical') . '&key=' . $user_source['api_key'],
|
||||||
glyph('calendar') . _("iCal Export")
|
glyph('calendar') . _('iCal Export')
|
||||||
) : '',
|
) : '',
|
||||||
$its_me ? button(
|
$its_me ? button(
|
||||||
page_link_to('shifts_json_export') . '&key=' . $user_source['api_key'],
|
page_link_to('shifts_json_export') . '&key=' . $user_source['api_key'],
|
||||||
glyph('export') . _("JSON Export")
|
glyph('export') . _('JSON Export')
|
||||||
) : '',
|
) : '',
|
||||||
$its_me ? button(
|
$its_me ? button(
|
||||||
page_link_to('user_myshifts') . '&reset',
|
page_link_to('user_myshifts') . '&reset',
|
||||||
|
@ -483,9 +483,9 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
|
||||||
'</h1>'
|
'</h1>'
|
||||||
]),
|
]),
|
||||||
div('col-md-3', [
|
div('col-md-3', [
|
||||||
'<h4>' . _("User state") . '</h4>',
|
'<h4>' . _('User state') . '</h4>',
|
||||||
($admin_user_privilege && $freeloader)
|
($admin_user_privilege && $freeloader)
|
||||||
? '<span class="text-danger"><span class="glyphicon glyphicon-exclamation-sign"></span> ' . _("Freeloader") . '</span><br />'
|
? '<span class="text-danger"><span class="glyphicon glyphicon-exclamation-sign"></span> ' . _('Freeloader') . '</span><br />'
|
||||||
: '',
|
: '',
|
||||||
$user_source['Gekommen']
|
$user_source['Gekommen']
|
||||||
? User_shift_state_render($user_source) . '<br />'
|
? User_shift_state_render($user_source) . '<br />'
|
||||||
|
@ -494,53 +494,53 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
|
||||||
? (
|
? (
|
||||||
$user_source['Gekommen']
|
$user_source['Gekommen']
|
||||||
? '<span class="text-success"><span class="glyphicon glyphicon-home"></span> '
|
? '<span class="text-success"><span class="glyphicon glyphicon-home"></span> '
|
||||||
. sprintf(_("Arrived at %s"), date('Y-m-d', $user_source['arrival_date']))
|
. sprintf(_('Arrived at %s'), date('Y-m-d', $user_source['arrival_date']))
|
||||||
. '</span>'
|
. '</span>'
|
||||||
: '<span class="text-danger">'
|
: '<span class="text-danger">'
|
||||||
. sprintf(_("Not arrived (Planned: %s)"), date('Y-m-d', $user_source['planned_arrival_date']))
|
. sprintf(_('Not arrived (Planned: %s)'), date('Y-m-d', $user_source['planned_arrival_date']))
|
||||||
. '</span>'
|
. '</span>'
|
||||||
)
|
)
|
||||||
: (
|
: (
|
||||||
$user_source['Gekommen']
|
$user_source['Gekommen']
|
||||||
? '<span class="text-success"><span class="glyphicon glyphicon-home"></span> ' . _("Arrived") . '</span>'
|
? '<span class="text-success"><span class="glyphicon glyphicon-home"></span> ' . _('Arrived') . '</span>'
|
||||||
: '<span class="text-danger">' . _("Not arrived") . '</span>'),
|
: '<span class="text-danger">' . _('Not arrived') . '</span>'),
|
||||||
$admin_user_privilege
|
$admin_user_privilege
|
||||||
? (
|
? (
|
||||||
$user_source['got_voucher'] > 0
|
$user_source['got_voucher'] > 0
|
||||||
? '<br /><span class="text-success">'
|
? '<br /><span class="text-success">'
|
||||||
. glyph('cutlery')
|
. glyph('cutlery')
|
||||||
. sprintf(
|
. sprintf(
|
||||||
ngettext("Got %s voucher", "Got %s vouchers", $user_source['got_voucher']),
|
ngettext('Got %s voucher', 'Got %s vouchers', $user_source['got_voucher']),
|
||||||
$user_source['got_voucher']
|
$user_source['got_voucher']
|
||||||
)
|
)
|
||||||
. '</span><br />'
|
. '</span><br />'
|
||||||
: '<br /><span class="text-danger">' . _("Got no vouchers") . '</span><br />')
|
: '<br /><span class="text-danger">' . _('Got no vouchers') . '</span><br />')
|
||||||
: '',
|
: '',
|
||||||
($user_source['Gekommen'] && $admin_user_privilege && $user_source['Aktiv']) ? ' <span class="text-success">' . _("Active") . '</span>' : '',
|
($user_source['Gekommen'] && $admin_user_privilege && $user_source['Aktiv']) ? ' <span class="text-success">' . _('Active') . '</span>' : '',
|
||||||
($user_source['Gekommen'] && $admin_user_privilege && $user_source['Tshirt']) ? ' <span class="text-success">' . _("T-Shirt") . '</span>' : ''
|
($user_source['Gekommen'] && $admin_user_privilege && $user_source['Tshirt']) ? ' <span class="text-success">' . _('T-Shirt') . '</span>' : ''
|
||||||
]),
|
]),
|
||||||
div('col-md-3', [
|
div('col-md-3', [
|
||||||
'<h4>' . _("Angeltypes") . '</h4>',
|
'<h4>' . _('Angeltypes') . '</h4>',
|
||||||
User_angeltypes_render($user_angeltypes)
|
User_angeltypes_render($user_angeltypes)
|
||||||
]),
|
]),
|
||||||
div('col-md-3', [
|
div('col-md-3', [
|
||||||
'<h4>' . _("Rights") . '</h4>',
|
'<h4>' . _('Rights') . '</h4>',
|
||||||
User_groups_render($user_groups)
|
User_groups_render($user_groups)
|
||||||
])
|
])
|
||||||
]),
|
]),
|
||||||
($its_me || $admin_user_privilege) ? '<h2>' . _("Shifts") . '</h2>' : '',
|
($its_me || $admin_user_privilege) ? '<h2>' . _('Shifts') . '</h2>' : '',
|
||||||
($its_me || $admin_user_privilege) ? table([
|
($its_me || $admin_user_privilege) ? table([
|
||||||
'date' => _("Day"),
|
'date' => _('Day'),
|
||||||
'time' => _("Time"),
|
'time' => _('Time'),
|
||||||
'room' => _("Location"),
|
'room' => _('Location'),
|
||||||
'shift_info' => _("Name & workmates"),
|
'shift_info' => _('Name & workmates'),
|
||||||
'comment' => _("Comment"),
|
'comment' => _('Comment'),
|
||||||
'actions' => _("Action")
|
'actions' => _('Action')
|
||||||
], $myshifts_table) : '',
|
], $myshifts_table) : '',
|
||||||
$its_me ? info(glyph('info-sign') . _("Your night shifts between 2 and 8 am count twice."), true) : '',
|
$its_me ? info(glyph('info-sign') . _('Your night shifts between 2 and 8 am count twice.'), true) : '',
|
||||||
$its_me && count($shifts) == 0
|
$its_me && count($shifts) == 0
|
||||||
? error(sprintf(
|
? error(sprintf(
|
||||||
_("Go to the <a href=\"%s\">shifts table</a> to sign yourself up for some shifts."),
|
_('Go to the <a href="%s">shifts table</a> to sign yourself up for some shifts.'),
|
||||||
page_link_to('user_shifts')
|
page_link_to('user_shifts')
|
||||||
), true)
|
), true)
|
||||||
: ''
|
: ''
|
||||||
|
@ -557,10 +557,10 @@ function User_password_recovery_view()
|
||||||
{
|
{
|
||||||
return page_with_title(user_password_recovery_title(), [
|
return page_with_title(user_password_recovery_title(), [
|
||||||
msg(),
|
msg(),
|
||||||
_("We will send you an e-mail with a password recovery link. Please use the email address you used for registration."),
|
_('We will send you an e-mail with a password recovery link. Please use the email address you used for registration.'),
|
||||||
form([
|
form([
|
||||||
form_text('email', _("E-Mail"), ""),
|
form_text('email', _('E-Mail'), ''),
|
||||||
form_submit('submit', _("Recover"))
|
form_submit('submit', _('Recover'))
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -574,11 +574,11 @@ function User_password_set_view()
|
||||||
{
|
{
|
||||||
return page_with_title(user_password_recovery_title(), [
|
return page_with_title(user_password_recovery_title(), [
|
||||||
msg(),
|
msg(),
|
||||||
_("Please enter a new password."),
|
_('Please enter a new password.'),
|
||||||
form([
|
form([
|
||||||
form_password('password', _("Password")),
|
form_password('password', _('Password')),
|
||||||
form_password('password2', _("Confirm password")),
|
form_password('password2', _('Confirm password')),
|
||||||
form_submit('submit', _("Save"))
|
form_submit('submit', _('Save'))
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -595,7 +595,9 @@ function User_angeltypes_render($user_angeltypes)
|
||||||
if ($angeltype['restricted'] == 1 && $angeltype['confirm_user_id'] == null) {
|
if ($angeltype['restricted'] == 1 && $angeltype['confirm_user_id'] == null) {
|
||||||
$class = 'text-warning';
|
$class = 'text-warning';
|
||||||
}
|
}
|
||||||
$output[] = '<a href="' . angeltype_link($angeltype['id']) . '" class="' . $class . '">' . ($angeltype['supporter'] ? 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);
|
||||||
}
|
}
|
||||||
|
@ -634,7 +636,7 @@ function render_user_departure_date_hint()
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
if (!isset($user['planned_departure_date']) || $user['planned_departure_date'] == null) {
|
if (!isset($user['planned_departure_date']) || $user['planned_departure_date'] == null) {
|
||||||
return _("Please enter your planned date of departure on your settings page to give us a feeling for teardown capacities.");
|
return _('Please enter your planned date of departure on your settings page to give us a feeling for teardown capacities.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -649,7 +651,7 @@ function render_user_freeloader_hint()
|
||||||
|
|
||||||
if (User_is_freeloader($user)) {
|
if (User_is_freeloader($user)) {
|
||||||
return sprintf(
|
return sprintf(
|
||||||
_("You freeloaded at least %s shifts. Shift signup is locked. Please go to heavens desk to be unlocked again."),
|
_('You freeloaded at least %s shifts. Shift signup is locked. Please go to heavens desk to be unlocked again.'),
|
||||||
$max_freeloadable_shifts
|
$max_freeloadable_shifts
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -667,7 +669,7 @@ function render_user_arrived_hint()
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
if ($user['Gekommen'] == 0) {
|
if ($user['Gekommen'] == 0) {
|
||||||
return _("You are not marked as arrived. Please go to heaven's desk, get your angel badge and/or tell them that you arrived already.");
|
return _('You are not marked as arrived. Please go to heaven\'s desk, get your angel badge and/or tell them that you arrived already.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -680,8 +682,8 @@ function render_user_tshirt_hint()
|
||||||
{
|
{
|
||||||
global $enable_tshirt_size, $user;
|
global $enable_tshirt_size, $user;
|
||||||
|
|
||||||
if ($enable_tshirt_size && $user['Size'] == "") {
|
if ($enable_tshirt_size && $user['Size'] == '') {
|
||||||
return _("You need to specify a tshirt size in your settings!");
|
return _('You need to specify a tshirt size in your settings!');
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -694,8 +696,8 @@ function render_user_dect_hint()
|
||||||
{
|
{
|
||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
if ($user['DECT'] == "") {
|
if ($user['DECT'] == '') {
|
||||||
return _("You need to specify a DECT phone number in your settings! If you don't have a DECT phone, just enter \"-\".");
|
return _('You need to specify a DECT phone number in your settings! If you don\'t have a DECT phone, just enter \'-\'.');
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -182,5 +182,5 @@ echo template_render(__DIR__ . '/../templates/layout.html', [
|
||||||
'faq_url' => $faq_url,
|
'faq_url' => $faq_url,
|
||||||
'contact_email' => $contact_email,
|
'contact_email' => $contact_email,
|
||||||
'locale' => locale(),
|
'locale' => locale(),
|
||||||
'event_info' => EventConfig_info($event_config) . ' < br />'
|
'event_info' => EventConfig_info($event_config) . ' <br />'
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Reference in New Issue