Compare commits
6 Commits
6abe7ba61a
...
feature-ne
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6333ff6433 | ||
|
|
99720de0ca | ||
|
|
ae0e83def6 | ||
|
|
68ae6f9161 | ||
|
|
863381a226 | ||
|
|
94eddea78b |
@@ -21,15 +21,15 @@ class Controller extends BaseController
|
||||
{
|
||||
$data = json_decode(Storage::disk('local')->get($file));
|
||||
foreach ($path as $subobject) {
|
||||
$data = $data->$subobject;
|
||||
}
|
||||
$data = $data->$subobject ?? [];
|
||||
}
|
||||
$items = [];
|
||||
foreach ($data as $item_data) {
|
||||
$items[] = new $class($item_data);
|
||||
if ($maxItems && count($items) == $maxItems) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
@@ -113,16 +113,16 @@ class Controller extends BaseController
|
||||
'ssl' => [
|
||||
"verify_peer" => false,
|
||||
"verify_peer_name" => false,
|
||||
],
|
||||
'http' => [
|
||||
'method' => 'GET',
|
||||
'header' => 'X-Api-Key: ' . sha1(request()->server('REMOTE_ADDR')) . "\r\n"
|
||||
. 'X-User-Agent: ' . request()->server('HTTP_USER_AGENT') . "\r\n"
|
||||
]
|
||||
],
|
||||
'http' => [
|
||||
'method' => 'GET',
|
||||
'header' => 'X-Api-Key: ' . sha1(request()->server('REMOTE_ADDR')) . "\r\n"
|
||||
. 'X-User-Agent: ' . request()->server('HTTP_USER_AGENT') . "\r\n"
|
||||
]
|
||||
];
|
||||
//\dump($http_response_header);
|
||||
$result = @file_get_contents($this->API_URL . $url, false, stream_context_create($arrContextOptions));
|
||||
return $result ? json_decode($result) : null;
|
||||
$result = @file_get_contents($this->API_URL . $url, false, stream_context_create($arrContextOptions));
|
||||
return $result ? json_decode($result) : null;
|
||||
}
|
||||
|
||||
protected function checkAPI($url)
|
||||
|
||||
@@ -146,7 +146,7 @@ class NewsController extends Controller
|
||||
}
|
||||
$apiResult = $this->API('nieuws/' . $url . '?pagina=' . (int)max(1, $page) . ($total ? '&aantal=' . $total : ''));
|
||||
$news = [];
|
||||
foreach ($apiResult->news as $newsItem) {
|
||||
foreach ($apiResult->news ?? [] as $newsItem) {
|
||||
$news[] = new \Model\NewsItem($newsItem);
|
||||
}
|
||||
|
||||
|
||||
10
public/js/functions.js
vendored
10
public/js/functions.js
vendored
@@ -47,7 +47,8 @@ $(document).ready(function(){
|
||||
isLoading = 1;
|
||||
$isLoading.show();
|
||||
var $button = $(this).attr("disabled", "disabled");
|
||||
var $container = $(options.container)
|
||||
var $container = $(options.container);
|
||||
$container.each(function(){$(this).find('.no-results').remove();});
|
||||
|
||||
// Fire request for the next page
|
||||
$.ajax({url: options.url + (options.url.indexOf('?') >= 0 ? '&' : '?') + 'pagina=' + options.nextPage + (options.dateStart ? '&dateStart=' + options.dateStart : '') + (options.dateEnd ? '&dateEnd=' + options.dateEnd : '')})
|
||||
@@ -56,6 +57,7 @@ $(document).ready(function(){
|
||||
isLoading = 0;
|
||||
$isLoading.hide();
|
||||
$button.removeAttr("disabled");
|
||||
$(options.container + ' .loader').remove();
|
||||
})
|
||||
.done(function (data) {
|
||||
if (!data) {
|
||||
@@ -69,6 +71,12 @@ $(document).ready(function(){
|
||||
var id = this.toString();
|
||||
$(id).append($('<div>'+data+'</div>').find(id).length ? $('<div>'+data+'</div>').find(id).children() : $(data));
|
||||
});
|
||||
$container.each(function () {
|
||||
var id = this.toString();
|
||||
if (!$(id).find('li').length) {
|
||||
$(id).append('<li class="no-results">Geen items gevonden.</li>');
|
||||
}
|
||||
});
|
||||
++options.nextPage;
|
||||
});
|
||||
}
|
||||
|
||||
2
public/js/functions.min.js
vendored
2
public/js/functions.min.js
vendored
File diff suppressed because one or more lines are too long
10
resources/assets/js/functions/loadMoreNews.js
vendored
10
resources/assets/js/functions/loadMoreNews.js
vendored
@@ -25,7 +25,8 @@
|
||||
isLoading = 1;
|
||||
$isLoading.show();
|
||||
var $button = $(this).attr("disabled", "disabled");
|
||||
var $container = $(options.container)
|
||||
var $container = $(options.container);
|
||||
$container.each(function(){$(this).find('.no-results').remove();});
|
||||
|
||||
// Fire request for the next page
|
||||
$.ajax({url: options.url + (options.url.indexOf('?') >= 0 ? '&' : '?') + 'pagina=' + options.nextPage + (options.dateStart ? '&dateStart=' + options.dateStart : '') + (options.dateEnd ? '&dateEnd=' + options.dateEnd : '')})
|
||||
@@ -34,6 +35,7 @@
|
||||
isLoading = 0;
|
||||
$isLoading.hide();
|
||||
$button.removeAttr("disabled");
|
||||
$(options.container + ' .loader').remove();
|
||||
})
|
||||
.done(function (data) {
|
||||
if (!data) {
|
||||
@@ -47,6 +49,12 @@
|
||||
var id = this.toString();
|
||||
$(id).append($('<div>'+data+'</div>').find(id).length ? $('<div>'+data+'</div>').find(id).children() : $(data));
|
||||
});
|
||||
$container.each(function () {
|
||||
var id = this.toString();
|
||||
if (!$(id).find('li').length) {
|
||||
$(id).append('<li class="no-results">Geen items gevonden.</li>');
|
||||
}
|
||||
});
|
||||
++options.nextPage;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -29,13 +29,20 @@
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
}
|
||||
.daterangepicker.show-calendar .drp-buttons {
|
||||
display: flex;
|
||||
width: 48%;
|
||||
float: left;
|
||||
}
|
||||
.daterangepicker .drp-selected {
|
||||
display: none;
|
||||
}
|
||||
.daterangepicker.show-calendar .drp-buttons:before {
|
||||
display: block;
|
||||
content: 'Selecteer een begindatum en een einddatum.';
|
||||
height: 23px;
|
||||
width: 90%;
|
||||
text-align: center;
|
||||
padding-left: 10px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
$(function() {
|
||||
@@ -44,7 +51,31 @@
|
||||
autoUpdateInput: false,
|
||||
locale: {
|
||||
cancelLabel: 'Annuleer',
|
||||
applyLabel: 'Filteren'
|
||||
applyLabel: 'Filteren',
|
||||
"daysOfWeek": [
|
||||
"Zo",
|
||||
"Ma",
|
||||
"Di",
|
||||
"Wo",
|
||||
"Do",
|
||||
"Vr",
|
||||
"Za"
|
||||
],
|
||||
"monthNames": [
|
||||
"Januari",
|
||||
"Februari",
|
||||
"Maart",
|
||||
"April",
|
||||
"Mei",
|
||||
"Juni",
|
||||
"Juli",
|
||||
"Augustus",
|
||||
"September",
|
||||
"Oktober",
|
||||
"November",
|
||||
"December"
|
||||
],
|
||||
"firstDay": 1
|
||||
}
|
||||
}, function(start, end, label) {
|
||||
$('input[name="daterange"]').val(start.format('DD-MM-YYYY') + ' - ' + end.format('DD-MM-YYYY'));
|
||||
@@ -53,8 +84,8 @@
|
||||
options.dateStart = start.format('YYYY-MM-DD');
|
||||
options.dateEnd = end.format('YYYY-MM-DD');
|
||||
options.nextPage = 1;
|
||||
console.log(options);
|
||||
$('.content_container #items-more-news li').remove();
|
||||
$('.content_container #items-more-news').append('<li class="loader"><span class="fas fa-spinner fa-spin"></span> Laden...</li>');
|
||||
$moreNews.loadMoreNews(options);
|
||||
$moreNews.click();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user