File formatting fixes

main
Igor Scheller 5 years ago committed by msquare
parent a33298c3ce
commit 390db395a6

@ -69,7 +69,8 @@ function AngelType_update($angeltype)
`contact_dect` = ?, `contact_dect` = ?,
`contact_email` = ?, `contact_email` = ?,
`show_on_dashboard` = ? `show_on_dashboard` = ?
WHERE `id` = ?', WHERE `id` = ?
',
[ [
$angeltype['name'], $angeltype['name'],
(int)$angeltype['restricted'], (int)$angeltype['restricted'],
@ -207,7 +208,8 @@ function AngelTypes()
return DB::select(' return DB::select('
SELECT * SELECT *
FROM `AngelTypes` FROM `AngelTypes`
ORDER BY `name`'); ORDER BY `name`
');
} }
/** /**

@ -59,7 +59,8 @@ function ShiftEntries_by_shift($shift_id)
FROM `ShiftEntry` FROM `ShiftEntry`
JOIN `users` ON `ShiftEntry`.`UID`=`users`.`id` JOIN `users` ON `ShiftEntry`.`UID`=`users`.`id`
JOIN `AngelTypes` ON `ShiftEntry`.`TID`=`AngelTypes`.`id` JOIN `AngelTypes` ON `ShiftEntry`.`TID`=`AngelTypes`.`id`
WHERE `ShiftEntry`.`SID` = ?', WHERE `ShiftEntry`.`SID` = ?
',
[$shift_id] [$shift_id]
); );
} }
@ -124,7 +125,8 @@ function ShiftEntry_update($shift_entry)
`Comment` = ?, `Comment` = ?,
`freeload_comment` = ?, `freeload_comment` = ?,
`freeloaded` = ? `freeloaded` = ?
WHERE `id` = ?', WHERE `id` = ?
',
[ [
$shift_entry['Comment'], $shift_entry['Comment'],
$shift_entry['freeload_comment'], $shift_entry['freeload_comment'],

@ -91,7 +91,8 @@ function Shifts_by_room($room)
*/ */
function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter) function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
{ {
$sql = 'SELECT * FROM ( $sql = '
SELECT * FROM (
SELECT DISTINCT `Shifts`.*, `ShiftTypes`.`name`, `Room`.`Name` AS `room_name` SELECT DISTINCT `Shifts`.*, `ShiftTypes`.`name`, `Room`.`Name` AS `room_name`
FROM `Shifts` FROM `Shifts`
JOIN `Room` USING (`RID`) JOIN `Room` USING (`RID`)
@ -116,9 +117,11 @@ function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
AND `start` BETWEEN ? AND ? AND `start` BETWEEN ? AND ?
AND `NeededAngelTypes`.`angel_type_id` IN (' . implode(',', $shiftsFilter->getTypes()) . ') AND `NeededAngelTypes`.`angel_type_id` IN (' . implode(',', $shiftsFilter->getTypes()) . ')
AND `NeededAngelTypes`.`count` > 0 AND `NeededAngelTypes`.`count` > 0
AND NOT s.shift_id IS NULL) AS tmp_shifts AND NOT s.shift_id IS NULL
) AS tmp_shifts
ORDER BY `room_name`, `start`'; ORDER BY `room_name`, `start`
';
return DB::select( return DB::select(
$sql, $sql,
@ -168,7 +171,8 @@ function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id LEFT JOIN schedule_shift AS s on Shifts.SID = s.shift_id
WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ') WHERE `Shifts`.`RID` IN (' . implode(',', $shiftsFilter->getRooms()) . ')
AND `start` BETWEEN ? AND ? AND `start` BETWEEN ? AND ?
AND NOT s.shift_id IS NULL'; AND NOT s.shift_id IS NULL
';
return DB::select( return DB::select(
$sql, $sql,

@ -281,13 +281,11 @@ function User_get_shifts_sum_query()
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)
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`.`start`)) < %2$d)
OR (HOUR(FROM_UNIXTIME(`Shifts`.`start`)) <= %1$d AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) >= %2$d) OR (HOUR(FROM_UNIXTIME(`Shifts`.`start`)) <= %1$d AND HOUR(FROM_UNIXTIME(`Shifts`.`end`)) >= %2$d)
) ))
)
* (`Shifts`.`end` - `Shifts`.`start`) * (`Shifts`.`end` - `Shifts`.`start`)
* (1 - (%3$d + 1) * `ShiftEntry`.`freeloaded`) * (1 - (%3$d + 1) * `ShiftEntry`.`freeloaded`)
), 0) ), 0)

@ -1,7 +1,5 @@
<?php <?php
use Engelsystem\Renderer\Twig\Extensions\Assets;
/** /**
* Render a stat for dashborad (big number with label). * Render a stat for dashborad (big number with label).
* If no style given, style is danger if number > 0, and success if number == 0. * If no style given, style is danger if number > 0, and success if number == 0.
@ -194,12 +192,12 @@ function toolbar_item_divider()
*/ */
function toolbar_dropdown($glyphicon, $label, $submenu, $class = '') function toolbar_dropdown($glyphicon, $label, $submenu, $class = '')
{ {
return '<li class="dropdown ' . $class . '"> return '<li class="dropdown ' . $class . '">'
<a href="#" class="dropdown-toggle" data-toggle="dropdown">' . '<a href="#" class="dropdown-toggle" data-toggle="dropdown">'
. ($glyphicon != '' ? '<span class="glyphicon glyphicon-' . $glyphicon . '"></span> ' : '') . ($glyphicon != '' ? '<span class="glyphicon glyphicon-' . $glyphicon . '"></span> ' : '')
. $label . $label
. ' <span class="caret"></span></a> . '<span class="caret"></span></a>'
<ul class="dropdown-menu" role="menu">' . '<ul class="dropdown-menu" role="menu">'
. join("\n", $submenu) . join("\n", $submenu)
. '</ul></li>'; . '</ul></li>';
} }
@ -214,12 +212,12 @@ function toolbar_dropdown($glyphicon, $label, $submenu, $class = '')
function toolbar_popover($glyphicon, $label, $content, $class = '') function toolbar_popover($glyphicon, $label, $content, $class = '')
{ {
$dom_id = md5(microtime() . $glyphicon . $label); $dom_id = md5(microtime() . $glyphicon . $label);
return '<li class="dropdown messages ' . $class . '"> return '<li class="dropdown messages ' . $class . '">'
<a id="' . $dom_id . '" href="#" tabindex="0">' . '<a id="' . $dom_id . '" href="#" tabindex="0">'
. ($glyphicon != '' ? '<span class="glyphicon glyphicon-' . $glyphicon . '"></span> ' : '') . ($glyphicon != '' ? '<span class="glyphicon glyphicon-' . $glyphicon . '"></span> ' : '')
. $label . $label
. ' <span class="caret"></span></a> . ' <span class="caret"></span></a>'
<script type="text/javascript"> . '<script type="text/javascript">
$(function(){ $(function(){
$(\'#' . $dom_id . '\').popover({ $(\'#' . $dom_id . '\').popover({
trigger: \'click\', trigger: \'click\',

@ -53,7 +53,8 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
], 'driving_license'), ], 'driving_license'),
form_submit('submit', __('Save')) form_submit('submit', __('Save'))
]), ]),
'<script type="text/javascript"> '
<script type="text/javascript">
$(function() { $(function() {
var checkbox = $(\'#wants_to_drive\'); var checkbox = $(\'#wants_to_drive\');
if(checkbox.is(\':checked\')) if(checkbox.is(\':checked\'))
@ -61,15 +62,14 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
else else
$(\'#driving_license\').hide(); $(\'#driving_license\').hide();
checkbox.click( checkbox.click(function() {
function() {
if($(\'#wants_to_drive\').is(\':checked\')) if($(\'#wants_to_drive\').is(\':checked\'))
$(\'#driving_license\').show(); $(\'#driving_license\').show();
else else
$(\'#driving_license\').hide(); $(\'#driving_license\').hide();
}
);
}); });
</script>' });
</script>
'
]); ]);
} }

Loading…
Cancel
Save