Include phpcs for /includes
This commit is contained in:
parent
1af185c7ac
commit
f7d499b362
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
<file>config</file>
|
<file>config</file>
|
||||||
<file>db</file>
|
<file>db</file>
|
||||||
|
<file>includes</file>
|
||||||
<file>public/index.php</file>
|
<file>public/index.php</file>
|
||||||
<file>src</file>
|
<file>src</file>
|
||||||
<file>tests</file>
|
<file>tests</file>
|
||||||
|
@ -19,4 +20,7 @@
|
||||||
<property name="ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach" value="true" />
|
<property name="ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach" value="true" />
|
||||||
</properties>
|
</properties>
|
||||||
</rule>
|
</rule>
|
||||||
|
<rule ref="Generic.Files.LineLength.TooLong">
|
||||||
|
<exclude-pattern>/includes</exclude-pattern>
|
||||||
|
</rule>
|
||||||
</ruleset>
|
</ruleset>
|
||||||
|
|
|
@ -6,6 +6,7 @@ use Engelsystem\Config\Config;
|
||||||
/**
|
/**
|
||||||
* Include the autoloader
|
* Include the autoloader
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once __DIR__ . '/autoload.php';
|
require_once __DIR__ . '/autoload.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -305,7 +305,8 @@ function angeltypes_list_controller()
|
||||||
$angeltype['membership'] = AngelType_render_membership($angeltype);
|
$angeltype['membership'] = AngelType_render_membership($angeltype);
|
||||||
if (!empty($angeltype['user_angeltype_id'])) {
|
if (!empty($angeltype['user_angeltype_id'])) {
|
||||||
$actions[] = button(
|
$actions[] = button(
|
||||||
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'),
|
||||||
|
|
|
@ -186,8 +186,11 @@ function shift_edit_controller()
|
||||||
|
|
||||||
$angel_types_spinner = '';
|
$angel_types_spinner = '';
|
||||||
foreach ($angeltypes as $angeltype_id => $angeltype_name) {
|
foreach ($angeltypes as $angeltype_id => $angeltype_name) {
|
||||||
$angel_types_spinner .= form_spinner('type_' . $angeltype_id, $angeltype_name,
|
$angel_types_spinner .= form_spinner(
|
||||||
$needed_angel_types[$angeltype_id]);
|
'type_' . $angeltype_id,
|
||||||
|
$angeltype_name,
|
||||||
|
$needed_angel_types[$angeltype_id]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return page_with_title(
|
return page_with_title(
|
||||||
|
|
|
@ -70,10 +70,12 @@ function user_delete_controller()
|
||||||
if ($request->hasPostData('submit')) {
|
if ($request->hasPostData('submit')) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
|
||||||
if (!(
|
if (
|
||||||
|
!(
|
||||||
$request->has('password')
|
$request->has('password')
|
||||||
&& $auth->verifyPassword($user, $request->postData('password'))
|
&& $auth->verifyPassword($user, $request->postData('password'))
|
||||||
)) {
|
)
|
||||||
|
) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
error(__('auth.password.error'));
|
error(__('auth.password.error'));
|
||||||
}
|
}
|
||||||
|
@ -173,8 +175,10 @@ function user_edit_vouchers_controller()
|
||||||
$user_source->state->save();
|
$user_source->state->save();
|
||||||
|
|
||||||
success(__('Saved the number of vouchers.'));
|
success(__('Saved the number of vouchers.'));
|
||||||
engelsystem_log(User_Nick_render($user_source, true) . ': ' . sprintf('Got %s vouchers',
|
engelsystem_log(User_Nick_render($user_source, true) . ': ' . sprintf(
|
||||||
$user_source->state->got_voucher));
|
'Got %s vouchers',
|
||||||
|
$user_source->state->got_voucher
|
||||||
|
));
|
||||||
|
|
||||||
throw_redirect(user_link($user_source->id));
|
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'));
|
$shifts = Shifts_by_user($user_source->id, auth()->can('user_shifts_admin'));
|
||||||
foreach ($shifts as &$shift) {
|
foreach ($shifts as &$shift) {
|
||||||
// TODO: Move queries to model
|
// TODO: Move queries to model
|
||||||
$shift['needed_angeltypes'] = Db::select('
|
$shift['needed_angeltypes'] = Db::select(
|
||||||
|
'
|
||||||
SELECT DISTINCT `AngelTypes`.*
|
SELECT DISTINCT `AngelTypes`.*
|
||||||
FROM `ShiftEntry`
|
FROM `ShiftEntry`
|
||||||
JOIN `AngelTypes` ON `ShiftEntry`.`TID`=`AngelTypes`.`id`
|
JOIN `AngelTypes` ON `ShiftEntry`.`TID`=`AngelTypes`.`id`
|
||||||
|
@ -216,7 +221,8 @@ function user_controller()
|
||||||
[$shift['SID']]
|
[$shift['SID']]
|
||||||
);
|
);
|
||||||
foreach ($shift['needed_angeltypes'] as &$needed_angeltype) {
|
foreach ($shift['needed_angeltypes'] as &$needed_angeltype) {
|
||||||
$needed_angeltype['users'] = Db::select('
|
$needed_angeltype['users'] = Db::select(
|
||||||
|
'
|
||||||
SELECT `ShiftEntry`.`freeloaded`, `users`.*
|
SELECT `ShiftEntry`.`freeloaded`, `users`.*
|
||||||
FROM `ShiftEntry`
|
FROM `ShiftEntry`
|
||||||
JOIN `users` ON `ShiftEntry`.`UID`=`users`.`id`
|
JOIN `users` ON `ShiftEntry`.`UID`=`users`.`id`
|
||||||
|
@ -270,7 +276,8 @@ function users_list_controller()
|
||||||
}
|
}
|
||||||
|
|
||||||
$order_by = 'name';
|
$order_by = 'name';
|
||||||
if ($request->has('OrderBy') && in_array($request->input('OrderBy'), [
|
if (
|
||||||
|
$request->has('OrderBy') && in_array($request->input('OrderBy'), [
|
||||||
'name',
|
'name',
|
||||||
'first_name',
|
'first_name',
|
||||||
'last_name',
|
'last_name',
|
||||||
|
@ -285,7 +292,8 @@ function users_list_controller()
|
||||||
'planned_arrival_date',
|
'planned_arrival_date',
|
||||||
'planned_departure_date',
|
'planned_departure_date',
|
||||||
'last_login_at',
|
'last_login_at',
|
||||||
])) {
|
])
|
||||||
|
) {
|
||||||
$order_by = $request->input('OrderBy');
|
$order_by = $request->input('OrderBy');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
/**
|
/**
|
||||||
* Include legacy code
|
* Include legacy code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$includeFiles = [
|
$includeFiles = [
|
||||||
__DIR__ . '/../includes/sys_auth.php',
|
__DIR__ . '/../includes/sys_auth.php',
|
||||||
__DIR__ . '/../includes/sys_form.php',
|
__DIR__ . '/../includes/sys_form.php',
|
||||||
|
|
|
@ -58,7 +58,8 @@ function AngelType_delete($angeltype)
|
||||||
*/
|
*/
|
||||||
function AngelType_update($angeltype)
|
function AngelType_update($angeltype)
|
||||||
{
|
{
|
||||||
Db::update('
|
Db::update(
|
||||||
|
'
|
||||||
UPDATE `AngelTypes` SET
|
UPDATE `AngelTypes` SET
|
||||||
`name` = ?,
|
`name` = ?,
|
||||||
`restricted` = ?,
|
`restricted` = ?,
|
||||||
|
@ -104,7 +105,8 @@ function AngelType_update($angeltype)
|
||||||
*/
|
*/
|
||||||
function AngelType_create($angeltype)
|
function AngelType_create($angeltype)
|
||||||
{
|
{
|
||||||
Db::insert('
|
Db::insert(
|
||||||
|
'
|
||||||
INSERT INTO `AngelTypes` (
|
INSERT INTO `AngelTypes` (
|
||||||
`name`,
|
`name`,
|
||||||
`restricted`,
|
`restricted`,
|
||||||
|
|
|
@ -18,7 +18,8 @@ use Engelsystem\Database\Db;
|
||||||
*/
|
*/
|
||||||
function NeededAngelType_add($shift_id, $angeltype_id, $room_id, $count)
|
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`)
|
INSERT INTO `NeededAngelTypes` ( `shift_id`, `angel_type_id`, `room_id`, `count`)
|
||||||
VALUES (?, ?, ?, ?)
|
VALUES (?, ?, ?, ?)
|
||||||
',
|
',
|
||||||
|
@ -27,7 +28,8 @@ function NeededAngelType_add($shift_id, $angeltype_id, $room_id, $count)
|
||||||
$angeltype_id,
|
$angeltype_id,
|
||||||
$room_id,
|
$room_id,
|
||||||
$count,
|
$count,
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
|
|
||||||
return Db::getPdo()->lastInsertId();
|
return Db::getPdo()->lastInsertId();
|
||||||
}
|
}
|
||||||
|
@ -77,7 +79,8 @@ function NeededAngelTypes_by_room($room_id)
|
||||||
*/
|
*/
|
||||||
function NeededAngelTypes_by_shift($shiftId)
|
function NeededAngelTypes_by_shift($shiftId)
|
||||||
{
|
{
|
||||||
$needed_angeltypes_source = Db::select('
|
$needed_angeltypes_source = Db::select(
|
||||||
|
'
|
||||||
SELECT
|
SELECT
|
||||||
`NeededAngelTypes`.*,
|
`NeededAngelTypes`.*,
|
||||||
`AngelTypes`.`id`,
|
`AngelTypes`.`id`,
|
||||||
|
|
|
@ -29,7 +29,8 @@ function ShiftEntries_freeloaded_count()
|
||||||
*/
|
*/
|
||||||
function ShiftEntries_by_shift($shift_id)
|
function ShiftEntries_by_shift($shift_id)
|
||||||
{
|
{
|
||||||
return Db::select('
|
return Db::select(
|
||||||
|
'
|
||||||
SELECT
|
SELECT
|
||||||
`users`.*,
|
`users`.*,
|
||||||
`ShiftEntry`.`UID`,
|
`ShiftEntry`.`UID`,
|
||||||
|
@ -60,7 +61,8 @@ function ShiftEntry_create($shift_entry)
|
||||||
$shifttype = ShiftType($shift['shifttype_id']);
|
$shifttype = ShiftType($shift['shifttype_id']);
|
||||||
$room = Room::find($shift['RID']);
|
$room = Room::find($shift['RID']);
|
||||||
$angeltype = AngelType($shift_entry['TID']);
|
$angeltype = AngelType($shift_entry['TID']);
|
||||||
$result = Db::insert('
|
$result = Db::insert(
|
||||||
|
'
|
||||||
INSERT INTO `ShiftEntry` (
|
INSERT INTO `ShiftEntry` (
|
||||||
`SID`,
|
`SID`,
|
||||||
`TID`,
|
`TID`,
|
||||||
|
@ -101,7 +103,8 @@ function ShiftEntry_create($shift_entry)
|
||||||
*/
|
*/
|
||||||
function ShiftEntry_update($shift_entry)
|
function ShiftEntry_update($shift_entry)
|
||||||
{
|
{
|
||||||
Db::update('
|
Db::update(
|
||||||
|
'
|
||||||
UPDATE `ShiftEntry`
|
UPDATE `ShiftEntry`
|
||||||
SET
|
SET
|
||||||
`Comment` = ?,
|
`Comment` = ?,
|
||||||
|
@ -167,7 +170,8 @@ function ShiftEntry_delete($shiftEntry)
|
||||||
*/
|
*/
|
||||||
function ShiftEntries_upcoming_for_user($userId)
|
function ShiftEntries_upcoming_for_user($userId)
|
||||||
{
|
{
|
||||||
return Db::select('
|
return Db::select(
|
||||||
|
'
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `ShiftEntry`
|
FROM `ShiftEntry`
|
||||||
JOIN `Shifts` ON (`Shifts`.`SID` = `ShiftEntry`.`SID`)
|
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)
|
function ShiftEntries_finished_by_user($userId, Carbon $sinceTime = null)
|
||||||
{
|
{
|
||||||
return Db::select('
|
return Db::select(
|
||||||
|
'
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `ShiftEntry`
|
FROM `ShiftEntry`
|
||||||
JOIN `Shifts` ON (`Shifts`.`SID` = `ShiftEntry`.`SID`)
|
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)
|
function ShiftEntries_by_shift_and_angeltype($shift_id, $angeltype_id)
|
||||||
{
|
{
|
||||||
return Db::select('
|
return Db::select(
|
||||||
|
'
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `ShiftEntry`
|
FROM `ShiftEntry`
|
||||||
WHERE `SID` = ?
|
WHERE `SID` = ?
|
||||||
|
@ -240,7 +246,8 @@ function ShiftEntries_by_shift_and_angeltype($shift_id, $angeltype_id)
|
||||||
*/
|
*/
|
||||||
function ShiftEntries_freeloaded_by_user($userId)
|
function ShiftEntries_freeloaded_by_user($userId)
|
||||||
{
|
{
|
||||||
return Db::select('
|
return Db::select(
|
||||||
|
'
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `ShiftEntry`
|
FROM `ShiftEntry`
|
||||||
WHERE `freeloaded` = 1
|
WHERE `freeloaded` = 1
|
||||||
|
|
|
@ -22,7 +22,8 @@ function ShiftType_delete($shifttype_id)
|
||||||
*/
|
*/
|
||||||
function ShiftType_update($shifttype_id, $name, $angeltype_id, $description)
|
function ShiftType_update($shifttype_id, $name, $angeltype_id, $description)
|
||||||
{
|
{
|
||||||
Db::update('
|
Db::update(
|
||||||
|
'
|
||||||
UPDATE `ShiftTypes` SET
|
UPDATE `ShiftTypes` SET
|
||||||
`name`=?,
|
`name`=?,
|
||||||
`angeltype_id`=?,
|
`angeltype_id`=?,
|
||||||
|
@ -48,7 +49,8 @@ function ShiftType_update($shifttype_id, $name, $angeltype_id, $description)
|
||||||
*/
|
*/
|
||||||
function ShiftType_create($name, $angeltype_id, $description)
|
function ShiftType_create($name, $angeltype_id, $description)
|
||||||
{
|
{
|
||||||
Db::insert('
|
Db::insert(
|
||||||
|
'
|
||||||
INSERT INTO `ShiftTypes` (`name`, `angeltype_id`, `description`)
|
INSERT INTO `ShiftTypes` (`name`, `angeltype_id`, `description`)
|
||||||
VALUES(?, ?, ?)
|
VALUES(?, ?, ?)
|
||||||
',
|
',
|
||||||
|
|
|
@ -197,7 +197,8 @@ function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
||||||
*/
|
*/
|
||||||
function NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype)
|
function NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype)
|
||||||
{
|
{
|
||||||
return Db::selectOne('
|
return Db::selectOne(
|
||||||
|
'
|
||||||
SELECT
|
SELECT
|
||||||
`NeededAngelTypes`.*,
|
`NeededAngelTypes`.*,
|
||||||
`Shifts`.`SID`,
|
`Shifts`.`SID`,
|
||||||
|
@ -245,7 +246,8 @@ function NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype)
|
||||||
*/
|
*/
|
||||||
function ShiftEntries_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
function ShiftEntries_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
||||||
{
|
{
|
||||||
$sql = sprintf('
|
$sql = sprintf(
|
||||||
|
'
|
||||||
SELECT
|
SELECT
|
||||||
users.*,
|
users.*,
|
||||||
`ShiftEntry`.`UID`,
|
`ShiftEntry`.`UID`,
|
||||||
|
@ -527,7 +529,8 @@ function Shift_update($shift)
|
||||||
$shift['name'] = ShiftType($shift['shifttype_id'])['name'];
|
$shift['name'] = ShiftType($shift['shifttype_id'])['name'];
|
||||||
mail_shift_change(Shift($shift['SID']), $shift);
|
mail_shift_change(Shift($shift['SID']), $shift);
|
||||||
|
|
||||||
return Db::update('
|
return Db::update(
|
||||||
|
'
|
||||||
UPDATE `Shifts` SET
|
UPDATE `Shifts` SET
|
||||||
`shifttype_id` = ?,
|
`shifttype_id` = ?,
|
||||||
`start` = ?,
|
`start` = ?,
|
||||||
|
@ -564,7 +567,8 @@ function Shift_update($shift)
|
||||||
*/
|
*/
|
||||||
function Shift_create($shift, $transactionId = null)
|
function Shift_create($shift, $transactionId = null)
|
||||||
{
|
{
|
||||||
Db::insert('
|
Db::insert(
|
||||||
|
'
|
||||||
INSERT INTO `Shifts` (
|
INSERT INTO `Shifts` (
|
||||||
`shifttype_id`,
|
`shifttype_id`,
|
||||||
`start`,
|
`start`,
|
||||||
|
@ -607,7 +611,8 @@ function Shift_create($shift, $transactionId = null)
|
||||||
*/
|
*/
|
||||||
function Shifts_by_user($userId, $include_freeload_comments = false)
|
function Shifts_by_user($userId, $include_freeload_comments = false)
|
||||||
{
|
{
|
||||||
return Db::select('
|
return Db::select(
|
||||||
|
'
|
||||||
SELECT
|
SELECT
|
||||||
`rooms`.*,
|
`rooms`.*,
|
||||||
`rooms`.name AS Name,
|
`rooms`.name AS Name,
|
||||||
|
|
|
@ -80,7 +80,8 @@ function User_is_AngelType_supporter($user, $angeltype)
|
||||||
|
|
||||||
$privileges = privileges_for_user($user->id);
|
$privileges = privileges_for_user($user->id);
|
||||||
|
|
||||||
return (count(Db::select('
|
return (count(Db::select(
|
||||||
|
'
|
||||||
SELECT `id`
|
SELECT `id`
|
||||||
FROM `UserAngelTypes`
|
FROM `UserAngelTypes`
|
||||||
WHERE `user_id`=?
|
WHERE `user_id`=?
|
||||||
|
@ -194,7 +195,8 @@ function UserAngelType_delete($user_angeltype)
|
||||||
*/
|
*/
|
||||||
function UserAngelType_create($userId, $angeltype)
|
function UserAngelType_create($userId, $angeltype)
|
||||||
{
|
{
|
||||||
Db::insert('
|
Db::insert(
|
||||||
|
'
|
||||||
INSERT INTO `UserAngelTypes` (`user_id`, `angeltype_id`, `supporter`)
|
INSERT INTO `UserAngelTypes` (`user_id`, `angeltype_id`, `supporter`)
|
||||||
VALUES (?, ?, FALSE)
|
VALUES (?, ?, FALSE)
|
||||||
',
|
',
|
||||||
|
@ -233,7 +235,8 @@ function UserAngelType($user_angeltype_id)
|
||||||
*/
|
*/
|
||||||
function UserAngelType_by_User_and_AngelType($userId, $angeltype)
|
function UserAngelType_by_User_and_AngelType($userId, $angeltype)
|
||||||
{
|
{
|
||||||
$angelType = Db::selectOne('
|
$angelType = Db::selectOne(
|
||||||
|
'
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `UserAngelTypes`
|
FROM `UserAngelTypes`
|
||||||
WHERE `user_id`=?
|
WHERE `user_id`=?
|
||||||
|
|
|
@ -10,7 +10,8 @@ use Engelsystem\Database\Db;
|
||||||
*/
|
*/
|
||||||
function User_groups($userId)
|
function User_groups($userId)
|
||||||
{
|
{
|
||||||
return Db::select('
|
return Db::select(
|
||||||
|
'
|
||||||
SELECT `Groups`.*
|
SELECT `Groups`.*
|
||||||
FROM `UserGroups`
|
FROM `UserGroups`
|
||||||
JOIN `Groups` ON `Groups`.`UID`=`UserGroups`.`group_id`
|
JOIN `Groups` ON `Groups`.`UID`=`UserGroups`.`group_id`
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Engelsystem\Helpers\Shifts;
|
|
||||||
use Engelsystem\Models\Room;
|
|
||||||
use Engelsystem\Models\Worklog;
|
use Engelsystem\Models\Worklog;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,8 @@ function Users_by_angeltype_inverted($angeltype)
|
||||||
function Users_by_angeltype($angeltype)
|
function Users_by_angeltype($angeltype)
|
||||||
{
|
{
|
||||||
return User::query()
|
return User::query()
|
||||||
->select('users.*',
|
->select(
|
||||||
|
'users.*',
|
||||||
'UserAngelTypes.id AS user_angeltype_id',
|
'UserAngelTypes.id AS user_angeltype_id',
|
||||||
'UserAngelTypes.confirm_user_id',
|
'UserAngelTypes.confirm_user_id',
|
||||||
'UserAngelTypes.supporter',
|
'UserAngelTypes.supporter',
|
||||||
|
@ -273,7 +274,8 @@ function User_get_shifts_sum_query()
|
||||||
return 'COALESCE(SUM(`end` - `start`), 0)';
|
return 'COALESCE(SUM(`end` - `start`), 0)';
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf('
|
return sprintf(
|
||||||
|
'
|
||||||
COALESCE(SUM(
|
COALESCE(SUM(
|
||||||
(1 + (
|
(1 + (
|
||||||
(HOUR(FROM_UNIXTIME(`Shifts`.`end`)) > %1$d AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) < %2$d)
|
(HOUR(FROM_UNIXTIME(`Shifts`.`end`)) > %1$d AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) < %2$d)
|
||||||
|
|
|
@ -230,7 +230,9 @@ function admin_active()
|
||||||
}
|
}
|
||||||
$actions[] = form(
|
$actions[] = form(
|
||||||
[form_submit('submit', __('set active'), 'btn-sm', false, 'secondary')],
|
[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) {
|
if ($usr->state->active) {
|
||||||
|
@ -243,7 +245,9 @@ function admin_active()
|
||||||
}
|
}
|
||||||
$actions[] = form(
|
$actions[] = form(
|
||||||
[form_submit('submit', __('remove active'), 'btn-sm', false, 'secondary')],
|
[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) {
|
if (!$usr->state->got_shirt) {
|
||||||
|
@ -256,7 +260,9 @@ function admin_active()
|
||||||
}
|
}
|
||||||
$actions[] = form(
|
$actions[] = form(
|
||||||
[form_submit('submit', __('got t-shirt'), 'btn-sm', false, 'secondary')],
|
[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) {
|
if ($usr->state->got_shirt) {
|
||||||
|
@ -269,7 +275,9 @@ function admin_active()
|
||||||
}
|
}
|
||||||
$actions[] = form(
|
$actions[] = form(
|
||||||
[form_submit('submit', __('remove t-shirt'), 'btn-sm', false, 'secondary')],
|
[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'],
|
'name' => $group['Name'],
|
||||||
'privileges' => join(', ', $privileges_html),
|
'privileges' => join(', ', $privileges_html),
|
||||||
'actions' => button(
|
'actions' => button(
|
||||||
page_link_to('admin_groups',
|
page_link_to(
|
||||||
['action' => 'edit', 'id' => $group['UID']]),
|
'admin_groups',
|
||||||
|
['action' => 'edit', 'id' => $group['UID']]
|
||||||
|
),
|
||||||
__('edit'),
|
__('edit'),
|
||||||
'btn-sm'
|
'btn-sm'
|
||||||
)
|
)
|
||||||
|
|
|
@ -388,7 +388,8 @@ function admin_shifts()
|
||||||
LIMIT 1', [$type_id]);
|
LIMIT 1', [$type_id]);
|
||||||
|
|
||||||
if (!empty($angel_type_source)) {
|
if (!empty($angel_type_source)) {
|
||||||
Db::insert('
|
Db::insert(
|
||||||
|
'
|
||||||
INSERT INTO `NeededAngelTypes` (`shift_id`, `angel_type_id`, `count`)
|
INSERT INTO `NeededAngelTypes` (`shift_id`, `angel_type_id`, `count`)
|
||||||
VALUES (?, ?, ?)
|
VALUES (?, ?, ?)
|
||||||
',
|
',
|
||||||
|
@ -433,7 +434,8 @@ function admin_shifts()
|
||||||
'<a href="%s">%s</a>',
|
'<a href="%s">%s</a>',
|
||||||
page_link_to('admin_shifts_history'),
|
page_link_to('admin_shifts_history'),
|
||||||
icon('clock-history')
|
icon('clock-history')
|
||||||
), [
|
),
|
||||||
|
[
|
||||||
msg(),
|
msg(),
|
||||||
form([
|
form([
|
||||||
div('row', [
|
div('row', [
|
||||||
|
@ -501,7 +503,8 @@ function admin_shifts()
|
||||||
]),
|
]),
|
||||||
form_submit('preview', icon('search') . __('Preview'))
|
form_submit('preview', icon('search') . __('Preview'))
|
||||||
])
|
])
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -67,7 +67,8 @@ function admin_user()
|
||||||
. html_select_key(
|
. html_select_key(
|
||||||
'size',
|
'size',
|
||||||
'eSize',
|
'eSize',
|
||||||
$tshirt_sizes, $user_source->personalData->shirt_size,
|
$tshirt_sizes,
|
||||||
|
$user_source->personalData->shirt_size,
|
||||||
__('Please select...')
|
__('Please select...')
|
||||||
)
|
)
|
||||||
. '</td></tr>' . "\n";
|
. '</td></tr>' . "\n";
|
||||||
|
@ -151,7 +152,8 @@ function admin_user()
|
||||||
$html .= form_csrf();
|
$html .= form_csrf();
|
||||||
$html .= '<table>';
|
$html .= '<table>';
|
||||||
|
|
||||||
$groups = Db::select('
|
$groups = Db::select(
|
||||||
|
'
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `Groups`
|
FROM `Groups`
|
||||||
LEFT OUTER JOIN `UserGroups` ON (
|
LEFT OUTER JOIN `UserGroups` ON (
|
||||||
|
@ -205,7 +207,8 @@ function admin_user()
|
||||||
|| ($my_highest_group['group_id'] <= $his_highest_group['group_id'])
|
|| ($my_highest_group['group_id'] <= $his_highest_group['group_id'])
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
$groups_source = Db::select('
|
$groups_source = Db::select(
|
||||||
|
'
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `Groups`
|
FROM `Groups`
|
||||||
LEFT OUTER JOIN `UserGroups` ON (
|
LEFT OUTER JOIN `UserGroups` ON (
|
||||||
|
|
|
@ -107,8 +107,10 @@ function guest_register()
|
||||||
|
|
||||||
if (!$nickValidation->isValid()) {
|
if (!$nickValidation->isValid()) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
$msg .= error(sprintf(__('Please enter a valid nick.') . ' ' . __('Use up to 24 letters, numbers, connecting punctuations or spaces for your nickname.'),
|
$msg .= error(sprintf(
|
||||||
$nick), true);
|
__('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) {
|
if (User::whereName($nick)->count() > 0) {
|
||||||
$valid = false;
|
$valid = false;
|
||||||
|
@ -378,8 +380,10 @@ function guest_register()
|
||||||
24,
|
24,
|
||||||
'nickname'
|
'nickname'
|
||||||
),
|
),
|
||||||
form_info('',
|
form_info(
|
||||||
__('Use up to 24 letters, numbers, connecting punctuations or spaces for your nickname.'))
|
'',
|
||||||
|
__('Use up to 24 letters, numbers, connecting punctuations or spaces for your nickname.')
|
||||||
|
)
|
||||||
]),
|
]),
|
||||||
|
|
||||||
$enable_pronoun ? div('col', [
|
$enable_pronoun ? div('col', [
|
||||||
|
@ -451,7 +455,9 @@ function guest_register()
|
||||||
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
|
||||||
)
|
)
|
||||||
]) : '',
|
]) : '',
|
||||||
]),
|
]),
|
||||||
|
@ -462,9 +468,13 @@ function guest_register()
|
||||||
]) : '',
|
]) : '',
|
||||||
|
|
||||||
div('col', [
|
div('col', [
|
||||||
$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, __('Please select...')) : ''
|
$tshirt_sizes,
|
||||||
|
$tshirt_size,
|
||||||
|
__('Please select...')
|
||||||
|
) : ''
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,8 @@ function user_myshifts()
|
||||||
]);
|
]);
|
||||||
} 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');
|
||||||
$shift = Db::selectOne('
|
$shift = Db::selectOne(
|
||||||
|
'
|
||||||
SELECT
|
SELECT
|
||||||
`ShiftEntry`.`freeloaded`,
|
`ShiftEntry`.`freeloaded`,
|
||||||
`ShiftEntry`.`freeload_comment`,
|
`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.'));
|
error(__('The administration has not configured any angeltypes yet - or you are not subscribed to any angeltype.'));
|
||||||
throw_redirect(page_link_to('/'));
|
throw_redirect(page_link_to('/'));
|
||||||
}
|
}
|
||||||
$types = Db::select('
|
$types = Db::select(
|
||||||
|
'
|
||||||
SELECT
|
SELECT
|
||||||
`AngelTypes`.`id`,
|
`AngelTypes`.`id`,
|
||||||
`AngelTypes`.`name`,
|
`AngelTypes`.`name`,
|
||||||
|
|
|
@ -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_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']),
|
: form_checkbox('no_self_signup', __('No Self Sign Up allowed'), $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']),
|
||||||
|
@ -256,12 +259,15 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a
|
||||||
if ($admin_user_angeltypes) {
|
if ($admin_user_angeltypes) {
|
||||||
$member['actions'] = table_buttons([
|
$member['actions'] = table_buttons([
|
||||||
$admin_angeltypes
|
$admin_angeltypes
|
||||||
? button(page_link_to('user_angeltypes', [
|
? button(
|
||||||
|
page_link_to('user_angeltypes', [
|
||||||
'action' => 'update',
|
'action' => 'update',
|
||||||
'user_angeltype_id' => $member['user_angeltype_id'],
|
'user_angeltype_id' => $member['user_angeltype_id'],
|
||||||
'supporter' => 1
|
'supporter' => 1
|
||||||
]),
|
]),
|
||||||
__('Add supporter rights'), 'btn-sm')
|
__('Add supporter rights'),
|
||||||
|
'btn-sm'
|
||||||
|
)
|
||||||
: '',
|
: '',
|
||||||
button(
|
button(
|
||||||
page_link_to('user_angeltypes', [
|
page_link_to('user_angeltypes', [
|
||||||
|
|
|
@ -136,7 +136,8 @@ class ShiftCalendarShiftRenderer
|
||||||
|
|
||||||
if (auth()->can('user_shifts_admin')) {
|
if (auth()->can('user_shifts_admin')) {
|
||||||
$html .= '<li class="list-group-item d-flex align-items-center ' . $this->classBg() . '">';
|
$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'),
|
icon('plus-lg') . __('Add more angels'),
|
||||||
'btn-sm'
|
'btn-sm'
|
||||||
);
|
);
|
||||||
|
@ -195,7 +196,8 @@ class ShiftCalendarShiftRenderer
|
||||||
. '</a> '
|
. '</a> '
|
||||||
. button(
|
. button(
|
||||||
shift_entry_create_link($shift, $angeltype),
|
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;
|
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_select('user_id', __('User'), $users_select, $signup_user->id),
|
||||||
form_submit('submit', icon('check-lg') . __('Save'))
|
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)
|
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>',
|
. ' <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(
|
||||||
AngelType_name_render($angeltype)), true),
|
__('Do you want to sign up the following user for this shift as %s?'),
|
||||||
|
AngelType_name_render($angeltype)
|
||||||
|
), true),
|
||||||
form([
|
form([
|
||||||
form_select('user_id', __('User'), $users_select, $signup_user->id),
|
form_select('user_id', __('User'), $users_select, $signup_user->id),
|
||||||
form_submit('submit', icon('check-lg') . __('Save'))
|
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)
|
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>',
|
. ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>',
|
||||||
[
|
[
|
||||||
Shift_view_header($shift, $room),
|
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_textarea('comment', __('Comment (for your eyes only):'), $comment),
|
||||||
form_submit('submit', icon('check-lg') . __('Save'))
|
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)) {
|
} 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(
|
||||||
$angeltype['name'])
|
__('Become %s'),
|
||||||
|
$angeltype['name']
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
|
|
|
@ -21,7 +21,10 @@ class UserHintsRenderer
|
||||||
$icon = $this->important ? 'exclamation-triangle' : 'info-circle';
|
$icon = $this->important ? 'exclamation-triangle' : 'info-circle';
|
||||||
|
|
||||||
return toolbar_popover(
|
return toolbar_popover(
|
||||||
$icon . ' text-white', '', $this->hints, 'bg-' . $hint_class
|
$icon . ' text-white',
|
||||||
|
'',
|
||||||
|
$this->hints,
|
||||||
|
'bg-' . $hint_class
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -579,8 +579,8 @@ function User_view(
|
||||||
$auth = auth();
|
$auth = auth();
|
||||||
$nightShiftsConfig = config('night_shifts');
|
$nightShiftsConfig = config('night_shifts');
|
||||||
$user_name = htmlspecialchars(
|
$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 = '';
|
$myshifts_table = '';
|
||||||
if ($its_me || $admin_user_privilege) {
|
if ($its_me || $admin_user_privilege) {
|
||||||
$my_shifts = User_view_myshifts(
|
$my_shifts = User_view_myshifts(
|
||||||
|
|
Loading…
Reference in New Issue