Beelden toegevoegd
This commit is contained in:
51
app/Http/Controllers/ImagesController.php
Normal file
51
app/Http/Controllers/ImagesController.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use \Model\NewsItem;
|
||||
|
||||
class ImagesController extends Controller
|
||||
{
|
||||
private static function TimestampToDateTime($timestamp) {
|
||||
$result = new \DateTime;
|
||||
$result->setTimestamp($timestamp);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
$apiResult = $this->API('beelden/details/' . $id);
|
||||
$imagesItem = new \Model\NewsItem($apiResult->images);
|
||||
|
||||
return view('imagesitem', ['images' => $imagesItem, 'metadata' => $imagesItem->metadata]);
|
||||
}
|
||||
|
||||
public function overview(Request $request)
|
||||
{
|
||||
return $this->listImages($request, 'overzicht');
|
||||
}
|
||||
|
||||
public function regionlist(Request $request, $region)
|
||||
{
|
||||
return $this->listImages($request, 'regio/' . $region, ucfirst($region));
|
||||
}
|
||||
|
||||
public function themelist(Request $request, $theme)
|
||||
{
|
||||
return $this->listImages($request, 'thema/' . $theme, ucfirst($theme));
|
||||
}
|
||||
|
||||
private function listImages(Request $request, $url, $title = null)
|
||||
{
|
||||
$page = (int)$request->get('pagina', 1);
|
||||
$apiResult = $this->API('beelden/' . $url . '?pagina=' . (int)max(1, $page));
|
||||
$images = [];
|
||||
foreach($apiResult->items as $imagesItem)
|
||||
{
|
||||
$images[] = new \Model\NewsItem($imagesItem);
|
||||
}
|
||||
|
||||
return view($request->ajax() ? 'partial/imageslist_small' : 'imageslist', ['title' => $title, 'images' => $images]);
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,14 @@ $img = $data[0];
|
||||
?>
|
||||
<h4 class="page_margin_top box_header"><span class="fa fa-camera"></span> Beelden uit 't Gooi</h4>
|
||||
|
||||
<div class='featured'>
|
||||
<div class='featured' style='display: none;'>
|
||||
<p>
|
||||
<img src="images/logo.png" alt="{{$img->images[0]->title}}" title="{{$img->images[0]->title}}" />
|
||||
<a href="{{ route('beelden') }}"><img src="images/logo.png" alt="{{$img->images[0]->title}}" title="{{$img->images[0]->title}}" /></a>
|
||||
<b>{{ $img->title }}</b>
|
||||
{{ $img->images[0]->title }}
|
||||
</p>
|
||||
<p class='bouwmee'><a href="mailto:beelden@nhgooi.nl">Uw foto hier? Mail naar beelden@nhgooi.nl!</a></p>
|
||||
</div>
|
||||
<p class='bouwmee'><a href="mailto:beelden@nhgooi.nl">Uw foto hier? Mail naar beelden@nhgooi.nl!</a></p>
|
||||
|
||||
<style>
|
||||
.featured {
|
||||
@@ -23,6 +23,8 @@ $img = $data[0];
|
||||
}
|
||||
.featured img {
|
||||
width: 100%;
|
||||
max-height: 300px;
|
||||
object-fit: cover;
|
||||
}
|
||||
.featured p, .featured a {
|
||||
font-size: 90%;
|
||||
@@ -31,7 +33,7 @@ $img = $data[0];
|
||||
color: #3A3A3A;
|
||||
text-align: center;
|
||||
}
|
||||
.featured .bouwmee {
|
||||
a.bouwmee {
|
||||
color: #3333CC;
|
||||
}
|
||||
</style>
|
||||
@@ -39,11 +41,12 @@ $img = $data[0];
|
||||
@push('scripts')
|
||||
<script>
|
||||
$(function() {
|
||||
$('.featured').hide().attr('display', '');
|
||||
$('.featured img')
|
||||
.load(function() {
|
||||
$('.featured').slideDown();
|
||||
})
|
||||
.attr('src', '{{$imgBase . $img->images[0]->url}}');
|
||||
.load(function() {
|
||||
$('.featured').slideDown();
|
||||
})
|
||||
.attr('src', '{{$imgBase . $img->images[0]->url}}');
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
@@ -28,6 +28,11 @@ Route::get('/nieuws/zoeken', function(Illuminate\Http\Request $request) {
|
||||
Route::get('/blog/{id}/{title}', 'NewsController@blog')->where(['id' => '\d+'])->name('blog');
|
||||
Route::get('/blog', 'NewsController@activeblog');
|
||||
|
||||
Route::get('/beelden', 'ImagesController@overview')->name('beelden');
|
||||
Route::get('/beelden/regio/{region}', 'ImagesController@regionlist' )->where(['region' => '[a-z0-9]+'])->name('beelden.regio');
|
||||
Route::get('/beelden/thema/{theme}', 'ImagesController@themelist' )->where(['themelist' => '[a-z0-9]+'])->name('beelden.thema');
|
||||
Route::get('/beelden/{id}/{title}', 'ImagesController@show')->where(['id' => '\d+'])->name('beelden.detail');
|
||||
|
||||
Route::get('/onair', 'RadioController@onair')->name('onair');
|
||||
|
||||
Route::get('/agenda', 'CalendarController@overview')->name('agenda');
|
||||
|
||||
Reference in New Issue
Block a user