Podcastpagina
This commit is contained in:
42
app/Http/Controllers/PodcastController.php
Normal file
42
app/Http/Controllers/PodcastController.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use \Illuminate\Http\Request;
|
||||
use \Model\Programma;
|
||||
|
||||
class PodcastController extends Controller
|
||||
{
|
||||
public function podcasts(Request $request, $programma)
|
||||
{
|
||||
$action = 'overzicht';
|
||||
$viewData = [];
|
||||
if((int)$programma > 0) {
|
||||
$action = 'programma/' . (int)$programma;
|
||||
$viewData['program'] = new \Model\Program($this->API('programma/details/' . (int)$programma));
|
||||
}
|
||||
|
||||
return $this->getPodcastList($request, $action, $viewData);
|
||||
}
|
||||
|
||||
private function getPodcastList(Request $request, $action, $viewData = [])
|
||||
{
|
||||
$page = (int)$request->get('pagina', 1);
|
||||
$apiResult = $this->API('podcast/' . $action . '?pagina=' . (int)max(1, $page) . '&aantal=100');
|
||||
$podcasts = [];
|
||||
foreach($apiResult->podcasts as $podcast)
|
||||
{
|
||||
$podcasts[] = new \Model\Podcast($podcast);
|
||||
}
|
||||
|
||||
return view($request->ajax() ? 'partial.podcastitems' : 'podcastseries', array_merge($viewData, ['podcasts' => $podcasts, 'searchURL' => 'gemist/zoeken']));
|
||||
}
|
||||
|
||||
public function podcast(Request $request, $id)
|
||||
{
|
||||
parent::registerView($request, 'podcast', $id);
|
||||
$apiResult = $this->API('podcast/details/' . (int)$id);
|
||||
$podcast = new \Model\Podcast($apiResult);
|
||||
return view('podcastitem', ['podcast' => $podcast, 'metadata' => $podcast->metadata]);
|
||||
}
|
||||
}
|
||||
32
resources/views/partial/podcastdirectitems.blade.php
Normal file
32
resources/views/partial/podcastdirectitems.blade.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<ul class='blog row grid'>
|
||||
@foreach($podcasts as $podcast)
|
||||
<?php
|
||||
$url = $podcast->url;
|
||||
$popoutUrl = route('luister.podcast') . $podcast->url . '?auth=' . $podcast->auth;
|
||||
?>
|
||||
<li class="post card column column_1_1">
|
||||
<div class="post_content">
|
||||
<h2><a href="{{$url}}" title="{{$podcast->title}}">{!!$podcast->titleWithoutProgram()!!}</a></h2>
|
||||
<ul class="post_details">
|
||||
<li class="date">
|
||||
{{ Formatter::relativeDate($podcast->created) }}
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
@if($podcast->image)
|
||||
<a href="{{$url}}" title="{{$podcast->title}}" class="fixed-height">
|
||||
<img src='{{$imgBase . $podcast->image->url}}' alt='{{$podcast->image->title}}'>
|
||||
</a>
|
||||
@endif
|
||||
<p>{!! $podcast->content !!}</p>
|
||||
<a class="action_button player" href="{{$popoutUrl}}">
|
||||
<span class="fa fa-external-link-alt"></span>
|
||||
<span>Luister in nieuw venster</span>
|
||||
</a>
|
||||
<span class="clearfix"></span>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@endforeach
|
||||
|
||||
</ul><!--/.row-->
|
||||
81
resources/views/podcastseries.blade.php
Normal file
81
resources/views/podcastseries.blade.php
Normal file
@@ -0,0 +1,81 @@
|
||||
@extends('layouts/sidebar')
|
||||
|
||||
@section('title')
|
||||
Fragment gemist
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
@parent
|
||||
|
||||
@if(isset($program))
|
||||
<h2>{{$program->name}}</h2>
|
||||
<p class="intro">
|
||||
{!! $program->description !!}
|
||||
</p>
|
||||
@endif
|
||||
|
||||
@if($podcasts)
|
||||
|
||||
<div class="page_layout clearfix">
|
||||
<div class="row grid" id="items">
|
||||
@include('partial.podcastdirectitems', ['podcasts' => $podcasts])
|
||||
</div><!--/.row-->
|
||||
</div>
|
||||
|
||||
<div id="loading" style="display: none">
|
||||
<div class="progress progress-striped active">
|
||||
<div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%">
|
||||
<b>Meer podcasts aan het ophalen...</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
/*
|
||||
var page = 1;
|
||||
var isLoading = 0;
|
||||
var $items = $('#items');
|
||||
var $isLoading = $('#loading');
|
||||
$(function() {
|
||||
$(window).scroll(function () {
|
||||
var $this = $(this);
|
||||
var tweak = 10;
|
||||
|
||||
if(!isLoading && (page > 0) && ($this.scrollTop() >= $items.height() - $this.height() - tweak))
|
||||
{
|
||||
isLoading = 1;
|
||||
$isLoading.show();
|
||||
$.ajax({ url: document.location.pathname + '?pagina=' + (++page) })
|
||||
.always(function() { isLoading = 0; $isLoading.hide(); })
|
||||
.done(function(data) {
|
||||
if(!data) {
|
||||
if(page > 1) $items.append("<hr /><p>Er zijn geen podcasts (meer).</p>");
|
||||
page = -1;
|
||||
return;
|
||||
}
|
||||
$newPage = $("<div />").append(data);
|
||||
$items.append($newPage);
|
||||
$newPage.find("audio, video").mediaelementplayer({ stretching: 'responsive' });
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
*/
|
||||
</script>
|
||||
@endpush
|
||||
@else
|
||||
|
||||
<p>Er zijn geen fragmenten beschikbaar.</p>
|
||||
|
||||
@endif
|
||||
|
||||
@endsection
|
||||
|
||||
@push('styles')
|
||||
<style>
|
||||
#gemist_tabs li {
|
||||
width: 50%;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
@@ -14,7 +14,7 @@
|
||||
// "24 uur Scherp de Zeis (4 december)" => "/programma/1030/scherp-zeis",
|
||||
// "Vroeger of Later Luisterlijst (21 december)" => "/vol-luisterlijst"),
|
||||
"Podcast" => array(
|
||||
"Duurzaam Gooi" => "/gemist/programma/1076/podcast-duurzaam-gooi"),
|
||||
"Duurzaam Gooi" => "/podcast/1076/podcast-duurzaam-gooi"),
|
||||
"Regioagenda" => "/agenda",
|
||||
"Over ons" => array(
|
||||
"" => "/contact",
|
||||
|
||||
@@ -60,6 +60,16 @@ Route::get('/gemist/fragment/{id}/{title}', 'RadioController@podcast')->where(['
|
||||
Route::get('/gemist/programma', 'RadioController@terugluisteren')->name('gemist.programma');
|
||||
Route::get('/gemist/programma/{programma}/{title}', 'RadioController@podcasts')->where(['programma' => '\d+']);
|
||||
|
||||
Route::get('/podcast/{programma}/{title}', 'PodcastController@podcasts')->where(['programma' => '\d+']);
|
||||
Route::get('/podcast/aflevering/{id}/{title}', 'PodcastController@podcast')->where(['id' => '\d+']);
|
||||
Route::get('/podcast/zoeken/{query}', 'RadioController@searchpodcast')->name('gemist.zoeken');
|
||||
Route::get('/podcast/zoeken', function(Illuminate\Http\Request $request) {
|
||||
if($query = $request->get('query', null)) {
|
||||
return redirect('/podcast/zoeken/' . urlencode($query));
|
||||
}
|
||||
return redirect('/podcast');
|
||||
});
|
||||
|
||||
Route::get('/kijk/live', 'StreamController@livetv')->name('kijk.live');
|
||||
Route::get('/kijk/studio', 'StreamController@studio')->name('kijk.studio');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user