Include phpcs for /includes
This commit is contained in:
parent
1af185c7ac
commit
f7d499b362
|
@ -4,6 +4,7 @@
|
|||
|
||||
<file>config</file>
|
||||
<file>db</file>
|
||||
<file>includes</file>
|
||||
<file>public/index.php</file>
|
||||
<file>src</file>
|
||||
<file>tests</file>
|
||||
|
@ -18,5 +19,8 @@
|
|||
<properties>
|
||||
<property name="ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach" value="true" />
|
||||
</properties>
|
||||
</rule>
|
||||
</rule>
|
||||
<rule ref="Generic.Files.LineLength.TooLong">
|
||||
<exclude-pattern>/includes</exclude-pattern>
|
||||
</rule>
|
||||
</ruleset>
|
||||
|
|
|
@ -6,6 +6,7 @@ use Engelsystem\Config\Config;
|
|||
/**
|
||||
* Include the autoloader
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/autoload.php';
|
||||
|
||||
/**
|
||||
|
|
|
@ -305,7 +305,8 @@ function angeltypes_list_controller()
|
|||
$angeltype['membership'] = AngelType_render_membership($angeltype);
|
||||
if (!empty($angeltype['user_angeltype_id'])) {
|
||||
$actions[] = button(
|
||||
page_link_to('user_angeltypes',
|
||||
page_link_to(
|
||||
'user_angeltypes',
|
||||
['action' => 'delete', 'user_angeltype_id' => $angeltype['user_angeltype_id']]
|
||||
),
|
||||
__('leave'),
|
||||
|
|
|
@ -186,8 +186,11 @@ function shift_edit_controller()
|
|||
|
||||
$angel_types_spinner = '';
|
||||
foreach ($angeltypes as $angeltype_id => $angeltype_name) {
|
||||
$angel_types_spinner .= form_spinner('type_' . $angeltype_id, $angeltype_name,
|
||||
$needed_angel_types[$angeltype_id]);
|
||||
$angel_types_spinner .= form_spinner(
|
||||
'type_' . $angeltype_id,
|
||||
$angeltype_name,
|
||||
$needed_angel_types[$angeltype_id]
|
||||
);
|
||||
}
|
||||
|
||||
return page_with_title(
|
||||
|
|
|
@ -28,11 +28,11 @@ function user_angeltypes_unconfirmed_hint()
|
|||
|
||||
$count = count($unconfirmed_user_angeltypes);
|
||||
return _e(
|
||||
'There is %d unconfirmed angeltype.',
|
||||
'There are %d unconfirmed angeltypes.',
|
||||
$count,
|
||||
[$count]
|
||||
)
|
||||
'There is %d unconfirmed angeltype.',
|
||||
'There are %d unconfirmed angeltypes.',
|
||||
$count,
|
||||
[$count]
|
||||
)
|
||||
. ' ' . __('Angel types which need approvals:')
|
||||
. ' ' . join(', ', $unconfirmed_links);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ function user_driver_license_edit_controller()
|
|||
$driverLicense->drive_car = $request->has('has_license_car');
|
||||
$driverLicense->drive_3_5t = $request->has('has_license_3_5t_transporter');
|
||||
$driverLicense->drive_7_5t = $request->has('has_license_7_5t_truck');
|
||||
$driverLicense->drive_12t= $request->has('has_license_12t_truck');
|
||||
$driverLicense->drive_12t = $request->has('has_license_12t_truck');
|
||||
$driverLicense->drive_forklift = $request->has('has_license_forklift');
|
||||
|
||||
if ($driverLicense->wantsToDrive()) {
|
||||
|
|
|
@ -70,10 +70,12 @@ function user_delete_controller()
|
|||
if ($request->hasPostData('submit')) {
|
||||
$valid = true;
|
||||
|
||||
if (!(
|
||||
if (
|
||||
!(
|
||||
$request->has('password')
|
||||
&& $auth->verifyPassword($user, $request->postData('password'))
|
||||
)) {
|
||||
)
|
||||
) {
|
||||
$valid = false;
|
||||
error(__('auth.password.error'));
|
||||
}
|
||||
|
@ -173,8 +175,10 @@ function user_edit_vouchers_controller()
|
|||
$user_source->state->save();
|
||||
|
||||
success(__('Saved the number of vouchers.'));
|
||||
engelsystem_log(User_Nick_render($user_source, true) . ': ' . sprintf('Got %s vouchers',
|
||||
$user_source->state->got_voucher));
|
||||
engelsystem_log(User_Nick_render($user_source, true) . ': ' . sprintf(
|
||||
'Got %s vouchers',
|
||||
$user_source->state->got_voucher
|
||||
));
|
||||
|
||||
throw_redirect(user_link($user_source->id));
|
||||
}
|
||||
|
@ -206,7 +210,8 @@ function user_controller()
|
|||
$shifts = Shifts_by_user($user_source->id, auth()->can('user_shifts_admin'));
|
||||
foreach ($shifts as &$shift) {
|
||||
// TODO: Move queries to model
|
||||
$shift['needed_angeltypes'] = Db::select('
|
||||
$shift['needed_angeltypes'] = Db::select(
|
||||
'
|
||||
SELECT DISTINCT `AngelTypes`.*
|
||||
FROM `ShiftEntry`
|
||||
JOIN `AngelTypes` ON `ShiftEntry`.`TID`=`AngelTypes`.`id`
|
||||
|
@ -216,7 +221,8 @@ function user_controller()
|
|||
[$shift['SID']]
|
||||
);
|
||||
foreach ($shift['needed_angeltypes'] as &$needed_angeltype) {
|
||||
$needed_angeltype['users'] = Db::select('
|
||||
$needed_angeltype['users'] = Db::select(
|
||||
'
|
||||
SELECT `ShiftEntry`.`freeloaded`, `users`.*
|
||||
FROM `ShiftEntry`
|
||||
JOIN `users` ON `ShiftEntry`.`UID`=`users`.`id`
|
||||
|
@ -270,7 +276,8 @@ function users_list_controller()
|
|||
}
|
||||
|
||||
$order_by = 'name';
|
||||
if ($request->has('OrderBy') && in_array($request->input('OrderBy'), [
|
||||
if (
|
||||
$request->has('OrderBy') && in_array($request->input('OrderBy'), [
|
||||
'name',
|
||||
'first_name',
|
||||
'last_name',
|
||||
|
@ -285,7 +292,8 @@ function users_list_controller()
|
|||
'planned_arrival_date',
|
||||
'planned_departure_date',
|
||||
'last_login_at',
|
||||
])) {
|
||||
])
|
||||
) {
|
||||
$order_by = $request->input('OrderBy');
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
/**
|
||||
* Include legacy code
|
||||
*/
|
||||
|
||||
$includeFiles = [
|
||||
__DIR__ . '/../includes/sys_auth.php',
|
||||
__DIR__ . '/../includes/sys_form.php',
|
||||
|
|
|
@ -30,19 +30,19 @@ function mail_shift_change($old_shift, $new_shift)
|
|||
|
||||
if ($old_shift['start'] != $new_shift['start']) {
|
||||
$message .= sprintf(
|
||||
__('* Shift Start changed from %s to %s'),
|
||||
date('Y-m-d H:i', $old_shift['start']),
|
||||
date('Y-m-d H:i', $new_shift['start'])
|
||||
) . "\n";
|
||||
__('* Shift Start changed from %s to %s'),
|
||||
date('Y-m-d H:i', $old_shift['start']),
|
||||
date('Y-m-d H:i', $new_shift['start'])
|
||||
) . "\n";
|
||||
$noticeable_changes = true;
|
||||
}
|
||||
|
||||
if ($old_shift['end'] != $new_shift['end']) {
|
||||
$message .= sprintf(
|
||||
__('* Shift End changed from %s to %s'),
|
||||
date('Y-m-d H:i', $old_shift['end']),
|
||||
date('Y-m-d H:i', $new_shift['end'])
|
||||
) . "\n";
|
||||
__('* Shift End changed from %s to %s'),
|
||||
date('Y-m-d H:i', $old_shift['end']),
|
||||
date('Y-m-d H:i', $new_shift['end'])
|
||||
) . "\n";
|
||||
$noticeable_changes = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,8 @@ function AngelType_delete($angeltype)
|
|||
*/
|
||||
function AngelType_update($angeltype)
|
||||
{
|
||||
Db::update('
|
||||
Db::update(
|
||||
'
|
||||
UPDATE `AngelTypes` SET
|
||||
`name` = ?,
|
||||
`restricted` = ?,
|
||||
|
@ -104,7 +105,8 @@ function AngelType_update($angeltype)
|
|||
*/
|
||||
function AngelType_create($angeltype)
|
||||
{
|
||||
Db::insert('
|
||||
Db::insert(
|
||||
'
|
||||
INSERT INTO `AngelTypes` (
|
||||
`name`,
|
||||
`restricted`,
|
||||
|
|
|
@ -18,7 +18,8 @@ use Engelsystem\Database\Db;
|
|||
*/
|
||||
function NeededAngelType_add($shift_id, $angeltype_id, $room_id, $count)
|
||||
{
|
||||
Db::insert('
|
||||
Db::insert(
|
||||
'
|
||||
INSERT INTO `NeededAngelTypes` ( `shift_id`, `angel_type_id`, `room_id`, `count`)
|
||||
VALUES (?, ?, ?, ?)
|
||||
',
|
||||
|
@ -27,7 +28,8 @@ function NeededAngelType_add($shift_id, $angeltype_id, $room_id, $count)
|
|||
$angeltype_id,
|
||||
$room_id,
|
||||
$count,
|
||||
]);
|
||||
]
|
||||
);
|
||||
|
||||
return Db::getPdo()->lastInsertId();
|
||||
}
|
||||
|
@ -77,7 +79,8 @@ function NeededAngelTypes_by_room($room_id)
|
|||
*/
|
||||
function NeededAngelTypes_by_shift($shiftId)
|
||||
{
|
||||
$needed_angeltypes_source = Db::select('
|
||||
$needed_angeltypes_source = Db::select(
|
||||
'
|
||||
SELECT
|
||||
`NeededAngelTypes`.*,
|
||||
`AngelTypes`.`id`,
|
||||
|
|
|
@ -29,7 +29,8 @@ function ShiftEntries_freeloaded_count()
|
|||
*/
|
||||
function ShiftEntries_by_shift($shift_id)
|
||||
{
|
||||
return Db::select('
|
||||
return Db::select(
|
||||
'
|
||||
SELECT
|
||||
`users`.*,
|
||||
`ShiftEntry`.`UID`,
|
||||
|
@ -60,7 +61,8 @@ function ShiftEntry_create($shift_entry)
|
|||
$shifttype = ShiftType($shift['shifttype_id']);
|
||||
$room = Room::find($shift['RID']);
|
||||
$angeltype = AngelType($shift_entry['TID']);
|
||||
$result = Db::insert('
|
||||
$result = Db::insert(
|
||||
'
|
||||
INSERT INTO `ShiftEntry` (
|
||||
`SID`,
|
||||
`TID`,
|
||||
|
@ -101,7 +103,8 @@ function ShiftEntry_create($shift_entry)
|
|||
*/
|
||||
function ShiftEntry_update($shift_entry)
|
||||
{
|
||||
Db::update('
|
||||
Db::update(
|
||||
'
|
||||
UPDATE `ShiftEntry`
|
||||
SET
|
||||
`Comment` = ?,
|
||||
|
@ -167,7 +170,8 @@ function ShiftEntry_delete($shiftEntry)
|
|||
*/
|
||||
function ShiftEntries_upcoming_for_user($userId)
|
||||
{
|
||||
return Db::select('
|
||||
return Db::select(
|
||||
'
|
||||
SELECT *
|
||||
FROM `ShiftEntry`
|
||||
JOIN `Shifts` ON (`Shifts`.`SID` = `ShiftEntry`.`SID`)
|
||||
|
@ -192,7 +196,8 @@ function ShiftEntries_upcoming_for_user($userId)
|
|||
*/
|
||||
function ShiftEntries_finished_by_user($userId, Carbon $sinceTime = null)
|
||||
{
|
||||
return Db::select('
|
||||
return Db::select(
|
||||
'
|
||||
SELECT *
|
||||
FROM `ShiftEntry`
|
||||
JOIN `Shifts` ON (`Shifts`.`SID` = `ShiftEntry`.`SID`)
|
||||
|
@ -219,7 +224,8 @@ function ShiftEntries_finished_by_user($userId, Carbon $sinceTime = null)
|
|||
*/
|
||||
function ShiftEntries_by_shift_and_angeltype($shift_id, $angeltype_id)
|
||||
{
|
||||
return Db::select('
|
||||
return Db::select(
|
||||
'
|
||||
SELECT *
|
||||
FROM `ShiftEntry`
|
||||
WHERE `SID` = ?
|
||||
|
@ -240,7 +246,8 @@ function ShiftEntries_by_shift_and_angeltype($shift_id, $angeltype_id)
|
|||
*/
|
||||
function ShiftEntries_freeloaded_by_user($userId)
|
||||
{
|
||||
return Db::select('
|
||||
return Db::select(
|
||||
'
|
||||
SELECT *
|
||||
FROM `ShiftEntry`
|
||||
WHERE `freeloaded` = 1
|
||||
|
|
|
@ -22,7 +22,8 @@ function ShiftType_delete($shifttype_id)
|
|||
*/
|
||||
function ShiftType_update($shifttype_id, $name, $angeltype_id, $description)
|
||||
{
|
||||
Db::update('
|
||||
Db::update(
|
||||
'
|
||||
UPDATE `ShiftTypes` SET
|
||||
`name`=?,
|
||||
`angeltype_id`=?,
|
||||
|
@ -48,7 +49,8 @@ function ShiftType_update($shifttype_id, $name, $angeltype_id, $description)
|
|||
*/
|
||||
function ShiftType_create($name, $angeltype_id, $description)
|
||||
{
|
||||
Db::insert('
|
||||
Db::insert(
|
||||
'
|
||||
INSERT INTO `ShiftTypes` (`name`, `angeltype_id`, `description`)
|
||||
VALUES(?, ?, ?)
|
||||
',
|
||||
|
|
|
@ -197,7 +197,8 @@ function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|||
*/
|
||||
function NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype)
|
||||
{
|
||||
return Db::selectOne('
|
||||
return Db::selectOne(
|
||||
'
|
||||
SELECT
|
||||
`NeededAngelTypes`.*,
|
||||
`Shifts`.`SID`,
|
||||
|
@ -245,7 +246,8 @@ function NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype)
|
|||
*/
|
||||
function ShiftEntries_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
||||
{
|
||||
$sql = sprintf('
|
||||
$sql = sprintf(
|
||||
'
|
||||
SELECT
|
||||
users.*,
|
||||
`ShiftEntry`.`UID`,
|
||||
|
@ -527,7 +529,8 @@ function Shift_update($shift)
|
|||
$shift['name'] = ShiftType($shift['shifttype_id'])['name'];
|
||||
mail_shift_change(Shift($shift['SID']), $shift);
|
||||
|
||||
return Db::update('
|
||||
return Db::update(
|
||||
'
|
||||
UPDATE `Shifts` SET
|
||||
`shifttype_id` = ?,
|
||||
`start` = ?,
|
||||
|
@ -564,7 +567,8 @@ function Shift_update($shift)
|
|||
*/
|
||||
function Shift_create($shift, $transactionId = null)
|
||||
{
|
||||
Db::insert('
|
||||
Db::insert(
|
||||
'
|
||||
INSERT INTO `Shifts` (
|
||||
`shifttype_id`,
|
||||
`start`,
|
||||
|
@ -607,7 +611,8 @@ function Shift_create($shift, $transactionId = null)
|
|||
*/
|
||||
function Shifts_by_user($userId, $include_freeload_comments = false)
|
||||
{
|
||||
return Db::select('
|
||||
return Db::select(
|
||||
'
|
||||
SELECT
|
||||
`rooms`.*,
|
||||
`rooms`.name AS Name,
|
||||
|
|
|
@ -23,7 +23,7 @@ function stats_currently_working(ShiftsFilter $filter = null)
|
|||
)) AS `count`
|
||||
FROM `Shifts`
|
||||
WHERE (`end` >= UNIX_TIMESTAMP() AND `start` <= UNIX_TIMESTAMP())
|
||||
'. ($filter ? 'AND Shifts.RID IN (' . implode(',', $filter->getRooms()) . ')' : '')
|
||||
' . ($filter ? 'AND Shifts.RID IN (' . implode(',', $filter->getRooms()) . ')' : '')
|
||||
);
|
||||
|
||||
return $result['count'] ?: '-';
|
||||
|
@ -48,7 +48,7 @@ function stats_hours_to_work(ShiftsFilter $filter = null)
|
|||
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
||||
WHERE `end` >= UNIX_TIMESTAMP()
|
||||
AND s.shift_id IS NULL
|
||||
'. ($filter ? 'AND Shifts.RID IN (' . implode(',', $filter->getRooms()) . ')' : '') . '
|
||||
' . ($filter ? 'AND Shifts.RID IN (' . implode(',', $filter->getRooms()) . ')' : '') . '
|
||||
|
||||
UNION ALL
|
||||
|
||||
|
@ -59,7 +59,7 @@ function stats_hours_to_work(ShiftsFilter $filter = null)
|
|||
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
||||
WHERE `end` >= UNIX_TIMESTAMP()
|
||||
AND NOT s.shift_id IS NULL
|
||||
'. ($filter ? 'AND Shifts.RID IN (' . implode(',', $filter->getRooms()) . ')' : '') . '
|
||||
' . ($filter ? 'AND Shifts.RID IN (' . implode(',', $filter->getRooms()) . ')' : '') . '
|
||||
) AS `tmp`
|
||||
'
|
||||
);
|
||||
|
@ -102,7 +102,7 @@ function stats_angels_needed_three_hours(ShiftsFilter $filter = null)
|
|||
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
||||
WHERE `end` > UNIX_TIMESTAMP() AND `start` < ?
|
||||
AND s.shift_id IS NULL
|
||||
'. ($filter ? 'AND Shifts.RID IN (' . implode(',', $filter->getRooms()) . ')' : '') . '
|
||||
' . ($filter ? 'AND Shifts.RID IN (' . implode(',', $filter->getRooms()) . ')' : '') . '
|
||||
|
||||
UNION ALL
|
||||
|
||||
|
@ -129,7 +129,7 @@ function stats_angels_needed_three_hours(ShiftsFilter $filter = null)
|
|||
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
||||
WHERE `end` > UNIX_TIMESTAMP() AND `start` < ?
|
||||
AND NOT s.shift_id IS NULL
|
||||
'. ($filter ? 'AND Shifts.RID IN (' . implode(',', $filter->getRooms()) . ')' : '') . '
|
||||
' . ($filter ? 'AND Shifts.RID IN (' . implode(',', $filter->getRooms()) . ')' : '') . '
|
||||
) AS `tmp`', [
|
||||
$in3hours,
|
||||
$in3hours
|
||||
|
@ -181,7 +181,7 @@ function stats_angels_needed_for_nightshifts(ShiftsFilter $filter = null)
|
|||
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
||||
WHERE `end` > ? AND `start` < ?
|
||||
AND s.shift_id IS NULL
|
||||
'. ($filter ? 'AND Shifts.RID IN (' . implode(',', $filter->getRooms()) . ')' : '') . '
|
||||
' . ($filter ? 'AND Shifts.RID IN (' . implode(',', $filter->getRooms()) . ')' : '') . '
|
||||
|
||||
UNION ALL
|
||||
|
||||
|
@ -208,7 +208,7 @@ function stats_angels_needed_for_nightshifts(ShiftsFilter $filter = null)
|
|||
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
|
||||
WHERE `end` > ? AND `start` < ?
|
||||
AND NOT s.shift_id IS NULL
|
||||
'. ($filter ? 'AND Shifts.RID IN (' . implode(',', $filter->getRooms()) . ')' : '') . '
|
||||
' . ($filter ? 'AND Shifts.RID IN (' . implode(',', $filter->getRooms()) . ')' : '') . '
|
||||
) AS `tmp`', [
|
||||
$night_start,
|
||||
$night_end,
|
||||
|
|
|
@ -80,7 +80,8 @@ function User_is_AngelType_supporter($user, $angeltype)
|
|||
|
||||
$privileges = privileges_for_user($user->id);
|
||||
|
||||
return (count(Db::select('
|
||||
return (count(Db::select(
|
||||
'
|
||||
SELECT `id`
|
||||
FROM `UserAngelTypes`
|
||||
WHERE `user_id`=?
|
||||
|
@ -88,11 +89,11 @@ function User_is_AngelType_supporter($user, $angeltype)
|
|||
AND `supporter`=TRUE
|
||||
LIMIT 1
|
||||
',
|
||||
[
|
||||
[
|
||||
$user->id,
|
||||
$angeltype['id']
|
||||
]
|
||||
)) > 0)
|
||||
)) > 0)
|
||||
|| in_array('admin_user_angeltypes', $privileges);
|
||||
}
|
||||
|
||||
|
@ -194,7 +195,8 @@ function UserAngelType_delete($user_angeltype)
|
|||
*/
|
||||
function UserAngelType_create($userId, $angeltype)
|
||||
{
|
||||
Db::insert('
|
||||
Db::insert(
|
||||
'
|
||||
INSERT INTO `UserAngelTypes` (`user_id`, `angeltype_id`, `supporter`)
|
||||
VALUES (?, ?, FALSE)
|
||||
',
|
||||
|
@ -233,7 +235,8 @@ function UserAngelType($user_angeltype_id)
|
|||
*/
|
||||
function UserAngelType_by_User_and_AngelType($userId, $angeltype)
|
||||
{
|
||||
$angelType = Db::selectOne('
|
||||
$angelType = Db::selectOne(
|
||||
'
|
||||
SELECT *
|
||||
FROM `UserAngelTypes`
|
||||
WHERE `user_id`=?
|
||||
|
@ -256,7 +259,7 @@ function UserAngelType_by_User_and_AngelType($userId, $angeltype)
|
|||
* @param bool $onlyConfirmed
|
||||
* @return array[]|null
|
||||
*/
|
||||
function UserAngelTypes_by_User($userId, $onlyConfirmed=false)
|
||||
function UserAngelTypes_by_User($userId, $onlyConfirmed = false)
|
||||
{
|
||||
return Db::select(
|
||||
'
|
||||
|
|
|
@ -10,7 +10,8 @@ use Engelsystem\Database\Db;
|
|||
*/
|
||||
function User_groups($userId)
|
||||
{
|
||||
return Db::select('
|
||||
return Db::select(
|
||||
'
|
||||
SELECT `Groups`.*
|
||||
FROM `UserGroups`
|
||||
JOIN `Groups` ON `Groups`.`UID`=`UserGroups`.`group_id`
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?php
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Engelsystem\Helpers\Shifts;
|
||||
use Engelsystem\Models\Room;
|
||||
use Engelsystem\Models\Worklog;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
|
|
|
@ -87,7 +87,8 @@ function Users_by_angeltype_inverted($angeltype)
|
|||
function Users_by_angeltype($angeltype)
|
||||
{
|
||||
return User::query()
|
||||
->select('users.*',
|
||||
->select(
|
||||
'users.*',
|
||||
'UserAngelTypes.id AS user_angeltype_id',
|
||||
'UserAngelTypes.confirm_user_id',
|
||||
'UserAngelTypes.supporter',
|
||||
|
@ -151,13 +152,13 @@ function User_validate_planned_arrival_date($planned_arrival_date)
|
|||
$teardown = $config->get('teardown_end');
|
||||
|
||||
/** @var Carbon $buildup */
|
||||
if (!empty($buildup) && Carbon::createFromTimestamp($planned_arrival_date)->lessThan($buildup->setTime(0,0))) {
|
||||
if (!empty($buildup) && Carbon::createFromTimestamp($planned_arrival_date)->lessThan($buildup->setTime(0, 0))) {
|
||||
// Planned arrival can not be before buildup start date
|
||||
return new ValidationResult(false, $buildup->getTimestamp());
|
||||
}
|
||||
|
||||
/** @var Carbon $teardown */
|
||||
if (!empty($teardown) && Carbon::createFromTimestamp($planned_arrival_date)->greaterThanOrEqualTo($teardown->addDay()->setTime(0,0))) {
|
||||
if (!empty($teardown) && Carbon::createFromTimestamp($planned_arrival_date)->greaterThanOrEqualTo($teardown->addDay()->setTime(0, 0))) {
|
||||
// Planned arrival can not be after teardown end date
|
||||
return new ValidationResult(false, $teardown->getTimestamp());
|
||||
}
|
||||
|
@ -189,13 +190,13 @@ function User_validate_planned_departure_date($planned_arrival_date, $planned_de
|
|||
$teardown = $config->get('teardown_end');
|
||||
|
||||
/** @var Carbon $buildup */
|
||||
if (!empty($buildup) && Carbon::createFromTimestamp($planned_departure_date)->lessThan($buildup->setTime(0,0))) {
|
||||
if (!empty($buildup) && Carbon::createFromTimestamp($planned_departure_date)->lessThan($buildup->setTime(0, 0))) {
|
||||
// Planned departure can not be before buildup start date
|
||||
return new ValidationResult(false, $buildup->getTimestamp());
|
||||
}
|
||||
|
||||
/** @var Carbon $teardown */
|
||||
if (!empty($teardown) && Carbon::createFromTimestamp($planned_departure_date)->greaterThanOrEqualTo($teardown->addDay()->setTime(0,0))) {
|
||||
if (!empty($teardown) && Carbon::createFromTimestamp($planned_departure_date)->greaterThanOrEqualTo($teardown->addDay()->setTime(0, 0))) {
|
||||
// Planned departure can not be after teardown end date
|
||||
return new ValidationResult(false, $teardown->getTimestamp());
|
||||
}
|
||||
|
@ -237,18 +238,18 @@ function User_get_eligable_voucher_count($user)
|
|||
+ $worklog->count();
|
||||
|
||||
$shiftsTime = 0;
|
||||
foreach ($shifts as $shift){
|
||||
foreach ($shifts as $shift) {
|
||||
$shiftsTime += ($shift['end'] - $shift['start']) / 60 / 60;
|
||||
}
|
||||
foreach ($worklog as $entry){
|
||||
foreach ($worklog as $entry) {
|
||||
$shiftsTime += $entry->hours;
|
||||
}
|
||||
|
||||
$vouchers = $voucher_settings['initial_vouchers'];
|
||||
if($voucher_settings['shifts_per_voucher']){
|
||||
if ($voucher_settings['shifts_per_voucher']) {
|
||||
$vouchers += $shifts_done / $voucher_settings['shifts_per_voucher'];
|
||||
}
|
||||
if($voucher_settings['hours_per_voucher']){
|
||||
if ($voucher_settings['hours_per_voucher']) {
|
||||
$vouchers += $shiftsTime / $voucher_settings['hours_per_voucher'];
|
||||
}
|
||||
|
||||
|
@ -273,7 +274,8 @@ function User_get_shifts_sum_query()
|
|||
return 'COALESCE(SUM(`end` - `start`), 0)';
|
||||
}
|
||||
|
||||
return sprintf('
|
||||
return sprintf(
|
||||
'
|
||||
COALESCE(SUM(
|
||||
(1 + (
|
||||
(HOUR(FROM_UNIXTIME(`Shifts`.`end`)) > %1$d AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) < %2$d)
|
||||
|
|
|
@ -230,7 +230,9 @@ function admin_active()
|
|||
}
|
||||
$actions[] = form(
|
||||
[form_submit('submit', __('set active'), 'btn-sm', false, 'secondary')],
|
||||
page_link_to('admin_active', $parameters), false, true
|
||||
page_link_to('admin_active', $parameters),
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
if ($usr->state->active) {
|
||||
|
@ -243,7 +245,9 @@ function admin_active()
|
|||
}
|
||||
$actions[] = form(
|
||||
[form_submit('submit', __('remove active'), 'btn-sm', false, 'secondary')],
|
||||
page_link_to('admin_active', $parametersRemove), false, true
|
||||
page_link_to('admin_active', $parametersRemove),
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
if (!$usr->state->got_shirt) {
|
||||
|
@ -256,7 +260,9 @@ function admin_active()
|
|||
}
|
||||
$actions[] = form(
|
||||
[form_submit('submit', __('got t-shirt'), 'btn-sm', false, 'secondary')],
|
||||
page_link_to('admin_active', $parametersShirt), false, true
|
||||
page_link_to('admin_active', $parametersShirt),
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
if ($usr->state->got_shirt) {
|
||||
|
@ -269,7 +275,9 @@ function admin_active()
|
|||
}
|
||||
$actions[] = form(
|
||||
[form_submit('submit', __('remove t-shirt'), 'btn-sm', false, 'secondary')],
|
||||
page_link_to('admin_active', $parameters), false, true
|
||||
page_link_to('admin_active', $parameters),
|
||||
false,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,10 @@ function admin_groups()
|
|||
'name' => $group['Name'],
|
||||
'privileges' => join(', ', $privileges_html),
|
||||
'actions' => button(
|
||||
page_link_to('admin_groups',
|
||||
['action' => 'edit', 'id' => $group['UID']]),
|
||||
page_link_to(
|
||||
'admin_groups',
|
||||
['action' => 'edit', 'id' => $group['UID']]
|
||||
),
|
||||
__('edit'),
|
||||
'btn-sm'
|
||||
)
|
||||
|
|
|
@ -240,11 +240,11 @@ function admin_shifts()
|
|||
$day = Carbon::createTimestampFromDatetime(date('Y-m-d', $start) . ' 00:00');
|
||||
do {
|
||||
// Alle Schichtwechselstunden durchgehen
|
||||
for($i = 0; $i < count($change_hours); $i++) {
|
||||
for ($i = 0; $i < count($change_hours); $i++) {
|
||||
$start_hour = $change_hours[$i];
|
||||
if ($i < count($change_hours) - 1) {
|
||||
// Normales Intervall zwischen zwei Schichtwechselstunden
|
||||
$end_hour = $change_hours[$i+1];
|
||||
$end_hour = $change_hours[$i + 1];
|
||||
} elseif ($shift_over_midnight) {
|
||||
// Letzte Schichtwechselstunde: Wenn eine 24h Abdeckung gewünscht ist, hier die erste Schichtwechselstunde als Ende ensetzen
|
||||
$end_hour = $change_hours[0];
|
||||
|
@ -294,7 +294,7 @@ function admin_shifts()
|
|||
}
|
||||
|
||||
$day = Carbon::createTimestampFromDatetime(date('Y-m-d', $day + 36 * 60 * 60) . ' 00:00');
|
||||
} while($day <= $end_day);
|
||||
} while ($day <= $end_day);
|
||||
|
||||
usort($shifts, function ($a, $b) {
|
||||
return $a['start'] < $b['start'] ? -1 : 1;
|
||||
|
@ -388,7 +388,8 @@ function admin_shifts()
|
|||
LIMIT 1', [$type_id]);
|
||||
|
||||
if (!empty($angel_type_source)) {
|
||||
Db::insert('
|
||||
Db::insert(
|
||||
'
|
||||
INSERT INTO `NeededAngelTypes` (`shift_id`, `angel_type_id`, `count`)
|
||||
VALUES (?, ?, ?)
|
||||
',
|
||||
|
@ -421,10 +422,10 @@ function admin_shifts()
|
|||
$angel_types = '';
|
||||
foreach ($types as $type) {
|
||||
$angel_types .= '<div class="col-md-4">' . form_spinner(
|
||||
'type_' . $type['id'],
|
||||
$type['name'],
|
||||
$needed_angel_types[$type['id']]
|
||||
)
|
||||
'type_' . $type['id'],
|
||||
$type['name'],
|
||||
$needed_angel_types[$type['id']]
|
||||
)
|
||||
. '</div>';
|
||||
}
|
||||
|
||||
|
@ -433,10 +434,11 @@ function admin_shifts()
|
|||
'<a href="%s">%s</a>',
|
||||
page_link_to('admin_shifts_history'),
|
||||
icon('clock-history')
|
||||
), [
|
||||
),
|
||||
[
|
||||
msg(),
|
||||
form([
|
||||
div('row',[
|
||||
div('row', [
|
||||
div('col-md-6', [
|
||||
form_select('shifttype_id', __('Shifttype'), $shifttypes, $shifttype_id),
|
||||
form_text('title', __('Title'), $title),
|
||||
|
@ -501,7 +503,8 @@ function admin_shifts()
|
|||
]),
|
||||
form_submit('preview', icon('search') . __('Preview'))
|
||||
])
|
||||
]);
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -67,7 +67,8 @@ function admin_user()
|
|||
. html_select_key(
|
||||
'size',
|
||||
'eSize',
|
||||
$tshirt_sizes, $user_source->personalData->shirt_size,
|
||||
$tshirt_sizes,
|
||||
$user_source->personalData->shirt_size,
|
||||
__('Please select...')
|
||||
)
|
||||
. '</td></tr>' . "\n";
|
||||
|
@ -151,7 +152,8 @@ function admin_user()
|
|||
$html .= form_csrf();
|
||||
$html .= '<table>';
|
||||
|
||||
$groups = Db::select('
|
||||
$groups = Db::select(
|
||||
'
|
||||
SELECT *
|
||||
FROM `Groups`
|
||||
LEFT OUTER JOIN `UserGroups` ON (
|
||||
|
@ -205,7 +207,8 @@ function admin_user()
|
|||
|| ($my_highest_group['group_id'] <= $his_highest_group['group_id'])
|
||||
)
|
||||
) {
|
||||
$groups_source = Db::select('
|
||||
$groups_source = Db::select(
|
||||
'
|
||||
SELECT *
|
||||
FROM `Groups`
|
||||
LEFT OUTER JOIN `UserGroups` ON (
|
||||
|
|
|
@ -107,8 +107,10 @@ function guest_register()
|
|||
|
||||
if (!$nickValidation->isValid()) {
|
||||
$valid = false;
|
||||
$msg .= error(sprintf(__('Please enter a valid nick.') . ' ' . __('Use up to 24 letters, numbers, connecting punctuations or spaces for your nickname.'),
|
||||
$nick), true);
|
||||
$msg .= error(sprintf(
|
||||
__('Please enter a valid nick.') . ' ' . __('Use up to 24 letters, numbers, connecting punctuations or spaces for your nickname.'),
|
||||
$nick
|
||||
), true);
|
||||
}
|
||||
if (User::whereName($nick)->count() > 0) {
|
||||
$valid = false;
|
||||
|
@ -164,7 +166,7 @@ function guest_register()
|
|||
$valid = false;
|
||||
$msg .= error(__('Your passwords don\'t match.'), true);
|
||||
}
|
||||
} else if ($enable_password) {
|
||||
} elseif ($enable_password) {
|
||||
$valid = false;
|
||||
$msg .= error(sprintf(
|
||||
__('Your password is too short (please use at least %s characters).'),
|
||||
|
@ -378,8 +380,10 @@ function guest_register()
|
|||
24,
|
||||
'nickname'
|
||||
),
|
||||
form_info('',
|
||||
__('Use up to 24 letters, numbers, connecting punctuations or spaces for your nickname.'))
|
||||
form_info(
|
||||
'',
|
||||
__('Use up to 24 letters, numbers, connecting punctuations or spaces for your nickname.')
|
||||
)
|
||||
]),
|
||||
|
||||
$enable_pronoun ? div('col', [
|
||||
|
@ -451,7 +455,9 @@ function guest_register()
|
|||
form_date(
|
||||
'planned_arrival_date',
|
||||
__('Planned date of arrival') . ' ' . entry_required(),
|
||||
$planned_arrival_date, $buildup_start_date, $teardown_end_date
|
||||
$planned_arrival_date,
|
||||
$buildup_start_date,
|
||||
$teardown_end_date
|
||||
)
|
||||
]) : '',
|
||||
]),
|
||||
|
@ -462,9 +468,13 @@ function guest_register()
|
|||
]) : '',
|
||||
|
||||
div('col', [
|
||||
$enable_tshirt_size ? form_select('tshirt_size',
|
||||
$enable_tshirt_size ? form_select(
|
||||
'tshirt_size',
|
||||
__('Shirt size') . ' ' . entry_required(),
|
||||
$tshirt_sizes, $tshirt_size, __('Please select...')) : ''
|
||||
$tshirt_sizes,
|
||||
$tshirt_size,
|
||||
__('Please select...')
|
||||
) : ''
|
||||
]),
|
||||
]),
|
||||
|
||||
|
|
|
@ -74,10 +74,10 @@ function make_atom_entry_from_news(News $news)
|
|||
<title>' . htmlspecialchars($news->title) . '</title>
|
||||
<link href="' . page_link_to('news/' . $news->id) . '"/>
|
||||
<id>' . preg_replace(
|
||||
'#^https?://#',
|
||||
'',
|
||||
page_link_to('news/' . $news->id)
|
||||
) . '</id>
|
||||
'#^https?://#',
|
||||
'',
|
||||
page_link_to('news/' . $news->id)
|
||||
) . '</id>
|
||||
<updated>' . $news->updated_at->format('Y-m-d\TH:i:sP') . '</updated>
|
||||
<summary type="html">' . htmlspecialchars($news->text) . '</summary>
|
||||
</entry>' . "\n";
|
||||
|
|
|
@ -48,7 +48,8 @@ function user_myshifts()
|
|||
]);
|
||||
} elseif ($request->has('edit') && preg_match('/^\d+$/', $request->input('edit'))) {
|
||||
$shift_entry_id = $request->input('edit');
|
||||
$shift = Db::selectOne('
|
||||
$shift = Db::selectOne(
|
||||
'
|
||||
SELECT
|
||||
`ShiftEntry`.`freeloaded`,
|
||||
`ShiftEntry`.`freeload_comment`,
|
||||
|
|
|
@ -156,7 +156,8 @@ function load_types()
|
|||
error(__('The administration has not configured any angeltypes yet - or you are not subscribed to any angeltype.'));
|
||||
throw_redirect(page_link_to('/'));
|
||||
}
|
||||
$types = Db::select('
|
||||
$types = Db::select(
|
||||
'
|
||||
SELECT
|
||||
`AngelTypes`.`id`,
|
||||
`AngelTypes`.`name`,
|
||||
|
@ -318,7 +319,7 @@ function view_user_shifts()
|
|||
function ical_hint()
|
||||
{
|
||||
$user = auth()->user();
|
||||
if(!auth()->can('ical')) {
|
||||
if (!auth()->can('ical')) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
|
@ -261,7 +261,7 @@ function strip_item($item)
|
|||
function check_email($email)
|
||||
{
|
||||
// Convert the domain part from idn to ascii
|
||||
if(substr_count($email, '@') == 1) {
|
||||
if (substr_count($email, '@') == 1) {
|
||||
list($name, $domain) = explode('@', $email);
|
||||
$domain = idn_to_ascii($domain, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46);
|
||||
$email = $name . '@' . $domain;
|
||||
|
|
|
@ -52,7 +52,7 @@ function tabs($tabs, $selected = 0)
|
|||
$id = null;
|
||||
}
|
||||
$tab_header[] = '<li role="presentation" class="nav-item">
|
||||
<a href="'. $href . '" class="nav-link' . ($active ? ' active' : '') . '" role="tab"'
|
||||
<a href="' . $href . '" class="nav-link' . ($active ? ' active' : '') . '" role="tab"'
|
||||
. ($id ? ' id="' . $id . '-tab"' : '')
|
||||
. ($id ? ' aria-controls="' . $id . '" data-bs-target="#' . $id . '" data-bs-toggle="tab" role="tab"' : '')
|
||||
. ($id && $active ? ' aria-selected="true"' : ' aria-selected="false"')
|
||||
|
@ -221,7 +221,7 @@ function toolbar_dropdown_item_divider(): string
|
|||
*/
|
||||
function toolbar_dropdown($icon, $label, $submenu, $class = ''): string
|
||||
{
|
||||
$template =<<<EOT
|
||||
$template = <<<EOT
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle {class}" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
{icon} {label}
|
||||
|
|
|
@ -97,14 +97,17 @@ function AngelType_edit_view($angeltype, $supporter_mode)
|
|||
? form_info(__('No Self Sign Up allowed'), $angeltype['no_self_signup'] ? __('Yes') : __('No'))
|
||||
: form_checkbox('no_self_signup', __('No Self Sign Up allowed'), $angeltype['no_self_signup']),
|
||||
$supporter_mode
|
||||
? form_info(__('Requires driver license'),
|
||||
$angeltype['requires_driver_license']
|
||||
? form_info(
|
||||
__('Requires driver license'),
|
||||
$angeltype['requires_driver_license']
|
||||
? __('Yes')
|
||||
: __('No'))
|
||||
: __('No')
|
||||
)
|
||||
: form_checkbox(
|
||||
'requires_driver_license',
|
||||
__('Requires driver license'),
|
||||
$angeltype['requires_driver_license']),
|
||||
'requires_driver_license',
|
||||
__('Requires driver license'),
|
||||
$angeltype['requires_driver_license']
|
||||
),
|
||||
$supporter_mode
|
||||
? form_info(__('Show on dashboard'), $angeltype['show_on_dashboard'] ? __('Yes') : __('No'))
|
||||
: form_checkbox('show_on_dashboard', __('Show on dashboard'), $angeltype['show_on_dashboard']),
|
||||
|
@ -256,12 +259,15 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a
|
|||
if ($admin_user_angeltypes) {
|
||||
$member['actions'] = table_buttons([
|
||||
$admin_angeltypes
|
||||
? button(page_link_to('user_angeltypes', [
|
||||
'action' => 'update',
|
||||
'user_angeltype_id' => $member['user_angeltype_id'],
|
||||
'supporter' => 1
|
||||
]),
|
||||
__('Add supporter rights'), 'btn-sm')
|
||||
? button(
|
||||
page_link_to('user_angeltypes', [
|
||||
'action' => 'update',
|
||||
'user_angeltype_id' => $member['user_angeltype_id'],
|
||||
'supporter' => 1
|
||||
]),
|
||||
__('Add supporter rights'),
|
||||
'btn-sm'
|
||||
)
|
||||
: '',
|
||||
button(
|
||||
page_link_to('user_angeltypes', [
|
||||
|
|
|
@ -226,14 +226,14 @@ class ShiftCalendarRenderer
|
|||
return div('tick day');
|
||||
}
|
||||
return div('tick day', [
|
||||
date(__('m-d'), $time) .'<br>'.date(__('H:i'), $time)
|
||||
date(__('m-d'), $time) . '<br>' . date(__('H:i'), $time)
|
||||
]);
|
||||
} elseif ($time % (60 * 60) == 0) {
|
||||
if (!$label) {
|
||||
return div('tick hour');
|
||||
}
|
||||
return div('tick hour', [
|
||||
date(__('m-d'), $time) .'<br>'.date(__('H:i'), $time)
|
||||
date(__('m-d'), $time) . '<br>' . date(__('H:i'), $time)
|
||||
]);
|
||||
}
|
||||
return div('tick');
|
||||
|
@ -276,9 +276,9 @@ class ShiftCalendarRenderer
|
|||
}
|
||||
}
|
||||
return ShiftCalendarRenderer::SECONDS_PER_ROW * floor(
|
||||
($start_time - ShiftCalendarRenderer::TIME_MARGIN)
|
||||
($start_time - ShiftCalendarRenderer::TIME_MARGIN)
|
||||
/ ShiftCalendarRenderer::SECONDS_PER_ROW
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -295,9 +295,9 @@ class ShiftCalendarRenderer
|
|||
}
|
||||
|
||||
return ShiftCalendarRenderer::SECONDS_PER_ROW * ceil(
|
||||
($end_time + ShiftCalendarRenderer::TIME_MARGIN)
|
||||
($end_time + ShiftCalendarRenderer::TIME_MARGIN)
|
||||
/ ShiftCalendarRenderer::SECONDS_PER_ROW
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -136,7 +136,8 @@ class ShiftCalendarShiftRenderer
|
|||
|
||||
if (auth()->can('user_shifts_admin')) {
|
||||
$html .= '<li class="list-group-item d-flex align-items-center ' . $this->classBg() . '">';
|
||||
$html .= button(shift_entry_create_link_admin($shift),
|
||||
$html .= button(
|
||||
shift_entry_create_link_admin($shift),
|
||||
icon('plus-lg') . __('Add more angels'),
|
||||
'btn-sm'
|
||||
);
|
||||
|
@ -195,7 +196,8 @@ class ShiftCalendarShiftRenderer
|
|||
. '</a> '
|
||||
. button(
|
||||
shift_entry_create_link($shift, $angeltype),
|
||||
__('Sign up'), 'btn-sm btn-primary text-nowrap d-print-none'
|
||||
__('Sign up'),
|
||||
'btn-sm btn-primary text-nowrap d-print-none'
|
||||
);
|
||||
break;
|
||||
|
||||
|
|
|
@ -93,7 +93,8 @@ function ShiftEntry_create_view_admin($shift, Room $room, $angeltype, $angeltype
|
|||
form_select('user_id', __('User'), $users_select, $signup_user->id),
|
||||
form_submit('submit', icon('check-lg') . __('Save'))
|
||||
])
|
||||
]);
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,17 +109,21 @@ function ShiftEntry_create_view_admin($shift, Room $room, $angeltype, $angeltype
|
|||
*/
|
||||
function ShiftEntry_create_view_supporter($shift, Room $room, $angeltype, $signup_user, $users_select)
|
||||
{
|
||||
return page_with_title(ShiftEntry_create_title() . ': ' . $shift['name']
|
||||
return page_with_title(
|
||||
ShiftEntry_create_title() . ': ' . $shift['name']
|
||||
. ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>',
|
||||
[
|
||||
Shift_view_header($shift, $room),
|
||||
info(sprintf(__('Do you want to sign up the following user for this shift as %s?'),
|
||||
AngelType_name_render($angeltype)), true),
|
||||
info(sprintf(
|
||||
__('Do you want to sign up the following user for this shift as %s?'),
|
||||
AngelType_name_render($angeltype)
|
||||
), true),
|
||||
form([
|
||||
form_select('user_id', __('User'), $users_select, $signup_user->id),
|
||||
form_submit('submit', icon('check-lg') . __('Save'))
|
||||
])
|
||||
]);
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,7 +137,8 @@ function ShiftEntry_create_view_supporter($shift, Room $room, $angeltype, $signu
|
|||
*/
|
||||
function ShiftEntry_create_view_user($shift, Room $room, $angeltype, $comment)
|
||||
{
|
||||
return page_with_title(ShiftEntry_create_title() . ': ' . $shift['name']
|
||||
return page_with_title(
|
||||
ShiftEntry_create_title() . ': ' . $shift['name']
|
||||
. ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>',
|
||||
[
|
||||
Shift_view_header($shift, $room),
|
||||
|
@ -141,7 +147,8 @@ function ShiftEntry_create_view_user($shift, Room $room, $angeltype, $comment)
|
|||
form_textarea('comment', __('Comment (for your eyes only):'), $comment),
|
||||
form_submit('submit', icon('check-lg') . __('Save'))
|
||||
])
|
||||
]);
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -93,8 +93,10 @@ function Shift_signup_button_render($shift, $angeltype, $user_angeltype = null)
|
|||
} elseif (empty($user_angeltype)) {
|
||||
return button(
|
||||
page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
|
||||
sprintf(__('Become %s'),
|
||||
$angeltype['name'])
|
||||
sprintf(
|
||||
__('Become %s'),
|
||||
$angeltype['name']
|
||||
)
|
||||
);
|
||||
}
|
||||
return '';
|
||||
|
@ -284,10 +286,10 @@ function shift_length($shift)
|
|||
{
|
||||
$length = floor(($shift['end'] - $shift['start']) / (60 * 60)) . ':';
|
||||
$length .= str_pad(
|
||||
(($shift['end'] - $shift['start']) % (60 * 60)) / 60,
|
||||
2,
|
||||
'0',
|
||||
STR_PAD_LEFT
|
||||
) . 'h';
|
||||
(($shift['end'] - $shift['start']) % (60 * 60)) / 60,
|
||||
2,
|
||||
'0',
|
||||
STR_PAD_LEFT
|
||||
) . 'h';
|
||||
return $length;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,10 @@ class UserHintsRenderer
|
|||
$icon = $this->important ? 'exclamation-triangle' : 'info-circle';
|
||||
|
||||
return toolbar_popover(
|
||||
$icon . ' text-white', '', $this->hints, 'bg-' . $hint_class
|
||||
$icon . ' text-white',
|
||||
'',
|
||||
$this->hints,
|
||||
'bg-' . $hint_class
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ function User_view_shiftentries($needed_angel_type)
|
|||
{
|
||||
$shift_info = '<br><a href="'
|
||||
. page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $needed_angel_type['id']])
|
||||
.'"><b>' . $needed_angel_type['name'] . '</a>:</b> ';
|
||||
. '"><b>' . $needed_angel_type['name'] . '</a>:</b> ';
|
||||
|
||||
$shift_entries = [];
|
||||
foreach ($needed_angel_type['users'] as $user_shift) {
|
||||
|
@ -579,8 +579,8 @@ function User_view(
|
|||
$auth = auth();
|
||||
$nightShiftsConfig = config('night_shifts');
|
||||
$user_name = htmlspecialchars(
|
||||
$user_source->personalData->first_name) . ' ' . htmlspecialchars($user_source->personalData->last_name
|
||||
);
|
||||
$user_source->personalData->first_name
|
||||
) . ' ' . htmlspecialchars($user_source->personalData->last_name);
|
||||
$myshifts_table = '';
|
||||
if ($its_me || $admin_user_privilege) {
|
||||
$my_shifts = User_view_myshifts(
|
||||
|
@ -709,9 +709,9 @@ function User_view(
|
|||
) : '',
|
||||
$its_me && count($shifts) == 0
|
||||
? error(sprintf(
|
||||
__('Go to the <a href="%s">shifts table</a> to sign yourself up for some shifts.'),
|
||||
page_link_to('user_shifts')
|
||||
), true)
|
||||
__('Go to the <a href="%s">shifts table</a> to sign yourself up for some shifts.'),
|
||||
page_link_to('user_shifts')
|
||||
), true)
|
||||
: '',
|
||||
$its_me ? ical_hint() : ''
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue