Merge remote-tracking branch 'MyIgel/translations'

This commit is contained in:
Igor Scheller 2018-09-15 14:58:31 +02:00
commit d0abc27c07
55 changed files with 984 additions and 963 deletions

View File

@ -17,7 +17,10 @@
"php": ">=7.0.0", "php": ">=7.0.0",
"ext-gettext": "*", "ext-gettext": "*",
"ext-json": "*", "ext-json": "*",
"ext-libxml": "*",
"ext-PDO": "*", "ext-PDO": "*",
"ext-SimpleXML": "*",
"ext-xml": "*",
"erusev/parsedown": "^1.6", "erusev/parsedown": "^1.6",
"illuminate/container": "5.5.*", "illuminate/container": "5.5.*",
"illuminate/database": "5.5.*", "illuminate/database": "5.5.*",

View File

@ -113,7 +113,6 @@ return [
// Available T-Shirt sizes, set value to null if not available // Available T-Shirt sizes, set value to null if not available
'tshirt_sizes' => [ 'tshirt_sizes' => [
'' => _('Please select...'),
'S' => 'S', 'S' => 'S',
'S-G' => 'S Girl', 'S-G' => 'S Girl',
'M' => 'M', 'M' => 'M',

View File

@ -10,7 +10,7 @@ use Engelsystem\ShiftsFilterRenderer;
*/ */
function angeltypes_title() function angeltypes_title()
{ {
return _('Angeltypes'); return __('Angeltypes');
} }
/** /**
@ -66,7 +66,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))
]; ];
} }
@ -88,12 +88,12 @@ function angeltype_delete_controller()
if (request()->has('confirmed')) { if (request()->has('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)
]; ];
} }
@ -136,7 +136,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.'));
} }
} }
@ -166,7 +166,7 @@ function angeltype_edit_controller()
} }
return [ return [
sprintf(_('Edit %s'), $angeltype['name']), sprintf(__('Edit %s'), $angeltype['name']),
AngelType_edit_view($angeltype, $supporter_mode) AngelType_edit_view($angeltype, $supporter_mode)
]; ];
} }
@ -204,7 +204,7 @@ function angeltype_controller()
} }
return [ return [
sprintf(_('Team %s'), $angeltype['name']), sprintf(__('Team %s'), $angeltype['name']),
AngelType_view( AngelType_view(
$angeltype, $angeltype,
$members, $members,
@ -289,7 +289,7 @@ function angeltypes_list_controller()
$actions = [ $actions = [
button( button(
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]), page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
_('view'), __('view'),
'btn-xs' 'btn-xs'
) )
]; ];
@ -297,12 +297,12 @@ function angeltypes_list_controller()
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'
); );
} }
@ -313,13 +313,13 @@ function angeltypes_list_controller()
page_link_to('user_angeltypes', page_link_to('user_angeltypes',
['action' => 'delete', 'user_angeltype_id' => $angeltype['user_angeltype_id']] ['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'
); );
} }
@ -356,7 +356,7 @@ function load_angeltype()
$angeltype = AngelType($request->input('angeltype_id')); $angeltype = AngelType($request->input('angeltype_id'));
if (empty($angeltype)) { if (empty($angeltype)) {
error(_('Angeltype doesn\'t exist . ')); error(__('Angeltype doesn\'t exist . '));
redirect(page_link_to('angeltypes')); redirect(page_link_to('angeltypes'));
} }

View File

@ -5,7 +5,7 @@
*/ */
function event_config_title() function event_config_title()
{ {
return _('Event config'); return __('Event config');
} }
/** /**
@ -54,40 +54,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 (!is_null($buildup_start_date) && !is_null($event_start_date) && $buildup_start_date > $event_start_date) { if (!is_null($buildup_start_date) && !is_null($event_start_date) && $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 (!is_null($event_start_date) && !is_null($event_end_date) && $event_start_date > $event_end_date) { if (!is_null($event_start_date) && !is_null($event_end_date) && $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 (!is_null($event_end_date) && !is_null($teardown_end_date) && $event_end_date > $teardown_end_date) { if (!is_null($event_end_date) && !is_null($teardown_end_date) && $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 (!is_null($buildup_start_date) && !is_null($teardown_end_date) && $buildup_start_date > $teardown_end_date) { if (!is_null($buildup_start_date) && !is_null($teardown_end_date) && $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) {
@ -111,7 +111,7 @@ function event_config_edit_controller()
date('Y-m-d', $teardown_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'));
} }
} }

View File

@ -24,7 +24,7 @@ function public_dashboard_controller()
} }
return [ return [
_('Public Dashboard'), __('Public Dashboard'),
public_dashboard_view($stats, $free_shifts) public_dashboard_view($stats, $free_shifts)
]; ];
} }

View File

@ -106,7 +106,7 @@ function shift_entry_create_controller_admin($shift, $angeltype)
'freeload_comment' => '' 'freeload_comment' => ''
]); ]);
success(sprintf(_('%s has been subscribed to the shift.'), User_Nick_render($signup_user))); success(sprintf(__('%s has been subscribed to the shift.'), User_Nick_render($signup_user)));
redirect(shift_link($shift)); redirect(shift_link($shift));
} }
@ -146,7 +146,7 @@ function shift_entry_create_controller_supporter($shift, $angeltype)
$signup_user = User($request->input('user_id')); $signup_user = User($request->input('user_id'));
} }
if (!UserAngelType_exists($signup_user, $angeltype)) { if (!UserAngelType_exists($signup_user, $angeltype)) {
error(_('User is not in angeltype.')); error(__('User is not in angeltype.'));
redirect(shift_link($shift)); redirect(shift_link($shift));
} }
@ -163,7 +163,7 @@ function shift_entry_create_controller_supporter($shift, $angeltype)
); );
if (!$shift_signup_state->isSignupAllowed()) { if (!$shift_signup_state->isSignupAllowed()) {
if ($shift_signup_state->getState() == ShiftSignupState::OCCUPIED) { if ($shift_signup_state->getState() == ShiftSignupState::OCCUPIED) {
error(_('This shift is already occupied.')); error(__('This shift is already occupied.'));
} }
redirect(shift_link($shift)); redirect(shift_link($shift));
} }
@ -178,7 +178,7 @@ function shift_entry_create_controller_supporter($shift, $angeltype)
'freeload_comment' => '' 'freeload_comment' => ''
]); ]);
success(sprintf(_('%s has been subscribed to the shift.'), User_Nick_render($signup_user))); success(sprintf(__('%s has been subscribed to the shift.'), User_Nick_render($signup_user)));
redirect(shift_link($shift)); redirect(shift_link($shift));
} }
@ -203,17 +203,17 @@ function shift_entry_create_controller_supporter($shift, $angeltype)
function shift_entry_error_message(ShiftSignupState $shift_signup_state) function shift_entry_error_message(ShiftSignupState $shift_signup_state)
{ {
if ($shift_signup_state->getState() == ShiftSignupState::ANGELTYPE) { if ($shift_signup_state->getState() == ShiftSignupState::ANGELTYPE) {
error(_('You need be accepted member of the angeltype.')); error(__('You need be accepted member of the angeltype.'));
} elseif ($shift_signup_state->getState() == ShiftSignupState::COLLIDES) { } elseif ($shift_signup_state->getState() == ShiftSignupState::COLLIDES) {
error(_('This shift collides with one of your shifts.')); error(__('This shift collides with one of your shifts.'));
} elseif ($shift_signup_state->getState() == ShiftSignupState::OCCUPIED) { } elseif ($shift_signup_state->getState() == ShiftSignupState::OCCUPIED) {
error(_('This shift is already occupied.')); error(__('This shift is already occupied.'));
} elseif ($shift_signup_state->getState() == ShiftSignupState::SHIFT_ENDED) { } elseif ($shift_signup_state->getState() == ShiftSignupState::SHIFT_ENDED) {
error(_('This shift ended already.')); error(__('This shift ended already.'));
} elseif ($shift_signup_state->getState() == ShiftSignupState::NOT_ARRIVED) { } elseif ($shift_signup_state->getState() == ShiftSignupState::NOT_ARRIVED) {
error(_('You are not marked as arrived.')); error(__('You are not marked as arrived.'));
} elseif ($shift_signup_state->getState() == ShiftSignupState::SIGNED_UP) { } elseif ($shift_signup_state->getState() == ShiftSignupState::SIGNED_UP) {
error(_('You are signed up for this shift.')); error(__('You are signed up for this shift.'));
} }
} }
@ -263,7 +263,7 @@ function shift_entry_create_controller_user($shift, $angeltype)
UserAngelType_create($signup_user, $angeltype); UserAngelType_create($signup_user, $angeltype);
} }
success(_('You are subscribed. Thank you!')); success(__('You are subscribed. Thank you!'));
redirect(shift_link($shift)); redirect(shift_link($shift));
} }
@ -322,7 +322,7 @@ function shift_entry_load()
} }
$shiftEntry = ShiftEntry($request->input('shift_entry_id')); $shiftEntry = ShiftEntry($request->input('shift_entry_id'));
if (empty($shiftEntry)) { if (empty($shiftEntry)) {
error(_('Shift entry not found.')); error(__('Shift entry not found.'));
redirect(page_link_to('user_shifts')); redirect(page_link_to('user_shifts'));
} }
@ -344,13 +344,13 @@ function shift_entry_delete_controller()
$angeltype = AngelType($shiftEntry['TID']); $angeltype = AngelType($shiftEntry['TID']);
$signout_user = User($shiftEntry['UID']); $signout_user = User($shiftEntry['UID']);
if (!Shift_signout_allowed($shift, $angeltype, $signout_user)) { if (!Shift_signout_allowed($shift, $angeltype, $signout_user)) {
error(_('You are not allowed to remove this shift entry. If necessary, ask your supporter or heaven to do so.')); error(__('You are not allowed to remove this shift entry. If necessary, ask your supporter or heaven to do so.'));
redirect(user_link($signout_user)); redirect(user_link($signout_user));
} }
if ($request->has('continue')) { if ($request->has('continue')) {
ShiftEntry_delete($shiftEntry); ShiftEntry_delete($shiftEntry);
success(_('Shift entry removed.')); success(__('Shift entry removed.'));
redirect(shift_link($shift)); redirect(shift_link($shift));
} }

View File

@ -94,33 +94,33 @@ function shift_edit_controller()
$rid = $request->input('rid'); $rid = $request->input('rid');
} else { } else {
$valid = false; $valid = false;
$msg .= error(_('Please select a room.'), true); $msg .= error(__('Please select a room.'), true);
} }
if ($request->has('shifttype_id') && isset($shifttypes[$request->input('shifttype_id')])) { if ($request->has('shifttype_id') && isset($shifttypes[$request->input('shifttype_id')])) {
$shifttype_id = $request->input('shifttype_id'); $shifttype_id = $request->input('shifttype_id');
} else { } else {
$valid = false; $valid = false;
$msg .= error(_('Please select a shifttype.'), true); $msg .= error(__('Please select a shifttype.'), true);
} }
if ($request->has('start') && $tmp = parse_date('Y-m-d H:i', $request->input('start'))) { if ($request->has('start') && $tmp = parse_date('Y-m-d H:i', $request->input('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 ($request->has('end') && $tmp = parse_date('Y-m-d H:i', $request->input('end'))) { if ($request->has('end') && $tmp = parse_date('Y-m-d H:i', $request->input('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 => $count) { foreach ($needed_angel_types as $needed_angeltype_id => $count) {
@ -133,7 +133,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.'),
$angeltypes[$needed_angeltype_id] $angeltypes[$needed_angeltype_id]
), true); ), true);
} }
@ -163,7 +163,7 @@ function shift_edit_controller()
. ' 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
@ -182,17 +182,17 @@ function shift_edit_controller()
[ [
msg(), msg(),
'<noscript>' '<noscript>'
. info(_('This page is much more comfortable with javascript.'), true) . info(__('This page is much more comfortable with javascript.'), true)
. '</noscript>', . '</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'))
]) ])
] ]
); );
@ -230,20 +230,20 @@ function shift_delete_controller()
. ' 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="' '<a class="button" href="'
. page_link_to('user_shifts', ['delete_shift' => $shift_id, 'delete' => 1]) . . page_link_to('user_shifts', ['delete_shift' => $shift_id, 'delete' => 1]) .
'">' . _('delete') . '</a>' '">' . __('delete') . '</a>'
]); ]);
} }
@ -265,7 +265,7 @@ function shift_controller()
$shift = Shift($request->input('shift_id')); $shift = Shift($request->input('shift_id'));
if (empty($shift)) { if (empty($shift)) {
error(_('Shift could not be found.')); error(__('Shift could not be found.'));
redirect(page_link_to('user_shifts')); redirect(page_link_to('user_shifts'));
} }

View File

@ -30,12 +30,12 @@ function shifttype_delete_controller()
ShiftType_delete($shifttype['id']); ShiftType_delete($shifttype['id']);
engelsystem_log('Deleted shifttype ' . $shifttype['name']); engelsystem_log('Deleted shifttype ' . $shifttype['name']);
success(sprintf(_('Shifttype %s deleted.'), $shifttype['name'])); success(sprintf(__('Shifttype %s deleted.'), $shifttype['name']));
redirect(page_link_to('shifttypes')); redirect(page_link_to('shifttypes'));
} }
return [ return [
sprintf(_('Delete shifttype %s'), $shifttype['name']), sprintf(__('Delete shifttype %s'), $shifttype['name']),
ShiftType_delete_view($shifttype) ShiftType_delete_view($shifttype)
]; ];
} }
@ -58,7 +58,7 @@ function shifttype_edit_controller()
if ($request->has('shifttype_id')) { if ($request->has('shifttype_id')) {
$shifttype = ShiftType($request->input('shifttype_id')); $shifttype = ShiftType($request->input('shifttype_id'));
if (empty($shifttype)) { if (empty($shifttype)) {
error(_('Shifttype not found.')); error(__('Shifttype not found.'));
redirect(page_link_to('shifttypes')); redirect(page_link_to('shifttypes'));
} }
$shifttype_id = $shifttype['id']; $shifttype_id = $shifttype['id'];
@ -74,7 +74,7 @@ function shifttype_edit_controller()
$name = strip_request_item('name'); $name = strip_request_item('name');
} else { } else {
$valid = false; $valid = false;
error(_('Please enter a name.')); error(__('Please enter a name.'));
} }
if ($request->has('angeltype_id') && preg_match('/^\d+$/', $request->input('angeltype_id'))) { if ($request->has('angeltype_id') && preg_match('/^\d+$/', $request->input('angeltype_id'))) {
@ -92,12 +92,12 @@ function shifttype_edit_controller()
ShiftType_update($shifttype_id, $name, $angeltype_id, $description); ShiftType_update($shifttype_id, $name, $angeltype_id, $description);
engelsystem_log('Updated shifttype ' . $name); engelsystem_log('Updated shifttype ' . $name);
success(_('Updated shifttype.')); success(__('Updated shifttype.'));
} else { } else {
$shifttype_id = ShiftType_create($name, $angeltype_id, $description); $shifttype_id = ShiftType_create($name, $angeltype_id, $description);
engelsystem_log('Created shifttype ' . $name); engelsystem_log('Created shifttype ' . $name);
success(_('Created shifttype.')); success(__('Created shifttype.'));
} }
redirect(page_link_to('shifttypes', ['action' => 'view', 'shifttype_id' => $shifttype_id])); redirect(page_link_to('shifttypes', ['action' => 'view', 'shifttype_id' => $shifttype_id]));
} }
@ -156,7 +156,7 @@ function shifttypes_list_controller()
*/ */
function shifttypes_title() function shifttypes_title()
{ {
return _('Shifttypes'); return __('Shifttypes');
} }
/** /**

View File

@ -25,7 +25,7 @@ function user_angeltypes_unconfirmed_hint()
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,18 +40,18 @@ function user_angeltypes_delete_all_controller()
$request = request(); $request = request();
if (!$request->has('angeltype_id')) { if (!$request->has('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->input('angeltype_id')); $angeltype = AngelType($request->input('angeltype_id'));
if (empty($angeltype)) { if (empty($angeltype)) {
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'));
} }
@ -59,12 +59,12 @@ function user_angeltypes_delete_all_controller()
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)
]; ];
} }
@ -80,18 +80,18 @@ function user_angeltypes_confirm_all_controller()
$request = request(); $request = request();
if (!$request->has('angeltype_id')) { if (!$request->has('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->input('angeltype_id')); $angeltype = AngelType($request->input('angeltype_id'));
if (empty($angeltype)) { if (empty($angeltype)) {
error(_('Angeltype doesn\'t exist.')); error(__('Angeltype doesn\'t exist.'));
redirect(page_link_to('angeltypes')); redirect(page_link_to('angeltypes'));
} }
if (!in_array('admin_user_angeltypes', $privileges) && !User_is_AngelType_supporter($user, $angeltype)) { if (!in_array('admin_user_angeltypes', $privileges) && !User_is_AngelType_supporter($user, $angeltype)) {
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'));
} }
@ -99,12 +99,12 @@ function user_angeltypes_confirm_all_controller()
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)
]; ];
} }
@ -120,30 +120,30 @@ function user_angeltype_confirm_controller()
$request = request(); $request = request();
if (!$request->has('user_angeltype_id')) { if (!$request->has('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->input('user_angeltype_id')); $user_angeltype = UserAngelType($request->input('user_angeltype_id'));
if (empty($user_angeltype)) { if (empty($user_angeltype)) {
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 (empty($angeltype)) { if (empty($angeltype)) {
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 (empty($user_source)) { if (empty($user_source)) {
error(_('User doesn\'t exist.')); error(__('User doesn\'t exist.'));
redirect(page_link_to('angeltypes')); redirect(page_link_to('angeltypes'));
} }
@ -156,7 +156,7 @@ function user_angeltype_confirm_controller()
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)
)); ));
@ -164,7 +164,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)
]; ];
} }
@ -180,37 +180,37 @@ function user_angeltype_delete_controller()
$request = request(); $request = request();
if (!$request->has('user_angeltype_id')) { if (!$request->has('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->input('user_angeltype_id')); $user_angeltype = UserAngelType($request->input('user_angeltype_id'));
if (empty($user_angeltype)) { if (empty($user_angeltype)) {
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 (empty($angeltype)) { if (empty($angeltype)) {
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 (empty($user_source)) { if (empty($user_source)) {
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 ($request->has('confirmed')) { if ($request->has('confirmed')) {
UserAngelType_delete($user_angeltype); UserAngelType_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);
@ -218,7 +218,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)
]; ];
} }
@ -235,37 +235,37 @@ function user_angeltype_update_controller()
$request = request(); $request = request();
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 (!$request->has('user_angeltype_id')) { if (!$request->has('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 ($request->has('supporter') && preg_match('/^[01]$/', $request->input('supporter'))) { if ($request->has('supporter') && preg_match('/^[01]$/', $request->input('supporter'))) {
$supporter = $request->input('supporter') == '1'; $supporter = $request->input('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->input('user_angeltype_id')); $user_angeltype = UserAngelType($request->input('user_angeltype_id'));
if (empty($user_angeltype)) { if (empty($user_angeltype)) {
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 (empty($angeltype)) { if (empty($angeltype)) {
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 (empty($user_source)) { if (empty($user_source)) {
error(_('User doesn\'t exist.')); error(__('User doesn\'t exist.'));
redirect(page_link_to('angeltypes')); redirect(page_link_to('angeltypes'));
} }
@ -274,8 +274,8 @@ function user_angeltype_update_controller()
$success_message = sprintf( $success_message = sprintf(
$supporter $supporter
? _('Added supporter rights for %s to %s.') ? __('Added supporter rights for %s to %s.')
: _('Removed supporter rights for %s from %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)
); );
@ -286,7 +286,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,7 +326,7 @@ function user_angeltype_add_controller()
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)
)); ));
@ -343,7 +343,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'])
]; ];
} }
@ -360,14 +360,14 @@ 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 (!empty($user_angeltype)) { if (!empty($user_angeltype)) {
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 (request()->has('confirmed')) { if (request()->has('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( engelsystem_log(sprintf(
'User %s joined %s.', 'User %s joined %s.',
User_Nick_render($user), User_Nick_render($user),
@ -388,7 +388,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)
]; ];
} }

View File

@ -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>'
); );
} }
} }
@ -128,21 +128,21 @@ function user_driver_license_edit_controller()
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 (!empty($user_driver_license['user_id'])) { } elseif (!empty($user_driver_license['user_id'])) {
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)
]; ];
} }

View File

@ -19,7 +19,7 @@ function user_worklog_delete_controller()
if ($request->has('confirmed')) { if ($request->has('confirmed')) {
UserWorkLog_delete($userWorkLog); UserWorkLog_delete($userWorkLog);
success(_('Work log entry deleted.')); success(__('Work log entry deleted.'));
redirect(user_link($user_source)); redirect(user_link($user_source));
} }
@ -51,7 +51,7 @@ function user_worklog_edit_controller()
if ($valid) { if ($valid) {
UserWorkLog_update($userWorkLog); UserWorkLog_update($userWorkLog);
success(_('Work log entry updated.')); success(__('Work log entry updated.'));
redirect(user_link($user_source)); redirect(user_link($user_source));
} }
} }
@ -80,19 +80,19 @@ function user_worklog_from_request($userWorkLog)
); );
if (is_null($userWorkLog['work_timestamp'])) { if (is_null($userWorkLog['work_timestamp'])) {
$valid = false; $valid = false;
error(_('Please enter work date.')); error(__('Please enter work date.'));
} }
$userWorkLog['work_hours'] = $request->input('work_hours'); $userWorkLog['work_hours'] = $request->input('work_hours');
if (!preg_match("/[0-9]+(\.[0-9]+)?/", $userWorkLog['work_hours'])) { if (!preg_match("/[0-9]+(\.[0-9]+)?/", $userWorkLog['work_hours'])) {
$valid = false; $valid = false;
error(_('Please enter work hours in format ##[.##].')); error(__('Please enter work hours in format ##[.##].'));
} }
$userWorkLog['comment'] = $request->input('comment'); $userWorkLog['comment'] = $request->input('comment');
if (empty($userWorkLog['comment'])) { if (empty($userWorkLog['comment'])) {
$valid = false; $valid = false;
error(_('Please enter a comment.')); error(__('Please enter a comment.'));
} }
return [ return [
@ -124,7 +124,7 @@ function user_worklog_add_controller()
if ($valid) { if ($valid) {
UserWorkLog_create($userWorkLog); UserWorkLog_create($userWorkLog);
success(_('Work log entry created.')); success(__('Work log entry created.'));
redirect(user_link($user_source)); redirect(user_link($user_source));
} }
} }

View File

@ -58,7 +58,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));
} }
@ -72,14 +72,14 @@ function user_delete_controller()
) )
) { ) {
$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) {
User_delete($user_source['UID']); User_delete($user_source['UID']);
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());
@ -87,7 +87,7 @@ function user_delete_controller()
} }
return [ return [
sprintf(_('Delete %s'), $user_source['Nick']), sprintf(__('Delete %s'), $user_source['Nick']),
User_delete_view($user_source) User_delete_view($user_source)
]; ];
} }
@ -157,7 +157,7 @@ function user_edit_vouchers_controller()
$vouchers = trim($request->input('vouchers')); $vouchers = trim($request->input('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) {
@ -165,7 +165,7 @@ function user_edit_vouchers_controller()
User_update($user_source); User_update($user_source);
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']));
@ -174,7 +174,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)
]; ];
} }
@ -191,7 +191,7 @@ function user_controller()
if ($request->has('user_id')) { if ($request->has('user_id')) {
$user_source = User($request->input('user_id')); $user_source = User($request->input('user_id'));
if (empty($user_source)) { if (empty($user_source)) {
error(_('User not found.')); error(__('User not found.'));
redirect(page_link_to('/')); redirect(page_link_to('/'));
} }
} }
@ -226,7 +226,7 @@ function user_controller()
} }
if ($user_source['force_active']) { if ($user_source['force_active']) {
$tshirt_score = _('Enough'); $tshirt_score = __('Enough');
} else { } else {
$tshirt_score = sprintf('%.2f', User_tshirt_score($user_source)) . '&nbsp;h'; $tshirt_score = sprintf('%.2f', User_tshirt_score($user_source)) . '&nbsp;h';
} }
@ -274,7 +274,7 @@ function users_list_controller()
} }
return [ return [
_('All users'), __('All users'),
Users_view( Users_view(
$users, $users,
$order_by, $order_by,
@ -298,7 +298,7 @@ function user_password_recovery_set_new_controller()
$request = request(); $request = request();
$user_source = User_by_password_recovery_token($request->input('token')); $user_source = User_by_password_recovery_token($request->input('token'));
if (empty($user_source)) { if (empty($user_source)) {
error(_('Token is not correct.')); error(__('Token is not correct.'));
redirect(page_link_to('login')); redirect(page_link_to('login'));
} }
@ -311,16 +311,16 @@ function user_password_recovery_set_new_controller()
) { ) {
if ($request->postData('password') != $request->postData('password2')) { if ($request->postData('password') != $request->postData('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->postData('password')); set_password($user_source['UID'], $request->postData('password'));
success(_('Password saved.')); success(__('Password saved.'));
redirect(page_link_to('login')); redirect(page_link_to('login'));
} }
} }
@ -345,28 +345,28 @@ function user_password_recovery_start_controller()
$user_source = User_by_email($email); $user_source = User_by_email($email);
if (empty($user_source)) { if (empty($user_source)) {
$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('user_password_recovery', ['token' => $token]) page_link_to('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'));
} }
} }
@ -396,7 +396,7 @@ function user_password_recovery_controller()
*/ */
function user_password_recovery_title() function user_password_recovery_title()
{ {
return _('Password recovery'); return __('Password recovery');
} }
/** /**
@ -413,7 +413,7 @@ function load_user()
$user = User($request->input('user_id')); $user = User($request->input('user_id'));
if (empty($user)) { if (empty($user)) {
error(_('User doesn\'t exist.')); error(__('User doesn\'t exist.'));
redirect(page_link_to()); redirect(page_link_to());
} }

View File

@ -20,10 +20,10 @@ function engelsystem_email_to_user($recipient_user, $title, $message, $not_if_it
$locale = $translator->getLocale(); $locale = $translator->getLocale();
$translator->setLocale($recipient_user['Sprache']); $translator->setLocale($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 been signed. You got this email because you are registered in the engelsystem.'); . __('This email is autogenerated and has not been signed. You got this email because you are registered in the engelsystem.');
$translator->setLocale($locale); $translator->setLocale($locale);
return engelsystem_email($recipient_user['email'], $title, $message); return engelsystem_email($recipient_user['email'], $title, $message);

View File

@ -12,22 +12,22 @@ function mail_shift_change($old_shift, $new_shift)
$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";
@ -36,7 +36,7 @@ function mail_shift_change($old_shift, $new_shift)
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";
@ -44,7 +44,7 @@ function mail_shift_change($old_shift, $new_shift)
} }
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,7 +54,7 @@ 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";
@ -65,7 +65,7 @@ function mail_shift_change($old_shift, $new_shift)
if ($user['email_shiftinfo']) { if ($user['email_shiftinfo']) {
engelsystem_email_to_user( engelsystem_email_to_user(
$user, $user,
'[engelsystem] ' . _('Your Shift has changed'), '[engelsystem] ' . __('Your Shift has changed'),
$message, $message,
true true
); );
@ -81,7 +81,7 @@ 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";
@ -90,7 +90,7 @@ function mail_shift_delete($shift)
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);
} }
} }
} }
@ -107,13 +107,13 @@ function mail_shift_assign($user, $shift)
$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);
} }
/** /**
@ -128,11 +128,11 @@ function mail_shift_removed($user, $shift)
$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);
} }

View File

@ -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.')
); );
} }

View File

@ -293,7 +293,9 @@ function Shift_free_entries($needed_angeltype, $shift_entries)
$taken++; $taken++;
} }
} }
return max(0, $needed_angeltype['count'] - $taken);
$neededAngels = !empty($needed_angeltype) ? $needed_angeltype['count'] : 0;
return max(0, $neededAngels - $taken);
} }
/** /**

View File

@ -39,6 +39,10 @@ function User_tshirt_score($user)
$user['UID'], $user['UID'],
time() time()
]); ]);
if (!isset($result_shifts['tshirt_score'])) {
$result_shifts = ['tshirt_score' => 0];
}
$result_worklog = DB::selectOne(' $result_worklog = DB::selectOne('
SELECT SUM(`work_hours`) AS `tshirt_score` SELECT SUM(`work_hours`) AS `tshirt_score`
FROM `User` FROM `User`
@ -49,6 +53,9 @@ function User_tshirt_score($user)
$user['UID'], $user['UID'],
time() time()
]); ]);
if (!isset($result_worklog['tshirt_score'])) {
$result_worklog = ['tshirt_score' => 0];
}
return $result_shifts['tshirt_score'] + $result_worklog['tshirt_score']; return $result_shifts['tshirt_score'] + $result_worklog['tshirt_score'];
} }

View File

@ -7,7 +7,7 @@ use Engelsystem\Database\DB;
*/ */
function admin_active_title() function admin_active_title()
{ {
return _('Active angels'); return __('Active angels');
} }
/** /**
@ -39,14 +39,14 @@ function admin_active()
$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) {
@ -84,16 +84,16 @@ function admin_active()
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', ['search' => $search]) . '">&laquo; ' $set_active = '<a href="' . page_link_to('admin_active', ['search' => $search]) . '">&laquo; '
. _('back') . __('back')
. '</a> | <a href="' . '</a> | <a href="'
. page_link_to( . page_link_to(
'admin_active', 'admin_active',
['search' => $search, 'count' => $count, 'set_active' => 1, 'ack' => 1] ['search' => $search, 'count' => $count, 'set_active' => 1, 'ack' => 1]
) . '">' ) . '">'
. _('apply') . __('apply')
. '</a>'; . '</a>';
} }
} }
@ -104,9 +104,9 @@ function admin_active()
if (!empty($user_source)) { if (!empty($user_source)) {
DB::update('UPDATE `User` SET `Aktiv`=1 WHERE `UID`=? LIMIT 1', [$user_id]); DB::update('UPDATE `User` SET `Aktiv`=1 WHERE `UID`=? LIMIT 1', [$user_id]);
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 ($request->has('not_active') && preg_match('/^\d+$/', $request->input('not_active'))) { } elseif ($request->has('not_active') && preg_match('/^\d+$/', $request->input('not_active'))) {
$user_id = $request->input('not_active'); $user_id = $request->input('not_active');
@ -114,9 +114,9 @@ function admin_active()
if (!empty($user_source)) { if (!empty($user_source)) {
DB::update('UPDATE `User` SET `Aktiv`=0 WHERE `UID`=? LIMIT 1', [$user_id]); DB::update('UPDATE `User` SET `Aktiv`=0 WHERE `UID`=? LIMIT 1', [$user_id]);
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 ($request->has('tshirt') && preg_match('/^\d+$/', $request->input('tshirt'))) { } elseif ($request->has('tshirt') && preg_match('/^\d+$/', $request->input('tshirt'))) {
$user_id = $request->input('tshirt'); $user_id = $request->input('tshirt');
@ -124,7 +124,7 @@ function admin_active()
if (!empty($user_source)) { if (!empty($user_source)) {
DB::update('UPDATE `User` SET `Tshirt`=1 WHERE `UID`=? LIMIT 1', [$user_id]); DB::update('UPDATE `User` SET `Tshirt`=1 WHERE `UID`=? LIMIT 1', [$user_id]);
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);
} }
@ -134,9 +134,9 @@ function admin_active()
if (!empty($user_source)) { if (!empty($user_source)) {
DB::update('UPDATE `User` SET `Tshirt`=0 WHERE `UID`=? LIMIT 1', [$user_id]); DB::update('UPDATE `User` SET `Tshirt`=0 WHERE `UID`=? LIMIT 1', [$user_id]);
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);
} }
} }
@ -197,7 +197,7 @@ function admin_active()
$parameters['show_all_shifts'] = 1; $parameters['show_all_shifts'] = 1;
} }
$actions[] = '<a href="' . page_link_to('admin_active', $parameters) . '">' $actions[] = '<a href="' . page_link_to('admin_active', $parameters) . '">'
. _('set active') . __('set active')
. '</a>'; . '</a>';
} }
if ($usr['Aktiv'] == 1) { if ($usr['Aktiv'] == 1) {
@ -209,7 +209,7 @@ function admin_active()
$parametersRemove['show_all_shifts'] = 1; $parametersRemove['show_all_shifts'] = 1;
} }
$actions[] = '<a href="' . page_link_to('admin_active', $parametersRemove) . '">' $actions[] = '<a href="' . page_link_to('admin_active', $parametersRemove) . '">'
. _('remove active') . __('remove active')
. '</a>'; . '</a>';
} }
if ($usr['Tshirt'] == 0) { if ($usr['Tshirt'] == 0) {
@ -221,7 +221,7 @@ function admin_active()
$parametersShirt['show_all_shifts'] = 1; $parametersShirt['show_all_shifts'] = 1;
} }
$actions[] = '<a href="' . page_link_to('admin_active', $parametersShirt) . '">' $actions[] = '<a href="' . page_link_to('admin_active', $parametersShirt) . '">'
. _('got t-shirt') . __('got t-shirt')
. '</a>'; . '</a>';
} }
if ($usr['Tshirt'] == 1) { if ($usr['Tshirt'] == 1) {
@ -233,7 +233,7 @@ function admin_active()
$parameters['show_all_shifts'] = 1; $parameters['show_all_shifts'] = 1;
} }
$actions[] = '<a href="' . page_link_to('admin_active', $parameters) . '">' $actions[] = '<a href="' . page_link_to('admin_active', $parameters) . '">'
. _('remove t-shirt') . __('remove t-shirt')
. '</a>'; . '</a>';
} }
@ -244,52 +244,50 @@ function admin_active()
$shirt_statistics = []; $shirt_statistics = [];
foreach (array_keys($tshirt_sizes) as $size) { foreach (array_keys($tshirt_sizes) as $size) {
if (!empty($size)) { $gc = DB::selectOne(
$gc = DB::selectOne( 'SELECT count(*) FROM `User` WHERE `Size`=? AND `Tshirt`=1',
'SELECT count(*) FROM `User` WHERE `Size`=? AND `Tshirt`=1', [$size]
[$size] );
); $gc = array_shift($gc);
$gc = array_shift($gc);
$shirt_statistics[] = [ $shirt_statistics[] = [
'size' => $size, 'size' => $size,
'given' => (int)$gc 'given' => (int)$gc
]; ];
}
} }
$shirtCount = User_tshirts_count(); $shirtCount = User_tshirts_count();
$shirt_statistics[] = [ $shirt_statistics[] = [
'size' => '<b>' . _('Sum') . '</b>', 'size' => '<b>' . __('Sum') . '</b>',
'given' => '<b>' . $shirtCount . '</b>' 'given' => '<b>' . $shirtCount . '</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'),
'given' => _('Given shirts') 'given' => __('Given shirts')
], $shirt_statistics) ], $shirt_statistics)
]); ]);
} }

View File

@ -7,7 +7,7 @@ use Engelsystem\Database\DB;
*/ */
function admin_arrive_title() function admin_arrive_title()
{ {
return _('Arrived angels'); return __('Arrived angels');
} }
/** /**
@ -35,10 +35,10 @@ function admin_arrive()
LIMIT 1 LIMIT 1
', [$user_id]); ', [$user_id]);
engelsystem_log('User set to not arrived: ' . User_Nick_render($user_source)); engelsystem_log('User set to not arrived: ' . User_Nick_render($user_source));
success(_('Reset done. Angel has not arrived.')); 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 ($request->has('arrived') && preg_match('/^\d+$/', $request->input('arrived'))) { } elseif ($request->has('arrived') && preg_match('/^\d+$/', $request->input('arrived'))) {
$user_id = $request->input('arrived'); $user_id = $request->input('arrived');
@ -51,10 +51,10 @@ function admin_arrive()
LIMIT 1 LIMIT 1
', [time(), $user_id]); ', [time(), $user_id]);
engelsystem_log('User set has arrived: ' . User_Nick_render($user_source)); engelsystem_log('User set has arrived: ' . User_Nick_render($user_source));
success(_('Angel has been marked as arrived.')); 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);
} }
} }
@ -91,16 +91,16 @@ function admin_arrive()
} }
$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 $usr['actions'] = $usr['Gekommen'] == 1
? '<a href="' . page_link_to( ? '<a href="' . page_link_to(
'admin_arrive', 'admin_arrive',
['reset' => $usr['UID'], 'search' => $search] ['reset' => $usr['UID'], 'search' => $search]
) . '">' . _('reset') . '</a>' ) . '">' . __('reset') . '</a>'
: '<a href="' . page_link_to( : '<a href="' . page_link_to(
'admin_arrive', 'admin_arrive',
['arrived' => $usr['UID'], 'search' => $search] ['arrived' => $usr['UID'], 'search' => $search]
) . '">' . _('arrived') . '</a>'; ) . '">' . __('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']);
@ -169,61 +169,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)
]) ])
]) ])

View File

@ -7,7 +7,7 @@ use Engelsystem\Database\DB;
*/ */
function admin_free_title() function admin_free_title()
{ {
return _('Free angels'); return __('Free angels');
} }
/** /**
@ -94,7 +94,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')
: '' : ''
]; ];
} }
@ -102,25 +102,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, $angelType) form_select('angeltype', __('Angeltype'), $angel_types, $angelType)
]), ]),
div('col-md-2', [ div('col-md-2', [
form_checkbox('confirmed_only', _('Only confirmed'), $request->has('confirmed_only')) form_checkbox('confirmed_only', __('Only confirmed'), $request->has('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)
]); ]);

View File

@ -7,7 +7,7 @@ use Engelsystem\Database\DB;
*/ */
function admin_groups_title() function admin_groups_title()
{ {
return _('Grouprights'); return __('Grouprights');
} }
/** /**
@ -40,7 +40,7 @@ function admin_groups()
'actions' => button( 'actions' => button(
page_link_to('admin_groups', page_link_to('admin_groups',
['action' => 'edit', 'id' => $group['UID']]), ['action' => 'edit', 'id' => $group['UID']]),
_('edit'), __('edit'),
'btn-xs' 'btn-xs'
) )
]; ];
@ -48,8 +48,8 @@ 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)
]); ]);
@ -97,8 +97,8 @@ function admin_groups()
); );
} }
$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( form(
$privileges_form, $privileges_form,
page_link_to('admin_groups', ['action' => 'save', 'id' => $group_id]) page_link_to('admin_groups', ['action' => 'save', 'id' => $group_id])

View File

@ -5,7 +5,7 @@
*/ */
function admin_import_title() function admin_import_title()
{ {
return _('Frab import'); return __('Frab import');
} }
/** /**
@ -35,7 +35,7 @@ function admin_import()
fclose($test_handle); fclose($test_handle);
@unlink($import_dir . '/tmp'); @unlink($import_dir . '/tmp');
} catch (Exception $e) { } catch (Exception $e) {
error(_('Webserver has no write-permission on import directory.')); error(__('Webserver has no write-permission on import directory.'));
} }
$import_file = $import_dir . '/import_' . $user['UID'] . '.xml'; $import_file = $import_dir . '/import_' . $user['UID'] . '.xml';
@ -60,7 +60,7 @@ function admin_import()
$shifttype_id = $request->input('shifttype_id'); $shifttype_id = $request->input('shifttype_id');
} else { } else {
$valid = false; $valid = false;
error(_('Please select a shift type.')); error(__('Please select a shift type.'));
} }
$minutes_start = trim($request->input('add_minutes_start')); $minutes_start = trim($request->input('add_minutes_start'));
@ -68,14 +68,14 @@ function admin_import()
$add_minutes_start = $minutes_start; $add_minutes_start = $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 ($request->has('add_minutes_end') && is_numeric(trim($request->input('add_minutes_end')))) { if ($request->has('add_minutes_end') && is_numeric(trim($request->input('add_minutes_end')))) {
$add_minutes_end = trim($request->input('add_minutes_end')); $add_minutes_end = trim($request->input('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)) {
@ -83,16 +83,16 @@ function admin_import()
libxml_use_internal_errors(true); libxml_use_internal_errors(true);
if (simplexml_load_file($import_file) === false) { if (simplexml_load_file($import_file) === false) {
$valid = false; $valid = false;
error(_('No valid xml/xcal file provided.')); error(__('No valid xml/xcal file provided.'));
unlink($import_file); unlink($import_file);
} }
} else { } else {
$valid = false; $valid = false;
error(_('File upload went wrong.')); error(__('File upload went wrong.'));
} }
} else { } else {
$valid = false; $valid = false;
error(_('Please provide some data.')); error(__('Please provide some data.'));
} }
} }
@ -107,23 +107,23 @@ function admin_import()
); );
} else { } else {
$html .= div('well well-sm text-center', [ $html .= div('well well-sm text-center', [
_('File Upload') __('File Upload')
. mute(glyph('arrow-right')) . mute(glyph('arrow-right'))
. mute(_('Validation')) . mute(__('Validation'))
. mute(glyph('arrow-right')) . mute(glyph('arrow-right'))
. mute(_('Import')) . mute(__('Import'))
]) . div('row', [ ]) . div('row', [
div('col-md-offset-3 col-md-6', [ div('col-md-offset-3 col-md-6', [
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'))
]) ])
]) ])
]); ]);
@ -132,28 +132,28 @@ function admin_import()
case 'check': case 'check':
if (!file_exists($import_file)) { if (!file_exists($import_file)) {
error(_('Missing import file.')); error(__('Missing import file.'));
redirect(page_link_to('admin_import')); redirect(page_link_to('admin_import'));
} }
if ($request->has('shifttype_id') && isset($shifttypes[$request->input('shifttype_id')])) { if ($request->has('shifttype_id') && isset($shifttypes[$request->input('shifttype_id')])) {
$shifttype_id = $request->input('shifttype_id'); $shifttype_id = $request->input('shifttype_id');
} else { } else {
error(_('Please select a shift type.')); error(__('Please select a shift type.'));
redirect(page_link_to('admin_import')); redirect(page_link_to('admin_import'));
} }
if ($request->has('add_minutes_start') && is_numeric(trim($request->input('add_minutes_start')))) { if ($request->has('add_minutes_start') && is_numeric(trim($request->input('add_minutes_start')))) {
$add_minutes_start = trim($request->input('add_minutes_start')); $add_minutes_start = trim($request->input('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 ($request->has('add_minutes_end') && is_numeric(trim($request->input(('add_minutes_end'))))) { if ($request->has('add_minutes_end') && is_numeric(trim($request->input(('add_minutes_end'))))) {
$add_minutes_end = trim($request->input('add_minutes_end')); $add_minutes_end = trim($request->input('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'));
} }
@ -168,53 +168,53 @@ 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>' '<span class="text-success">' . __('File Upload') . glyph('ok-circle') . '</span>'
. mute(glyph('arrow-right')) . mute(glyph('arrow-right'))
. _('Validation') . __('Validation')
. mute(glyph('arrow-right')) . mute(glyph('arrow-right'))
. mute(_('Import')) . 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', 'step' => 'import',
@ -227,7 +227,7 @@ function admin_import()
case 'import': case 'import':
if (!file_exists($import_file)) { if (!file_exists($import_file)) {
error(_('Missing import file.')); error(__('Missing import file.'));
redirect(page_link_to('admin_import')); redirect(page_link_to('admin_import'));
} }
@ -238,21 +238,21 @@ function admin_import()
if ($request->has('shifttype_id') && isset($shifttypes[$request->input('shifttype_id')])) { if ($request->has('shifttype_id') && isset($shifttypes[$request->input('shifttype_id')])) {
$shifttype_id = $request->input('shifttype_id'); $shifttype_id = $request->input('shifttype_id');
} else { } else {
error(_('Please select a shift type.')); error(__('Please select a shift type.'));
redirect(page_link_to('admin_import')); redirect(page_link_to('admin_import'));
} }
if ($request->has('add_minutes_start') && is_numeric(trim($request->input('add_minutes_start')))) { if ($request->has('add_minutes_start') && is_numeric(trim($request->input('add_minutes_start')))) {
$add_minutes_start = trim($request->input('add_minutes_start')); $add_minutes_start = trim($request->input('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 ($request->has('add_minutes_end') && is_numeric(trim($request->input('add_minutes_end')))) { if ($request->has('add_minutes_end') && is_numeric(trim($request->input('add_minutes_end')))) {
$add_minutes_end = trim($request->input('add_minutes_end')); $add_minutes_end = trim($request->input('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'));
} }
@ -288,12 +288,12 @@ function admin_import()
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>' '<span class="text-success">' . __('File Upload') . glyph('ok-circle') . '</span>'
. mute(glyph('arrow-right')) . mute(glyph('arrow-right'))
. '<span class="text-success">' . _('Validation') . glyph('ok-circle') . '</span>' . '<span class="text-success">' . __('Validation') . glyph('ok-circle') . '</span>'
. mute(glyph('arrow-right')) . mute(glyph('arrow-right'))
. '<span class="text-success">' . _('Import') . glyph('ok-circle') . '</span>' . '<span class="text-success">' . __('Import') . glyph('ok-circle') . '</span>'
]) . success(_('It\'s done!'), true); ]) . success(__('It\'s done!'), true);
break; break;
default: default:
redirect(page_link_to('admin_import')); redirect(page_link_to('admin_import'));

View File

@ -5,7 +5,7 @@
*/ */
function admin_log_title() function admin_log_title()
{ {
return _('Log'); return __('Log');
} }
/** /**
@ -26,8 +26,8 @@ function admin_log()
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',

View File

@ -14,7 +14,7 @@ function admin_news()
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 ($request->has('id') && preg_match('/^\d{1,11}$/', $request->input('id'))) { if ($request->has('id') && preg_match('/^\d{1,11}$/', $request->input('id'))) {
$news_id = $request->input('id'); $news_id = $request->input('id');
} else { } else {
@ -34,19 +34,19 @@ function admin_news()
&& strip_tags($news['Text']) != $news['Text'] && strip_tags($news['Text']) != $news['Text']
) { ) {
$html .= warning( $html .= warning(
_('This message contains HTML. After saving the post some formatting will be lost!'), __('This message contains HTML. After saving the post some formatting will be lost!'),
true true
); );
} }
$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])
); );
@ -54,7 +54,7 @@ function admin_news()
$html .= '<a class="btn btn-danger" href="' $html .= '<a class="btn btn-danger" href="'
. page_link_to('admin_news', ['action' => 'delete', 'id' => $news_id]) . page_link_to('admin_news', ['action' => 'delete', 'id' => $news_id])
. '">' . '">'
. '<span class="glyphicon glyphicon-trash"></span> ' . _('Delete') . '<span class="glyphicon glyphicon-trash"></span> ' . __('Delete')
. '</a>'; . '</a>';
break; break;
@ -84,14 +84,14 @@ function admin_news()
); );
engelsystem_log('News updated: ' . $request->postData('eBetreff')); engelsystem_log('News updated: ' . $request->postData('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':
DB::delete('DELETE FROM `News` WHERE `ID`=? LIMIT 1', [$news_id]); DB::delete('DELETE FROM `News` WHERE `ID`=? LIMIT 1', [$news_id]);
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:

View File

@ -7,7 +7,7 @@ use Engelsystem\Database\DB;
*/ */
function admin_questions_title() function admin_questions_title()
{ {
return _('Answer questions'); return __('Answer questions');
} }
/** /**
@ -25,7 +25,7 @@ function admin_new_questions()
if ($new_messages > 0) { if ($new_messages > 0) {
return '<a href="' . page_link_to('admin_questions') . '">' return '<a href="' . page_link_to('admin_questions') . '">'
. _('There are unanswered questions!') . __('There are unanswered questions!')
. '</a>'; . '</a>';
} }
} }
@ -53,11 +53,11 @@ function admin_questions()
'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'
) )
]; ];
@ -75,26 +75,26 @@ function admin_questions()
'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)
]); ]);

View File

@ -4,7 +4,7 @@
*/ */
function admin_rooms_title() function admin_rooms_title()
{ {
return _('Rooms'); return __('Rooms');
} }
/** /**
@ -24,12 +24,12 @@ function admin_rooms()
'actions' => table_buttons([ 'actions' => table_buttons([
button( button(
page_link_to('admin_rooms', ['show' => 'edit', 'id' => $room['RID']]), page_link_to('admin_rooms', ['show' => 'edit', 'id' => $room['RID']]),
_('edit'), __('edit'),
'btn-xs' 'btn-xs'
), ),
button( button(
page_link_to('admin_rooms', ['show' => 'delete', 'id' => $room['RID']]), page_link_to('admin_rooms', ['show' => 'delete', 'id' => $room['RID']]),
_('delete'), __('delete'),
'btn-xs' 'btn-xs'
) )
]) ])
@ -79,13 +79,13 @@ function admin_rooms()
$result = Room_validate_name(strip_request_item('name'), $room_id); $result = Room_validate_name(strip_request_item('name'), $room_id);
if (!$result->isValid()) { if (!$result->isValid()) {
$valid = false; $valid = false;
$msg .= error(_('This name is already in use.'), true); $msg .= error(__('This name is already in use.'), true);
} else { } else {
$name = $result->getValue(); $name = $result->getValue();
} }
} else { } else {
$valid = false; $valid = false;
$msg .= error(_('Please enter a name.'), true); $msg .= error(__('Please enter a name.'), true);
} }
$from_frab = $request->has('from_frab'); $from_frab = $request->has('from_frab');
@ -110,7 +110,7 @@ function admin_rooms()
} else { } else {
$valid = false; $valid = false;
$msg .= error(sprintf( $msg .= error(sprintf(
_('Please enter needed angels for type %s.'), __('Please enter needed angels for type %s.'),
$angeltype $angeltype
), true); ), true);
} }
@ -139,7 +139,7 @@ function admin_rooms()
'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'));
} }
} }
@ -152,29 +152,29 @@ 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_frab', _('Frab import'), $from_frab), form_checkbox('from_frab', __('Frab import'), $from_frab),
form_text('map_url', _('Map URL'), $map_url), form_text('map_url', __('Map URL'), $map_url),
form_info('', _('The map url is used to display an iframe on the room page.')), form_info('', __('The map url is used to display an iframe on the room page.')),
form_textarea('description', _('Description'), $description), form_textarea('description', __('Description'), $description),
form_info('', _('Please use markdown for the description.')), form_info('', __('Please use markdown for the description.')),
]), ]),
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->input('show') == 'delete') { } elseif ($request->input('show') == 'delete') {
@ -182,19 +182,19 @@ function admin_rooms()
Room_delete($room_id); Room_delete($room_id);
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( button(
page_link_to('admin_rooms', ['show' => 'delete', 'id' => $room_id, 'ack' => 1]), page_link_to('admin_rooms', ['show' => 'delete', 'id' => $room_id, 'ack' => 1]),
_('Delete'), __('Delete'),
'delete btn-danger' 'delete btn-danger'
) )
]) ])
@ -204,13 +204,13 @@ 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_frab' => _('Frab import'), 'from_frab' => __('Frab import'),
'map_url' => _('Map'), 'map_url' => __('Map'),
'actions' => '' 'actions' => ''
], $rooms) ], $rooms)
]); ]);

View File

@ -7,7 +7,7 @@ use Engelsystem\Database\DB;
*/ */
function admin_shifts_title() function admin_shifts_title()
{ {
return _('Create shifts'); return __('Create shifts');
} }
/** /**
@ -55,13 +55,13 @@ function admin_shifts()
$shifttype = ShiftType($request->input('shifttype_id')); $shifttype = ShiftType($request->input('shifttype_id'));
if (empty($shifttype)) { if (empty($shifttype)) {
$valid = false; $valid = false;
error(_('Please select a shift type.')); error(__('Please select a shift type.'));
} else { } else {
$shifttype_id = $request->input('shifttype_id'); $shifttype_id = $request->input('shifttype_id');
} }
} else { } else {
$valid = false; $valid = false;
error(_('Please select a shift type.')); error(__('Please select a shift type.'));
} }
// Name/Bezeichnung der Schicht, darf leer sein // Name/Bezeichnung der Schicht, darf leer sein
@ -77,26 +77,26 @@ function admin_shifts()
} else { } else {
$valid = false; $valid = false;
$rid = $rooms[0]['RID']; $rid = $rooms[0]['RID'];
error(_('Please select a location.')); error(__('Please select a location.'));
} }
if ($request->has('start') && $tmp = parse_date('Y-m-d H:i', $request->input('start'))) { if ($request->has('start') && $tmp = parse_date('Y-m-d H:i', $request->input('start'))) {
$start = $tmp; $start = $tmp;
} else { } else {
$valid = false; $valid = false;
error(_('Please select a start time.')); error(__('Please select a start time.'));
} }
if ($request->has('end') && $tmp = parse_date('Y-m-d H:i', $request->input('end'))) { if ($request->has('end') && $tmp = parse_date('Y-m-d H:i', $request->input('end'))) {
$end = $tmp; $end = $tmp;
} else { } else {
$valid = false; $valid = false;
error(_('Please select an end time.')); error(__('Please select an end time.'));
} }
if ($start >= $end) { if ($start >= $end) {
$valid = false; $valid = false;
error(_('The shifts end has to be after its start.')); error(__('The shifts end has to be after its start.'));
} }
if ($request->has('mode')) { if ($request->has('mode')) {
@ -108,7 +108,7 @@ function admin_shifts()
$length = trim($request->input('length')); $length = trim($request->input('length'));
} else { } else {
$valid = false; $valid = false;
error(_('Please enter a shift duration in minutes.')); error(__('Please enter a shift duration in minutes.'));
} }
} elseif ($request->input('mode') == 'variable') { } elseif ($request->input('mode') == 'variable') {
if ( if (
@ -125,12 +125,12 @@ function admin_shifts()
); );
} else { } else {
$valid = false; $valid = false;
error(_('Please split the shift-change hours by colons.')); error(__('Please split the shift-change hours by colons.'));
} }
} }
} else { } else {
$valid = false; $valid = false;
error(_('Please select a mode.')); error(__('Please select a mode.'));
} }
if ($request->has('angelmode')) { if ($request->has('angelmode')) {
@ -143,21 +143,21 @@ function admin_shifts()
$needed_angel_types[$type['id']] = trim($request->input('type_' . $type['id'], 0)); $needed_angel_types[$type['id']] = trim($request->input('type_' . $type['id'], 0));
} else { } else {
$valid = false; $valid = false;
error(sprintf(_('Please check the needed angels for team %s.'), $type['name'])); error(sprintf(__('Please check the needed angels for team %s.'), $type['name']));
} }
} }
if (array_sum($needed_angel_types) == 0) { if (array_sum($needed_angel_types) == 0) {
$valid = false; $valid = false;
error(_('There are 0 angels needed. Please enter the amounts of needed angels.')); error(__('There are 0 angels needed. Please enter the amounts of needed angels.'));
} }
} else { } else {
$valid = false; $valid = false;
error(_('Please select a mode for needed angels.')); error(__('Please select a mode for needed angels.'));
} }
} else { } else {
$valid = false; $valid = false;
error(_('Please select needed angels.')); error(__('Please select needed angels.'));
} }
// Beim Zurück-Knopf das Formular zeigen // Beim Zurück-Knopf das Formular zeigen
@ -285,7 +285,7 @@ function admin_shifts()
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),
@ -297,13 +297,13 @@ function admin_shifts()
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'))
]) ])
]); ]);
} }
@ -379,48 +379,48 @@ function admin_shifts()
return page_with_title(admin_shifts_title(), [ return page_with_title(admin_shifts_title(), [
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, $rid), form_select('rid', __('Room'), $room_array, $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( form_text(
'length', 'length',
_('Length'), __('Length'),
$request->has('length') $request->has('length')
? $request->input('length') ? $request->input('length')
: '120' : '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'),
$request->has('change_hours') $request->has('change_hours')
? $request->input('input') ? $request->input('input')
: '00, 04, 08, 10, 12, 14, 16, 18, 20, 22' : '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( form_radio(
'angelmode', 'angelmode',
_('The following angels are needed'), __('The following angels are needed'),
$angelmode == 'manually', $angelmode == 'manually',
'manually' 'manually'
), ),
@ -429,7 +429,7 @@ function admin_shifts()
]) ])
]) ])
]), ]),
form_submit('preview', _('Preview')) form_submit('preview', __('Preview'))
]) ])
]); ]);
} }

View File

@ -7,7 +7,7 @@ use Engelsystem\Database\DB;
*/ */
function admin_user_title() function admin_user_title()
{ {
return _('All Angels'); return __('All Angels');
} }
/** /**
@ -18,13 +18,6 @@ function admin_user()
global $user, $privileges; global $user, $privileges;
$tshirt_sizes = config('tshirt_sizes'); $tshirt_sizes = config('tshirt_sizes');
$request = request(); $request = request();
foreach ($tshirt_sizes as $key => $size) {
if (empty($size)) {
unset($tshirt_sizes[$key]);
}
}
$html = ''; $html = '';
if (!$request->has('id')) { if (!$request->has('id')) {
@ -35,7 +28,7 @@ function admin_user()
if (!$request->has('action')) { if (!$request->has('action')) {
$user_source = User($user_id); $user_source = User($user_id);
if (empty($user_source)) { if (empty($user_source)) {
error(_('This user does not exist.')); error(__('This user does not exist.'));
redirect(users_link()); redirect(users_link());
} }
@ -68,11 +61,11 @@ function admin_user()
} }
$html .= " <tr><td>jabber</td><td>" . '<input size="40" name="ejabber" value="' . $user_source['jabber'] . '" class="form-control"></td></tr>' . "\n"; $html .= " <tr><td>jabber</td><td>" . '<input size="40" name="ejabber" value="' . $user_source['jabber'] . '" class="form-control"></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']) . '</td></tr>' . "\n"; . html_select_key('size', 'eSize', $tshirt_sizes, $user_source['Size'], __('Please select...')) . '</td></tr>' . "\n";
$options = [ $options = [
'1' => _('Yes'), '1' => __('Yes'),
'0' => _('No') '0' => __('No')
]; ];
// Gekommen? // Gekommen?
@ -85,7 +78,7 @@ function admin_user()
// 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";
} }
@ -104,7 +97,7 @@ function admin_user()
$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="' $html .= 'Hier kannst Du das Passwort dieses Engels neu setzen:<form action="'
. page_link_to('admin_user', ['action' => 'change_pw', 'id' => $user_id]) . page_link_to('admin_user', ['action' => 'change_pw', 'id' => $user_id])
@ -171,7 +164,7 @@ function admin_user()
} }
$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 />";
@ -319,7 +312,7 @@ function admin_user()
} }
} }
return page_with_title(_('Edit user'), [ return page_with_title(__('Edit user'), [
$html $html
]); ]);
} }

View File

@ -5,7 +5,7 @@
*/ */
function credits_title() function credits_title()
{ {
return _('Credits'); return __('Credits');
} }
/** /**

View File

@ -7,7 +7,7 @@ use Engelsystem\Database\DB;
*/ */
function login_title() function login_title()
{ {
return _('Login'); return __('Login');
} }
/** /**
@ -15,7 +15,7 @@ function login_title()
*/ */
function register_title() function register_title()
{ {
return _('Register'); return __('Register');
} }
/** /**
@ -23,7 +23,7 @@ function register_title()
*/ */
function logout_title() function logout_title()
{ {
return _('Logout'); return __('Logout');
} }
/** /**
@ -69,14 +69,8 @@ function guest_register()
} }
} }
foreach ($tshirt_sizes as $key => $size) {
if (empty($size)) {
unset($tshirt_sizes[$key]);
}
}
if (!in_array('register', $privileges) || (!isset($user) && !config('registration_enabled'))) { if (!in_array('register', $privileges) || (!isset($user) && !config('registration_enabled'))) {
error(_('Registration is disabled.')); error(__('Registration is disabled.'));
return page_with_title(register_title(), [ return page_with_title(register_title(), [
msg(), msg(),
@ -90,12 +84,12 @@ function guest_register()
$nick = User_validate_Nick($request->input('nick')); $nick = User_validate_Nick($request->input('nick'));
if (count(DB::select('SELECT `UID` FROM `User` WHERE `Nick`=? LIMIT 1', [$nick])) > 0) { if (count(DB::select('SELECT `UID` FROM `User` WHERE `Nick`=? LIMIT 1', [$nick])) > 0) {
$valid = false; $valid = false;
$msg .= error(sprintf(_('Your nick &quot;%s&quot; already exists.'), $nick), true); $msg .= error(sprintf(__('Your nick &quot;%s&quot; already exists.'), $nick), true);
} }
} else { } else {
$valid = false; $valid = false;
$msg .= error(sprintf( $msg .= error(sprintf(
_('Your nick &quot;%s&quot; is too short (min. 2 characters).'), __('Your nick &quot;%s&quot; is too short (min. 2 characters).'),
User_validate_Nick($request->input('nick')) User_validate_Nick($request->input('nick'))
), true); ), true);
} }
@ -104,11 +98,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 ($request->has('email_shiftinfo')) { if ($request->has('email_shiftinfo')) {
@ -123,7 +117,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);
} }
} }
@ -132,19 +126,19 @@ function guest_register()
$tshirt_size = $request->input('tshirt_size'); $tshirt_size = $request->input('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 ($request->has('password') && strlen($request->postData('password')) >= $min_password_length) { if ($request->has('password') && strlen($request->postData('password')) >= $min_password_length) {
if ($request->postData('password') != $request->postData('password2')) { if ($request->postData('password') != $request->postData('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);
} }
@ -155,11 +149,11 @@ function guest_register()
$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.'));
} }
} else { } else {
$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.'));
} }
$selected_angel_types = []; $selected_angel_types = [];
@ -187,7 +181,7 @@ function guest_register()
$dect = strip_request_item('dect'); $dect = strip_request_item('dect');
} else { } else {
$valid = false; $valid = false;
error(_('For dect numbers are only 5 digits allowed.')); error(__('For dect numbers are only 5 digits allowed.'));
} }
} }
if ($request->has('mobile')) { if ($request->has('mobile')) {
@ -271,7 +265,7 @@ function guest_register()
'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)) {
@ -299,7 +293,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([
@ -307,18 +301,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
) )
]) ])
@ -327,72 +321,72 @@ 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, __('Please select...')) : ''
]) ])
]), ]),
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(
'angel_types', 'angel_types',
_('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_submit('submit', _('Register')) form_submit('submit', __('Register'))
]) ])
]); ]);
} }
@ -435,19 +429,19 @@ function guest_login()
if ($request->has('password')) { if ($request->has('password')) {
if (!verify_password($request->postData('password'), $login_user['Passwort'], $login_user['UID'])) { if (!verify_password($request->postData('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)) {
@ -469,21 +463,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!')
]) ])
]) ])
]) ])
@ -494,12 +488,12 @@ 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( button(
page_link_to('angeltypes', ['action' => 'about']), page_link_to('angeltypes', ['action' => 'about']),
_('Teams/Job description') . ' &raquo;' __('Teams/Job description') . ' &raquo;'
) )
]) ])
]) ])
@ -517,12 +511,12 @@ function get_register_hint()
if (in_array('register', $privileges) && config('registration_enabled')) { if (in_array('register', $privileges) && config('registration_enabled')) {
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() . ' &raquo;') button(page_link_to('register'), register_title() . ' &raquo;')
]) ])
]); ]);
} }
return error(_('Registration is disabled.'), true); return error(__('Registration is disabled.'), true);
} }

View File

@ -7,7 +7,7 @@ use Engelsystem\Database\DB;
*/ */
function messages_title() function messages_title()
{ {
return _('Messages'); return __('Messages');
} }
/** /**
@ -44,7 +44,7 @@ function user_messages()
); );
$to_select_data = [ $to_select_data = [
'' => _('Select recipient...') '' => __('Select recipient...')
]; ];
foreach ($users as $u) { foreach ($users as $u) {
@ -73,7 +73,7 @@ function user_messages()
'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'))
] ]
]; ];
@ -93,14 +93,14 @@ function user_messages()
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'
); );
} }
@ -109,14 +109,14 @@ 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']))
@ -127,7 +127,7 @@ function user_messages()
if ($request->has('id') && preg_match('/^\d{1,11}$/', $request->input('id'))) { if ($request->has('id') && preg_match('/^\d{1,11}$/', $request->input('id'))) {
$message_id = $request->input('id'); $message_id = $request->input('id');
} else { } else {
return error(_('Incomplete call, missing Message ID.'), true); return error(__('Incomplete call, missing Message ID.'), true);
} }
$message = DB::selectOne( $message = DB::selectOne(
@ -141,7 +141,7 @@ function user_messages()
); );
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;
@ -149,7 +149,7 @@ function user_messages()
if ($request->has('id') && preg_match('/^\d{1,11}$/', $request->input('id'))) { if ($request->has('id') && preg_match('/^\d{1,11}$/', $request->input('id'))) {
$message_id = $request->input('id'); $message_id = $request->input('id');
} else { } else {
return error(_('Incomplete call, missing Message ID.'), true); return error(__('Incomplete call, missing Message ID.'), true);
} }
$message = DB::selectOne( $message = DB::selectOne(
@ -160,7 +160,7 @@ function user_messages()
DB::delete('DELETE FROM `Messages` WHERE `id`=? LIMIT 1', [$message_id]); DB::delete('DELETE FROM `Messages` WHERE `id`=? LIMIT 1', [$message_id]);
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;
@ -169,12 +169,12 @@ function user_messages()
if (Message_send($request->input('to'), $request->input('text'))) { if (Message_send($request->input('to'), $request->input('text'))) {
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);
} }
} }

View File

@ -7,7 +7,7 @@ use Engelsystem\Database\DB;
*/ */
function myshifts_title() function myshifts_title()
{ {
return _('My shifts'); return __('My shifts');
} }
/** /**
@ -35,15 +35,15 @@ function user_myshifts()
if ($request->has('reset')) { if ($request->has('reset')) {
if ($request->input('reset') == 'ack') { if ($request->input('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 ($request->has('edit') && preg_match('/^\d+$/', $request->input('edit'))) { } elseif ($request->has('edit') && preg_match('/^\d+$/', $request->input('edit'))) {
$shift_entry_id = $request->input('edit'); $shift_entry_id = $request->input('edit');
@ -82,7 +82,7 @@ function user_myshifts()
$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!'));
} }
} }
@ -104,7 +104,7 @@ function user_myshifts()
. ' 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']]));
} }
} }

View File

@ -7,7 +7,7 @@ use Engelsystem\Database\DB;
*/ */
function user_news_comments_title() function user_news_comments_title()
{ {
return _('News comments'); return __('News comments');
} }
/** /**
@ -15,7 +15,7 @@ function user_news_comments_title()
*/ */
function news_title() function news_title()
{ {
return _('News'); return __('News');
} }
/** /**
@ -23,7 +23,7 @@ function news_title()
*/ */
function meetings_title() function meetings_title()
{ {
return _('Meetings'); return __('Meetings');
} }
/** /**
@ -117,7 +117,7 @@ function display_news($news)
if ($page != 'news_comments') { if ($page != 'news_comments') {
$html .= '&emsp;<a href="' . page_link_to('news_comments', ['nid' => $news['ID']]) . '">' $html .= '&emsp;<a href="' . page_link_to('news_comments', ['nid' => $news['ID']]) . '">'
. '<span class="glyphicon glyphicon-comment"></span> ' . '<span class="glyphicon glyphicon-comment"></span> '
. _('Comments') . ' &raquo;</a> ' . __('Comments') . ' &raquo;</a> '
. '<span class="badge">' . '<span class="badge">'
. count(DB::select('SELECT `ID` FROM `NewsComments` WHERE `Refid`=?', [$news['ID']])) . count(DB::select('SELECT `ID` FROM `NewsComments` WHERE `Refid`=?', [$news['ID']]))
. '</span>'; . '</span>';
@ -162,7 +162,7 @@ function user_news_comments()
] ]
); );
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);
@ -183,13 +183,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>';
@ -230,7 +230,7 @@ function user_news()
] ]
); );
engelsystem_log('Created news: ' . $request->postData('betreff') . ', treffen: ' . $isMeeting); engelsystem_log('Created news: ' . $request->postData('betreff') . ', treffen: ' . $isMeeting);
success(_('Entry saved.')); success(__('Entry saved.'));
redirect(page_link_to('news')); redirect(page_link_to('news'));
} }
@ -269,13 +269,13 @@ function user_news()
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>';

View File

@ -7,7 +7,7 @@ use Engelsystem\Database\DB;
*/ */
function questions_title() function questions_title()
{ {
return _('Ask the Heaven'); return __('Ask the Heaven');
} }
/** /**
@ -50,11 +50,11 @@ function user_questions()
[$user['UID'], $question] [$user['UID'], $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;
@ -62,7 +62,7 @@ function user_questions()
if ($request->has('id') && preg_match('/^\d{1,11}$/', $request->input('id'))) { if ($request->has('id') && preg_match('/^\d{1,11}$/', $request->input('id'))) {
$question_id = $request->input('id'); $question_id = $request->input('id');
} else { } else {
return error(_('Incomplete call, missing Question ID.'), true); return error(__('Incomplete call, missing Question ID.'), true);
} }
$question = DB::selectOne( $question = DB::selectOne(
@ -77,7 +77,7 @@ function user_questions()
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;

View File

@ -7,7 +7,7 @@ use Engelsystem\Database\DB;
*/ */
function settings_title() function settings_title()
{ {
return _('Settings'); return __('Settings');
} }
/** /**
@ -28,11 +28,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'] = $request->has('email_shiftinfo'); $user_source['email_shiftinfo'] = $request->has('email_shiftinfo');
@ -43,7 +43,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.'));
} }
} }
@ -59,7 +59,7 @@ function user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes)
$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.'));
} }
} }
@ -69,7 +69,7 @@ function user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes)
$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.'));
} }
} }
@ -82,7 +82,7 @@ function user_settings_main($user_source, $enable_tshirt_size, $tshirt_sizes)
$user_source['DECT'] = strip_request_item('dect', $user_source['DECT']); $user_source['DECT'] = strip_request_item('dect', $user_source['DECT']);
} else { } else {
$valid = false; $valid = false;
error(_('For dect numbers are only 5 digits allowed.')); error(__('For dect numbers are only 5 digits allowed.'));
} }
$user_source['Handy'] = strip_request_item('mobile', $user_source['Handy']); $user_source['Handy'] = strip_request_item('mobile', $user_source['Handy']);
$user_source['Hometown'] = strip_request_item('hometown', $user_source['Hometown']); $user_source['Hometown'] = strip_request_item('hometown', $user_source['Hometown']);
@ -90,7 +90,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'));
} }
@ -109,14 +109,14 @@ function user_settings_password($user_source)
!$request->has('password') !$request->has('password')
|| !verify_password($request->postData('password'), $user_source['Passwort'], $user_source['UID']) || !verify_password($request->postData('password'), $user_source['Passwort'], $user_source['UID'])
) { ) {
error(_('-> not OK. Please try again.')); error(__('-> not OK. Please try again.'));
} elseif (strlen($request->postData('new_password')) < config('min_password_length')) { } elseif (strlen($request->postData('new_password')) < config('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->postData('new_password') != $request->postData('new_password2')) { } elseif ($request->postData('new_password') != $request->postData('new_password2')) {
error(_('Your passwords don\'t match.')); error(__('Your passwords don\'t match.'));
} else { } else {
set_password($user_source['UID'], $request->postData('new_password')); set_password($user_source['UID'], $request->postData('new_password'));
success(_('Password saved.')); success(__('Password saved.'));
} }
redirect(page_link_to('user_settings')); redirect(page_link_to('user_settings'));
} }
@ -151,7 +151,7 @@ function user_settings_theme($user_source, $themes)
] ]
); );
success(_('Theme changed.')); success(__('Theme changed.'));
redirect(page_link_to('user_settings')); redirect(page_link_to('user_settings'));
} }
@ -224,12 +224,6 @@ function user_settings()
} }
} }
foreach ($tshirt_sizes as $key => $size) {
if (empty($size)) {
unset($tshirt_sizes[$key]);
}
}
$user_source = $user; $user_source = $user;
if ($request->has('submit')) { if ($request->has('submit')) {

View File

@ -8,7 +8,7 @@ use Engelsystem\ShiftsFilter;
*/ */
function shifts_title() function shifts_title()
{ {
return _('Shifts'); return __('Shifts');
} }
/** /**
@ -99,7 +99,7 @@ function load_rooms()
'SELECT `RID` AS `id`, `Name` AS `name` FROM `Room` ORDER BY `Name`' 'SELECT `RID` AS `id`, `Name` AS `name` FROM `Room` ORDER BY `Name`'
); );
if (empty($rooms)) { if (empty($rooms)) {
error(_('The administration has not configured any rooms yet.')); error(__('The administration has not configured any rooms yet.'));
redirect(page_link_to('/')); redirect(page_link_to('/'));
} }
return $rooms; return $rooms;
@ -118,7 +118,7 @@ function load_days()
$days = array_map('array_shift', $days); $days = array_map('array_shift', $days);
if (empty($days)) { if (empty($days)) {
error(_('The administration has not configured any shifts yet.')); error(__('The administration has not configured any shifts yet.'));
redirect(page_link_to('/')); redirect(page_link_to('/'));
} }
return $days; return $days;
@ -132,7 +132,7 @@ function load_types()
global $user; global $user;
if (!count(DB::select('SELECT `id`, `name` FROM `AngelTypes` WHERE `restricted` = 0'))) { if (!count(DB::select('SELECT `id`, `name` FROM `AngelTypes` WHERE `restricted` = 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(page_link_to('/')); redirect(page_link_to('/'));
} }
$types = DB::select(' $types = DB::select('
@ -200,11 +200,11 @@ function view_user_shifts()
$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());
@ -226,7 +226,7 @@ function view_user_shifts()
msg(), msg(),
view(__DIR__ . '/../../resources/views/pages/user-shifts.html', [ view(__DIR__ . '/../../resources/views/pages/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_select' => html_select_key(
'start_day', 'start_day',
'start_day', 'start_day',
@ -245,34 +245,34 @@ function view_user_shifts()
$types, $types,
$shiftsFilter->getTypes(), $shiftsFilter->getTypes(),
'types', 'types',
_('Angeltypes') . '<sup>1</sup>', __('Angeltypes') . '<sup>1</sup>',
[ [
button( button(
'javascript: checkOwnTypes(\'selection_types\', ' . json_encode($ownTypes) . ')', 'javascript: checkOwnTypes(\'selection_types\', ' . json_encode($ownTypes) . ')',
_('Own') __('Own')
), ),
] ]
), ),
'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' => ical_hint(), 'ical_text' => ical_hint(),
'filter' => _('Filter'), 'filter' => __('Filter'),
'set_yesterday' => _('Yesterday'), 'set_yesterday' => __('Yesterday'),
'set_today' => _('Today'), 'set_today' => __('Today'),
'set_tomorrow' => _('Tomorrow'), 'set_tomorrow' => __('Tomorrow'),
'set_last_8h' => _('last 8h'), 'set_last_8h' => __('last 8h'),
'set_last_4h' => _('last 4h'), 'set_last_4h' => __('last 4h'),
'set_next_4h' => _('next 4h'), 'set_next_4h' => __('next 4h'),
'set_next_8h' => _('next 8h'), 'set_next_8h' => __('next 8h'),
'buttons' => button( 'buttons' => button(
public_dashboard_link(), public_dashboard_link(),
glyph('dashboard') . _('Public Dashboard') glyph('dashboard') . __('Public Dashboard')
) )
]) ])
]) ])
@ -286,9 +286,9 @@ function ical_hint()
{ {
global $user; global $user;
return heading(_('iCal export'), 2) return heading(__('iCal export'), 2)
. '<p>' . sprintf( . '<p>' . sprintf(
_('Export your own 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 your own 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('ical', ['key' => $user['api_key']]), page_link_to('ical', ['key' => $user['api_key']]),
page_link_to('shifts_json_export', ['key' => $user['api_key']]), page_link_to('shifts_json_export', ['key' => $user['api_key']]),
page_link_to('user_myshifts', ['reset' => 1]) page_link_to('user_myshifts', ['reset' => 1])
@ -321,8 +321,8 @@ function make_select($items, $selected, $name, $title = null, $additionalButtons
} }
$buttons = []; $buttons = [];
$buttons[] = button('javascript: checkAll(\'selection_' . $name . '\', true)', _('All')); $buttons[] = button('javascript: checkAll(\'selection_' . $name . '\', true)', __('All'));
$buttons[] = button('javascript: checkAll(\'selection_' . $name . '\', false)', _('None')); $buttons[] = button('javascript: checkAll(\'selection_' . $name . '\', false)', __('None'));
$buttons = array_merge($buttons, $additionalButtons); $buttons = array_merge($buttons, $additionalButtons);
$html .= buttons($buttons); $html .= buttons($buttons);

View File

@ -367,11 +367,16 @@ function form_textarea($name, $label, $value, $disabled = false)
* @param string $label * @param string $label
* @param string[] $values * @param string[] $values
* @param string $selected * @param string $selected
* @param string $selectText
* @return string * @return string
*/ */
function form_select($name, $label, $values, $selected) function form_select($name, $label, $values, $selected, $selectText = '')
{ {
return form_element($label, html_select_key('form_' . $name, $name, $values, $selected), 'form_' . $name); return form_element(
$label,
html_select_key('form_' . $name, $name, $values, $selected, $selectText),
'form_' . $name
);
} }
/** /**
@ -425,11 +430,15 @@ function html_options($name, $options, $selected = '')
* @param string $name * @param string $name
* @param string[] $rows * @param string[] $rows
* @param string $selected * @param string $selected
* @param string $selectText
* @return string * @return string
*/ */
function html_select_key($dom_id, $name, $rows, $selected) function html_select_key($dom_id, $name, $rows, $selected, $selectText = '')
{ {
$html = '<select class="form-control" id="' . $dom_id . '" name="' . $name . '">'; $html = '<select class="form-control" id="' . $dom_id . '" name="' . $name . '">';
if (!empty($selectText)) {
$html .= '<option value="">' . $selectText . '</option>';
}
foreach ($rows as $key => $row) { foreach ($rows as $key => $row) {
if (($key == $selected) || ($row === $selected)) { if (($key == $selected) || ($row === $selected)) {
$html .= '<option value="' . $key . '" selected="selected">' . $row . '</option>'; $html .= '<option value="' . $key . '" selected="selected">' . $row . '</option>';

View File

@ -189,7 +189,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);
@ -213,7 +213,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();
@ -222,7 +222,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;
} }

View File

@ -325,7 +325,7 @@ function table($columns, $rows_raw, $data = true)
function render_table($columns, $rows, $data = true) function render_table($columns, $rows, $data = true)
{ {
if (count($rows) == 0) { if (count($rows) == 0) {
return info(_('No data found.'), true); return info(__('No data found.'), true);
} }
$html = '<table class="table table-striped' . ($data ? ' data' : '') . '">'; $html = '<table class="table table-striped' . ($data ? ' data' : '') . '">';

View File

@ -31,15 +31,15 @@ function AngelType_render_membership($user_angeltype)
if (!empty($user_angeltype['user_angeltype_id'])) { if (!empty($user_angeltype['user_angeltype_id'])) {
if ($user_angeltype['restricted']) { if ($user_angeltype['restricted']) {
if (empty($user_angeltype['confirm_user_id'])) { if (empty($user_angeltype['confirm_user_id'])) {
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);
} }
@ -50,16 +50,16 @@ 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'), glyph('remove') . _('cancel')), button(page_link_to('angeltypes'), glyph('remove') . __('cancel')),
button( button(
page_link_to( page_link_to(
'angeltypes', 'angeltypes',
['action' => 'delete', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1] ['action' => 'delete', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]
), ),
glyph('ok') . _('delete'), glyph('ok') . __('delete'),
'btn-danger' 'btn-danger'
) )
]) ])
@ -75,48 +75,48 @@ function AngelType_delete_view($angeltype)
*/ */
function AngelType_edit_view($angeltype, $supporter_mode) function AngelType_edit_view($angeltype, $supporter_mode)
{ {
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']),
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).')
), ),
$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'), ? form_info(__('Requires driver license'),
$angeltype['requires_driver_license'] $angeltype['requires_driver_license']
? _('Yes') ? __('Yes')
: _('No')) : __('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']),
$supporter_mode $supporter_mode
? form_info(_('Show on dashboard'), $angeltype['show_on_dashboard'] ? _('Yes') : _('No')) ? form_info(__('Show on dashboard'), $angeltype['show_on_dashboard'] ? __('Yes') : __('No'))
: form_checkbox('show_on_dashboard', _('Show on dashboard'), $angeltype['show_on_dashboard']), : form_checkbox('show_on_dashboard', __('Show on dashboard'), $angeltype['show_on_dashboard']),
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.')),
heading(_('Contact'), 3), heading(__('Contact'), 3),
form_info( form_info(
'', '',
_('Primary contact person/desk for user questions.') __('Primary contact person/desk for user questions.')
), ),
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_submit('submit', _('Save')) form_submit('submit', __('Save'))
]) ])
]); ]);
} }
@ -135,50 +135,50 @@ 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( $buttons[] = button(
user_driver_license_edit_link($user), user_driver_license_edit_link($user),
glyph('road') . _('my driving license') glyph('road') . __('my driving license')
); );
} }
if (is_null($user_angeltype)) { if (is_null($user_angeltype)) {
$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'] && empty($user_driver_license)) { if ($angeltype['requires_driver_license'] && empty($user_driver_license)) {
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'] && empty($user_angeltype['confirm_user_id'])) { if ($angeltype['restricted'] && empty($user_angeltype['confirm_user_id'])) {
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( $buttons[] = button(
page_link_to('user_angeltypes', ['action' => 'delete', 'user_angeltype_id' => $user_angeltype['id']]), page_link_to('user_angeltypes', ['action' => 'delete', 'user_angeltype_id' => $user_angeltype['id']]),
_('leave') __('leave')
); );
} }
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'
); );
} }
@ -219,7 +219,7 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a
'user_angeltypes', 'user_angeltypes',
['action' => 'confirm', 'user_angeltype_id' => $member['user_angeltype_id']] ['action' => 'confirm', 'user_angeltype_id' => $member['user_angeltype_id']]
), ),
_('confirm'), __('confirm'),
'btn-xs' 'btn-xs'
), ),
button( button(
@ -227,7 +227,7 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a
'user_angeltypes', 'user_angeltypes',
['action' => 'delete', 'user_angeltype_id' => $member['user_angeltype_id']] ['action' => 'delete', 'user_angeltype_id' => $member['user_angeltype_id']]
), ),
_('deny'), __('deny'),
'btn-xs' 'btn-xs'
) )
]); ]);
@ -241,7 +241,7 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a
'user_angeltype_id' => $member['user_angeltype_id'], 'user_angeltype_id' => $member['user_angeltype_id'],
'supporter' => 0 'supporter' => 0
]), ]),
_('Remove supporter rights'), __('Remove supporter rights'),
'btn-xs' 'btn-xs'
) )
]); ]);
@ -258,14 +258,14 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a
'user_angeltype_id' => $member['user_angeltype_id'], 'user_angeltype_id' => $member['user_angeltype_id'],
'supporter' => 1 'supporter' => 1
]), ]),
_('Add supporter rights'), 'btn-xs') __('Add supporter rights'), 'btn-xs')
: '', : '',
button( button(
page_link_to('user_angeltypes', [ page_link_to('user_angeltypes', [
'action' => 'delete', 'action' => 'delete',
'user_angeltype_id' => $member['user_angeltype_id'] 'user_angeltype_id' => $member['user_angeltype_id']
]), ]),
_('remove'), __('remove'),
'btn-xs' 'btn-xs'
) )
]); ]);
@ -293,21 +293,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' => ''
]; ];
} }
@ -341,18 +341,18 @@ function AngelType_view(
ShiftCalendarRenderer $shiftCalendarRenderer, ShiftCalendarRenderer $shiftCalendarRenderer,
$tab $tab
) { ) {
return page_with_title(sprintf(_('Team %s'), $angeltype['name']), [ return page_with_title(sprintf(__('Team %s'), $angeltype['name']), [
AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $user_driver_license, $user), AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $user_driver_license, $user),
msg(), msg(),
tabs([ tabs([
_('Info') => AngelType_view_info( __('Info') => AngelType_view_info(
$angeltype, $angeltype,
$members, $members,
$admin_user_angeltypes, $admin_user_angeltypes,
$admin_angeltypes, $admin_angeltypes,
$supporter $supporter
), ),
_('Shifts') => AngelType_view_shifts( __('Shifts') => AngelType_view_shifts(
$angeltype, $angeltype,
$shiftsFilterRenderer, $shiftsFilterRenderer,
$shiftCalendarRenderer $shiftCalendarRenderer
@ -398,7 +398,7 @@ function AngelType_view_info(
$info[] = AngelTypes_render_contact_info($angeltype); $info[] = AngelTypes_render_contact_info($angeltype);
} }
$info[] = '<h3>' . _('Description') . '</h3>'; $info[] = '<h3>' . __('Description') . '</h3>';
$parsedown = new Parsedown(); $parsedown = new Parsedown();
if ($angeltype['description'] != '') { if ($angeltype['description'] != '') {
$info[] = '<div class="well">' . $parsedown->parse($angeltype['description']) . '</div>'; $info[] = '<div class="well">' . $parsedown->parse($angeltype['description']) . '</div>';
@ -413,13 +413,13 @@ function AngelType_view_info(
$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) {
$info[] = '<h3>' . _('Supporters') . '</h3>'; $info[] = '<h3>' . __('Supporters') . '</h3>';
$info[] = table($table_headers, $supporters); $info[] = table($table_headers, $supporters);
} }
if (count($members_confirmed) > 0) { if (count($members_confirmed) > 0) {
$members_confirmed[] = [ $members_confirmed[] = [
'Nick' => _('Sum'), 'Nick' => __('Sum'),
'DECT' => count($members_confirmed), 'DECT' => count($members_confirmed),
'actions' => '' 'actions' => ''
]; ];
@ -427,13 +427,13 @@ function AngelType_view_info(
if (count($members_unconfirmed) > 0) { if (count($members_unconfirmed) > 0) {
$members_unconfirmed[] = [ $members_unconfirmed[] = [
'Nick' => _('Sum'), 'Nick' => __('Sum'),
'DECT' => count($members_unconfirmed), 'DECT' => count($members_unconfirmed),
'actions' => '' 'actions' => ''
]; ];
} }
$info[] = '<h3>' . _('Members') . '</h3>'; $info[] = '<h3>' . __('Members') . '</h3>';
if ($admin_user_angeltypes) { if ($admin_user_angeltypes) {
$info[] = buttons([ $info[] = buttons([
button( button(
@ -441,7 +441,7 @@ function AngelType_view_info(
'user_angeltypes', 'user_angeltypes',
['action' => 'add', 'angeltype_id' => $angeltype['id']] ['action' => 'add', 'angeltype_id' => $angeltype['id']]
), ),
_('Add'), __('Add'),
'add' 'add'
) )
]); ]);
@ -449,15 +449,15 @@ function AngelType_view_info(
$info[] = table($table_headers, $members_confirmed); $info[] = 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) {
$info[] = '<h3>' . _('Unconfirmed') . '</h3>'; $info[] = '<h3>' . __('Unconfirmed') . '</h3>';
$info[] = buttons([ $info[] = 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']]),
glyph('ok') . _('confirm all') glyph('ok') . __('confirm all')
), ),
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']]),
glyph('remove') . _('deny all') glyph('remove') . __('deny all')
) )
]); ]);
$info[] = table($table_headers, $members_unconfirmed); $info[] = table($table_headers, $members_unconfirmed);
@ -474,10 +474,10 @@ function AngelType_view_info(
*/ */
function AngelTypes_render_contact_info($angeltype) function AngelTypes_render_contact_info($angeltype)
{ {
return heading(_('Contact'), 3) . description([ return heading(__('Contact'), 3) . description([
_('Name') => $angeltype['contact_name'], __('Name') => $angeltype['contact_name'],
_('DECT') => $angeltype['contact_dect'], __('DECT') => $angeltype['contact_dect'],
_('E-Mail') => $angeltype['contact_email'] __('E-Mail') => $angeltype['contact_email']
]); ]);
} }
@ -494,15 +494,15 @@ function AngelTypes_list_view($angeltypes, $admin_angeltypes)
msg(), msg(),
buttons([ buttons([
$admin_angeltypes $admin_angeltypes
? button(page_link_to('angeltypes', ['action' => 'edit']), _('New angeltype'), 'add') ? 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)
]); ]);
@ -532,12 +532,12 @@ function AngelTypes_about_view_angeltype($angeltype)
'user_angeltypes', 'user_angeltypes',
['action' => 'delete', 'user_angeltype_id' => $angeltype['user_angeltype_id']] ['action' => 'delete', 'user_angeltype_id' => $angeltype['user_angeltype_id']]
), ),
_('leave') __('leave')
); );
} 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'
); );
} }
@ -546,7 +546,7 @@ 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
); );
} }
@ -583,17 +583,17 @@ function AngelTypes_about_view($angeltypes, $user_logged_in)
$faqUrl = config('faq_url'); $faqUrl = config('faq_url');
if (!empty($faqUrl)) { if (!empty($faqUrl)) {
$buttons[] = button($faqUrl, _('FAQ'), 'btn-primary'); $buttons[] = button($faqUrl, __('FAQ'), 'btn-primary');
} }
$content = [ $content = [
buttons($buttons), buttons($buttons),
'<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);
} }

View File

@ -10,7 +10,7 @@ function EventConfig_countdown_page($event_config)
{ {
if (empty($event_config)) { if (empty($event_config)) {
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 (!is_null($event_config['event_name'])) { if (!is_null($event_config['event_name'])) {
$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,33 +27,33 @@ function EventConfig_countdown_page($event_config)
if (!is_null($event_config['buildup_start_date']) && time() < $event_config['buildup_start_date']) { if (!is_null($event_config['buildup_start_date']) && 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 (!is_null($event_config['event_start_date']) && time() < $event_config['event_start_date']) { if (!is_null($event_config['event_start_date']) && 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 (!is_null($event_config['event_end_date']) && time() < $event_config['event_end_date']) { if (!is_null($event_config['event_end_date']) && 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 (!is_null($event_config['teardown_end_date']) && time() < $event_config['teardown_end_date']) { if (!is_null($event_config['teardown_end_date']) && 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>'
]); ]);
} }
@ -79,27 +79,27 @@ function EventConfig_info($event_config)
&& !is_null($event_config['event_end_date']) && !is_null($event_config['event_end_date'])
) { ) {
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 (!is_null($event_config['event_name']) && !is_null($event_config['event_start_date'])) { if (!is_null($event_config['event_name']) && !is_null($event_config['event_start_date'])) {
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 (!is_null($event_config['event_start_date']) && !is_null($event_config['event_end_date'])) { if (!is_null($event_config['event_start_date']) && !is_null($event_config['event_end_date'])) {
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'])
); );
} }
@ -135,26 +135,26 @@ 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( form_info(
'', '',
_('Welcome message is shown after successful registration. You can use markdown.') __('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'))
]) ])
]) ])
]) ])

View File

@ -23,7 +23,7 @@ function public_dashboard_view($stats, $free_shifts)
$shift_panels[] = '</div>'; $shift_panels[] = '</div>';
$needed_angels = div('first', [ $needed_angels = div('first', [
div('col-md-12', [ div('col-md-12', [
heading(_('Needed angels:'), 1) heading(__('Needed angels:'), 1)
]), ]),
div('container-fluid', [ div('container-fluid', [
join($shift_panels) join($shift_panels)
@ -34,10 +34,10 @@ function public_dashboard_view($stats, $free_shifts)
return page([ return page([
div('public-dashboard', [ div('public-dashboard', [
div('first', [ div('first', [
stats(_('Angels needed in the next 3 hrs'), $stats['needed-3-hours']), stats(__('Angels needed in the next 3 hrs'), $stats['needed-3-hours']),
stats(_('Angels needed for nightshifts'), $stats['needed-night']), stats(__('Angels needed for nightshifts'), $stats['needed-night']),
stats(_('Angels currently working'), $stats['angels-working'], 'default'), stats(__('Angels currently working'), $stats['angels-working'], 'default'),
stats(_('Hours to be worked'), $stats['hours-to-work'], 'default'), stats(__('Hours to be worked'), $stats['hours-to-work'], 'default'),
'<script> '<script>
$(function() { $(function() {
setInterval(function() { setInterval(function() {
@ -52,8 +52,8 @@ function public_dashboard_view($stats, $free_shifts)
buttons([ buttons([
button_js(' button_js('
$(\'#navbar-collapse-1,#footer,#fullscreen-button\').remove(); $(\'#navbar-collapse-1,#footer,#fullscreen-button\').remove();
$(\'.navbar-brand\').append(\' ' . _('Public Dashboard') . '\'); $(\'.navbar-brand\').append(\' ' . __('Public Dashboard') . '\');
', glyph('fullscreen') . _('Fullscreen')) ', glyph('fullscreen') . __('Fullscreen'))
]) ])
], 'fullscreen-button') ], 'fullscreen-button')
]); ]);

View File

@ -12,7 +12,7 @@ function Questions_view($open_questions, $answered_questions, $ask_action)
$question['actions'] = '<a href="' $question['actions'] = '<a href="'
. page_link_to('user_questions', ['action' => 'delete', 'id' => $question['QID']]) . page_link_to('user_questions', ['action' => 'delete', 'id' => $question['QID']])
. '">' . '">'
. _('delete') . __('delete')
. '</a>'; . '</a>';
$question['Question'] = str_replace("\n", '<br />', $question['Question']); $question['Question'] = str_replace("\n", '<br />', $question['Question']);
} }
@ -23,28 +23,28 @@ function Questions_view($open_questions, $answered_questions, $ask_action)
$question['actions'] = '<a href="' $question['actions'] = '<a href="'
. page_link_to('user_questions', ['action' => 'delete', 'id' => $question['QID']]) . page_link_to('user_questions', ['action' => 'delete', 'id' => $question['QID']])
. '">' . '">'
. _('delete') . __('delete')
. '</a>'; . '</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)
]); ]);
} }

View File

@ -21,14 +21,14 @@ function Room_view($room, ShiftsFilterRenderer $shiftsFilterRenderer, ShiftCalen
$description = ''; $description = '';
if (!empty($room['description'])) { if (!empty($room['description'])) {
$description = '<h3>' . _('Description') . '</h3>'; $description = '<h3>' . __('Description') . '</h3>';
$parsedown = new Parsedown(); $parsedown = new Parsedown();
$description .= '<div class="well">' . $parsedown->parse($room['description']) . '</div>'; $description .= '<div class="well">' . $parsedown->parse($room['description']) . '</div>';
} }
$tabs = []; $tabs = [];
if (!empty($room['map_url'])) { if (!empty($room['map_url'])) {
$tabs[_('Map')] = sprintf( $tabs[__('Map')] = sprintf(
'<div class="map">' '<div class="map">'
. '<iframe style="width: 100%%; min-height: 400px; border: 0 none;" src="%s"></iframe>' . '<iframe style="width: 100%%; min-height: 400px; border: 0 none;" src="%s"></iframe>'
. '</div>', . '</div>',
@ -36,7 +36,7 @@ function Room_view($room, ShiftsFilterRenderer $shiftsFilterRenderer, ShiftCalen
); );
} }
$tabs[_('Shifts')] = div('first', [ $tabs[__('Shifts')] = div('first', [
$shiftsFilterRenderer->render(page_link_to('rooms', [ $shiftsFilterRenderer->render(page_link_to('rooms', [
'action' => 'view', 'action' => 'view',
'room_id' => $room['RID'] 'room_id' => $room['RID']

View File

@ -143,7 +143,7 @@ class ShiftCalendarRenderer
public function render() public function render()
{ {
if (count($this->lanes) == 0) { if (count($this->lanes) == 0) {
return info(_('No shifts found.'), true); return info(__('No shifts found.'), true);
} }
return div('shift-calendar', [ return div('shift-calendar', [
$this->renderTimeLane(), $this->renderTimeLane(),
@ -245,7 +245,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++) {
@ -311,11 +311,11 @@ class ShiftCalendarRenderer
private function renderLegend() private function renderLegend()
{ {
return div('legend', [ return div('legend', [
label(_('Your shift'), 'primary'), label(__('Your shift'), 'primary'),
label(_('Help needed'), 'danger'), label(__('Help needed'), 'danger'),
label(_('Other angeltype needed / collides with my shifts'), 'warning'), label(__('Other angeltype needed / collides with my shifts'), 'warning'),
label(_('Shift is full'), 'success'), label(__('Shift is full'), 'success'),
label(_('Shift running/ended or user not arrived'), 'default') label(__('Shift running/ended or user not arrived'), 'default')
]); ]);
} }
} }

View File

@ -131,7 +131,7 @@ class ShiftCalendarShiftRenderer
if (in_array('user_shifts_admin', $privileges)) { if (in_array('user_shifts_admin', $privileges)) {
$html .= '<li class="list-group-item">'; $html .= '<li class="list-group-item">';
$html .= button(shift_entry_create_link_admin($shift), $html .= button(shift_entry_create_link_admin($shift),
glyph('plus') . _('Add more angels'), glyph('plus') . __('Add more angels'),
'btn-xs' 'btn-xs'
); );
$html .= '</li>'; $html .= '</li>';
@ -191,18 +191,18 @@ class ShiftCalendarShiftRenderer
. '</a> ' . '</a> '
. button( . button(
shift_entry_create_link($shift, $angeltype), shift_entry_create_link($shift, $angeltype),
_('Sign up'), 'btn-xs btn-primary' __('Sign up'), 'btn-xs btn-primary'
); );
break; break;
case ShiftSignupState::SHIFT_ENDED: case ShiftSignupState::SHIFT_ENDED:
// No link and add a text hint, when the shift ended // No link and add a text hint, when the shift ended
$entry_list[] = $inner_text . ' (' . _('ended') . ')'; $entry_list[] = $inner_text . ' (' . __('ended') . ')';
break; break;
case ShiftSignupState::NOT_ARRIVED: case ShiftSignupState::NOT_ARRIVED:
// No link and add a text hint, when the shift ended // No link and add a text hint, when the shift ended
$entry_list[] = $inner_text . ' (' . _('please arrive for signup') . ')'; $entry_list[] = $inner_text . ' (' . __('please arrive for signup') . ')';
break; break;
case ShiftSignupState::ANGELTYPE: case ShiftSignupState::ANGELTYPE:
@ -217,7 +217,7 @@ class ShiftCalendarShiftRenderer
'user_angeltypes', 'user_angeltypes',
['action' => 'add', 'angeltype_id' => $angeltype['id']] ['action' => 'add', 'angeltype_id' => $angeltype['id']]
), ),
sprintf(_('Become %s'), $angeltype['name']), sprintf(__('Become %s'), $angeltype['name']),
'btn-xs' 'btn-xs'
); );
} }

View File

@ -14,7 +14,7 @@ function ShiftEntry_delete_view_admin($shiftEntry, $shift, $angeltype, $signoff_
{ {
return page_with_title(ShiftEntry_delete_title(), [ return page_with_title(ShiftEntry_delete_title(), [
info(sprintf( info(sprintf(
_('Do you want to sign off %s from shift %s from %s to %s as %s?'), __('Do you want to sign off %s from shift %s from %s to %s as %s?'),
User_Nick_render($signoff_user), User_Nick_render($signoff_user),
$shift['name'], $shift['name'],
date('Y-m-d H:i', $shift['start']), date('Y-m-d H:i', $shift['start']),
@ -22,10 +22,10 @@ function ShiftEntry_delete_view_admin($shiftEntry, $shift, $angeltype, $signoff_
$angeltype['name'] $angeltype['name']
), true), ), true),
buttons([ buttons([
button(user_link($signoff_user), glyph('remove') . _('cancel')), button(user_link($signoff_user), glyph('remove') . __('cancel')),
button(shift_entry_delete_link($shiftEntry, [ button(shift_entry_delete_link($shiftEntry, [
'continue' => 1 'continue' => 1
]), glyph('ok') . _('delete'), 'btn-danger') ]), glyph('ok') . __('delete'), 'btn-danger')
]) ])
]); ]);
} }
@ -44,17 +44,17 @@ function ShiftEntry_delete_view($shiftEntry, $shift, $angeltype, $signoff_user)
{ {
return page_with_title(ShiftEntry_delete_title(), [ return page_with_title(ShiftEntry_delete_title(), [
info(sprintf( info(sprintf(
_('Do you want to sign off from your shift %s from %s to %s as %s?'), __('Do you want to sign off from your shift %s from %s to %s as %s?'),
$shift['name'], $shift['name'],
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']),
$angeltype['name'] $angeltype['name']
), true), ), true),
buttons([ buttons([
button(user_link($signoff_user), glyph('remove') . _('cancel')), button(user_link($signoff_user), glyph('remove') . __('cancel')),
button(shift_entry_delete_link($shiftEntry, [ button(shift_entry_delete_link($shiftEntry, [
'continue' => 1 'continue' => 1
]), glyph('ok') . _('delete'), 'btn-danger') ]), glyph('ok') . __('delete'), 'btn-danger')
]) ])
]); ]);
} }
@ -64,7 +64,7 @@ function ShiftEntry_delete_view($shiftEntry, $shift, $angeltype, $signoff_user)
*/ */
function ShiftEntry_delete_title() function ShiftEntry_delete_title()
{ {
return _('Shift sign off'); return __('Shift sign off');
} }
/** /**
@ -85,11 +85,11 @@ function ShiftEntry_create_view_admin($shift, $room, $angeltype, $angeltypes_sel
. ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>', . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>',
[ [
Shift_view_header($shift, $room), Shift_view_header($shift, $room),
info(_('Do you want to sign up the following user for this shift?'), true), info(__('Do you want to sign up the following user for this shift?'), true),
form([ form([
form_select('angeltype_id', _('Angeltype'), $angeltypes_select, $angeltype['id']), form_select('angeltype_id', __('Angeltype'), $angeltypes_select, $angeltype['id']),
form_select('user_id', _('User'), $users_select, $signup_user['UID']), form_select('user_id', __('User'), $users_select, $signup_user['UID']),
form_submit('submit', glyph('ok') . _('Save')) form_submit('submit', glyph('ok') . __('Save'))
]) ])
]); ]);
} }
@ -110,11 +110,11 @@ function ShiftEntry_create_view_supporter($shift, $room, $angeltype, $signup_use
. ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>', . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>',
[ [
Shift_view_header($shift, $room), Shift_view_header($shift, $room),
info(sprintf(_('Do you want to sign up the following user for this shift as %s?'), info(sprintf(__('Do you want to sign up the following user for this shift as %s?'),
AngelType_name_render($angeltype)), true), AngelType_name_render($angeltype)), true),
form([ form([
form_select('user_id', _('User'), $users_select, $signup_user['UID']), form_select('user_id', __('User'), $users_select, $signup_user['UID']),
form_submit('submit', glyph('ok') . _('Save')) form_submit('submit', glyph('ok') . __('Save'))
]) ])
]); ]);
} }
@ -134,10 +134,10 @@ function ShiftEntry_create_view_user($shift, $room, $angeltype, $comment)
. ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>', . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>',
[ [
Shift_view_header($shift, $room), Shift_view_header($shift, $room),
info(sprintf(_('Do you want to sign up for this shift as %s?'), AngelType_name_render($angeltype)), true), info(sprintf(__('Do you want to sign up for this shift as %s?'), AngelType_name_render($angeltype)), true),
form([ form([
form_textarea('comment', _('Comment (for your eyes only):'), $comment), form_textarea('comment', __('Comment (for your eyes only):'), $comment),
form_submit('submit', glyph('ok') . _('Save')) form_submit('submit', glyph('ok') . __('Save'))
]) ])
]); ]);
} }
@ -147,7 +147,7 @@ function ShiftEntry_create_view_user($shift, $room, $angeltype, $comment)
*/ */
function ShiftEntry_create_title() function ShiftEntry_create_title()
{ {
return _('Shift signup'); return __('Shift signup');
} }
/** /**
@ -178,25 +178,25 @@ 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( form_textarea(
'freeload_comment', 'freeload_comment',
_('Freeload comment (Only for shift coordination):'), __('Freeload comment (Only for shift coordination):'),
$freeload_comment $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'))
]) ])
]); ]);
} }

View File

@ -19,16 +19,16 @@ 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'), glyph('remove') . _('cancel')), button(page_link_to('shifttypes'), glyph('remove') . __('cancel')),
button( button(
page_link_to( page_link_to(
'shifttypes', 'shifttypes',
['action' => 'delete', 'shifttype_id' => $shifttype['id'], 'confirmed' => 1] ['action' => 'delete', 'shifttype_id' => $shifttype['id'], 'confirmed' => 1]
), ),
glyph('ok') . _('delete'), glyph('ok') . __('delete'),
'btn-danger' 'btn-danger'
) )
]) ])
@ -46,23 +46,23 @@ function ShiftType_delete_view($shifttype)
function ShiftType_edit_view($name, $angeltype_id, $angeltypes, $description, $shifttype_id) function ShiftType_edit_view($name, $angeltype_id, $angeltypes, $description, $shifttype_id)
{ {
$angeltypes_select = [ $angeltypes_select = [
'' => _('All') '' => __('All')
]; ];
foreach ($angeltypes as $angeltype) { foreach ($angeltypes as $angeltype) {
$angeltypes_select[$angeltype['id']] = $angeltype['name']; $angeltypes_select[$angeltype['id']] = $angeltype['name'];
} }
return page_with_title($shifttype_id ? _('Edit shifttype') : _('Create shifttype'), [ return page_with_title($shifttype_id ? __('Edit shifttype') : __('Create shifttype'), [
msg(), msg(),
buttons([ buttons([
button(page_link_to('shifttypes'), shifttypes_title(), 'back') button(page_link_to('shifttypes'), shifttypes_title(), 'back')
]), ]),
form([ form([
form_text('name', _('Name'), $name), form_text('name', __('Name'), $name),
form_select('angeltype_id', _('Angeltype'), $angeltypes_select, $angeltype_id), form_select('angeltype_id', __('Angeltype'), $angeltypes_select, $angeltype_id),
form_textarea('description', _('Description'), $description), form_textarea('description', __('Description'), $description),
form_info('', _('Please use markdown for the description.')), form_info('', __('Please use markdown for the description.')),
form_submit('submit', _('Save')) form_submit('submit', __('Save'))
]) ])
]); ]);
} }
@ -77,7 +77,7 @@ function ShiftType_view($shifttype, $angeltype)
$parsedown = new Parsedown(); $parsedown = new Parsedown();
$title = $shifttype['name']; $title = $shifttype['name'];
if ($angeltype) { if ($angeltype) {
$title .= ' <small>' . sprintf(_('for team %s'), $angeltype['name']) . '</small>'; $title .= ' <small>' . sprintf(__('for team %s'), $angeltype['name']) . '</small>';
} }
return page_with_title($title, [ return page_with_title($title, [
msg(), msg(),
@ -89,16 +89,16 @@ function ShiftType_view($shifttype, $angeltype)
) : '', ) : '',
button( button(
page_link_to('shifttypes', ['action' => 'edit', 'shifttype_id' => $shifttype['id']]), page_link_to('shifttypes', ['action' => 'edit', 'shifttype_id' => $shifttype['id']]),
_('edit'), __('edit'),
'edit' 'edit'
), ),
button( button(
page_link_to('shifttypes', ['action' => 'delete', 'shifttype_id' => $shifttype['id']]), page_link_to('shifttypes', ['action' => 'delete', 'shifttype_id' => $shifttype['id']]),
_('delete'), __('delete'),
'delete' 'delete'
) )
]), ]),
heading(_('Description'), 2), heading(__('Description'), 2),
$parsedown->parse($shifttype['description']) $parsedown->parse($shifttype['description'])
]); ]);
} }
@ -121,12 +121,12 @@ function ShiftTypes_list_view($shifttypes)
'shifttypes', 'shifttypes',
['action' => 'edit', 'shifttype_id' => $shifttype['id']] ['action' => 'edit', 'shifttype_id' => $shifttype['id']]
), ),
_('edit'), __('edit'),
'btn-xs' 'btn-xs'
), ),
button( button(
page_link_to('shifttypes', ['action' => 'delete', 'shifttype_id' => $shifttype['id']]), page_link_to('shifttypes', ['action' => 'delete', 'shifttype_id' => $shifttype['id']]),
_('delete'), __('delete'),
'btn-xs' 'btn-xs'
) )
]); ]);
@ -135,10 +135,10 @@ function ShiftTypes_list_view($shifttypes)
return page_with_title(shifttypes_title(), [ return page_with_title(shifttypes_title(), [
msg(), msg(),
buttons([ buttons([
button(page_link_to('shifttypes', ['action' => 'edit']), _('New shifttype'), 'add') button(page_link_to('shifttypes', ['action' => 'edit']), __('New shifttype'), 'add')
]), ]),
table([ table([
'name' => _('Name'), 'name' => __('Name'),
'actions' => '' 'actions' => ''
], $shifttypes) ], $shifttypes)
]); ]);

View File

@ -13,7 +13,7 @@ function Shift_view_header($shift, $room)
{ {
return div('row', [ return div('row', [
div('col-sm-3 col-xs-6', [ div('col-sm-3 col-xs-6', [
'<h4>' . _('Title') . '</h4>', '<h4>' . __('Title') . '</h4>',
'<p class="lead">' '<p class="lead">'
. ($shift['URL'] != '' . ($shift['URL'] != ''
? '<a href="' . $shift['URL'] . '">' . $shift['title'] . '</a>' ? '<a href="' . $shift['URL'] . '">' . $shift['title'] . '</a>'
@ -21,23 +21,23 @@ function Shift_view_header($shift, $room)
. '</p>' . '</p>'
]), ]),
div('col-sm-3 col-xs-6', [ div('col-sm-3 col-xs-6', [
'<h4>' . _('Start') . '</h4>', '<h4>' . __('Start') . '</h4>',
'<p class="lead' . (time() >= $shift['start'] ? ' text-success' : '') . '">', '<p class="lead' . (time() >= $shift['start'] ? ' text-success' : '') . '">',
glyph('calendar') . date(_('Y-m-d'), $shift['start']), glyph('calendar') . date(__('Y-m-d'), $shift['start']),
'<br />', '<br />',
glyph('time') . date('H:i', $shift['start']), glyph('time') . date('H:i', $shift['start']),
'</p>' '</p>'
]), ]),
div('col-sm-3 col-xs-6', [ div('col-sm-3 col-xs-6', [
'<h4>' . _('End') . '</h4>', '<h4>' . __('End') . '</h4>',
'<p class="lead' . (time() >= $shift['end'] ? ' text-success' : '') . '">', '<p class="lead' . (time() >= $shift['end'] ? ' text-success' : '') . '">',
glyph('calendar') . date(_('Y-m-d'), $shift['end']), glyph('calendar') . date(__('Y-m-d'), $shift['end']),
'<br />', '<br />',
glyph('time') . date('H:i', $shift['end']), glyph('time') . date('H:i', $shift['end']),
'</p>' '</p>'
]), ]),
div('col-sm-3 col-xs-6', [ div('col-sm-3 col-xs-6', [
'<h4>' . _('Location') . '</h4>', '<h4>' . __('Location') . '</h4>',
'<p class="lead">' . Room_name_render($room) . '</p>' '<p class="lead">' . Room_name_render($room) . '</p>'
]) ])
]); ]);
@ -52,14 +52,14 @@ function Shift_editor_info_render($shift)
$info = []; $info = [];
if (!empty($shift['created_by_user_id'])) { if (!empty($shift['created_by_user_id'])) {
$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 (!empty($shift['edited_by_user_id'])) { if (!empty($shift['edited_by_user_id'])) {
$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']))
); );
@ -82,11 +82,11 @@ function Shift_signup_button_render($shift, $angeltype, $user_angeltype = null)
} }
if ($angeltype['shift_signup_state']->isSignupAllowed()) { if ($angeltype['shift_signup_state']->isSignupAllowed()) {
return button(shift_entry_create_link($shift, $angeltype), _('Sign up')); return button(shift_entry_create_link($shift, $angeltype), __('Sign up'));
} elseif (empty($user_angeltype)) { } elseif (empty($user_angeltype)) {
return button( return button(
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]), page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
sprintf(_('Become %s'), sprintf(__('Become %s'),
$angeltype['name']) $angeltype['name'])
); );
} }
@ -125,33 +125,33 @@ function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupSt
$content = [msg()]; $content = [msg()];
if ($shift_signup_state->getState() == ShiftSignupState::COLLIDES) { if ($shift_signup_state->getState() == ShiftSignupState::COLLIDES) {
$content[] = info(_('This shift collides with one of your shifts.'), true); $content[] = info(__('This shift collides with one of your shifts.'), true);
} }
if ($shift_signup_state->getState() == ShiftSignupState::SIGNED_UP) { if ($shift_signup_state->getState() == ShiftSignupState::SIGNED_UP) {
$content[] = info(_('You are signed up for this shift.'), true); $content[] = info(__('You are signed up for this shift.'), true);
} }
$buttons = []; $buttons = [];
if ($shift_admin || $admin_shifttypes || $admin_rooms) { if ($shift_admin || $admin_shifttypes || $admin_rooms) {
$buttons = [ $buttons = [
$shift_admin ? button(shift_edit_link($shift), glyph('pencil') . _('edit')) : '', $shift_admin ? button(shift_edit_link($shift), glyph('pencil') . __('edit')) : '',
$shift_admin ? button(shift_delete_link($shift), glyph('trash') . _('delete')) : '', $shift_admin ? button(shift_delete_link($shift), glyph('trash') . __('delete')) : '',
$admin_shifttypes ? button(shifttype_link($shifttype), $shifttype['name']) : '', $admin_shifttypes ? button(shifttype_link($shifttype), $shifttype['name']) : '',
$admin_rooms ? button(room_link($room), glyph('map-marker') . $room['Name']) : '', $admin_rooms ? button(room_link($room), glyph('map-marker') . $room['Name']) : '',
]; ];
} }
$buttons[] = button(user_link($user), '<span class="icon-icon_angel"></span> ' . _('My shifts')); $buttons[] = button(user_link($user), '<span class="icon-icon_angel"></span> ' . __('My shifts'));
$content[] = buttons($buttons); $content[] = buttons($buttons);
$content[] = Shift_view_header($shift, $room); $content[] = Shift_view_header($shift, $room);
$content[] = div('row', [ $content[] = div('row', [
div('col-sm-6', [ div('col-sm-6', [
'<h2>' . _('Needed angels') . '</h2>', '<h2>' . __('Needed angels') . '</h2>',
'<div class="list-group">' . $needed_angels . '</div>' '<div class="list-group">' . $needed_angels . '</div>'
]), ]),
div('col-sm-6', [ div('col-sm-6', [
'<h2>' . _('Description') . '</h2>', '<h2>' . __('Description') . '</h2>',
$parsedown->parse($shifttype['description']) $parsedown->parse($shifttype['description'])
]) ])
]); ]);

View File

@ -9,19 +9,19 @@
*/ */
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( button(
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]), page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
glyph('remove') . _('cancel') glyph('remove') . __('cancel')
), ),
button( button(
page_link_to('user_angeltypes', [ page_link_to('user_angeltypes', [
@ -30,7 +30,7 @@ function UserAngelType_update_view($user_angeltype, $user, $angeltype, $supporte
'supporter' => ($supporter ? '1' : '0'), 'supporter' => ($supporter ? '1' : '0'),
'confirmed' => 1, 'confirmed' => 1,
]), ]),
glyph('ok') . _('yes'), glyph('ok') . __('yes'),
'btn-primary' 'btn-primary'
) )
]) ])
@ -43,23 +43,23 @@ 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( button(
page_link_to( page_link_to(
'angeltypes', 'angeltypes',
['action' => 'view', 'angeltype_id' => $angeltype['id']] ['action' => 'view', 'angeltype_id' => $angeltype['id']]
), ),
glyph('remove') . _('cancel') glyph('remove') . __('cancel')
), ),
button( button(
page_link_to( page_link_to(
'user_angeltypes', 'user_angeltypes',
['action' => 'delete_all', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1] ['action' => 'delete_all', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]
), ),
glyph('ok') . _('yes'), glyph('ok') . __('yes'),
'btn-primary' 'btn-primary'
) )
]) ])
@ -72,15 +72,15 @@ 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(angeltype_link($angeltype['id']), glyph('remove') . _('cancel')), button(angeltype_link($angeltype['id']), glyph('remove') . __('cancel')),
button( button(
page_link_to('user_angeltypes', page_link_to('user_angeltypes',
['action' => 'confirm_all', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]), ['action' => 'confirm_all', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]),
glyph('ok') . _('yes'), glyph('ok') . __('yes'),
'btn-primary' 'btn-primary'
) )
]) ])
@ -95,21 +95,21 @@ 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( info(sprintf(
_('Do you really want to confirm %s for %s?'), __('Do you really want to confirm %s for %s?'),
User_Nick_render($user), User_Nick_render($user),
$angeltype['name'] $angeltype['name']
), true), ), true),
buttons([ buttons([
button(angeltype_link($angeltype['id']), glyph('remove') . _('cancel')), button(angeltype_link($angeltype['id']), glyph('remove') . __('cancel')),
button( button(
page_link_to( page_link_to(
'user_angeltypes', 'user_angeltypes',
['action' => 'confirm', 'user_angeltype_id' => $user_angeltype['id'], 'confirmed' => 1] ['action' => 'confirm', 'user_angeltype_id' => $user_angeltype['id'], 'confirmed' => 1]
), ),
glyph('ok') . _('yes'), glyph('ok') . __('yes'),
'btn-primary' 'btn-primary'
) )
]) ])
@ -124,19 +124,19 @@ 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( info(sprintf(
_('Do you really want to delete %s from %s?'), __('Do you really want to delete %s from %s?'),
User_Nick_render($user), User_Nick_render($user),
$angeltype['name'] $angeltype['name']
), true), ), true),
buttons([ buttons([
button(angeltype_link($angeltype['id']), glyph('remove') . _('cancel')), button(angeltype_link($angeltype['id']), glyph('remove') . __('cancel')),
button( button(
page_link_to('user_angeltypes', page_link_to('user_angeltypes',
['action' => 'delete', 'user_angeltype_id' => $user_angeltype['id'], 'confirmed' => 1]), ['action' => 'delete', 'user_angeltype_id' => $user_angeltype['id'], 'confirmed' => 1]),
glyph('ok') . _('yes'), glyph('ok') . __('yes'),
'btn-primary' 'btn-primary'
) )
]) ])
@ -156,19 +156,19 @@ 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( button(
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]), page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
_('back'), __('back'),
'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'))
]) ])
]); ]);
} }
@ -180,21 +180,21 @@ 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( info(sprintf(
_('Do you really want to add %s to %s?'), __('Do you really want to add %s to %s?'),
User_Nick_render($user), User_Nick_render($user),
$angeltype['name'] $angeltype['name']
), true), ), true),
buttons([ buttons([
button(angeltype_link($angeltype['id']), glyph('remove') . _('cancel')), button(angeltype_link($angeltype['id']), glyph('remove') . __('cancel')),
button( button(
page_link_to( page_link_to(
'user_angeltypes', 'user_angeltypes',
['action' => 'add', 'angeltype_id' => $angeltype['id'], 'user_id' => $user['UID'], 'confirmed' => 1] ['action' => 'add', 'angeltype_id' => $angeltype['id'], 'user_id' => $user['UID'], 'confirmed' => 1]
), ),
glyph('ok') . _('save'), glyph('ok') . __('save'),
'btn-primary' 'btn-primary'
) )
]) ])

View File

@ -10,46 +10,46 @@
*/ */
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 drive a car for the event'), $wants_to_drive), form_checkbox('wants_to_drive', __('I am willing to drive a car for the event'), $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 event (You\'ll get reimbursed for fuel)'), __('I have my own car with me and am willing to use it for the event (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( form_checkbox(
'has_license_forklift', 'has_license_forklift',
_('Forklift'), __('Forklift'),
$user_driver_license['has_license_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() {

View File

@ -11,14 +11,14 @@ function UserWorkLog_delete_view($user_source, $userWorkLog)
{ {
return page_with_title(UserWorkLog_delete_title(), [ return page_with_title(UserWorkLog_delete_title(), [
info(sprintf( info(sprintf(
_('Do you want to delete the worklog entry for %s?'), __('Do you want to delete the worklog entry for %s?'),
User_Nick_render($user_source) User_Nick_render($user_source)
), true), ), true),
buttons([ buttons([
button(user_link($user_source), glyph('remove') . _('cancel')), button(user_link($user_source), glyph('remove') . __('cancel')),
button(user_worklog_delete_link($userWorkLog, [ button(user_worklog_delete_link($userWorkLog, [
'confirmed' => 1 'confirmed' => 1
]), glyph('ok') . _('delete'), 'btn-danger') ]), glyph('ok') . __('delete'), 'btn-danger')
]) ])
]); ]);
} }
@ -28,7 +28,7 @@ function UserWorkLog_delete_view($user_source, $userWorkLog)
*/ */
function UserWorkLog_delete_title() function UserWorkLog_delete_title()
{ {
return _('Delete work log entry'); return __('Delete work log entry');
} }
/** /**
@ -41,11 +41,11 @@ function UserWorkLog_delete_title()
function UserWorkLog_edit_form($user_source, $userWorkLog) function UserWorkLog_edit_form($user_source, $userWorkLog)
{ {
return form([ return form([
form_info(_('User'), User_Nick_render($user_source)), form_info(__('User'), User_Nick_render($user_source)),
form_date('work_timestamp', _('Work date'), $userWorkLog['work_timestamp'], null, time()), form_date('work_timestamp', __('Work date'), $userWorkLog['work_timestamp'], null, time()),
form_text('work_hours', _('Work hours'), $userWorkLog['work_hours']), form_text('work_hours', __('Work hours'), $userWorkLog['work_hours']),
form_text('comment', _('Comment'), $userWorkLog['comment']), form_text('comment', __('Comment'), $userWorkLog['comment']),
form_submit('submit', _('Save')) form_submit('submit', __('Save'))
]); ]);
} }
@ -60,7 +60,7 @@ function UserWorkLog_edit_view($user_source, $userWorkLog)
{ {
return page_with_title(UserWorkLog_edit_title(), [ return page_with_title(UserWorkLog_edit_title(), [
buttons([ buttons([
button(user_link($user_source), _('back')) button(user_link($user_source), __('back'))
]), ]),
msg(), msg(),
UserWorkLog_edit_form($user_source, $userWorkLog) UserWorkLog_edit_form($user_source, $userWorkLog)
@ -78,7 +78,7 @@ function UserWorkLog_add_view($user_source, $userWorkLog)
{ {
return page_with_title(UserWorkLog_add_title(), [ return page_with_title(UserWorkLog_add_title(), [
buttons([ buttons([
button(user_link($user_source), _('back')) button(user_link($user_source), __('back'))
]), ]),
msg(), msg(),
UserWorkLog_edit_form($user_source, $userWorkLog) UserWorkLog_edit_form($user_source, $userWorkLog)
@ -90,7 +90,7 @@ function UserWorkLog_add_view($user_source, $userWorkLog)
*/ */
function UserWorkLog_edit_title() function UserWorkLog_edit_title()
{ {
return _('Edit work log entry'); return __('Edit work log entry');
} }
/** /**
@ -98,5 +98,5 @@ function UserWorkLog_edit_title()
*/ */
function UserWorkLog_add_title() function UserWorkLog_add_title()
{ {
return _('Add work log entry'); return __('Add work log entry');
} }

View File

@ -26,69 +26,70 @@ 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'],
__('Please select...')
) : '', ) : '',
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'))
]) ])
]) ])
]) ])
@ -106,29 +107,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') . ' &raquo;') button(page_link_to('angeltypes', ['action' => 'about']), __('Teams/Job description') . ' &raquo;')
]) ])
]) ])
]) ])
@ -143,18 +144,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'))
]) ])
]); ]);
} }
@ -167,19 +168,19 @@ 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( info(sprintf(
_('Angel should receive at least %d vouchers.'), __('Angel should receive at least %d vouchers.'),
User_get_eligable_voucher_count($user) User_get_eligable_voucher_count($user)
), true), ), 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']])
) )
@ -213,13 +214,13 @@ function Users_view(
$user['Aktiv'] = glyph_bool($user['Aktiv']); $user['Aktiv'] = glyph_bool($user['Aktiv']);
$user['force_active'] = glyph_bool($user['force_active']); $user['force_active'] = glyph_bool($user['force_active']);
$user['Tshirt'] = glyph_bool($user['Tshirt']); $user['Tshirt'] = glyph_bool($user['Tshirt']);
$user['lastLogIn'] = date(_('m/d/Y h:i a'), $user['lastLogIn']); $user['lastLogIn'] = date(__('m/d/Y h:i a'), $user['lastLogIn']);
$user['actions'] = table_buttons([ $user['actions'] = table_buttons([
button_glyph(page_link_to('admin_user', ['id' => $user['UID']]), 'edit', 'btn-xs') button_glyph(page_link_to('admin_user', ['id' => $user['UID']]), 'edit', 'btn-xs')
]); ]);
} }
$users[] = [ $users[] = [
'Nick' => '<strong>' . _('Sum') . '</strong>', 'Nick' => '<strong>' . __('Sum') . '</strong>',
'Gekommen' => $arrived_count, 'Gekommen' => $arrived_count,
'got_voucher' => $voucher_count, 'got_voucher' => $voucher_count,
'Aktiv' => $active_count, 'Aktiv' => $active_count,
@ -229,24 +230,24 @@ function Users_view(
'actions' => '<strong>' . count($users) . '</strong>' 'actions' => '<strong>' . count($users) . '</strong>'
]; ];
return page_with_title(_('All users'), [ return page_with_title(__('All users'), [
msg(), msg(),
buttons([ buttons([
button(page_link_to('register'), glyph('plus') . _('New user')) button(page_link_to('register'), glyph('plus') . __('New user'))
]), ]),
table([ table([
'Nick' => Users_table_header_link('Nick', _('Nick'), $order_by), 'Nick' => Users_table_header_link('Nick', __('Nick'), $order_by),
'Vorname' => Users_table_header_link('Vorname', _('Prename'), $order_by), 'Vorname' => Users_table_header_link('Vorname', __('Prename'), $order_by),
'Name' => Users_table_header_link('Name', _('Name'), $order_by), 'Name' => Users_table_header_link('Name', __('Name'), $order_by),
'DECT' => Users_table_header_link('DECT', _('DECT'), $order_by), 'DECT' => Users_table_header_link('DECT', __('DECT'), $order_by),
'Gekommen' => Users_table_header_link('Gekommen', _('Arrived'), $order_by), 'Gekommen' => Users_table_header_link('Gekommen', __('Arrived'), $order_by),
'got_voucher' => Users_table_header_link('got_voucher', _('Voucher'), $order_by), 'got_voucher' => Users_table_header_link('got_voucher', __('Voucher'), $order_by),
'freeloads' => _('Freeloads'), 'freeloads' => __('Freeloads'),
'Aktiv' => Users_table_header_link('Aktiv', _('Active'), $order_by), 'Aktiv' => Users_table_header_link('Aktiv', __('Active'), $order_by),
'force_active' => Users_table_header_link('force_active', _('Forced'), $order_by), 'force_active' => Users_table_header_link('force_active', __('Forced'), $order_by),
'Tshirt' => Users_table_header_link('Tshirt', _('T-Shirt'), $order_by), 'Tshirt' => Users_table_header_link('Tshirt', __('T-Shirt'), $order_by),
'Size' => Users_table_header_link('Size', _('Size'), $order_by), 'Size' => Users_table_header_link('Size', __('Size'), $order_by),
'lastLogIn' => Users_table_header_link('lastLogIn', _('Last login'), $order_by), 'lastLogIn' => Users_table_header_link('lastLogIn', __('Last login'), $order_by),
'actions' => '' 'actions' => ''
], $users) ], $users)
]); ]);
@ -280,7 +281,7 @@ function User_shift_state_render($user)
$upcoming_shifts = ShiftEntries_upcoming_for_user($user); $upcoming_shifts = ShiftEntries_upcoming_for_user($user);
if (empty($upcoming_shifts)) { if (empty($upcoming_shifts)) {
return '<span class="text-success">' . _('Free') . '</span>'; return '<span class="text-success">' . __('Free') . '</span>';
} }
$nextShift = array_shift($upcoming_shifts); $nextShift = array_shift($upcoming_shifts);
@ -288,23 +289,23 @@ function User_shift_state_render($user)
if ($nextShift['start'] > time()) { if ($nextShift['start'] > time()) {
if ($nextShift['start'] - time() > 3600) { if ($nextShift['start'] - time() > 3600) {
return '<span class="text-success moment-countdown" data-timestamp="' . $nextShift['start'] . '">' return '<span class="text-success moment-countdown" data-timestamp="' . $nextShift['start'] . '">'
. _('Next shift %c') . __('Next shift %c')
. '</span>'; . '</span>';
} }
return '<span class="text-warning moment-countdown" data-timestamp="' . $nextShift['start'] . '">' return '<span class="text-warning moment-countdown" data-timestamp="' . $nextShift['start'] . '">'
. _('Next shift %c') . __('Next shift %c')
. '</span>'; . '</span>';
} }
$halfway = ($nextShift['start'] + $nextShift['end']) / 2; $halfway = ($nextShift['start'] + $nextShift['end']) / 2;
if (time() < $halfway) { if (time() < $halfway) {
return '<span class="text-danger moment-countdown" data-timestamp="' . $nextShift['start'] . '">' return '<span class="text-danger moment-countdown" data-timestamp="' . $nextShift['start'] . '">'
. _('Shift started %c') . __('Shift started %c')
. '</span>'; . '</span>';
} }
return '<span class="text-danger moment-countdown" data-timestamp="' . $nextShift['end'] . '">' return '<span class="text-danger moment-countdown" data-timestamp="' . $nextShift['end'] . '">'
. _('Shift ends %c') . __('Shift ends %c')
. '</span>'; . '</span>';
} }
@ -372,26 +373,26 @@ function User_view_myshift($shift, $user_source, $its_me)
. '</p>'; . '</p>';
if (in_array('user_shifts_admin', $privileges)) { if (in_array('user_shifts_admin', $privileges)) {
$myshift['comment'] .= '<br />' $myshift['comment'] .= '<br />'
. '<p class="text-danger">' . _('Freeloaded') . ': ' . $shift['freeload_comment'] . '</p>'; . '<p class="text-danger">' . __('Freeloaded') . ': ' . $shift['freeload_comment'] . '</p>';
} else { } else {
$myshift['comment'] .= '<br /><p class="text-danger">' . _('Freeloaded') . '</p>'; $myshift['comment'] .= '<br /><p class="text-danger">' . __('Freeloaded') . '</p>';
} }
} }
$myshift['actions'] = [ $myshift['actions'] = [
button(shift_link($shift), glyph('eye-open') . _('view'), 'btn-xs') button(shift_link($shift), glyph('eye-open') . __('view'), 'btn-xs')
]; ];
if ($its_me || in_array('user_shifts_admin', $privileges)) { if ($its_me || in_array('user_shifts_admin', $privileges)) {
$myshift['actions'][] = button( $myshift['actions'][] = button(
page_link_to('user_myshifts', ['edit' => $shift['id'], 'id' => $user_source['UID']]), page_link_to('user_myshifts', ['edit' => $shift['id'], 'id' => $user_source['UID']]),
glyph('edit') . _('edit'), glyph('edit') . __('edit'),
'btn-xs' 'btn-xs'
); );
} }
if (Shift_signout_allowed($shift, ['id' => $shift['TID']], $user_source)) { if (Shift_signout_allowed($shift, ['id' => $shift['TID']], $user_source)) {
$myshift['actions'][] = button( $myshift['actions'][] = button(
shift_entry_delete_link($shift), shift_entry_delete_link($shift),
glyph('trash') . _('sign off'), glyph('trash') . __('sign off'),
'btn-xs' 'btn-xs'
); );
} }
@ -441,7 +442,7 @@ function User_view_myshifts(
if (count($myshifts_table) > 0) { if (count($myshifts_table) > 0) {
ksort($myshifts_table); ksort($myshifts_table);
$myshifts_table[] = [ $myshifts_table[] = [
'date' => '<b>' . _('Sum:') . '</b>', 'date' => '<b>' . __('Sum:') . '</b>',
'duration' => '<b>' . sprintf('%.2f', round($timesum / 3600, 2)) . '&nbsp;h</b>', 'duration' => '<b>' . sprintf('%.2f', round($timesum / 3600, 2)) . '&nbsp;h</b>',
'room' => '', 'room' => '',
'shift_info' => '', 'shift_info' => '',
@ -450,7 +451,7 @@ function User_view_myshifts(
]; ];
if (config('enable_tshirt_size', false) && ($its_me || $tshirt_admin)) { if (config('enable_tshirt_size', false) && ($its_me || $tshirt_admin)) {
$myshifts_table[] = [ $myshifts_table[] = [
'date' => '<b>' . _('Your t-shirt score') . '&trade;:</b>', 'date' => '<b>' . __('Your t-shirt score') . '&trade;:</b>',
'duration' => '<b>' . $tshirt_score . '</b>', 'duration' => '<b>' . $tshirt_score . '</b>',
'room' => '', 'room' => '',
'shift_info' => '', 'shift_info' => '',
@ -476,12 +477,12 @@ function User_view_worklog($worklog, $admin_user_worklog_privilege)
$actions = table_buttons([ $actions = table_buttons([
button( button(
user_worklog_edit_link($worklog), user_worklog_edit_link($worklog),
glyph('edit') . _('edit'), glyph('edit') . __('edit'),
'btn-xs' 'btn-xs'
), ),
button( button(
user_worklog_delete_link($worklog), user_worklog_delete_link($worklog),
glyph('trash') . _('delete'), glyph('trash') . __('delete'),
'btn-xs' 'btn-xs'
) )
]); ]);
@ -491,10 +492,10 @@ function User_view_worklog($worklog, $admin_user_worklog_privilege)
'date' => glyph('calendar') . date('Y-m-d', $worklog['work_timestamp']), 'date' => glyph('calendar') . date('Y-m-d', $worklog['work_timestamp']),
'duration' => '<b>' . sprintf('%.2f', $worklog['work_hours']) . '</b>', 'duration' => '<b>' . sprintf('%.2f', $worklog['work_hours']) . '</b>',
'room' => '', 'room' => '',
'shift_info' => _('Work log entry'), 'shift_info' => __('Work log entry'),
'comment' => $worklog['comment'] . '<br>' 'comment' => $worklog['comment'] . '<br>'
. sprintf( . sprintf(
_('Added by %s at %s'), __('Added by %s at %s'),
User_Nick_render(User($worklog['created_user_id'])), User_Nick_render(User($worklog['created_user_id'])),
date('Y-m-d H:i', $worklog['created_timestamp']) date('Y-m-d H:i', $worklog['created_timestamp'])
), ),
@ -545,15 +546,15 @@ function User_view(
); );
if (count($my_shifts) > 0) { if (count($my_shifts) > 0) {
$myshifts_table = table([ $myshifts_table = table([
'date' => _('Day &amp; time'), 'date' => __('Day &amp; time'),
'duration' => _('Duration'), 'duration' => __('Duration'),
'room' => _('Location'), 'room' => __('Location'),
'shift_info' => _('Name &amp; workmates'), 'shift_info' => __('Name &amp; workmates'),
'comment' => _('Comment'), 'comment' => __('Comment'),
'actions' => _('Action') 'actions' => __('Action')
], $my_shifts); ], $my_shifts);
} elseif ($user_source['force_active']) { } elseif ($user_source['force_active']) {
$myshifts_table = success(_('You have done enough to get a t-shirt.'), true); $myshifts_table = success(__('You have done enough to get a t-shirt.'), true);
} }
} }
@ -568,42 +569,42 @@ function User_view(
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( page_link_to(
'users', 'users',
['action' => 'edit_vouchers', 'user_id' => $user_source['UID']] ['action' => 'edit_vouchers', 'user_id' => $user_source['UID']]
), ),
glyph('cutlery') . _('Edit vouchers') glyph('cutlery') . __('Edit vouchers')
) : '', ) : '',
$admin_user_worklog_privilege ? button( $admin_user_worklog_privilege ? button(
user_worklog_add_link($user_source), user_worklog_add_link($user_source),
glyph('list') . _('Add work log') glyph('list') . __('Add work log')
) : '', ) : '',
$its_me ? button( $its_me ? button(
page_link_to('user_settings'), page_link_to('user_settings'),
glyph('list-alt') . _('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' => 1]), page_link_to('user_myshifts', ['reset' => 1]),
glyph('repeat') . _('Reset API key') glyph('repeat') . __('Reset API key')
) : '' ) : ''
]) ])
]) ])
@ -616,15 +617,15 @@ function User_view(
User_angeltypes_render($user_angeltypes), User_angeltypes_render($user_angeltypes),
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>' : '',
$myshifts_table, $myshifts_table,
$its_me ? info( $its_me ? info(
glyph('info-sign') . _('Your night shifts between 2 and 8 am count twice.'), glyph('info-sign') . __('Your night shifts between 2 and 8 am count twice.'),
true 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)
: '', : '',
@ -650,7 +651,7 @@ function User_view_state($admin_user_privilege, $freeloader, $user_source)
} }
return div('col-md-3', [ return div('col-md-3', [
heading(_('User state'), 4), heading(__('User state'), 4),
join('<br>', $state) join('<br>', $state)
]); ]);
} }
@ -668,9 +669,9 @@ function User_view_state_user($user_source)
]; ];
if ($user_source['Gekommen']) { if ($user_source['Gekommen']) {
$state[] = '<span class="text-success">' . glyph('home') . _('Arrived') . '</span>'; $state[] = '<span class="text-success">' . glyph('home') . __('Arrived') . '</span>';
} else { } else {
$state[] = '<span class="text-danger">' . _('Not arrived') . '</span>'; $state[] = '<span class="text-danger">' . __('Not arrived') . '</span>';
} }
return $state; return $state;
@ -689,27 +690,27 @@ function User_view_state_admin($freeloader, $user_source)
$state = []; $state = [];
if ($freeloader) { if ($freeloader) {
$state[] = '<span class="text-danger">' . glyph('exclamation-sign') . _('Freeloader') . '</span>'; $state[] = '<span class="text-danger">' . glyph('exclamation-sign') . __('Freeloader') . '</span>';
} }
$state[] = User_shift_state_render($user_source); $state[] = User_shift_state_render($user_source);
if ($user_source['Gekommen']) { if ($user_source['Gekommen']) {
$state[] = '<span class="text-success">' . glyph('home') $state[] = '<span class="text-success">' . glyph('home')
. 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>';
if ($user_source['force_active']) { if ($user_source['force_active']) {
$state[] = '<span class="text-success">' . _('Active (forced)') . '</span>'; $state[] = '<span class="text-success">' . __('Active (forced)') . '</span>';
} elseif ($user_source['Aktiv']) { } elseif ($user_source['Aktiv']) {
$state[] = '<span class="text-success">' . _('Active') . '</span>'; $state[] = '<span class="text-success">' . __('Active') . '</span>';
} }
if ($user_source['Tshirt']) { if ($user_source['Tshirt']) {
$state[] = '<span class="text-success">' . _('T-Shirt') . '</span>'; $state[] = '<span class="text-success">' . __('T-Shirt') . '</span>';
} }
} else { } else {
$state[] = '<span class="text-danger">' $state[] = '<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>';
} }
@ -722,7 +723,7 @@ function User_view_state_admin($freeloader, $user_source)
) )
. '</span>'; . '</span>';
} else { } else {
$state[] = '<span class="text-danger">' . _('Got no vouchers') . '</span>'; $state[] = '<span class="text-danger">' . __('Got no vouchers') . '</span>';
} }
return $state; return $state;
@ -737,10 +738,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'))
]) ])
]); ]);
} }
@ -754,11 +755,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'))
]) ])
]); ]);
} }
@ -780,7 +781,7 @@ function User_angeltypes_render($user_angeltypes)
. '</a>'; . '</a>';
} }
return div('col-md-3', [ return div('col-md-3', [
heading(_('Angeltypes'), 4), heading(__('Angeltypes'), 4),
join('<br>', $output) join('<br>', $output)
]); ]);
} }
@ -797,7 +798,7 @@ function User_groups_render($user_groups)
} }
return div('col-md-3', [ return div('col-md-3', [
'<h4>' . _('Rights') . '</h4>', '<h4>' . __('Rights') . '</h4>',
join('<br>', $output) join('<br>', $output)
]); ]);
} }
@ -846,7 +847,7 @@ function render_user_departure_date_hint()
global $user; global $user;
if (!isset($user['planned_departure_date']) || empty($user['planned_departure_date'])) { if (!isset($user['planned_departure_date']) || empty($user['planned_departure_date'])) {
$text = _('Please enter your planned date of departure on your settings page to give us a feeling for teardown capacities.'); $text = __('Please enter your planned date of departure on your settings page to give us a feeling for teardown capacities.');
return render_profile_link($text, null, 'alert-link'); return render_profile_link($text, null, 'alert-link');
} }
@ -862,7 +863,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.'),
config('max_freeloadable_shifts') config('max_freeloadable_shifts')
); );
} }
@ -884,7 +885,7 @@ function render_user_arrived_hint()
if (!empty($event_config) if (!empty($event_config)
&& !is_null($event_config['buildup_start_date']) && !is_null($event_config['buildup_start_date'])
&& time() > $event_config['buildup_start_date']) { && time() > $event_config['buildup_start_date']) {
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.');
} }
} }
@ -899,7 +900,7 @@ function render_user_tshirt_hint()
global $user; global $user;
if (config('enable_tshirt_size') && $user['Size'] == '') { if (config('enable_tshirt_size') && $user['Size'] == '') {
$text = _('You need to specify a tshirt size in your settings!'); $text = __('You need to specify a tshirt size in your settings!');
return render_profile_link($text, null, 'alert-link'); return render_profile_link($text, null, 'alert-link');
} }
@ -914,7 +915,7 @@ function render_user_dect_hint()
global $user; global $user;
if ($user['Gekommen'] == 1 && $user['DECT'] == '') { if ($user['Gekommen'] == 1 && $user['DECT'] == '') {
$text = _('You need to specify a DECT phone number in your settings! If you don\'t have a DECT phone, just enter \'-\'.'); $text = __('You need to specify a DECT phone number in your settings! If you don\'t have a DECT phone, just enter \'-\'.');
return render_profile_link($text, null, 'alert-link'); return render_profile_link($text, null, 'alert-link');
} }

View File

@ -2,6 +2,7 @@
namespace Engelsystem\Middleware; namespace Engelsystem\Middleware;
use Engelsystem\Helpers\Translator;
use Engelsystem\Http\Request; use Engelsystem\Http\Request;
use Engelsystem\Http\Response; use Engelsystem\Http\Response;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
@ -83,9 +84,12 @@ class LegacyMiddleware implements MiddlewareInterface
} }
if (empty($title) and empty($content)) { if (empty($title) and empty($content)) {
/** @var Translator $translator */
$translator = $this->container->get('translator');
$page = 404; $page = 404;
$title = _('Page not found'); $title = $translator->translate('Page not found');
$content = _('This page could not be found or you don\'t have permission to view it. You probably have to sign in or register in order to gain access!'); $content = $translator->translate('This page could not be found or you don\'t have permission to view it. You probably have to sign in or register in order to gain access!');
} }
return $this->renderPage($page, $title, $content); return $this->renderPage($page, $title, $content);

View File

@ -2,6 +2,7 @@
namespace Engelsystem\Test\Unit\Middleware; namespace Engelsystem\Test\Unit\Middleware;
use Engelsystem\Helpers\Translator;
use Engelsystem\Http\Request; use Engelsystem\Http\Request;
use Engelsystem\Middleware\LegacyMiddleware; use Engelsystem\Middleware\LegacyMiddleware;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
@ -37,6 +38,10 @@ class LegacyMiddlewareTest extends TestCase
$handler = $this->getMockForAbstractClass(RequestHandlerInterface::class); $handler = $this->getMockForAbstractClass(RequestHandlerInterface::class);
/** @var ServerRequestInterface|MockObject $request */ /** @var ServerRequestInterface|MockObject $request */
$request = $this->getMockForAbstractClass(ServerRequestInterface::class); $request = $this->getMockForAbstractClass(ServerRequestInterface::class);
/** @var Translator|MockObject $translator */
$translator = $this->getMockBuilder(Translator::class)
->disableOriginalConstructor()
->getMock();
$middleware->expects($this->exactly(2)) $middleware->expects($this->exactly(2))
->method('loadPage') ->method('loadPage')
@ -50,15 +55,27 @@ class LegacyMiddlewareTest extends TestCase
->method('renderPage') ->method('renderPage')
->withConsecutive( ->withConsecutive(
['user_worklog', 'title', 'content'], ['user_worklog', 'title', 'content'],
['404', 'Page not found'], ['404', 'Page not found', 'It\'s not available!'],
['login', 'title2', 'content2'] ['login', 'title2', 'content2']
) )
->willReturn($response); ->willReturn($response);
$container->expects($this->atLeastOnce()) $container->expects($this->exactly(4))
->method('get') ->method('get')
->with('request') ->withConsecutive(['request'], ['request'], ['translator'], ['request'])
->willReturn($defaultRequest); ->willReturnOnConsecutiveCalls(
$defaultRequest,
$defaultRequest,
$translator,
$defaultRequest
);
$translator->expects($this->exactly(2))
->method('translate')
->willReturnOnConsecutiveCalls(
'Page not found',
'It\'s not available!'
);
$defaultRequest->query = $parameters; $defaultRequest->query = $parameters;
$defaultRequest->expects($this->once()) $defaultRequest->expects($this->once())