Commit e04f344b authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Die Komplette Pagination entfernt.

parent ec05a546
...@@ -4,8 +4,6 @@ namespace App; ...@@ -4,8 +4,6 @@ namespace App;
use App; use App;
use App\lib\TextLanguageDetect\TextLanguageDetect; use App\lib\TextLanguageDetect\TextLanguageDetect;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
use Jenssegers\Agent\Agent; use Jenssegers\Agent\Agent;
use LaravelLocalization; use LaravelLocalization;
use Log; use Log;
...@@ -237,38 +235,6 @@ class MetaGer ...@@ -237,38 +235,6 @@ class MetaGer
} }
//Get current page form url e.g. &page=6
$currentPage = LengthAwarePaginator::resolveCurrentPage();
$offset = $currentPage - 1;
//Create a new Laravel collection from the array data
$collection = new Collection($this->results);
//Define how many items we want to be visible in each page
$perPage = $this->resultCount;
//Slice the collection to get the items to display in current page
$currentPageSearchResults = $collection->slice($offset * $perPage, $perPage)->all();
# Für diese 20 Links folgt nun unsere Boost-Implementation.
$currentPageSearchResults = $this->parseBoost($currentPageSearchResults);
# Für diese 20 Links folgt nun unsere Adgoal- Implementation.
$currentPageSearchResults = $this->parseAdgoal($currentPageSearchResults);
//Create our paginator and pass it to the view
$paginatedSearchResults = new LengthAwarePaginator($currentPageSearchResults, count($collection), $perPage);
$paginatedSearchResults->setPath('/meta/meta.ger3');
foreach ($this->request->all() as $key => $value) {
if ($key === "out") {
continue;
}
$paginatedSearchResults->addQuery($key, $value);
}
$this->results = $paginatedSearchResults;
if (LaravelLocalization::getCurrentLocale() === "en") { if (LaravelLocalization::getCurrentLocale() === "en") {
$this->ads = []; $this->ads = [];
} }
...@@ -289,6 +255,7 @@ class MetaGer ...@@ -289,6 +255,7 @@ class MetaGer
if (count($this->results) <= 0) { if (count($this->results) <= 0) {
$this->errors[] = "Leider konnten wir zu Ihrer Sucheingabe keine passenden Ergebnisse finden. Sie können aber versuchen diese anzupassen."; $this->errors[] = "Leider konnten wir zu Ihrer Sucheingabe keine passenden Ergebnisse finden. Sie können aber versuchen diese anzupassen.";
} }
} }
public function parseBoost($results) public function parseBoost($results)
......
...@@ -35,15 +35,12 @@ ...@@ -35,15 +35,12 @@
@for($i = 0; $i <= 2; $i++) @for($i = 0; $i <= 2; $i++)
@include('layouts.ad', ['ad' => $metager->popAd()]) @include('layouts.ad', ['ad' => $metager->popAd()])
@endfor @endfor
@foreach($metager->getResults()->items() as $result) @foreach($metager->getResults() as $result)
@if($result->number % 7 === 0) @if($result->number % 7 === 0)
@include('layouts.ad', ['ad' => $metager->popAd()]) @include('layouts.ad', ['ad' => $metager->popAd()])
@endif @endif
@include('layouts.result', ['result' => $result]) @include('layouts.result', ['result' => $result])
@endforeach @endforeach
<nav class="pager">
{!! $metager->getResults()->links() !!}
</nav>
</div> </div>
@if( $metager->showQuicktips() ) @if( $metager->showQuicktips() )
<div class="hidden-xs col-md-4" id="quicktips"> <div class="hidden-xs col-md-4" id="quicktips">
...@@ -51,4 +48,3 @@ ...@@ -51,4 +48,3 @@
</div> </div>
@endif @endif
@endsection @endsection
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment