Styled pages missed program and fragment missed
This commit is contained in:
@@ -131,6 +131,19 @@ class Controller extends BaseController
|
||||
return json_decode(file_get_contents($this->API_URL . $url, false, stream_context_create($arrContextOptions)));
|
||||
}
|
||||
|
||||
protected function checkAPI($url)
|
||||
{
|
||||
return $this->get_http_response_code($this->API_URL . $url);
|
||||
}
|
||||
|
||||
protected function get_http_response_code($url)
|
||||
{
|
||||
$headers = get_headers($url);
|
||||
return substr($headers[0], 9, 3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected static function JsonToDateTime($obj)
|
||||
{
|
||||
return new \DateTime($obj->date, new \DateTimeZone($obj->timezone));
|
||||
|
||||
@@ -15,7 +15,7 @@ class PodcastController extends Controller
|
||||
$action = 'programma/' . (int)$programma;
|
||||
$viewData['program'] = new \Model\Program($this->API('programma/details/' . (int)$programma));
|
||||
}
|
||||
|
||||
|
||||
return $this->getPodcastList($request, $action, $viewData);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,12 @@ class RadioController extends Controller
|
||||
return view('radioprogram', ['program' => new \Model\Program($apiResult)]);
|
||||
}
|
||||
|
||||
public function podcast(Request $request, $id)
|
||||
public function podcast(Request $request, $id, $title = '')
|
||||
{
|
||||
if($this->checkAPI('podcast/details/' . (int)$id) != "200"){
|
||||
return view('podcastitem', array_merge($this->getSidebareData(), ['title' => $title, 'podcast' => null, 'metadata' => null, 'related' => [], 'searchURL' => 'gemist/zoeken']));
|
||||
}
|
||||
|
||||
parent::registerView($request, 'podcast', $id);
|
||||
$apiResult = $this->API('podcast/details/' . (int)$id);
|
||||
$podcast = new \Model\Podcast($apiResult);
|
||||
@@ -69,7 +73,7 @@ class RadioController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
return view('podcastitem', array_merge($this->getSidebareData(), ['podcast' => $podcast, 'metadata' => $podcast->metadata, 'related' => $related, 'searchURL' => 'gemist/zoeken']));
|
||||
return view('podcastitem', array_merge($this->getSidebareData(), ['title' => $title, 'podcast' => $podcast, 'metadata' => $podcast->metadata, 'related' => $related, 'searchURL' => 'gemist/zoeken']));
|
||||
}
|
||||
|
||||
public function podcasts(Request $request, $programma = null)
|
||||
@@ -93,7 +97,8 @@ class RadioController extends Controller
|
||||
{
|
||||
$programs = [];
|
||||
$now = new \DateTimeImmutable('2 minutes ago');
|
||||
$apiResult = $this->API('programma/schema/recent');
|
||||
$page = (int)$request->get('pagina', 1);
|
||||
$apiResult = $this->API('programma/schema/recent?pagina=' . (int)max(1, $page) . '&aantal=12');
|
||||
foreach($apiResult->schedule as $item) {
|
||||
if(!$item->program->nonstop && !$item->program->rerun) {
|
||||
$item->start = self::JsonToDateTime($item->start);
|
||||
@@ -104,7 +109,7 @@ class RadioController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
return view('programlist', array_merge($this->getSidebareData(), ['programs' => array_reverse($programs)]));
|
||||
return view($request->ajax() ? 'partial/programitems' : 'programlist', ['programs' => array_reverse($programs)]);
|
||||
}
|
||||
|
||||
private function getPodcastList(Request $request, $action, $viewData = [])
|
||||
@@ -117,7 +122,7 @@ class RadioController extends Controller
|
||||
$podcasts[] = new \Model\Podcast($podcast);
|
||||
}
|
||||
|
||||
return view($request->ajax() ? 'partial.podcastitems' : 'podcastlist', array_merge($viewData, ['podcasts' => $podcasts, 'searchURL' => 'gemist/zoeken']));
|
||||
return view($request->ajax() ? 'partial/podcastitems' : 'podcastlist', array_merge($viewData, ['id' => 'items-podcasts', 'podcasts' => $podcasts, 'searchURL' => 'gemist/zoeken']));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user