From 390db395a6817636b4a114a3a999f403624f2552 Mon Sep 17 00:00:00 2001
From: Igor Scheller
Date: Wed, 13 May 2020 18:26:32 +0200
Subject: [PATCH] File formatting fixes
---
..._01_01_000004_cleanup_group_privileges.php | 4 +-
...000005_add_angel_supporter_permissions.php | 2 +-
includes/controller/users_controller.php | 10 +-
includes/helper/graph_helper.php | 24 +-
includes/model/AngelType_model.php | 76 ++---
includes/model/NeededAngelTypes_model.php | 4 +-
includes/model/Room_model.php | 4 +-
includes/model/ShiftEntry_model.php | 88 +++---
includes/model/ShiftTypes_model.php | 10 +-
includes/model/Shifts_model.php | 282 +++++++++---------
includes/model/Stats.php | 78 ++---
includes/model/UserAngelTypes_model.php | 104 +++----
includes/model/UserDriverLicenses_model.php | 40 +--
includes/model/UserGroups_model.php | 12 +-
includes/model/UserWorkLog_model.php | 12 +-
includes/model/User_model.php | 16 +-
includes/pages/admin_active.php | 8 +-
includes/pages/admin_shifts.php | 16 +-
includes/pages/schedule/ImportSchedule.php | 26 +-
includes/pages/user_atom.php | 24 +-
includes/pages/user_shifts.php | 10 +-
includes/sys_form.php | 44 +--
includes/sys_template.php | 38 ++-
includes/view/UserDriverLicenses_view.php | 34 +--
includes/view/User_view.php | 2 +-
resources/assets/themes/error.less | 6 +-
resources/assets/themes/theme0.less | 2 +-
resources/assets/themes/theme10.less | 10 +-
resources/assets/themes/theme11.less | 2 +-
resources/assets/themes/theme3.less | 6 +-
resources/assets/themes/theme4.less | 2 +-
resources/assets/themes/theme5.less | 2 +-
resources/assets/themes/theme7.less | 2 +-
resources/assets/themes/theme8.less | 14 +-
resources/assets/themes/theme9.less | 10 +-
resources/views/pages/user-shifts.html | 2 +-
36 files changed, 515 insertions(+), 511 deletions(-)
diff --git a/db/migrations/2018_01_01_000004_cleanup_group_privileges.php b/db/migrations/2018_01_01_000004_cleanup_group_privileges.php
index aead4422..c453508a 100644
--- a/db/migrations/2018_01_01_000004_cleanup_group_privileges.php
+++ b/db/migrations/2018_01_01_000004_cleanup_group_privileges.php
@@ -54,8 +54,8 @@ class CleanupGroupPrivileges extends Migration
'
DELETE FROM `GroupPrivileges`
WHERE
- group_id = ?
- AND privilege_id = ?
+ group_id = ?
+ AND privilege_id = ?
',
[
-40, // Shift Coordinator
diff --git a/db/migrations/2018_01_01_000005_add_angel_supporter_permissions.php b/db/migrations/2018_01_01_000005_add_angel_supporter_permissions.php
index b9d4cdc2..2f23fbe0 100644
--- a/db/migrations/2018_01_01_000005_add_angel_supporter_permissions.php
+++ b/db/migrations/2018_01_01_000005_add_angel_supporter_permissions.php
@@ -61,7 +61,7 @@ class AddAngelSupporterPermissions extends Migration
return sprintf('
%s FROM GroupPrivileges
WHERE group_id = (SELECT UID FROM `Groups` WHERE `name` = ?)
- AND privilege_id = (SELECT id FROM `Privileges` WHERE `name` = ?)
+ AND privilege_id = (SELECT id FROM `Privileges` WHERE `name` = ?)
', $type);
}
}
diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php
index c0dcd377..5c28b201 100644
--- a/includes/controller/users_controller.php
+++ b/includes/controller/users_controller.php
@@ -213,11 +213,11 @@ function user_controller()
);
foreach ($shift['needed_angeltypes'] as &$needed_angeltype) {
$needed_angeltype['users'] = DB::select('
- SELECT `ShiftEntry`.`freeloaded`, `users`.*
- FROM `ShiftEntry`
- JOIN `users` ON `ShiftEntry`.`UID`=`users`.`id`
- WHERE `ShiftEntry`.`SID` = ?
- AND `ShiftEntry`.`TID` = ?
+ SELECT `ShiftEntry`.`freeloaded`, `users`.*
+ FROM `ShiftEntry`
+ JOIN `users` ON `ShiftEntry`.`UID`=`users`.`id`
+ WHERE `ShiftEntry`.`SID` = ?
+ AND `ShiftEntry`.`TID` = ?
',
[$shift['SID'], $needed_angeltype['id']]
);
diff --git a/includes/helper/graph_helper.php b/includes/helper/graph_helper.php
index 7c6e6114..a4bcb773 100644
--- a/includes/helper/graph_helper.php
+++ b/includes/helper/graph_helper.php
@@ -31,16 +31,16 @@ function bargraph($dom_id, $key, $row_names, $colors, $data)
}
return '
- ';
+ ';
}
diff --git a/includes/model/AngelType_model.php b/includes/model/AngelType_model.php
index 713d0f74..d50aeb4b 100644
--- a/includes/model/AngelType_model.php
+++ b/includes/model/AngelType_model.php
@@ -44,9 +44,9 @@ function AngelType_has_contact_info($angeltype)
function AngelType_delete($angeltype)
{
DB::delete('
- DELETE FROM `AngelTypes`
- WHERE `id`=?
- LIMIT 1
+ DELETE FROM `AngelTypes`
+ WHERE `id`=?
+ LIMIT 1
', [$angeltype['id']]);
engelsystem_log('Deleted angeltype: ' . AngelType_name_render($angeltype, true));
}
@@ -59,17 +59,18 @@ function AngelType_delete($angeltype)
function AngelType_update($angeltype)
{
DB::update('
- UPDATE `AngelTypes` SET
- `name` = ?,
- `restricted` = ?,
- `description` = ?,
- `requires_driver_license` = ?,
- `no_self_signup` = ?,
- `contact_name` = ?,
- `contact_dect` = ?,
- `contact_email` = ?,
- `show_on_dashboard` = ?
- WHERE `id` = ?',
+ UPDATE `AngelTypes` SET
+ `name` = ?,
+ `restricted` = ?,
+ `description` = ?,
+ `requires_driver_license` = ?,
+ `no_self_signup` = ?,
+ `contact_name` = ?,
+ `contact_dect` = ?,
+ `contact_email` = ?,
+ `show_on_dashboard` = ?
+ WHERE `id` = ?
+ ',
[
$angeltype['name'],
(int)$angeltype['restricted'],
@@ -104,18 +105,18 @@ function AngelType_update($angeltype)
function AngelType_create($angeltype)
{
DB::insert('
- INSERT INTO `AngelTypes` (
- `name`,
- `restricted`,
- `description`,
- `requires_driver_license`,
- `no_self_signup`,
- `contact_name`,
- `contact_dect`,
- `contact_email`,
- `show_on_dashboard`
- )
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
+ INSERT INTO `AngelTypes` (
+ `name`,
+ `restricted`,
+ `description`,
+ `requires_driver_license`,
+ `no_self_signup`,
+ `contact_name`,
+ `contact_dect`,
+ `contact_email`,
+ `show_on_dashboard`
+ )
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
',
[
$angeltype['name'],
@@ -187,14 +188,14 @@ function AngelType_validate_name($name, $angeltype)
function AngelTypes_with_user($userId)
{
return DB::select('
- SELECT `AngelTypes`.*,
- `UserAngelTypes`.`id` AS `user_angeltype_id`,
- `UserAngelTypes`.`confirm_user_id`,
- `UserAngelTypes`.`supporter`
- FROM `AngelTypes`
- LEFT JOIN `UserAngelTypes` ON `AngelTypes`.`id`=`UserAngelTypes`.`angeltype_id`
- AND `UserAngelTypes`.`user_id` = ?
- ORDER BY `name`', [$userId]);
+ SELECT `AngelTypes`.*,
+ `UserAngelTypes`.`id` AS `user_angeltype_id`,
+ `UserAngelTypes`.`confirm_user_id`,
+ `UserAngelTypes`.`supporter`
+ FROM `AngelTypes`
+ LEFT JOIN `UserAngelTypes` ON `AngelTypes`.`id`=`UserAngelTypes`.`angeltype_id`
+ AND `UserAngelTypes`.`user_id` = ?
+ ORDER BY `name`', [$userId]);
}
/**
@@ -205,9 +206,10 @@ function AngelTypes_with_user($userId)
function AngelTypes()
{
return DB::select('
- SELECT *
- FROM `AngelTypes`
- ORDER BY `name`');
+ SELECT *
+ FROM `AngelTypes`
+ ORDER BY `name`
+ ');
}
/**
diff --git a/includes/model/NeededAngelTypes_model.php b/includes/model/NeededAngelTypes_model.php
index 53f783c1..c58e2811 100644
--- a/includes/model/NeededAngelTypes_model.php
+++ b/includes/model/NeededAngelTypes_model.php
@@ -18,8 +18,8 @@ use Engelsystem\Database\DB;
function NeededAngelType_add($shift_id, $angeltype_id, $room_id, $count)
{
DB::insert('
- INSERT INTO `NeededAngelTypes` ( `shift_id`, `angel_type_id`, `room_id`, `count`)
- VALUES (?, ?, ?, ?)
+ INSERT INTO `NeededAngelTypes` ( `shift_id`, `angel_type_id`, `room_id`, `count`)
+ VALUES (?, ?, ?, ?)
',
[
$shift_id,
diff --git a/includes/model/Room_model.php b/includes/model/Room_model.php
index f9eaf31d..dee8d2bb 100644
--- a/includes/model/Room_model.php
+++ b/includes/model/Room_model.php
@@ -72,8 +72,8 @@ function Room_delete($room_id)
function Room_create($name, $map_url, $description)
{
DB::insert('
- INSERT INTO `Room` (`Name`, `map_url`, `description`)
- VALUES (?, ?, ?)
+ INSERT INTO `Room` (`Name`, `map_url`, `description`)
+ VALUES (?, ?, ?)
', [
$name,
$map_url,
diff --git a/includes/model/ShiftEntry_model.php b/includes/model/ShiftEntry_model.php
index ea025604..d5d28b9a 100644
--- a/includes/model/ShiftEntry_model.php
+++ b/includes/model/ShiftEntry_model.php
@@ -48,18 +48,19 @@ function ShiftEntries_freeloaded_count()
function ShiftEntries_by_shift($shift_id)
{
return DB::select('
- SELECT
- `users`.*,
- `ShiftEntry`.`UID`,
- `ShiftEntry`.`TID`,
- `ShiftEntry`.`SID`,
- `AngelTypes`.`name` AS `angel_type_name`,
- `ShiftEntry`.`Comment`,
- `ShiftEntry`.`freeloaded`
- FROM `ShiftEntry`
- JOIN `users` ON `ShiftEntry`.`UID`=`users`.`id`
- JOIN `AngelTypes` ON `ShiftEntry`.`TID`=`AngelTypes`.`id`
- WHERE `ShiftEntry`.`SID` = ?',
+ SELECT
+ `users`.*,
+ `ShiftEntry`.`UID`,
+ `ShiftEntry`.`TID`,
+ `ShiftEntry`.`SID`,
+ `AngelTypes`.`name` AS `angel_type_name`,
+ `ShiftEntry`.`Comment`,
+ `ShiftEntry`.`freeloaded`
+ FROM `ShiftEntry`
+ JOIN `users` ON `ShiftEntry`.`UID`=`users`.`id`
+ JOIN `AngelTypes` ON `ShiftEntry`.`TID`=`AngelTypes`.`id`
+ WHERE `ShiftEntry`.`SID` = ?
+ ',
[$shift_id]
);
}
@@ -78,15 +79,15 @@ function ShiftEntry_create($shift_entry)
$room = Room($shift['RID']);
$angeltype = AngelType($shift_entry['TID']);
$result = DB::insert('
- INSERT INTO `ShiftEntry` (
- `SID`,
- `TID`,
- `UID`,
- `Comment`,
- `freeload_comment`,
- `freeloaded`
- )
- VALUES(?, ?, ?, ?, ?, ?)
+ INSERT INTO `ShiftEntry` (
+ `SID`,
+ `TID`,
+ `UID`,
+ `Comment`,
+ `freeload_comment`,
+ `freeloaded`
+ )
+ VALUES(?, ?, ?, ?, ?, ?)
',
[
$shift_entry['SID'],
@@ -119,12 +120,13 @@ function ShiftEntry_create($shift_entry)
function ShiftEntry_update($shift_entry)
{
DB::update('
- UPDATE `ShiftEntry`
- SET
- `Comment` = ?,
- `freeload_comment` = ?,
- `freeloaded` = ?
- WHERE `id` = ?',
+ UPDATE `ShiftEntry`
+ SET
+ `Comment` = ?,
+ `freeload_comment` = ?,
+ `freeloaded` = ?
+ WHERE `id` = ?
+ ',
[
$shift_entry['Comment'],
$shift_entry['freeload_comment'],
@@ -191,7 +193,7 @@ function ShiftEntries_upcoming_for_user($userId)
WHERE `ShiftEntry`.`UID` = ?
AND `Shifts`.`end` > ?
ORDER BY `Shifts`.`end`
- ',
+ ',
[
$userId,
time(),
@@ -209,16 +211,16 @@ function ShiftEntries_upcoming_for_user($userId)
function ShiftEntries_finished_by_user($userId, Carbon $sinceTime = null)
{
return DB::select('
- SELECT *
- FROM `ShiftEntry`
- JOIN `Shifts` ON (`Shifts`.`SID` = `ShiftEntry`.`SID`)
- JOIN `ShiftTypes` ON `ShiftTypes`.`id` = `Shifts`.`shifttype_id`
- WHERE `ShiftEntry`.`UID` = ?
- AND `Shifts`.`end` < ?
- AND `ShiftEntry`.`freeloaded` = 0
- ' . ($sinceTime ? 'AND Shifts.start >= ' . $sinceTime->getTimestamp() : '') . '
- ORDER BY `Shifts`.`end` desc
- ',
+ SELECT *
+ FROM `ShiftEntry`
+ JOIN `Shifts` ON (`Shifts`.`SID` = `ShiftEntry`.`SID`)
+ JOIN `ShiftTypes` ON `ShiftTypes`.`id` = `Shifts`.`shifttype_id`
+ WHERE `ShiftEntry`.`UID` = ?
+ AND `Shifts`.`end` < ?
+ AND `ShiftEntry`.`freeloaded` = 0
+ ' . ($sinceTime ? 'AND Shifts.start >= ' . $sinceTime->getTimestamp() : '') . '
+ ORDER BY `Shifts`.`end` desc
+ ',
[
$userId,
time(),
@@ -257,11 +259,11 @@ function ShiftEntries_by_shift_and_angeltype($shift_id, $angeltype_id)
function ShiftEntries_freeloaded_by_user($userId)
{
return DB::select('
- SELECT *
- FROM `ShiftEntry`
- WHERE `freeloaded` = 1
- AND `UID` = ?
- ',
+ SELECT *
+ FROM `ShiftEntry`
+ WHERE `freeloaded` = 1
+ AND `UID` = ?
+ ',
[
$userId
]
diff --git a/includes/model/ShiftTypes_model.php b/includes/model/ShiftTypes_model.php
index 599810be..91e855e0 100644
--- a/includes/model/ShiftTypes_model.php
+++ b/includes/model/ShiftTypes_model.php
@@ -23,11 +23,11 @@ function ShiftType_delete($shifttype_id)
function ShiftType_update($shifttype_id, $name, $angeltype_id, $description)
{
DB::update('
- UPDATE `ShiftTypes` SET
- `name`=?,
- `angeltype_id`=?,
- `description`=?
- WHERE `id`=?
+ UPDATE `ShiftTypes` SET
+ `name`=?,
+ `angeltype_id`=?,
+ `description`=?
+ WHERE `id`=?
',
[
$name,
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index feecdf60..bdb9325d 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -18,9 +18,9 @@ function Shifts_by_angeltype($angeltype)
WHERE `NeededAngelTypes`.`angel_type_id` = ?
AND `NeededAngelTypes`.`count` > 0
AND s.shift_id IS NULL
-
+
UNION
-
+
SELECT DISTINCT `Shifts`.* FROM `Shifts`
JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`room_id` = `Shifts`.`RID`
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
@@ -48,9 +48,9 @@ function Shifts_free($start, $end)
AND (SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`)
> (SELECT COUNT(*) FROM `ShiftEntry` WHERE `ShiftEntry`.`SID`=`Shifts`.`SID` AND `freeloaded`=0)
AND s.shift_id IS NULL
-
+
UNION
-
+
SELECT *
FROM `Shifts`
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
@@ -91,34 +91,37 @@ function Shifts_by_room($room)
*/
function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
{
- $sql = 'SELECT * FROM (
- SELECT DISTINCT `Shifts`.*, `ShiftTypes`.`name`, `Room`.`Name` AS `room_name`
- FROM `Shifts`
- JOIN `Room` USING (`RID`)
- JOIN `ShiftTypes` ON `ShiftTypes`.`id` = `Shifts`.`shifttype_id`
- JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id` = `Shifts`.`SID`
- LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
- WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
- AND `start` BETWEEN ? AND ?
- AND `NeededAngelTypes`.`angel_type_id` IN (' . implode(',', $shiftsFilter->getTypes()) . ')
- AND `NeededAngelTypes`.`count` > 0
- AND s.shift_id IS NULL
+ $sql = '
+ SELECT * FROM (
+ SELECT DISTINCT `Shifts`.*, `ShiftTypes`.`name`, `Room`.`Name` AS `room_name`
+ FROM `Shifts`
+ JOIN `Room` USING (`RID`)
+ JOIN `ShiftTypes` ON `ShiftTypes`.`id` = `Shifts`.`shifttype_id`
+ JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id` = `Shifts`.`SID`
+ LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
+ WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
+ AND `start` BETWEEN ? AND ?
+ AND `NeededAngelTypes`.`angel_type_id` IN (' . implode(',', $shiftsFilter->getTypes()) . ')
+ AND `NeededAngelTypes`.`count` > 0
+ AND s.shift_id IS NULL
- UNION
+ UNION
- SELECT DISTINCT `Shifts`.*, `ShiftTypes`.`name`, `Room`.`Name` AS `room_name`
- FROM `Shifts`
- JOIN `Room` USING (`RID`)
- JOIN `ShiftTypes` ON `ShiftTypes`.`id` = `Shifts`.`shifttype_id`
- JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
- LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
- WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
- AND `start` BETWEEN ? AND ?
- AND `NeededAngelTypes`.`angel_type_id` IN (' . implode(',', $shiftsFilter->getTypes()) . ')
- AND `NeededAngelTypes`.`count` > 0
- AND NOT s.shift_id IS NULL) AS tmp_shifts
+ SELECT DISTINCT `Shifts`.*, `ShiftTypes`.`name`, `Room`.`Name` AS `room_name`
+ FROM `Shifts`
+ JOIN `Room` USING (`RID`)
+ JOIN `ShiftTypes` ON `ShiftTypes`.`id` = `Shifts`.`shifttype_id`
+ JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
+ LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
+ WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
+ AND `start` BETWEEN ? AND ?
+ AND `NeededAngelTypes`.`angel_type_id` IN (' . implode(',', $shiftsFilter->getTypes()) . ')
+ AND `NeededAngelTypes`.`count` > 0
+ AND NOT s.shift_id IS NULL
+ ) AS tmp_shifts
- ORDER BY `room_name`, `start`';
+ ORDER BY `room_name`, `start`
+ ';
return DB::select(
$sql,
@@ -138,37 +141,38 @@ function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
{
$sql = '
- SELECT
- `NeededAngelTypes`.*,
- `Shifts`.`SID`,
- `AngelTypes`.`id`,
- `AngelTypes`.`name`,
- `AngelTypes`.`restricted`,
- `AngelTypes`.`no_self_signup`
- FROM `Shifts`
- JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`
- JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
- LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
- WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
- AND `start` BETWEEN ? AND ?
- AND s.shift_id IS NULL
-
- UNION
-
- SELECT
+ SELECT
`NeededAngelTypes`.*,
`Shifts`.`SID`,
`AngelTypes`.`id`,
`AngelTypes`.`name`,
`AngelTypes`.`restricted`,
`AngelTypes`.`no_self_signup`
- FROM `Shifts`
- JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
- JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
- LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
- WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
- AND `start` BETWEEN ? AND ?
- AND NOT s.shift_id IS NULL';
+ FROM `Shifts`
+ JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`
+ JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
+ LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
+ WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
+ AND `start` BETWEEN ? AND ?
+ AND s.shift_id IS NULL
+
+ UNION
+
+ SELECT
+ `NeededAngelTypes`.*,
+ `Shifts`.`SID`,
+ `AngelTypes`.`id`,
+ `AngelTypes`.`name`,
+ `AngelTypes`.`restricted`,
+ `AngelTypes`.`no_self_signup`
+ FROM `Shifts`
+ JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
+ JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
+ LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
+ WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
+ AND `start` BETWEEN ? AND ?
+ AND NOT s.shift_id IS NULL
+ ';
return DB::select(
$sql,
@@ -189,38 +193,38 @@ function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
function NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype)
{
return DB::selectOne('
- SELECT
- `NeededAngelTypes`.*,
- `Shifts`.`SID`,
- `AngelTypes`.`id`,
- `AngelTypes`.`name`,
- `AngelTypes`.`restricted`,
- `AngelTypes`.`no_self_signup`
- FROM `Shifts`
- JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`
- JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
- LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
- WHERE `Shifts`.`SID`=?
- AND `AngelTypes`.`id`=?
- AND s.shift_id IS NULL
-
- UNION
-
- SELECT
+ SELECT
`NeededAngelTypes`.*,
`Shifts`.`SID`,
`AngelTypes`.`id`,
`AngelTypes`.`name`,
`AngelTypes`.`restricted`,
`AngelTypes`.`no_self_signup`
- FROM `Shifts`
- JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
- JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
- LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
- WHERE `Shifts`.`SID`=?
- AND `AngelTypes`.`id`=?
- AND NOT s.shift_id IS NULL
- ',
+ FROM `Shifts`
+ JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`
+ JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
+ LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
+ WHERE `Shifts`.`SID`=?
+ AND `AngelTypes`.`id`=?
+ AND s.shift_id IS NULL
+
+ UNION
+
+ SELECT
+ `NeededAngelTypes`.*,
+ `Shifts`.`SID`,
+ `AngelTypes`.`id`,
+ `AngelTypes`.`name`,
+ `AngelTypes`.`restricted`,
+ `AngelTypes`.`no_self_signup`
+ FROM `Shifts`
+ JOIN `NeededAngelTypes` ON `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
+ JOIN `AngelTypes` ON `AngelTypes`.`id`= `NeededAngelTypes`.`angel_type_id`
+ LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
+ WHERE `Shifts`.`SID`=?
+ AND `AngelTypes`.`id`=?
+ AND NOT s.shift_id IS NULL
+ ',
[
$shift['SID'],
$angeltype['id'],
@@ -237,19 +241,19 @@ function NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype)
function ShiftEntries_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
{
$sql = sprintf('
- SELECT
- users.*,
- `ShiftEntry`.`UID`,
- `ShiftEntry`.`TID`,
- `ShiftEntry`.`SID`,
- `ShiftEntry`.`Comment`,
- `ShiftEntry`.`freeloaded`
- FROM `Shifts`
- JOIN `ShiftEntry` ON `ShiftEntry`.`SID`=`Shifts`.`SID`
- JOIN `users` ON `ShiftEntry`.`UID`=`users`.`id`
- WHERE `Shifts`.`RID` IN (%s)
- AND `start` BETWEEN ? AND ?
- ORDER BY `Shifts`.`start`
+ SELECT
+ users.*,
+ `ShiftEntry`.`UID`,
+ `ShiftEntry`.`TID`,
+ `ShiftEntry`.`SID`,
+ `ShiftEntry`.`Comment`,
+ `ShiftEntry`.`freeloaded`
+ FROM `Shifts`
+ JOIN `ShiftEntry` ON `ShiftEntry`.`SID`=`Shifts`.`SID`
+ JOIN `users` ON `ShiftEntry`.`UID`=`users`.`id`
+ WHERE `Shifts`.`RID` IN (%s)
+ AND `start` BETWEEN ? AND ?
+ ORDER BY `Shifts`.`start`
',
implode(',', $shiftsFilter->getRooms())
);
@@ -518,16 +522,16 @@ function Shift_update($shift)
mail_shift_change(Shift($shift['SID']), $shift);
return DB::update('
- UPDATE `Shifts` SET
- `shifttype_id` = ?,
- `start` = ?,
- `end` = ?,
- `RID` = ?,
- `title` = ?,
- `URL` = ?,
- `edited_by_user_id` = ?,
- `edited_at_timestamp` = ?
- WHERE `SID` = ?
+ UPDATE `Shifts` SET
+ `shifttype_id` = ?,
+ `start` = ?,
+ `end` = ?,
+ `RID` = ?,
+ `title` = ?,
+ `URL` = ?,
+ `edited_by_user_id` = ?,
+ `edited_at_timestamp` = ?
+ WHERE `SID` = ?
',
[
$shift['shifttype_id'],
@@ -552,18 +556,18 @@ function Shift_update($shift)
function Shift_create($shift)
{
DB::insert('
- INSERT INTO `Shifts` (
- `shifttype_id`,
- `start`,
- `end`,
- `RID`,
- `title`,
- `URL`,
- `created_by_user_id`,
- `edited_at_timestamp`,
- `created_at_timestamp`
- )
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
+ INSERT INTO `Shifts` (
+ `shifttype_id`,
+ `start`,
+ `end`,
+ `RID`,
+ `title`,
+ `URL`,
+ `created_by_user_id`,
+ `edited_at_timestamp`,
+ `created_at_timestamp`
+ )
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
',
[
$shift['shifttype_id'],
@@ -591,26 +595,26 @@ function Shift_create($shift)
function Shifts_by_user($userId, $include_freeload_comments = false)
{
return DB::select('
- SELECT
- `ShiftTypes`.`id` AS `shifttype_id`,
- `ShiftTypes`.`name`,
- `ShiftEntry`.`id`,
- `ShiftEntry`.`SID`,
- `ShiftEntry`.`TID`,
- `ShiftEntry`.`UID`,
- `ShiftEntry`.`freeloaded`,
- `ShiftEntry`.`Comment`,
- ' . ($include_freeload_comments ? '`ShiftEntry`.`freeload_comment`, ' : '') . '
- `Shifts`.*,
- @@session.time_zone AS timezone,
- `Room`.*
- FROM `ShiftEntry`
- JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`)
- JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
- JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`)
- WHERE `UID` = ?
- ORDER BY `start`
- ',
+ SELECT
+ `ShiftTypes`.`id` AS `shifttype_id`,
+ `ShiftTypes`.`name`,
+ `ShiftEntry`.`id`,
+ `ShiftEntry`.`SID`,
+ `ShiftEntry`.`TID`,
+ `ShiftEntry`.`UID`,
+ `ShiftEntry`.`freeloaded`,
+ `ShiftEntry`.`Comment`,
+ ' . ($include_freeload_comments ? '`ShiftEntry`.`freeload_comment`, ' : '') . '
+ `Shifts`.*,
+ @@session.time_zone AS timezone,
+ `Room`.*
+ FROM `ShiftEntry`
+ JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`)
+ JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
+ JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`)
+ WHERE `UID` = ?
+ ORDER BY `start`
+ ',
[
$userId
]
@@ -626,10 +630,10 @@ function Shifts_by_user($userId, $include_freeload_comments = false)
function Shift($shift_id)
{
$result = DB::selectOne('
- SELECT `Shifts`.*, `ShiftTypes`.`name`
- FROM `Shifts`
- JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
- WHERE `SID`=?', [$shift_id]);
+ SELECT `Shifts`.*, `ShiftTypes`.`name`
+ FROM `Shifts`
+ JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
+ WHERE `SID`=?', [$shift_id]);
if (empty($result)) {
return null;
diff --git a/includes/model/Stats.php b/includes/model/Stats.php
index e355b064..29550694 100644
--- a/includes/model/Stats.php
+++ b/includes/model/Stats.php
@@ -35,16 +35,16 @@ function stats_hours_to_work()
{
$result = Db::selectOne("
SELECT ROUND(SUM(`count`)) AS `count` FROM (
- SELECT
+ SELECT
(SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`)
* (`Shifts`.`end` - `Shifts`.`start`)/3600 AS `count`
FROM `Shifts`
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
WHERE `end` >= ?
AND s.shift_id IS NULL
-
+
UNION ALL
-
+
SELECT
(SELECT SUM(`count`) FROM `NeededAngelTypes` WHERE `NeededAngelTypes`.`room_id`=`Shifts`.`RID`)
* (`Shifts`.`end` - `Shifts`.`start`)/3600 AS `count`
@@ -77,16 +77,16 @@ function stats_angels_needed_three_hours()
SELECT
GREATEST(0,
(
- SELECT SUM(`count`)
- FROM `NeededAngelTypes`
- JOIN `AngelTypes` ON `AngelTypes`.`id`=`NeededAngelTypes`.`angel_type_id`
- WHERE `AngelTypes`.`show_on_dashboard`=TRUE
+ SELECT SUM(`count`)
+ FROM `NeededAngelTypes`
+ JOIN `AngelTypes` ON `AngelTypes`.`id`=`NeededAngelTypes`.`angel_type_id`
+ WHERE `AngelTypes`.`show_on_dashboard`=TRUE
AND `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`
) - (
- SELECT COUNT(*) FROM `ShiftEntry`
- JOIN `AngelTypes` ON `AngelTypes`.`id`=`ShiftEntry`.`TID`
- WHERE `AngelTypes`.`show_on_dashboard`=TRUE
- AND `ShiftEntry`.`SID`=`Shifts`.`SID`
+ SELECT COUNT(*) FROM `ShiftEntry`
+ JOIN `AngelTypes` ON `AngelTypes`.`id`=`ShiftEntry`.`TID`
+ WHERE `AngelTypes`.`show_on_dashboard`=TRUE
+ AND `ShiftEntry`.`SID`=`Shifts`.`SID`
AND `freeloaded`=0
)
)
@@ -95,22 +95,22 @@ function stats_angels_needed_three_hours()
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
WHERE `end` > ? AND `start` < ?
AND s.shift_id IS NULL
-
+
UNION ALL
-
+
SELECT
GREATEST(0,
(
- SELECT SUM(`count`)
- FROM `NeededAngelTypes`
- JOIN `AngelTypes` ON `AngelTypes`.`id`=`NeededAngelTypes`.`angel_type_id`
- WHERE `AngelTypes`.`show_on_dashboard`=TRUE
+ SELECT SUM(`count`)
+ FROM `NeededAngelTypes`
+ JOIN `AngelTypes` ON `AngelTypes`.`id`=`NeededAngelTypes`.`angel_type_id`
+ WHERE `AngelTypes`.`show_on_dashboard`=TRUE
AND `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
) - (
- SELECT COUNT(*) FROM `ShiftEntry`
- JOIN `AngelTypes` ON `AngelTypes`.`id`=`ShiftEntry`.`TID`
- WHERE `AngelTypes`.`show_on_dashboard`=TRUE
- AND `ShiftEntry`.`SID`=`Shifts`.`SID`
+ SELECT COUNT(*) FROM `ShiftEntry`
+ JOIN `AngelTypes` ON `AngelTypes`.`id`=`ShiftEntry`.`TID`
+ WHERE `AngelTypes`.`show_on_dashboard`=TRUE
+ AND `ShiftEntry`.`SID`=`Shifts`.`SID`
AND `freeloaded`=0
)
)
@@ -152,16 +152,16 @@ function stats_angels_needed_for_nightshifts()
SELECT
GREATEST(0,
(
- SELECT SUM(`count`)
- FROM `NeededAngelTypes`
- JOIN `AngelTypes` ON `AngelTypes`.`id`=`NeededAngelTypes`.`angel_type_id`
- WHERE `AngelTypes`.`show_on_dashboard`=TRUE
+ SELECT SUM(`count`)
+ FROM `NeededAngelTypes`
+ JOIN `AngelTypes` ON `AngelTypes`.`id`=`NeededAngelTypes`.`angel_type_id`
+ WHERE `AngelTypes`.`show_on_dashboard`=TRUE
AND `NeededAngelTypes`.`shift_id`=`Shifts`.`SID`
) - (
- SELECT COUNT(*) FROM `ShiftEntry`
- JOIN `AngelTypes` ON `AngelTypes`.`id`=`ShiftEntry`.`TID`
- WHERE `AngelTypes`.`show_on_dashboard`=TRUE
- AND `ShiftEntry`.`SID`=`Shifts`.`SID`
+ SELECT COUNT(*) FROM `ShiftEntry`
+ JOIN `AngelTypes` ON `AngelTypes`.`id`=`ShiftEntry`.`TID`
+ WHERE `AngelTypes`.`show_on_dashboard`=TRUE
+ AND `ShiftEntry`.`SID`=`Shifts`.`SID`
AND `freeloaded`=0
)
)
@@ -170,22 +170,22 @@ function stats_angels_needed_for_nightshifts()
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
WHERE `end` > ? AND `start` < ?
AND s.shift_id IS NULL
-
+
UNION ALL
-
+
SELECT
GREATEST(0,
(
- SELECT SUM(`count`)
- FROM `NeededAngelTypes`
- JOIN `AngelTypes` ON `AngelTypes`.`id`=`NeededAngelTypes`.`angel_type_id`
- WHERE `AngelTypes`.`show_on_dashboard`=TRUE
+ SELECT SUM(`count`)
+ FROM `NeededAngelTypes`
+ JOIN `AngelTypes` ON `AngelTypes`.`id`=`NeededAngelTypes`.`angel_type_id`
+ WHERE `AngelTypes`.`show_on_dashboard`=TRUE
AND `NeededAngelTypes`.`room_id`=`Shifts`.`RID`
) - (
- SELECT COUNT(*) FROM `ShiftEntry`
- JOIN `AngelTypes` ON `AngelTypes`.`id`=`ShiftEntry`.`TID`
- WHERE `AngelTypes`.`show_on_dashboard`=TRUE
- AND `ShiftEntry`.`SID`=`Shifts`.`SID`
+ SELECT COUNT(*) FROM `ShiftEntry`
+ JOIN `AngelTypes` ON `AngelTypes`.`id`=`ShiftEntry`.`TID`
+ WHERE `AngelTypes`.`show_on_dashboard`=TRUE
+ AND `ShiftEntry`.`SID`=`Shifts`.`SID`
AND `freeloaded`=0
)
)
diff --git a/includes/model/UserAngelTypes_model.php b/includes/model/UserAngelTypes_model.php
index e18eaf1b..0dcc7fb3 100644
--- a/includes/model/UserAngelTypes_model.php
+++ b/includes/model/UserAngelTypes_model.php
@@ -17,11 +17,11 @@ use Engelsystem\Models\User\User;
function UserAngelType_exists($userId, $angeltype)
{
return count(DB::select('
- SELECT `id`
- FROM `UserAngelTypes`
- WHERE `UserAngelTypes`.`user_id`=?
- AND `angeltype_id`=?
- ', [$userId, $angeltype['id']])) > 0;
+ SELECT `id`
+ FROM `UserAngelTypes`
+ WHERE `UserAngelTypes`.`user_id`=?
+ AND `angeltype_id`=?
+ ', [$userId, $angeltype['id']])) > 0;
}
/**
@@ -33,11 +33,11 @@ function UserAngelType_exists($userId, $angeltype)
function User_angeltypes($userId)
{
return DB::select('
- SELECT `AngelTypes`.*, `UserAngelTypes`.`confirm_user_id`, `UserAngelTypes`.`supporter`
- FROM `UserAngelTypes`
- JOIN `AngelTypes` ON `UserAngelTypes`.`angeltype_id` = `AngelTypes`.`id`
- WHERE `UserAngelTypes`.`user_id`=?
- ', [$userId]);
+ SELECT `AngelTypes`.*, `UserAngelTypes`.`confirm_user_id`, `UserAngelTypes`.`supporter`
+ FROM `UserAngelTypes`
+ JOIN `AngelTypes` ON `UserAngelTypes`.`angeltype_id` = `AngelTypes`.`id`
+ WHERE `UserAngelTypes`.`user_id`=?
+ ', [$userId]);
}
/**
@@ -50,16 +50,16 @@ function User_unconfirmed_AngelTypes($userId)
{
return DB::select('
SELECT
- `UserAngelTypes`.*,
- `AngelTypes`.`name`,
- count(`UnconfirmedMembers`.`user_id`) AS `count`
+ `UserAngelTypes`.*,
+ `AngelTypes`.`name`,
+ count(`UnconfirmedMembers`.`user_id`) AS `count`
FROM `UserAngelTypes`
JOIN `AngelTypes` ON `UserAngelTypes`.`angeltype_id`=`AngelTypes`.`id`
JOIN `UserAngelTypes` AS `UnconfirmedMembers` ON `UserAngelTypes`.`angeltype_id`=`UnconfirmedMembers`.`angeltype_id`
WHERE `UserAngelTypes`.`user_id`=?
- AND `UserAngelTypes`.`supporter`=TRUE
- AND `AngelTypes`.`restricted`=TRUE
- AND `UnconfirmedMembers`.`confirm_user_id` IS NULL
+ AND `UserAngelTypes`.`supporter`=TRUE
+ AND `AngelTypes`.`restricted`=TRUE
+ AND `UnconfirmedMembers`.`confirm_user_id` IS NULL
GROUP BY `UserAngelTypes`.`angeltype_id`, `UserAngelTypes`.`id`
ORDER BY `AngelTypes`.`name`
', [$userId]);
@@ -77,12 +77,12 @@ function User_is_AngelType_supporter($user, $angeltype)
$privileges = privileges_for_user($user->id);
return (count(DB::select('
- SELECT `id`
- FROM `UserAngelTypes`
- WHERE `user_id`=?
- AND `angeltype_id`=?
- AND `supporter`=TRUE
- LIMIT 1
+ SELECT `id`
+ FROM `UserAngelTypes`
+ WHERE `user_id`=?
+ AND `angeltype_id`=?
+ AND `supporter`=TRUE
+ LIMIT 1
',
[
$user->id,
@@ -101,10 +101,10 @@ function User_is_AngelType_supporter($user, $angeltype)
function UserAngelType_update($user_angeltype_id, $supporter)
{
DB::update('
- UPDATE `UserAngelTypes`
- SET `supporter`=?
- WHERE `id`=?
- LIMIT 1
+ UPDATE `UserAngelTypes`
+ SET `supporter`=?
+ WHERE `id`=?
+ LIMIT 1
', [(int)$supporter, $user_angeltype_id]);
}
@@ -116,9 +116,9 @@ function UserAngelType_update($user_angeltype_id, $supporter)
function UserAngelTypes_delete_all($angeltype_id)
{
DB::delete('
- DELETE FROM `UserAngelTypes`
- WHERE `angeltype_id`=?
- AND `confirm_user_id` IS NULL
+ DELETE FROM `UserAngelTypes`
+ WHERE `angeltype_id`=?
+ AND `confirm_user_id` IS NULL
', [$angeltype_id]);
}
@@ -131,10 +131,10 @@ function UserAngelTypes_delete_all($angeltype_id)
function UserAngelTypes_confirm_all($angeltype_id, $confirm_user_id)
{
DB::update('
- UPDATE `UserAngelTypes`
- SET `confirm_user_id`=?
- WHERE `angeltype_id`=?
- AND `confirm_user_id` IS NULL
+ UPDATE `UserAngelTypes`
+ SET `confirm_user_id`=?
+ WHERE `angeltype_id`=?
+ AND `confirm_user_id` IS NULL
', [$confirm_user_id, $angeltype_id]);
}
@@ -147,10 +147,10 @@ function UserAngelTypes_confirm_all($angeltype_id, $confirm_user_id)
function UserAngelType_confirm($user_angeltype_id, $confirm_user_id)
{
DB::update('
- UPDATE `UserAngelTypes`
- SET `confirm_user_id`=?
- WHERE `id`=?
- LIMIT 1', [$confirm_user_id, $user_angeltype_id]);
+ UPDATE `UserAngelTypes`
+ SET `confirm_user_id`=?
+ WHERE `id`=?
+ LIMIT 1', [$confirm_user_id, $user_angeltype_id]);
}
/**
@@ -161,9 +161,9 @@ function UserAngelType_confirm($user_angeltype_id, $confirm_user_id)
function UserAngelType_delete($user_angeltype)
{
DB::delete('
- DELETE FROM `UserAngelTypes`
- WHERE `id`=?
- LIMIT 1', [$user_angeltype['id']]);
+ DELETE FROM `UserAngelTypes`
+ WHERE `id`=?
+ LIMIT 1', [$user_angeltype['id']]);
}
/**
@@ -197,10 +197,10 @@ function UserAngelType_create($userId, $angeltype)
function UserAngelType($user_angeltype_id)
{
$angelType = DB::selectOne('
- SELECT *
- FROM `UserAngelTypes`
- WHERE `id`=?
- LIMIT 1', [$user_angeltype_id]);
+ SELECT *
+ FROM `UserAngelTypes`
+ WHERE `id`=?
+ LIMIT 1', [$user_angeltype_id]);
return empty($angelType) ? null : $angelType;
}
@@ -215,11 +215,11 @@ function UserAngelType($user_angeltype_id)
function UserAngelType_by_User_and_AngelType($userId, $angeltype)
{
$angelType = DB::selectOne('
- SELECT *
- FROM `UserAngelTypes`
- WHERE `user_id`=?
- AND `angeltype_id`=?
- LIMIT 1
+ SELECT *
+ FROM `UserAngelTypes`
+ WHERE `user_id`=?
+ AND `angeltype_id`=?
+ LIMIT 1
',
[
$userId,
@@ -239,9 +239,9 @@ function UserAngelType_by_User_and_AngelType($userId, $angeltype)
function UserAngelTypes_by_User($userId)
{
return DB::select('
- SELECT *
- FROM `UserAngelTypes`
- WHERE `user_id`=?
+ SELECT *
+ FROM `UserAngelTypes`
+ WHERE `user_id`=?
',
[$userId]
);
diff --git a/includes/model/UserDriverLicenses_model.php b/includes/model/UserDriverLicenses_model.php
index 1be6d4d2..e79b95ed 100644
--- a/includes/model/UserDriverLicenses_model.php
+++ b/includes/model/UserDriverLicenses_model.php
@@ -64,16 +64,16 @@ 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 (?, ?, ?, ?, ?, ?, ?)
+ 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'],
@@ -97,16 +97,16 @@ function UserDriverLicenses_create($user_driver_license, $userId)
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`=?
- ',
+ 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'],
diff --git a/includes/model/UserGroups_model.php b/includes/model/UserGroups_model.php
index 769871e9..02c4b616 100644
--- a/includes/model/UserGroups_model.php
+++ b/includes/model/UserGroups_model.php
@@ -11,12 +11,12 @@ use Engelsystem\Database\DB;
function User_groups($userId)
{
return DB::select('
- SELECT `Groups`.*
- FROM `UserGroups`
- JOIN `Groups` ON `Groups`.`UID`=`UserGroups`.`group_id`
- WHERE `UserGroups`.`uid`=?
- ORDER BY `UserGroups`.`group_id`
- ',
+ SELECT `Groups`.*
+ FROM `UserGroups`
+ JOIN `Groups` ON `Groups`.`UID`=`UserGroups`.`group_id`
+ WHERE `UserGroups`.`uid`=?
+ ORDER BY `UserGroups`.`group_id`
+ ',
[$userId]
);
}
diff --git a/includes/model/UserWorkLog_model.php b/includes/model/UserWorkLog_model.php
index e785067d..ec446119 100644
--- a/includes/model/UserWorkLog_model.php
+++ b/includes/model/UserWorkLog_model.php
@@ -30,12 +30,12 @@ function UserWorkLogsForUser($userId, Carbon $sinceTime = null)
{
return Db::select(
'
- SELECT *
- FROM `UserWorkLog`
- WHERE `user_id`=?
- ' . ($sinceTime ? 'AND work_timestamp >= ' . $sinceTime->getTimestamp() : '') . '
- ORDER BY `created_timestamp`
- ',
+ SELECT *
+ FROM `UserWorkLog`
+ WHERE `user_id`=?
+ ' . ($sinceTime ? 'AND work_timestamp >= ' . $sinceTime->getTimestamp() : '') . '
+ ORDER BY `created_timestamp`
+ ',
[
$userId
]
diff --git a/includes/model/User_model.php b/includes/model/User_model.php
index 0858c0e2..1402afe8 100644
--- a/includes/model/User_model.php
+++ b/includes/model/User_model.php
@@ -23,7 +23,7 @@ function User_tshirt_score($userId)
$result_shifts = DB::selectOne(sprintf('
SELECT ROUND((%s) / 3600, 2) AS `tshirt_score`
FROM `users` LEFT JOIN `ShiftEntry` ON `users`.`id` = `ShiftEntry`.`UID`
- LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID`
+ LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID`
WHERE `users`.`id` = ?
AND `Shifts`.`end` < ?
GROUP BY `users`.`id`
@@ -37,7 +37,7 @@ function User_tshirt_score($userId)
$result_worklog = DB::selectOne('
SELECT SUM(`work_hours`) AS `tshirt_score`
- FROM `users`
+ FROM `users`
LEFT JOIN `UserWorkLog` ON `users`.`id` = `UserWorkLog`.`user_id`
WHERE `users`.`id` = ?
AND `UserWorkLog`.`work_timestamp` < ?
@@ -281,13 +281,11 @@ function User_get_shifts_sum_query()
return sprintf('
COALESCE(SUM(
- (1 +
- (
- (HOUR(FROM_UNIXTIME(`Shifts`.`end`)) > %1$d AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) < %2$d)
- OR (HOUR(FROM_UNIXTIME(`Shifts`.`start`)) > %1$d AND HOUR(FROM_UNIXTIME(`Shifts`.`start`)) < %2$d)
- OR (HOUR(FROM_UNIXTIME(`Shifts`.`start`)) <= %1$d AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) >= %2$d)
- )
- )
+ (1 + (
+ (HOUR(FROM_UNIXTIME(`Shifts`.`end`)) > %1$d AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) < %2$d)
+ OR (HOUR(FROM_UNIXTIME(`Shifts`.`start`)) > %1$d AND HOUR(FROM_UNIXTIME(`Shifts`.`start`)) < %2$d)
+ OR (HOUR(FROM_UNIXTIME(`Shifts`.`start`)) <= %1$d AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) >= %2$d)
+ ))
* (`Shifts`.`end` - `Shifts`.`start`)
* (1 - (%3$d + 1) * `ShiftEntry`.`freeloaded`)
), 0)
diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php
index d82b8fa9..d9024e7c 100644
--- a/includes/pages/admin_active.php
+++ b/includes/pages/admin_active.php
@@ -62,8 +62,8 @@ function admin_active()
users.*,
COUNT(ShiftEntry.id) AS shift_count,
(%s + (
- SELECT COALESCE(SUM(`work_hours`) * 3600, 0) FROM `UserWorkLog` WHERE `user_id`=`users`.`id`
- AND `work_timestamp` < ?
+ SELECT COALESCE(SUM(`work_hours`) * 3600, 0) FROM `UserWorkLog` WHERE `user_id`=`users`.`id`
+ AND `work_timestamp` < ?
)) AS `shift_length`
',
$shift_sum_formula
@@ -156,8 +156,8 @@ function admin_active()
users.*,
COUNT(ShiftEntry.id) AS shift_count,
(%s + (
- SELECT COALESCE(SUM(`work_hours`) * 3600, 0) FROM `UserWorkLog` WHERE `user_id`=`users`.`id`
- AND `work_timestamp` < ?
+ SELECT COALESCE(SUM(`work_hours`) * 3600, 0) FROM `UserWorkLog` WHERE `user_id`=`users`.`id`
+ AND `work_timestamp` < ?
)) AS `shift_length`
',
$shift_sum_formula
diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php
index dbcce180..0ac87cc4 100644
--- a/includes/pages/admin_shifts.php
+++ b/includes/pages/admin_shifts.php
@@ -129,7 +129,7 @@ function admin_shifts()
$valid = false;
error(__('Please split the shift-change hours by colons.'));
}
- $shift_over_midnight = $request->has('shift_over_midnight')
+ $shift_over_midnight = $request->has('shift_over_midnight')
&& $request->input('shift_over_midnight') != 'false';
}
} else {
@@ -362,16 +362,16 @@ function admin_shifts()
$needed_angel_types_info = [];
foreach ($session->get('admin_shifts_types', []) as $type_id => $count) {
$angel_type_source = DB::selectOne('
- SELECT *
- FROM `AngelTypes`
- WHERE `id` = ?
- LIMIT 1', [$type_id]);
+ SELECT *
+ FROM `AngelTypes`
+ WHERE `id` = ?
+ LIMIT 1', [$type_id]);
if (!empty($angel_type_source)) {
DB::insert('
INSERT INTO `NeededAngelTypes` (`shift_id`, `angel_type_id`, `count`)
VALUES (?, ?, ?)
- ',
+ ',
[
$shift_id,
$type_id,
@@ -442,8 +442,8 @@ function admin_shifts()
: '00, 04, 08, 10, 12, 14, 16, 18, 20, 22'
),
form_checkbox(
- 'shift_over_midnight',
- __('Create a shift over midnight.'),
+ 'shift_over_midnight',
+ __('Create a shift over midnight.'),
$shift_over_midnight
)
]),
diff --git a/includes/pages/schedule/ImportSchedule.php b/includes/pages/schedule/ImportSchedule.php
index fa7b1b1e..f235a02e 100644
--- a/includes/pages/schedule/ImportSchedule.php
+++ b/includes/pages/schedule/ImportSchedule.php
@@ -551,19 +551,19 @@ class ImportSchedule extends BaseController
{
return $this->db->selectOne(
'
- SELECT
- s.SID AS id,
- s.title,
- s.start,
- s.end,
- s.shifttype_id AS shift_type_id,
- s.RID AS room_id,
- r.Name AS room_name,
- s.URL as url
- FROM Shifts AS s
- LEFT JOIN Room r on s.RID = r.RID
- WHERE SID = ?
- ',
+ SELECT
+ s.SID AS id,
+ s.title,
+ s.start,
+ s.end,
+ s.shifttype_id AS shift_type_id,
+ s.RID AS room_id,
+ r.Name AS room_name,
+ s.URL as url
+ FROM Shifts AS s
+ LEFT JOIN Room r on s.RID = r.RID
+ WHERE SID = ?
+ ',
[$id]
);
}
diff --git a/includes/pages/user_atom.php b/includes/pages/user_atom.php
index bbd7e7d4..dcbbed16 100644
--- a/includes/pages/user_atom.php
+++ b/includes/pages/user_atom.php
@@ -46,16 +46,16 @@ function make_atom_entries_from_news($news_entries)
$updatedAt = isset($news_entries[0]) ? $news_entries[0]->updated_at->format('Y-m-d\TH:i:sP') : '0000:00:00T00:00:00+00:00';
$html = '
-
- ' . config('app_name') . '
- ' . $request->getHttpHost()
- . htmlspecialchars(preg_replace(
- '#[&?]key=[a-f\d]{32}#',
- '',
- $request->getRequestUri()
- ))
- . '
- ' . $updatedAt . '' . "\n";
+
+' . config('app_name') . '
+' . $request->getHttpHost()
+ . htmlspecialchars(preg_replace(
+ '#[&?]key=[a-f\d]{32}#',
+ '',
+ $request->getRequestUri()
+ ))
+ . '
+' . $updatedAt . '' . "\n";
foreach ($news_entries as $news_entry) {
$html .= make_atom_entry_from_news($news_entry);
}
@@ -70,7 +70,7 @@ function make_atom_entries_from_news($news_entries)
function make_atom_entry_from_news(News $news)
{
return '
-
+
' . htmlspecialchars($news->title) . '
' . preg_replace(
@@ -80,5 +80,5 @@ function make_atom_entry_from_news(News $news)
) . '
' . $news->updated_at->format('Y-m-d\TH:i:sP') . '
' . htmlspecialchars($news->text) . '
- ' . "\n";
+' . "\n";
}
diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php
index a5fd36b3..3f2b09b9 100644
--- a/includes/pages/user_shifts.php
+++ b/includes/pages/user_shifts.php
@@ -115,9 +115,9 @@ function load_rooms()
function load_days()
{
$days = DB::select('
- SELECT DISTINCT DATE(FROM_UNIXTIME(`start`)) AS `id`, DATE(FROM_UNIXTIME(`start`)) AS `name`
- FROM `Shifts`
- ORDER BY `id`, `name`
+ SELECT DISTINCT DATE(FROM_UNIXTIME(`start`)) AS `id`, DATE(FROM_UNIXTIME(`start`)) AS `name`
+ FROM `Shifts`
+ ORDER BY `id`, `name`
');
$days = array_map('array_shift', $days);
@@ -302,8 +302,8 @@ function ical_hint()
page_link_to('user_myshifts', ['reset' => 1])
)
. ' '
+ ' . __('Show API Key') . '
+ '
. '
'
. '' . $user->api_key . '
';
}
diff --git a/includes/sys_form.php b/includes/sys_form.php
index de271eda..ed4a65c8 100644
--- a/includes/sys_form.php
+++ b/includes/sys_form.php
@@ -27,28 +27,28 @@ function form_spinner($name, $label, $value)
$value = htmlspecialchars($value);
return form_element($label, '
-
-
-
-
- ');
+
+ ');
}
/**
@@ -71,7 +71,7 @@ function form_date($name, $label, $value, $start_date = '', $end_date = '')
return form_element($label, '
- '
+ '
. '' . glyph('th') . '
', $dom_id);
diff --git a/includes/sys_template.php b/includes/sys_template.php
index 2f764309..3973c93f 100644
--- a/includes/sys_template.php
+++ b/includes/sys_template.php
@@ -1,7 +1,5 @@
0, and success if number == 0.
@@ -194,12 +192,12 @@ function toolbar_item_divider()
*/
function toolbar_dropdown($glyphicon, $label, $submenu, $class = '')
{
- return '
- '
+ return ''
+ . ''
. ($glyphicon != '' ? ' ' : '')
. $label
- . '
- '
+ . '';
}
@@ -214,22 +212,22 @@ function toolbar_dropdown($glyphicon, $label, $submenu, $class = '')
function toolbar_popover($glyphicon, $label, $content, $class = '')
{
$dom_id = md5(microtime() . $glyphicon . $label);
- return '
- '
+ return ''
+ . ''
. ($glyphicon != '' ? ' ' : '')
. $label
- . '
- ';
+ . ' '
+ . '';
}
diff --git a/includes/view/UserDriverLicenses_view.php b/includes/view/UserDriverLicenses_view.php
index 32977d31..36ad575a 100644
--- a/includes/view/UserDriverLicenses_view.php
+++ b/includes/view/UserDriverLicenses_view.php
@@ -53,23 +53,23 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
], 'driving_license'),
form_submit('submit', __('Save'))
]),
- ''
+ checkbox.click(function() {
+ if($(\'#wants_to_drive\').is(\':checked\'))
+ $(\'#driving_license\').show();
+ else
+ $(\'#driving_license\').hide();
+ });
+ });
+
+ '
]);
}
diff --git a/includes/view/User_view.php b/includes/view/User_view.php
index df06bf02..01b8758a 100644
--- a/includes/view/User_view.php
+++ b/includes/view/User_view.php
@@ -589,7 +589,7 @@ function User_view(
(config('enable_pronoun') && $user_source->personalData->pronoun)
? '
' . htmlspecialchars($user_source->personalData->pronoun) . ' '
: ''
- )
+ )
. htmlspecialchars($user_source->name)
. (config('enable_user_name') ? '
' . $user_name . '' : ''),
[
diff --git a/resources/assets/themes/error.less b/resources/assets/themes/error.less
index 99a6aacb..9968247d 100644
--- a/resources/assets/themes/error.less
+++ b/resources/assets/themes/error.less
@@ -1,6 +1,6 @@
-/* =============================================================
- Error page
- ============================================================= */
+/* =============================================================
+ Error page
+ ============================================================= */
.error-big {
text-align: center;
diff --git a/resources/assets/themes/theme0.less b/resources/assets/themes/theme0.less
index 5028ee9f..9d37f0b4 100644
--- a/resources/assets/themes/theme0.less
+++ b/resources/assets/themes/theme0.less
@@ -1,2 +1,2 @@
// light
-@import "base.less";
\ No newline at end of file
+@import "base.less";
diff --git a/resources/assets/themes/theme10.less b/resources/assets/themes/theme10.less
index 8f9fe6d7..960e7625 100644
--- a/resources/assets/themes/theme10.less
+++ b/resources/assets/themes/theme10.less
@@ -1041,13 +1041,13 @@ a.thumbnail.active {
// Specials for cccamp19 design
.navbar-brand {
- .icon-icon_angel {
- background-color: @brand-primary;
+ .icon-icon_angel {
+ background-color: @brand-primary;
}
-
+
strong {
font-weight: lighter;
- color: @brand-primary;
+ color: @brand-primary;
text-shadow:
0 0 10px @brand-primary,
0 0 20px @brand-primary,
@@ -1062,7 +1062,7 @@ h1 {
font-weight: lighter;
color: @brand-primary;
text-shadow: 0 0 10px @brand-primary;
-
+
.icon-icon_angel {
background-color: @brand-primary;
}
diff --git a/resources/assets/themes/theme11.less b/resources/assets/themes/theme11.less
index 3526c7a6..7098beda 100644
--- a/resources/assets/themes/theme11.less
+++ b/resources/assets/themes/theme11.less
@@ -1046,5 +1046,5 @@ a.thumbnail.active {
}
.panel-info .panel-title {
- color: #000;
+ color: #000;
}
diff --git a/resources/assets/themes/theme3.less b/resources/assets/themes/theme3.less
index 1a56bc4c..0bb53e09 100644
--- a/resources/assets/themes/theme3.less
+++ b/resources/assets/themes/theme3.less
@@ -41,11 +41,11 @@
@navbar-default-brand-hover-bg: #000;
.navbar {
- .bg-info {
+ .bg-info {
background-color: darken(@brand-info, 30%);
- }
+ }
.bg-danger {
- background-color: darken(@brand-danger, 30%);
+ background-color: darken(@brand-danger, 30%);
}
}
diff --git a/resources/assets/themes/theme4.less b/resources/assets/themes/theme4.less
index 486dc9d0..ea69793e 100644
--- a/resources/assets/themes/theme4.less
+++ b/resources/assets/themes/theme4.less
@@ -1044,5 +1044,5 @@ a.thumbnail.active {
.label-warning, .label-success, .progress-bar-warning, .progress-bar-success,
.panel-warning .panel-heading, .panel-warning .panel-heading a,
.panel-success .panel-heading, .panel-success .panel-heading a {
- color: @gray-darker;
+ color: @gray-darker;
}
diff --git a/resources/assets/themes/theme5.less b/resources/assets/themes/theme5.less
index e09366e7..a5a4d739 100644
--- a/resources/assets/themes/theme5.less
+++ b/resources/assets/themes/theme5.less
@@ -26,7 +26,7 @@
@state-danger-border: @brand-danger;
.label.label-warning {
- color: #000;
+ color: #000;
}
@import "base.less";
diff --git a/resources/assets/themes/theme7.less b/resources/assets/themes/theme7.less
index 24f3a048..313e697b 100644
--- a/resources/assets/themes/theme7.less
+++ b/resources/assets/themes/theme7.less
@@ -1060,7 +1060,7 @@ a.thumbnail.active {
}
.btn-primary, .panel-info .panel-heading {
- background-image: linear-gradient(to right, rgb(0, 132, 176) , rgb(0, 163, 86));
+ background-image: linear-gradient(to right, rgb(0, 132, 176) , rgb(0, 163, 86));
}
.label-warning {
diff --git a/resources/assets/themes/theme8.less b/resources/assets/themes/theme8.less
index 435424fc..f176823f 100644
--- a/resources/assets/themes/theme8.less
+++ b/resources/assets/themes/theme8.less
@@ -1041,13 +1041,13 @@ a.thumbnail.active {
// Specials for cccamp19 design
.navbar-brand {
- .icon-icon_angel {
- background-color: @brand-primary;
+ .icon-icon_angel {
+ background-color: @brand-primary;
}
-
+
strong {
font-weight: lighter;
- color: @brand-primary;
+ color: @brand-primary;
text-shadow:
0 0 10px @brand-primary,
0 0 20px @brand-primary,
@@ -1062,14 +1062,14 @@ h1 {
font-weight: lighter;
color: @brand-primary;
text-shadow: 0 0 10px @brand-primary;
-
+
.icon-icon_angel {
background-color: @brand-primary;
}
}
.panel-title {
- color: #fff;
+ color: #fff;
}
.input-group-addon {
@@ -1078,4 +1078,4 @@ h1 {
.icon-icon_angel {
background-color: #000;
}
-}
\ No newline at end of file
+}
diff --git a/resources/assets/themes/theme9.less b/resources/assets/themes/theme9.less
index 4f33798e..1cabca87 100644
--- a/resources/assets/themes/theme9.less
+++ b/resources/assets/themes/theme9.less
@@ -1041,13 +1041,13 @@ a.thumbnail.active {
// Specials for cccamp19 design
.navbar-brand {
- .icon-icon_angel {
- background-color: @brand-primary;
+ .icon-icon_angel {
+ background-color: @brand-primary;
}
-
+
strong {
font-weight: lighter;
- color: @brand-primary;
+ color: @brand-primary;
text-shadow:
0 0 10px @brand-primary,
0 0 20px @brand-primary,
@@ -1062,7 +1062,7 @@ h1 {
font-weight: lighter;
color: @brand-primary;
text-shadow: 0 0 10px @brand-primary;
-
+
.icon-icon_angel {
background-color: @brand-primary;
}
diff --git a/resources/views/pages/user-shifts.html b/resources/views/pages/user-shifts.html
index d5a98f80..e6a0b213 100644
--- a/resources/views/pages/user-shifts.html
+++ b/resources/views/pages/user-shifts.html
@@ -80,4 +80,4 @@
%ical_text%
-
\ No newline at end of file
+