Grof begin met nieuws en gids

This commit is contained in:
2020-01-15 02:31:49 +01:00
parent 3af813ca23
commit 1294824faa
7 changed files with 1545 additions and 46 deletions

View File

@@ -1,2 +1 @@
website/storage/framework glob:website/storage
website/storage/logs

View File

@@ -11,9 +11,18 @@ class NewsController extends Controller
{ {
parent::registerView($request, 'nieuws', $id); parent::registerView($request, 'nieuws', $id);
$apiResult = $this->API('nieuws/bericht/' . $id); $apiResult = $this->API('nieuws/bericht/' . $id);
$newsItem = new \Model\NewsItem($apiResult);
return view('newsitem', ['news' => $newsItem, 'meta_featuredImage' => count($newsItem->images) ? $newsItem->images[0]->url : null]); switch($apiResult->version) {
case 1:
$newsItem = new \Model\NewsItem($apiResult->news);
return view('newsitem', ['news' => $newsItem, 'meta_featuredImage' => count($newsItem->images) ? $newsItem->images[0]->url : null]);
break;
case 2:
$newsItem = $apiResult->news;
$newsItem->published = new \DateTimeImmutable('@' . $newsItem->created);
return view('newsitem_nh', ['news' => $newsItem, 'podcast' => $apiResult->podcast]);
}
} }
public function overview(Request $request) public function overview(Request $request)

View File

@@ -0,0 +1,98 @@
@extends('page')
@section('title')
Nieuws | {{$news->title}}
@endsection
@include('_mediaplayer')
@section('content')
<article class="article-content" itemscope itemtype="http://schema.org/Article">
<div class="article-header">
<div class="article-meta clearfix">
<span class="news-pubdate" data-short-date="{{Formatter::fullDate($news->published, 'w d m y')}}, {{$news->published->format("H:i")}}" datetime="{{$news->published->format('c')}}">
{{Formatter::relativeDate($news->published)}}, {{$news->published->format("H:i")}}
</span>
</div>
</div>
<h1 class="article-title" itemprop="headline">{{$news->title}}</h1>
{{--
@if($news->media && count($news->media) > 0)
@if(!$news->media[0]->title) @php($news->media[0]->title = $news->title) @endif
<div class="mediabox">
<div class="big-images owl-carousel">
<div>
<div class="mediabox-image">
<img src="{{$news->media[0]->url}}" alt="{{strip_tags($news->media[0]->title)}}" title="{{strip_tags($news->media[0]->title)}}"/>
<span class="mediabox-image-title">{{$news->media[0]->title}}</span>
</div>
</div>
</div>
<div class="thumbs owl-carousel">
@if(count($news->media) > 1) @foreach($news->media as $image)
<div>
<img src="{{$image->url}}" alt="{{strip_tags($image->title)}}" title="{{strip_tags($image->title)}}" itemprop="image"/>
</div>
@endforeach @endif
</div>
</div>
</div>
@endif
--}}
@foreach($news->blocks as $block)
@if($block->type == "text")
{!!$block->text!!}
@elseif($block->type == "intro")
<div class="intro">{!!$block->text!!}</div>
@elseif($block->type == "quote")
<blockquote>
{!!$block->text!!}
<div class="author">{{$block->name}}</div>
</blockquote>
@elseif($block->type == "image")
<div class="mediabox-image">
<img src="{{$block->image->imageWide}}" alt="{{$block->image->title}}" title="{{$block->image->title}} &copy;{{$block->image->author}}"/>
<span class="mediabox-image-title">{{$block->image->imageWide}}</span>
</div>
@elseif($block->type == "video")
<video controls>
@foreach($block->video->streams as $stream)
<source src="{!!$stream->stream_url!!}" type="application/x-mpegurl" />
@endforeach
</video>
<span class="author">{{$block->video->author}}</span>
@endif
@endforeach
@if($podcast)
<div class="left_content">
<h2>Fragment</h2>
<p>{{ Formatter::relativeDate($podcast->created) }} uitgezonden @if($podcast->program) in <a href="{{ url('radio/programma' . $podcast->program->url ) }}">{{ $podcast->program->name }}</a> @endif </p>
<p>
<audio controls>
<source src="{{ $url = url( $apiUrl . 'podcast/download/' . $podcast->url . "?auth=" . $podcast->auth )}}" type="audio/mpeg" />
</audio>
</p>
<p><a href="{{ url('/radio/gemist/fragment/' . $podcast->url) }}" class="btn btn-default">Meer over dit fragment</a></p>
</div>
@endif
<hr />
<div class="article-bottom">
<div class="row">
<div class="col-md-6 col-sm-12 pull-right">
<a href="/contact?correction=true" class="block-ctalink" rel="nofollow">Correctie melden <i class="icon-arrow-small"></i></a>
</div>
</div>
</div>
@endsection

View File

@@ -1,7 +1,7 @@
<div class="row blocks blocks-large" data-displayswitch="blocksContainer"> <div class="row blocks blocks-large" data-displayswitch="blocksContainer">
@php($i = 0) @php($i = 0)
@foreach($news as $newsItem) @foreach($news as $newsItem)
@php($image = count($newsItem->images) ? $newsItem->images[0] : null) @php($image = isset($newsItem->images) && count($newsItem->images) ? $newsItem->images[0] : null)
<div class="block block-news col-md-4 col-sm-6 col-xs-12"> <div class="block block-news col-md-4 col-sm-6 col-xs-12">
<a href="{{url($newsItem->url)}}" title="{{$image ? $image->title : $newsItem->title}}" alt="{{$image ? $image->title : $newsItem->title}}"> <a href="{{url($newsItem->url)}}" title="{{$image ? $image->title : $newsItem->title}}" alt="{{$image ? $image->title : $newsItem->title}}">

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,86 @@
@php($date = null)@php($now = new \DateTime("now")) <?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) @foreach($schedule as $item)
@if(($formattedDate = Formatter::fullDate($item['starttime'], 'W d m')) != $date) @if(($formattedDate = Formatter::fullDate($item['starttime'], 'W d m')) != $date)
@php($date = $formattedDate) @php($date = $formattedDate)
@if($date != null) </table> @endif @if($date != null) </ul> @endif
<h2>{{$formattedDate}}</h2> <h5>{{$formattedDate}}</h2>
<table class="table table-hover"> <ul class="tt_items_list thin page_margin_top timetable_clearfix">
@endif @endif
@php($isCurrent = ($now >= $item['starttime']) && ($now <= $item['endtime'])) @php($isCurrent = ($now >= $item['starttime']) && ($now <= $item['endtime']))
@php($class =( $item['program']->priority < 2 ? 'bg-primary' @php($class =( $item['program']->priority < 2 ? 'bg-primary'
@@ -12,15 +88,15 @@
:( $isCurrent ? 'bg-info active text-primary' :( $isCurrent ? 'bg-info active text-primary'
:( '' :( ''
))))) )))))
<tr @if($class) class="{{$class}}" @endif>
<td class="time"><p>{{$item['starttime']->format('H:i')}} &ndash; {{$item['endtime']->format('H:i')}} uur</p></td> <li class="timetable_clearfix">
<td class="title"> <div class="event_container">
<p><a title="{{$item['program']->name}}" href="programma{{$item['program']->url}}">{{$item['program']->name}} <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 @if($isCurrent) <span class="bg-primary current-marker">Nu op NH Gooi</span> @endif
</a><p> <p>
<p>{{Formatter::excerpt(strip_tags($item['program']->description), 200)}}</p> <p>{{Formatter::excerpt(strip_tags($item['program']->description), 200)}}</p>
</td> </td>
</tr> </tr>
@endforeach @endforeach
</table> </ul>

View File

@@ -11,7 +11,7 @@
| |
*/ */
Route::get('/', function() { return redirect()->route('/radio/gemist'); }); Route::get('/', function() { return redirect()->route('gemist'); });
Route::get('/nieuws', 'NewsController@overview'); Route::get('/nieuws', 'NewsController@overview');
Route::get('/nieuws/regio/{region}', 'NewsController@regionlist' )->where(['region' => '[a-z0-9]+']); Route::get('/nieuws/regio/{region}', 'NewsController@regionlist' )->where(['region' => '[a-z0-9]+']);