Added radio page
This commit is contained in:
@@ -7,32 +7,47 @@ use \Model\Programma;
|
||||
|
||||
class RadioController extends Controller
|
||||
{
|
||||
public function schedule(Request $request, $shiftWeeks = 0)
|
||||
public function schedule(Request $request, $date = '')
|
||||
{
|
||||
$apiResult = $this->API('programma/schema/week/' . (int)$shiftWeeks);
|
||||
$apiResult = $this->API('programma/schema/week/0');
|
||||
$start = self::JsonToDateTime($apiResult->startdate);
|
||||
$end = self::JsonToDateTime($apiResult->enddate);
|
||||
$schedule = [];
|
||||
foreach($apiResult->schedule as $program)
|
||||
{
|
||||
$schedule[] = [
|
||||
$schedule[self::JsonToDateTime($program->start)->format('Ymd')][] = [
|
||||
'starttime' => self::JsonToDateTime($program->start),
|
||||
'endtime' => self::JsonToDateTime($program->end),
|
||||
'shift' => (int)$shiftWeeks,
|
||||
'shift' => 0,
|
||||
'program' => new \Model\Program($program->program)
|
||||
];
|
||||
}
|
||||
|
||||
return view($request->ajax() ? 'radioscheduleweek' : 'radioschedule', ['start' => $start, 'end' => $end, 'schedule' => $schedule, 'shift' => $shiftWeeks]);
|
||||
if ($date) {
|
||||
$days = [
|
||||
'custom' => (new \DateTime($date))->format('Ymd'),
|
||||
];
|
||||
} else {
|
||||
$days = [
|
||||
'day_before_yesterday' => (new \DateTime("-2 day"))->format('Ymd'),
|
||||
'yesterday' => (new \DateTime("yesterday"))->format('Ymd'),
|
||||
'today' => (new \DateTime("now"))->format('Ymd'),
|
||||
'tomorrow' => (new \DateTime("+1 day"))->format('Ymd'),
|
||||
'day_after_tomorrow' => (new \DateTime("+2 day"))->format('Ymd'),
|
||||
'custom' => (new \DateTime($date))->format('Ymd'),
|
||||
];
|
||||
}
|
||||
|
||||
return view($request->ajax() ? 'partial/radioscheduleweek' : 'radioschedule', ['start' => $start, 'end' => $end, 'schedule' => $schedule, 'shift' => 0, 'days' => $days, 'date' => $date]);
|
||||
}
|
||||
|
||||
|
||||
public function onair()
|
||||
{
|
||||
$data = $this->API('programma/schema/onair');
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
public function program($id)
|
||||
public function program($id)
|
||||
{
|
||||
$apiResult = $this->API('programma/details/' . (int)$id);
|
||||
return view('radioprogram', ['program' => new \Model\Program($apiResult)]);
|
||||
@@ -45,7 +60,7 @@ class RadioController extends Controller
|
||||
$podcast = new \Model\Podcast($apiResult);
|
||||
|
||||
$related = [];
|
||||
if($podcast->program != null)
|
||||
if($podcast->program != null)
|
||||
{
|
||||
$apiRelated = $this->API("podcast/programma/{$podcast->program->id}?date={$podcast->created->format('Y-m-d')}");
|
||||
foreach($apiRelated->podcasts as $relatedItem)
|
||||
@@ -54,7 +69,7 @@ class RadioController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
return view('podcastitem', ['podcast' => $podcast, 'metadata' => $podcast->metadata, 'related' => $related, 'searchURL' => 'gemist/zoeken']);
|
||||
return view('podcastitem', array_merge($this->getSidebareData(), ['podcast' => $podcast, 'metadata' => $podcast->metadata, 'related' => $related, 'searchURL' => 'gemist/zoeken']));
|
||||
}
|
||||
|
||||
public function podcasts(Request $request, $programma = null)
|
||||
@@ -65,14 +80,14 @@ class RadioController extends Controller
|
||||
$action = 'programma/' . (int)$programma;
|
||||
$viewData['program'] = new \Model\Program($this->API('programma/details/' . (int)$programma));
|
||||
}
|
||||
|
||||
return $this->getPodcastList($request, $action, $viewData);
|
||||
|
||||
return $this->getPodcastList($request, $action, array_merge($this->getSidebareData(), $viewData));
|
||||
}
|
||||
|
||||
public function searchpodcast(Request $request, $query)
|
||||
{
|
||||
return $this->getPodcastList($request, 'zoeken/' . $query)->with('query', urldecode($query));
|
||||
}
|
||||
}
|
||||
|
||||
public function terugluisteren(Request $request)
|
||||
{
|
||||
@@ -89,9 +104,9 @@ class RadioController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
return view('programlist', ['programs' => array_reverse($programs)]);
|
||||
return view('programlist', array_merge($this->getSidebareData(), ['programs' => array_reverse($programs)]));
|
||||
}
|
||||
|
||||
|
||||
private function getPodcastList(Request $request, $action, $viewData = [])
|
||||
{
|
||||
$page = (int)$request->get('pagina', 1);
|
||||
|
||||
Reference in New Issue
Block a user