Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
e04f344b
Commit
e04f344b
authored
Aug 22, 2016
by
Dominik Hebeler
Browse files
Die Komplette Pagination entfernt.
parent
ec05a546
Changes
2
Show whitespace changes
Inline
Side-by-side
app/MetaGer.php
View file @
e04f344b
...
...
@@ -4,8 +4,6 @@ namespace App;
use
App
;
use
App\lib\TextLanguageDetect\TextLanguageDetect
;
use
Illuminate\Http\Request
;
use
Illuminate\Pagination\LengthAwarePaginator
;
use
Illuminate\Support\Collection
;
use
Jenssegers\Agent\Agent
;
use
LaravelLocalization
;
use
Log
;
...
...
@@ -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"
)
{
$this
->
ads
=
[];
}
...
...
@@ -289,6 +255,7 @@ class MetaGer
if
(
count
(
$this
->
results
)
<=
0
)
{
$this
->
errors
[]
=
"Leider konnten wir zu Ihrer Sucheingabe keine passenden Ergebnisse finden. Sie können aber versuchen diese anzupassen."
;
}
}
public
function
parseBoost
(
$results
)
...
...
resources/views/metager3.blade.php
View file @
e04f344b
...
...
@@ -35,15 +35,12 @@
@
for
(
$i
=
0
;
$i
<=
2
;
$i
++
)
@
include
(
'layouts.ad'
,
[
'ad'
=>
$metager
->
popAd
()])
@
endfor
@
foreach
(
$metager
->
getResults
()
->
items
()
as
$result
)
@
foreach
(
$metager
->
getResults
()
as
$result
)
@
if
(
$result
->
number
%
7
===
0
)
@
include
(
'layouts.ad'
,
[
'ad'
=>
$metager
->
popAd
()])
@
endif
@
include
(
'layouts.result'
,
[
'result'
=>
$result
])
@
endforeach
<
nav
class
=
"pager"
>
{
!!
$metager
->
getResults
()
->
links
()
!!
}
</
nav
>
</
div
>
@
if
(
$metager
->
showQuicktips
()
)
<
div
class
=
"hidden-xs col-md-4"
id
=
"quicktips"
>
...
...
@@ -51,4 +48,3 @@
</
div
>
@
endif
@
endsection
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment