Cleanup: Simplification and removed dead code and duplicated/outdated declarations
This commit is contained in:
parent
3ebea2ae15
commit
5e81b8d2af
|
@ -81,7 +81,7 @@ function public_dashboard_controller_free_shift($shift, ShiftsFilter $filter = n
|
|||
'shifttype_name' => $shifttype['name'],
|
||||
'title' => $shift['title'],
|
||||
'room_name' => $room->name,
|
||||
'needed_angels' => []
|
||||
'needed_angels' => public_dashboard_needed_angels($shift['NeedAngels'], $filter),
|
||||
];
|
||||
|
||||
if (time() + 3 * 60 * 60 > $shift['start']) {
|
||||
|
@ -91,8 +91,6 @@ function public_dashboard_controller_free_shift($shift, ShiftsFilter $filter = n
|
|||
$free_shift['style'] = 'danger';
|
||||
}
|
||||
|
||||
$free_shift['needed_angels'] = public_dashboard_needed_angels($shift['NeedAngels'], $filter);
|
||||
|
||||
return $free_shift;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,9 +17,7 @@ function shift_link($shift)
|
|||
$parameters['shift_id'] = $shift['SID'];
|
||||
}
|
||||
|
||||
$link = page_link_to('shifts', $parameters);
|
||||
|
||||
return $link;
|
||||
return page_link_to('shifts', $parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,7 +40,7 @@ function user_driver_licenses_controller()
|
|||
$user = auth()->user();
|
||||
|
||||
if (!$user) {
|
||||
throw_redirect(page_link_to(''));
|
||||
throw_redirect(page_link_to());
|
||||
}
|
||||
|
||||
$action = strip_request_item('action', 'edit');
|
||||
|
|
|
@ -87,7 +87,7 @@ function user_worklog_from_request(Worklog $worklog)
|
|||
}
|
||||
|
||||
$worklog->hours = $request->input('work_hours');
|
||||
if (!preg_match("/^[0-9]+(\.[0-9]{0,2})?$/", $worklog->hours)) {
|
||||
if (!preg_match("/^\d+(\.\d{0,2})?$/", $worklog->hours)) {
|
||||
$valid = false;
|
||||
error(__('Please enter work hours in format ##[.##].'));
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ function users_controller()
|
|||
$request = request();
|
||||
|
||||
if (!$user) {
|
||||
throw_redirect(page_link_to(''));
|
||||
throw_redirect(page_link_to());
|
||||
}
|
||||
|
||||
$action = 'list';
|
||||
|
@ -58,7 +58,7 @@ function user_delete_controller()
|
|||
}
|
||||
|
||||
if (!auth()->can('admin_user')) {
|
||||
throw_redirect(page_link_to(''));
|
||||
throw_redirect(page_link_to());
|
||||
}
|
||||
|
||||
// You cannot delete yourself
|
||||
|
@ -150,7 +150,7 @@ function user_edit_vouchers_controller()
|
|||
(!auth()->can('admin_user') && !auth()->can('voucher.edit'))
|
||||
|| !config('enable_voucher')
|
||||
) {
|
||||
throw_redirect(page_link_to(''));
|
||||
throw_redirect(page_link_to());
|
||||
}
|
||||
|
||||
if ($request->hasPostData('submit')) {
|
||||
|
@ -266,7 +266,7 @@ function users_list_controller()
|
|||
$request = request();
|
||||
|
||||
if (!auth()->can('admin_user')) {
|
||||
throw_redirect(page_link_to(''));
|
||||
throw_redirect(page_link_to());
|
||||
}
|
||||
|
||||
$order_by = 'name';
|
||||
|
@ -385,8 +385,6 @@ function shiftCalendarRendererByShiftFilter(ShiftsFilter $shiftsFilter)
|
|||
$filtered_shifts = [];
|
||||
foreach ($shifts as $shift) {
|
||||
$needed_angels_count = 0;
|
||||
$taken = 0;
|
||||
|
||||
foreach ($needed_angeltypes[$shift['SID']] as $needed_angeltype) {
|
||||
$taken = 0;
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ require __DIR__ . '/includes.php';
|
|||
/**
|
||||
* Check for maintenance
|
||||
*/
|
||||
/** @var \Engelsystem\Application $app */
|
||||
if ($app->get('config')->get('maintenance')) {
|
||||
http_response_code(503);
|
||||
$url = $app->get(UrlGeneratorInterface::class);
|
||||
|
|
|
@ -29,7 +29,7 @@ function engelsystem_email_to_user($recipientUser, $title, $message, $notIfItsMe
|
|||
|
||||
$translator->setLocale($recipientUser->settings->language);
|
||||
$mailer->sendView(
|
||||
$recipientUser->contact->email ? $recipientUser->contact->email : $recipientUser->email,
|
||||
$recipientUser->contact->email ?: $recipientUser->email,
|
||||
$title,
|
||||
'emails/mail',
|
||||
['username' => $recipientUser->name, 'message' => $message]
|
||||
|
|
|
@ -27,13 +27,13 @@ class ShiftsFilter
|
|||
private $userShiftsAdmin;
|
||||
|
||||
/** @var int[] */
|
||||
private $filled = [];
|
||||
private $filled;
|
||||
|
||||
/** @var int[] */
|
||||
private $rooms = [];
|
||||
private $rooms;
|
||||
|
||||
/** @var int[] */
|
||||
private $types = [];
|
||||
private $types;
|
||||
|
||||
/** @var int unix timestamp */
|
||||
private $startTime = null;
|
||||
|
|
|
@ -375,8 +375,8 @@ function Shift_signup_allowed_angel(
|
|||
|
||||
if (
|
||||
empty($user_angeltype)
|
||||
|| ($angeltype['no_self_signup'] == 1 && !empty($user_angeltype))
|
||||
|| ($angeltype['restricted'] == 1 && !empty($user_angeltype) && !isset($user_angeltype['confirm_user_id']))
|
||||
|| $angeltype['no_self_signup'] == 1
|
||||
|| ($angeltype['restricted'] == 1 && !isset($user_angeltype['confirm_user_id']))
|
||||
) {
|
||||
// you cannot join if user is not of this angel type
|
||||
// you cannot join if you are not confirmed
|
||||
|
|
|
@ -1,130 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Engelsystem\Database\Db;
|
||||
|
||||
/**
|
||||
* Returns a new empty UserDriverLicense
|
||||
* FIXME entity object needed
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function UserDriverLicense_new()
|
||||
{
|
||||
return [
|
||||
'user_id' => null,
|
||||
'has_car' => false,
|
||||
'has_license_car' => false,
|
||||
'has_license_3_5t_transporter' => false,
|
||||
'has_license_7_5t_truck' => false,
|
||||
'has_license_12_5t_truck' => false,
|
||||
'has_license_forklift' => false
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Is it valid?
|
||||
*
|
||||
* @param array $user_driver_license The UserDriverLicense to check
|
||||
* @return boolean
|
||||
*/
|
||||
function UserDriverLicense_valid($user_driver_license)
|
||||
{
|
||||
return
|
||||
$user_driver_license['has_license_car']
|
||||
|| $user_driver_license['has_license_3_5t_transporter']
|
||||
|| $user_driver_license['has_license_7_5t_truck']
|
||||
|| $user_driver_license['has_license_12_5t_truck']
|
||||
|| $user_driver_license['has_license_forklift'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a users driver license information
|
||||
*
|
||||
* @param int $user_id The users id
|
||||
* @return array|null
|
||||
*/
|
||||
function UserDriverLicense($user_id)
|
||||
{
|
||||
$driverLicense = DB::selectOne('
|
||||
SELECT *
|
||||
FROM `UserDriverLicenses`
|
||||
WHERE `user_id`=?', [$user_id]);
|
||||
|
||||
return empty($driverLicense) ? null : $driverLicense;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a user's driver license entry
|
||||
*
|
||||
* @param array $user_driver_license The UserDriverLicense to create
|
||||
* @param int $userId
|
||||
* @return array
|
||||
*/
|
||||
function UserDriverLicenses_create($user_driver_license, $userId)
|
||||
{
|
||||
$user_driver_license['user_id'] = $userId;
|
||||
DB::insert('
|
||||
INSERT INTO `UserDriverLicenses` (
|
||||
`user_id`,
|
||||
`has_car`,
|
||||
`has_license_car`,
|
||||
`has_license_3_5t_transporter`,
|
||||
`has_license_7_5t_truck`,
|
||||
`has_license_12_5t_truck`,
|
||||
`has_license_forklift`
|
||||
)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
',
|
||||
[
|
||||
$user_driver_license['user_id'],
|
||||
(int)$user_driver_license['has_car'],
|
||||
(int)$user_driver_license['has_license_car'],
|
||||
(int)$user_driver_license['has_license_3_5t_transporter'],
|
||||
(int)$user_driver_license['has_license_7_5t_truck'],
|
||||
(int)$user_driver_license['has_license_12_5t_truck'],
|
||||
(int)$user_driver_license['has_license_forklift'],
|
||||
]
|
||||
);
|
||||
|
||||
return $user_driver_license;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a user's driver license entry
|
||||
*
|
||||
* @param array $user_driver_license The UserDriverLicense to update
|
||||
*/
|
||||
function UserDriverLicenses_update($user_driver_license)
|
||||
{
|
||||
DB::update('
|
||||
UPDATE `UserDriverLicenses`
|
||||
SET
|
||||
`has_car`=?,
|
||||
`has_license_car`=?,
|
||||
`has_license_3_5t_transporter`=?,
|
||||
`has_license_7_5t_truck`=?,
|
||||
`has_license_12_5t_truck`=?,
|
||||
`has_license_forklift`=?
|
||||
WHERE `user_id`=?
|
||||
',
|
||||
[
|
||||
(int)$user_driver_license['has_car'],
|
||||
(int)$user_driver_license['has_license_car'],
|
||||
(int)$user_driver_license['has_license_3_5t_transporter'],
|
||||
(int)$user_driver_license['has_license_7_5t_truck'],
|
||||
(int)$user_driver_license['has_license_12_5t_truck'],
|
||||
(int)$user_driver_license['has_license_forklift'],
|
||||
$user_driver_license['user_id'],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a user's driver license entry
|
||||
*
|
||||
* @param int $user_id
|
||||
*/
|
||||
function UserDriverLicenses_delete($user_id)
|
||||
{
|
||||
DB::delete('DELETE FROM `UserDriverLicenses` WHERE `user_id`=?', [$user_id]);
|
||||
}
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
use Carbon\Carbon;
|
||||
use Engelsystem\Models\Room;
|
||||
use Engelsystem\Models\User\User;
|
||||
use Engelsystem\Models\Worklog;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
|
|
|
@ -306,7 +306,7 @@ function admin_active()
|
|||
form_submit('submit', __('Search'))
|
||||
], page_link_to('admin_active')),
|
||||
$set_active == '' ? form([
|
||||
form_text('count', __('How much angels should be active?'), $count ? $count : $forced_count),
|
||||
form_text('count', __('How much angels should be active?'), $count ?: $forced_count),
|
||||
form_submit('set_active', __('Preview'))
|
||||
]) : $set_active,
|
||||
$msg . msg(),
|
||||
|
|
|
@ -91,7 +91,7 @@ function admin_free()
|
|||
}
|
||||
}
|
||||
|
||||
$email = ($usr->contact->email ? $usr->contact->email : $usr->email);
|
||||
$email = $usr->contact->email ?: $usr->email;
|
||||
$free_users_table[] = [
|
||||
'name' => User_Nick_render($usr) . User_Pronoun_render($usr),
|
||||
'shift_state' => User_shift_state_render($usr),
|
||||
|
|
|
@ -123,14 +123,11 @@ function admin_groups()
|
|||
|
||||
$group = Db::selectOne('SELECT * FROM `Groups` WHERE `UID`=? LIMIT 1', [$group_id]);
|
||||
$privileges = $request->request->all('privileges');
|
||||
if (!is_array($privileges)) {
|
||||
$privileges = [];
|
||||
}
|
||||
if (!empty($group)) {
|
||||
Db::delete('DELETE FROM `GroupPrivileges` WHERE `group_id`=?', [$group_id]);
|
||||
$privilege_names = [];
|
||||
foreach ($privileges as $privilege) {
|
||||
if (preg_match('/^\d{1,}$/', $privilege)) {
|
||||
if (preg_match('/^\d+$/', $privilege)) {
|
||||
$group_privileges_source = Db::selectOne(
|
||||
'SELECT `name` FROM `Privileges` WHERE `id`=? LIMIT 1',
|
||||
[$privilege]
|
||||
|
|
|
@ -27,8 +27,8 @@ function admin_shifts()
|
|||
$session = session();
|
||||
$start = Carbon::createTimestampFromDatetime(date('Y-m-d') . 'T00:00');
|
||||
$end = $start;
|
||||
$mode = 'single';
|
||||
$angelmode = 'manually';
|
||||
$mode = '';
|
||||
$angelmode = '';
|
||||
$length = '';
|
||||
$change_hours = [];
|
||||
$title = '';
|
||||
|
@ -452,7 +452,7 @@ function admin_shifts()
|
|||
div('col-md-6', [
|
||||
form_datetime('start', __('Start'), $start),
|
||||
form_datetime('end', __('End'), $end),
|
||||
form_info(__('Mode'), ''),
|
||||
form_info(__('Mode')),
|
||||
form_radio('mode', __('Create one shift'), $mode == 'single', 'single'),
|
||||
form_radio('mode', __('Create multiple shifts'), $mode == 'multi', 'multi'),
|
||||
form_text(
|
||||
|
@ -482,7 +482,7 @@ function admin_shifts()
|
|||
)
|
||||
]),
|
||||
div('col-md-6', [
|
||||
form_info(__('Needed angels'), ''),
|
||||
form_info(__('Needed angels')),
|
||||
form_radio(
|
||||
'angelmode',
|
||||
__('Take needed angels from room settings'),
|
||||
|
|
|
@ -44,7 +44,7 @@ function admin_user()
|
|||
. page_link_to('admin_user', ['action' => 'save', 'id' => $user_id])
|
||||
. '" method="post">' . "\n";
|
||||
$html .= form_csrf();
|
||||
$html .= '<table border="0">' . "\n";
|
||||
$html .= '<table>' . "\n";
|
||||
$html .= '<input type="hidden" name="Type" value="Normal">' . "\n";
|
||||
$html .= '<tr><td>' . "\n";
|
||||
$html .= '<table>' . "\n";
|
||||
|
@ -100,7 +100,7 @@ function admin_user()
|
|||
$html .= ' <tr><td>T-Shirt</td><td>' . "\n";
|
||||
$html .= html_options('eTshirt', $options, $user_source->state->got_shirt) . '</td></tr>' . "\n";
|
||||
|
||||
$html .= '</table>' . "\n" . '</td><td valign="top"></td></tr>';
|
||||
$html .= '</table>' . "\n" . '</td><td></td></tr>';
|
||||
|
||||
$html .= '</td></tr>' . "\n";
|
||||
$html .= '</table>' . "\n" . '<br />' . "\n";
|
||||
|
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace Engelsystem\Controllers\Admin\Schedule;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use DateTimeInterface;
|
||||
use Engelsystem\Controllers\BaseController;
|
||||
use Engelsystem\Controllers\HasUserNotifications;
|
||||
use Engelsystem\Helpers\Schedule\Event;
|
||||
|
@ -247,7 +248,7 @@ class ImportSchedule extends BaseController
|
|||
foreach ($newEvents as $event) {
|
||||
$this->createEvent(
|
||||
$event,
|
||||
(int)$shiftType,
|
||||
$shiftType,
|
||||
$rooms
|
||||
->where('name', $event->getRoom()->getName())
|
||||
->first(),
|
||||
|
@ -258,7 +259,7 @@ class ImportSchedule extends BaseController
|
|||
foreach ($changeEvents as $event) {
|
||||
$this->updateEvent(
|
||||
$event,
|
||||
(int)$shiftType,
|
||||
$shiftType,
|
||||
$rooms
|
||||
->where('name', $event->getRoom()->getName())
|
||||
->first()
|
||||
|
@ -326,8 +327,8 @@ class ImportSchedule extends BaseController
|
|||
[
|
||||
'shift' => $shift->getTitle(),
|
||||
'room' => $room->name,
|
||||
'from' => $shift->getDate()->format(Carbon::RFC3339),
|
||||
'to' => $shift->getEndDate()->format(Carbon::RFC3339),
|
||||
'from' => $shift->getDate()->format(DateTimeInterface::RFC3339),
|
||||
'to' => $shift->getEndDate()->format(DateTimeInterface::RFC3339),
|
||||
'guid' => $shift->getGuid(),
|
||||
]
|
||||
);
|
||||
|
@ -364,8 +365,8 @@ class ImportSchedule extends BaseController
|
|||
[
|
||||
'shift' => $shift->getTitle(),
|
||||
'room' => $room->name,
|
||||
'from' => $shift->getDate()->format(Carbon::RFC3339),
|
||||
'to' => $shift->getEndDate()->format(Carbon::RFC3339),
|
||||
'from' => $shift->getDate()->format(DateTimeInterface::RFC3339),
|
||||
'to' => $shift->getEndDate()->format(DateTimeInterface::RFC3339),
|
||||
'guid' => $shift->getGuid(),
|
||||
]
|
||||
);
|
||||
|
@ -386,8 +387,8 @@ class ImportSchedule extends BaseController
|
|||
'Deleted schedule shift "{shift}" ({from} {to}, {guid})',
|
||||
[
|
||||
'shift' => $shift->getTitle(),
|
||||
'from' => $shift->getDate()->format(Carbon::RFC3339),
|
||||
'to' => $shift->getEndDate()->format(Carbon::RFC3339),
|
||||
'from' => $shift->getDate()->format(DateTimeInterface::RFC3339),
|
||||
'to' => $shift->getEndDate()->format(DateTimeInterface::RFC3339),
|
||||
'guid' => $shift->getGuid(),
|
||||
]
|
||||
);
|
||||
|
@ -395,7 +396,7 @@ class ImportSchedule extends BaseController
|
|||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return Event[]|Room[]|RoomModel[]|ScheduleUrl|Schedule|string
|
||||
* @return Event[]|Room[]|RoomModel[]
|
||||
* @throws ErrorException
|
||||
*/
|
||||
protected function getScheduleData(Request $request)
|
||||
|
@ -528,7 +529,7 @@ class ImportSchedule extends BaseController
|
|||
$end = Carbon::createFromTimestamp($shift->end);
|
||||
$duration = $start->diff($end);
|
||||
|
||||
$event = new Event(
|
||||
return new Event(
|
||||
$scheduleShift->guid,
|
||||
0,
|
||||
new Room($shift->room_name),
|
||||
|
@ -542,8 +543,6 @@ class ImportSchedule extends BaseController
|
|||
'',
|
||||
''
|
||||
);
|
||||
|
||||
return $event;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,7 +24,7 @@ function user_myshifts()
|
|||
if (
|
||||
$request->has('id')
|
||||
&& auth()->can('user_shifts_admin')
|
||||
&& preg_match('/^\d{1,}$/', $request->input('id'))
|
||||
&& preg_match('/^\d+$/', $request->input('id'))
|
||||
&& User::find($request->input('id'))
|
||||
) {
|
||||
$shift_entry_id = $request->input('id');
|
||||
|
|
|
@ -39,11 +39,11 @@ function form_spinner($name, $label, $value)
|
|||
</div>
|
||||
<script type="text/javascript">
|
||||
$(\'#spinner-' . $name . '-down\').click(function() {
|
||||
var spinner = $(\'#spinner-' . $name . '\');
|
||||
let spinner = $(\'#spinner-' . $name . '\');
|
||||
spinner.val(parseInt(spinner.val()) - 1);
|
||||
});
|
||||
$(\'#spinner-' . $name . '-up\').click(function() {
|
||||
var spinner = $(\'#spinner-' . $name . '\');
|
||||
let spinner = $(\'#spinner-' . $name . '\');
|
||||
spinner.val(parseInt(spinner.val()) + 1);
|
||||
});
|
||||
</script>
|
||||
|
@ -55,7 +55,7 @@ function form_spinner($name, $label, $value)
|
|||
*
|
||||
* @param string $name Name of the parameter
|
||||
* @param string $label Label
|
||||
* @param int $value Unix Timestamp
|
||||
* @param int|Carbon $value Unix Timestamp
|
||||
* @param string $start_date Earliest possible date
|
||||
* @param string $end_date
|
||||
* @return string HTML
|
||||
|
@ -93,10 +93,12 @@ function form_datetime(string $name, string $label, $value)
|
|||
|
||||
return form_element($label, sprintf('
|
||||
<div class="input-group datetime" id="%s">
|
||||
<input type="datetime-local" pattern="[0-9]{4}-[0-9]{2}-[0-9]{2} ([01][0-9]|2[0-3]):[0-5][0-9]" placeholder="YYYY-MM-DD HH:MM" name="%s"
|
||||
<input type="datetime-local"
|
||||
pattern="[0-9]{4}-[0-9]{2}-[0-9]{2} ([01][0-9]|2[0-3]):[0-5][0-9]" placeholder="YYYY-MM-DD HH:MM"
|
||||
name="%s"
|
||||
class="form-control" value="%s" autocomplete="off">
|
||||
</div>
|
||||
', $dom_id, $name, htmlspecialchars($value ? $value->format('Y-m-d H:i') : ''), $dom_id), $dom_id);
|
||||
', $dom_id, $name, htmlspecialchars($value ? $value->format('Y-m-d H:i') : '')), $dom_id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,7 +114,7 @@ function form_checkboxes($name, $label, $items, $selected)
|
|||
{
|
||||
$html = form_element($label, '');
|
||||
foreach ($items as $key => $item) {
|
||||
$html .= form_checkbox($name . '_' . $key, $item, array_search($key, $selected) !== false);
|
||||
$html .= form_checkbox($name . '_' . $key, $item, in_array($key, $selected));
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
@ -140,8 +142,8 @@ function form_multi_checkboxes($names, $label, $items, $selected, $disabled = []
|
|||
$dom_id = '';
|
||||
foreach ($names as $name => $title) {
|
||||
$dom_id = $name . '_' . $key;
|
||||
$sel = array_search($key, $selected[$name]) !== false ? ' checked="checked"' : '';
|
||||
if (!empty($disabled) && !empty($disabled[$name]) && array_search($key, $disabled[$name]) !== false) {
|
||||
$sel = in_array($key, $selected[$name]) ? ' checked="checked"' : '';
|
||||
if (!empty($disabled) && !empty($disabled[$name]) && in_array($key, $disabled[$name])) {
|
||||
$sel .= ' disabled="disabled"';
|
||||
}
|
||||
$html .= '<td style="text-align: center;">'
|
||||
|
@ -216,7 +218,7 @@ function form_info($label, $text = '')
|
|||
if ($text == '') {
|
||||
return '<h4>' . $label . '</h4>';
|
||||
}
|
||||
return form_element($label, '<p class="form-control-static">' . $text . '</p>', '');
|
||||
return form_element($label, '<p class="form-control-static">' . $text . '</p>');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -173,7 +173,7 @@ function check_date($input, $error_message = null, $null_allowed = false, $time_
|
|||
* Returns REQUEST value filtered or default value (null) if not set.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $default_value
|
||||
* @param string|null $default_value
|
||||
* @return mixed|null
|
||||
*/
|
||||
function strip_request_item($name, $default_value = null)
|
||||
|
@ -215,7 +215,7 @@ function strip_request_item_nl($name, $default_value = null)
|
|||
if ($request->has($name)) {
|
||||
// Only allow letters, symbols, punctuation, separators, numbers and newlines without html tags
|
||||
return preg_replace(
|
||||
"/([^\p{L}\p{S}\p{P}\p{Z}\p{N}+\n]{1,})/ui",
|
||||
"/([^\p{L}\p{S}\p{P}\p{Z}\p{N}+\n]+)/ui",
|
||||
'',
|
||||
strip_tags($request->input($name))
|
||||
);
|
||||
|
@ -232,7 +232,7 @@ function strip_request_item_nl($name, $default_value = null)
|
|||
function strip_item($item)
|
||||
{
|
||||
// Only allow letters, symbols, punctuation, separators and numbers without html tags
|
||||
return preg_replace("/([^\p{L}\p{S}\p{P}\p{Z}\p{N}+]{1,})/ui", '', strip_tags($item));
|
||||
return preg_replace("/([^\p{L}\p{S}\p{P}\p{Z}\p{N}+]+)/ui", '', strip_tags($item));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -110,7 +110,7 @@ function progress_bar($valuemin, $valuemax, $valuenow, $class = '', $content = '
|
|||
. 'aria-valuenow="' . $valuenow . '" aria-valuemin="' . $valuemin . '" aria-valuemax="' . $valuemax . '" '
|
||||
. 'style="width: ' . floor(($valuenow - $valuemin) * 100 / ($valuemax - $valuemin)) . '%"'
|
||||
. '>'
|
||||
. $content . ''
|
||||
. $content
|
||||
. '</div>'
|
||||
. '</div>';
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ function public_dashboard_view($stats, $free_shifts)
|
|||
$shift_panels[] = '</div>';
|
||||
$needed_angels = div('first', [
|
||||
div('col-md-12', [
|
||||
heading(__('Needed angels:'), 1)
|
||||
heading(__('Needed angels:'))
|
||||
]),
|
||||
div('container-fluid', [
|
||||
join($shift_panels)
|
||||
|
|
|
@ -24,7 +24,7 @@ function Room_view(Room $room, ShiftsFilterRenderer $shiftsFilterRenderer, Shift
|
|||
if ($room->description) {
|
||||
$description = '<h3>' . __('Description') . '</h3>';
|
||||
$parsedown = new Parsedown();
|
||||
$description .= $parsedown->parse((string)$room->description);
|
||||
$description .= $parsedown->parse($room->description);
|
||||
}
|
||||
|
||||
$tabs = [];
|
||||
|
|
|
@ -34,19 +34,19 @@ class ShiftCalendarRenderer
|
|||
private $shiftsFilter;
|
||||
|
||||
/** @var int */
|
||||
private $firstBlockStartTime = 0;
|
||||
private $firstBlockStartTime;
|
||||
|
||||
/** @var int */
|
||||
private $lastBlockEndTime = 0;
|
||||
private $lastBlockEndTime;
|
||||
|
||||
/** @var int */
|
||||
private $blocksPerSlot = null;
|
||||
|
||||
/** @var array[] */
|
||||
private $needed_angeltypes = [];
|
||||
private $needed_angeltypes;
|
||||
|
||||
/** @var array[] */
|
||||
private $shift_entries = [];
|
||||
private $shift_entries;
|
||||
|
||||
/**
|
||||
* ShiftCalendarRenderer constructor.
|
||||
|
@ -100,7 +100,7 @@ class ShiftCalendarRenderer
|
|||
}
|
||||
}
|
||||
// If all lanes for this room are busy, create a new lane and add shift to it
|
||||
if ($shift_added == false) {
|
||||
if (!$shift_added) {
|
||||
$newLane = new ShiftCalendarLane($header, $this->getFirstBlockStartTime(), $this->getBlocksPerSlot());
|
||||
$newLane->addShift($shift);
|
||||
$lanes[$room_id][] = $newLane;
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace Engelsystem;
|
|||
use Engelsystem\Models\Room;
|
||||
use Engelsystem\Models\User\User;
|
||||
|
||||
use function config;
|
||||
use function theme_type;
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,7 +54,7 @@ function UserDriverLicense_edit_view($user_source, $user_driver_license)
|
|||
'
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var checkbox = $(\'#wants_to_drive\');
|
||||
let checkbox = $(\'#wants_to_drive\');
|
||||
if(checkbox.is(\':checked\'))
|
||||
$(\'#driving_license\').show();
|
||||
else
|
||||
|
|
|
@ -632,7 +632,7 @@ function User_view(
|
|||
form([
|
||||
form_hidden('action', 'arrived'),
|
||||
form_hidden('user', $user_source->id),
|
||||
form_submit('submit', __('arrived'), '', false, 'primary')
|
||||
form_submit('submit', __('arrived'), '', false)
|
||||
], page_link_to('admin_arrive'), true) : '',
|
||||
($admin_user_privilege || $auth->can('voucher.edit')) && config('enable_voucher') ?
|
||||
button(
|
||||
|
@ -677,19 +677,17 @@ function User_view(
|
|||
icon('phone')
|
||||
. ' <a href="tel:' . $user_source->contact->dect . '">'
|
||||
. $user_source->contact->dect
|
||||
. '</a>', 1
|
||||
. '</a>'
|
||||
)
|
||||
: '' ,
|
||||
: '' ,
|
||||
$auth->can('user_messages') ?
|
||||
heading(
|
||||
'<a href="' . page_link_to('/messages/' . $user_source->id) . '">'
|
||||
. icon('envelope')
|
||||
. '</a>',
|
||||
1
|
||||
. '</a>'
|
||||
)
|
||||
: '' ,
|
||||
]
|
||||
),
|
||||
]),
|
||||
User_view_state($admin_user_privilege, $freeloader, $user_source),
|
||||
User_angeltypes_render($user_angeltypes),
|
||||
User_groups_render($user_groups),
|
||||
|
|
Loading…
Reference in New Issue