File formatting fixes
This commit is contained in:
parent
a33298c3ce
commit
390db395a6
|
@ -69,7 +69,8 @@ function AngelType_update($angeltype)
|
|||
`contact_dect` = ?,
|
||||
`contact_email` = ?,
|
||||
`show_on_dashboard` = ?
|
||||
WHERE `id` = ?',
|
||||
WHERE `id` = ?
|
||||
',
|
||||
[
|
||||
$angeltype['name'],
|
||||
(int)$angeltype['restricted'],
|
||||
|
@ -207,7 +208,8 @@ function AngelTypes()
|
|||
return DB::select('
|
||||
SELECT *
|
||||
FROM `AngelTypes`
|
||||
ORDER BY `name`');
|
||||
ORDER BY `name`
|
||||
');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -59,7 +59,8 @@ function ShiftEntries_by_shift($shift_id)
|
|||
FROM `ShiftEntry`
|
||||
JOIN `users` ON `ShiftEntry`.`UID`=`users`.`id`
|
||||
JOIN `AngelTypes` ON `ShiftEntry`.`TID`=`AngelTypes`.`id`
|
||||
WHERE `ShiftEntry`.`SID` = ?',
|
||||
WHERE `ShiftEntry`.`SID` = ?
|
||||
',
|
||||
[$shift_id]
|
||||
);
|
||||
}
|
||||
|
@ -124,7 +125,8 @@ function ShiftEntry_update($shift_entry)
|
|||
`Comment` = ?,
|
||||
`freeload_comment` = ?,
|
||||
`freeloaded` = ?
|
||||
WHERE `id` = ?',
|
||||
WHERE `id` = ?
|
||||
',
|
||||
[
|
||||
$shift_entry['Comment'],
|
||||
$shift_entry['freeload_comment'],
|
||||
|
|
|
@ -91,7 +91,8 @@ function Shifts_by_room($room)
|
|||
*/
|
||||
function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
||||
{
|
||||
$sql = 'SELECT * FROM (
|
||||
$sql = '
|
||||
SELECT * FROM (
|
||||
SELECT DISTINCT `Shifts`.*, `ShiftTypes`.`name`, `Room`.`Name` AS `room_name`
|
||||
FROM `Shifts`
|
||||
JOIN `Room` USING (`RID`)
|
||||
|
@ -116,9 +117,11 @@ function Shifts_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|||
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
|
||||
AND NOT s.shift_id IS NULL
|
||||
) AS tmp_shifts
|
||||
|
||||
ORDER BY `room_name`, `start`';
|
||||
ORDER BY `room_name`, `start`
|
||||
';
|
||||
|
||||
return DB::select(
|
||||
$sql,
|
||||
|
@ -168,7 +171,8 @@ function NeededAngeltypes_by_ShiftsFilter(ShiftsFilter $shiftsFilter)
|
|||
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';
|
||||
AND NOT s.shift_id IS NULL
|
||||
';
|
||||
|
||||
return DB::select(
|
||||
$sql,
|
||||
|
|
|
@ -281,13 +281,11 @@ function User_get_shifts_sum_query()
|
|||
|
||||
return sprintf('
|
||||
COALESCE(SUM(
|
||||
(1 +
|
||||
(
|
||||
(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)
|
||||
|
|
|
@ -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 = '<?xml version="1.0" encoding="utf-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<title>' . config('app_name') . '</title>
|
||||
<id>' . $request->getHttpHost()
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<title>' . config('app_name') . '</title>
|
||||
<id>' . $request->getHttpHost()
|
||||
. htmlspecialchars(preg_replace(
|
||||
'#[&?]key=[a-f\d]{32}#',
|
||||
'',
|
||||
$request->getRequestUri()
|
||||
))
|
||||
. '</id>
|
||||
<updated>' . $updatedAt . '</updated>' . "\n";
|
||||
<updated>' . $updatedAt . '</updated>' . "\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 '
|
||||
<entry>
|
||||
<entry>
|
||||
<title>' . htmlspecialchars($news->title) . '</title>
|
||||
<link href="' . page_link_to('news/' . $news->id) . '"/>
|
||||
<id>' . preg_replace(
|
||||
|
@ -80,5 +80,5 @@ function make_atom_entry_from_news(News $news)
|
|||
) . '</id>
|
||||
<updated>' . $news->updated_at->format('Y-m-d\TH:i:sP') . '</updated>
|
||||
<summary type="html">' . htmlspecialchars($news->text) . '</summary>
|
||||
</entry>' . "\n";
|
||||
</entry>' . "\n";
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
|
||||
use Engelsystem\Renderer\Twig\Extensions\Assets;
|
||||
|
||||
/**
|
||||
* Render a stat for dashborad (big number with label).
|
||||
* 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 = '')
|
||||
{
|
||||
return '<li class="dropdown ' . $class . '">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">'
|
||||
return '<li class="dropdown ' . $class . '">'
|
||||
. '<a href="#" class="dropdown-toggle" data-toggle="dropdown">'
|
||||
. ($glyphicon != '' ? '<span class="glyphicon glyphicon-' . $glyphicon . '"></span> ' : '')
|
||||
. $label
|
||||
. ' <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu" role="menu">'
|
||||
. '<span class="caret"></span></a>'
|
||||
. '<ul class="dropdown-menu" role="menu">'
|
||||
. join("\n", $submenu)
|
||||
. '</ul></li>';
|
||||
}
|
||||
|
@ -214,12 +212,12 @@ function toolbar_dropdown($glyphicon, $label, $submenu, $class = '')
|
|||
function toolbar_popover($glyphicon, $label, $content, $class = '')
|
||||
{
|
||||
$dom_id = md5(microtime() . $glyphicon . $label);
|
||||
return '<li class="dropdown messages ' . $class . '">
|
||||
<a id="' . $dom_id . '" href="#" tabindex="0">'
|
||||
return '<li class="dropdown messages ' . $class . '">'
|
||||
. '<a id="' . $dom_id . '" href="#" tabindex="0">'
|
||||
. ($glyphicon != '' ? '<span class="glyphicon glyphicon-' . $glyphicon . '"></span> ' : '')
|
||||
. $label
|
||||
. ' <span class="caret"></span></a>
|
||||
<script type="text/javascript">
|
||||
. ' <span class="caret"></span></a>'
|
||||
. '<script type="text/javascript">
|
||||
$(function(){
|
||||
$(\'#' . $dom_id . '\').popover({
|
||||
trigger: \'click\',
|
||||
|
|
|
@ -53,7 +53,8 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
|
|||
], 'driving_license'),
|
||||
form_submit('submit', __('Save'))
|
||||
]),
|
||||
'<script type="text/javascript">
|
||||
'
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var checkbox = $(\'#wants_to_drive\');
|
||||
if(checkbox.is(\':checked\'))
|
||||
|
@ -61,15 +62,14 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
|
|||
else
|
||||
$(\'#driving_license\').hide();
|
||||
|
||||
checkbox.click(
|
||||
function() {
|
||||
checkbox.click(function() {
|
||||
if($(\'#wants_to_drive\').is(\':checked\'))
|
||||
$(\'#driving_license\').show();
|
||||
else
|
||||
$(\'#driving_license\').hide();
|
||||
}
|
||||
);
|
||||
});
|
||||
</script>'
|
||||
});
|
||||
</script>
|
||||
'
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue