103 lines
3.2 KiB
PHP
103 lines
3.2 KiB
PHP
<?php
|
|
$dates = array();
|
|
$byStartTime = array();
|
|
|
|
foreach($schedule as $item):
|
|
$date = $item['starttime'];
|
|
$time = $item['starttime']->format('H:i');
|
|
$item['enddate'] = Formatter::fullDate($item['endtime'], 'W d m');
|
|
while(true) {
|
|
$formattedDate = Formatter::fullDate($date, 'W d m');
|
|
$dates[$formattedDate] = null;
|
|
|
|
if(array_key_exists($time, $byStartTime)) {
|
|
$byStartTime[$time][$formattedDate] = $item;
|
|
} else {
|
|
$byStartTime[$time] = array($formattedDate => $item);
|
|
}
|
|
|
|
if($formattedDate == $item['enddate']) { break; }
|
|
|
|
$date->add(new DateInterval('P1D'));
|
|
$time = '00:00';
|
|
}
|
|
endforeach;
|
|
|
|
$dates = array_keys($dates);
|
|
$now = new \DateTime("now");
|
|
?>
|
|
|
|
<table class="tt_timetable">
|
|
<thead>
|
|
<tr class="row_gray" style="background-color: #F0F0F0 !important;">
|
|
<th></th>
|
|
@for($d = 0; $d < 7; ++$d)
|
|
<th>{{$dates[$d]}}</th>
|
|
@endfor
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@for($h = 0; $h < 24; $h += 0.5)
|
|
<tr class="{{$h == (int)$h ? "" : "row_gray"}}">
|
|
<td class="tt_hours_column">
|
|
{{$time = gmdate("H:i", $h * 3600)}} uur
|
|
</td>
|
|
@for($d = 0; $d < 7; ++$d)
|
|
@php($date = $dates[$d])
|
|
@if(isset($byStartTime[$time][$date]))
|
|
<?php
|
|
$item = $byStartTime[$time][$date];
|
|
$duration = ($date == $item['enddate'])
|
|
? ($item['endtime']->format('H') - $h)
|
|
: (24 - $h);
|
|
$slots = 2 * $duration;
|
|
?>
|
|
<td class="event" rowspan="{{$slots}}">
|
|
<div class="event_container tt_tooltip" style="height: {{$slots * 20}}px;">
|
|
<a class="event_header" href="#" title="{{$item['program']->name}}">{{$item['program']->name}}</a>
|
|
<div>{!!Formatter::excerpt($item['program']->description, 200)!!}</div>
|
|
<!-- <div class="tt_tooltip_text" style="width: 400px; height: 300px; top: -116px; left: 0px;">
|
|
<div class="tt_tooltip_content">
|
|
<b>{{$item['program']->name}}</b> <br/>
|
|
{!!Formatter::excerpt($item['program']->description, 200)!!}
|
|
</div>
|
|
<div class="tt_tooltip_arrow"></div>
|
|
</div> -->
|
|
</div>
|
|
|
|
</td>
|
|
@endif
|
|
@endfor
|
|
</tr>
|
|
@endfor
|
|
</tbody>
|
|
</table>
|
|
|
|
<div class="responsive">
|
|
@php($date = null)
|
|
@foreach($schedule as $item)
|
|
@if(($formattedDate = Formatter::fullDate($item['starttime'], 'W d m')) != $date)
|
|
@php($date = $formattedDate)
|
|
@if($date != null) </ul> @endif
|
|
<h5>{{$formattedDate}}</h2>
|
|
<ul class="tt_items_list thin page_margin_top timetable_clearfix">
|
|
@endif
|
|
@php($isCurrent = ($now >= $item['starttime']) && ($now <= $item['endtime']))
|
|
@php($class =( $item['program']->priority < 2 ? 'bg-primary'
|
|
:( $item['program']->nonstop || $item['program']->rerun ? 'text-muted'
|
|
:( $isCurrent ? 'bg-info active text-primary'
|
|
:( ''
|
|
)))))
|
|
|
|
<li class="timetable_clearfix">
|
|
<div class="event_container">
|
|
<a href="#" title="{{$item['program']->name}}" class="event_header">{{$item['program']->name}} </a>
|
|
@if($isCurrent) <span class="bg-primary current-marker">Nu op NH Gooi</span> @endif
|
|
<p>
|
|
<p>{{Formatter::excerpt(strip_tags($item['program']->description), 200)}}</p>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</ul>
|
|
|