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)

@ -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'; $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 = '<?xml version="1.0" encoding="utf-8"?> $html = '<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"> <feed xmlns="http://www.w3.org/2005/Atom">
<title>' . config('app_name') . '</title> <title>' . config('app_name') . '</title>
<id>' . $request->getHttpHost() <id>' . $request->getHttpHost()
. htmlspecialchars(preg_replace( . htmlspecialchars(preg_replace(
'#[&?]key=[a-f\d]{32}#', '#[&?]key=[a-f\d]{32}#',
'', '',
$request->getRequestUri() $request->getRequestUri()
)) ))
. '</id> . '</id>
<updated>' . $updatedAt . '</updated>' . "\n"; <updated>' . $updatedAt . '</updated>' . "\n";
foreach ($news_entries as $news_entry) { foreach ($news_entries as $news_entry) {
$html .= make_atom_entry_from_news($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) function make_atom_entry_from_news(News $news)
{ {
return ' return '
<entry> <entry>
<title>' . htmlspecialchars($news->title) . '</title> <title>' . htmlspecialchars($news->title) . '</title>
<link href="' . page_link_to('news/' . $news->id) . '"/> <link href="' . page_link_to('news/' . $news->id) . '"/>
<id>' . preg_replace( <id>' . preg_replace(
@ -80,5 +80,5 @@ function make_atom_entry_from_news(News $news)
) . '</id> ) . '</id>
<updated>' . $news->updated_at->format('Y-m-d\TH:i:sP') . '</updated> <updated>' . $news->updated_at->format('Y-m-d\TH:i:sP') . '</updated>
<summary type="html">' . htmlspecialchars($news->text) . '</summary> <summary type="html">' . htmlspecialchars($news->text) . '</summary>
</entry>' . "\n"; </entry>' . "\n";
} }

@ -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