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
fee8d80c
Commit
fee8d80c
authored
Apr 13, 2017
by
Phil Höfer
Browse files
Merge branch '462-nachrichten-nach-zeit-sortierbar-machen' into 'development'
Nachrichten werden nach Datum sortiert See merge request
!811
parents
72d1dad2
ce62fa70
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/MetaGer.php
View file @
fee8d80c
...
...
@@ -180,13 +180,24 @@ class MetaGer
// augment (boost&adgoal)
// authorize
// misc (WiP)
uasort
(
$this
->
results
,
function
(
$a
,
$b
)
{
if
(
$a
->
getRank
()
==
$b
->
getRank
())
{
return
0
;
}
if
(
$this
->
fokus
==
"nachrichten"
)
{
$this
->
results
=
array_filter
(
$this
->
results
,
function
(
$v
,
$k
)
{
return
!
is_null
(
$v
->
getRank
());
},
ARRAY_FILTER_USE_BOTH
);
uasort
(
$this
->
results
,
function
(
$a
,
$b
)
{
$datea
=
$a
->
getDate
();
$dateb
=
$b
->
getDate
();
return
$dateb
-
$datea
;
});
}
else
{
uasort
(
$this
->
results
,
function
(
$a
,
$b
)
{
if
(
$a
->
getRank
()
==
$b
->
getRank
())
{
return
0
;
}
return
(
$a
->
getRank
()
<
$b
->
getRank
())
?
1
:
-
1
;
});
return
(
$a
->
getRank
()
<
$b
->
getRank
())
?
1
:
-
1
;
});
}
# Validate Results
$newResults
=
[];
...
...
app/Models/Result.php
View file @
fee8d80c
...
...
@@ -62,8 +62,8 @@ class Result
$this
->
strippedLink
=
$this
->
getStrippedLink
(
$this
->
anzeigeLink
);
$this
->
rank
=
0
;
$this
->
partnershop
=
isset
(
$additionalInformation
[
"partnershop"
])
?
$additionalInformation
[
"partnershop"
]
:
false
;
$this
->
image
=
isset
(
$additionalInformation
[
"image"
])
?
$additionalInformation
[
"image"
]
:
""
;
$this
->
price
=
isset
(
$additionalInformation
[
"price"
])
?
$additionalInformation
[
"price"
]
:
0
;
$this
->
image
=
isset
(
$additionalInformation
[
"image"
])
?
$additionalInformation
[
"image"
]
:
""
;
$this
->
price
=
isset
(
$additionalInformation
[
"price"
])
?
$additionalInformation
[
"price"
]
:
0
;
$this
->
additionalInformation
=
$additionalInformation
;
}
...
...
@@ -386,6 +386,15 @@ return "https://proxy.suma-ev.de/mger/nph-proxy.cgi/en/w0/" . $tmp;
return
$this
->
rank
;
}
public
function
getDate
()
{
if
(
isset
(
$this
->
additionalInformation
[
"date"
]))
{
return
$this
->
additionalInformation
[
"date"
];
}
else
{
return
null
;
}
}
public
function
getLangString
()
{
$string
=
""
;
...
...
app/Models/parserSkripte/Onenewspage.php
View file @
fee8d80c
...
...
@@ -24,10 +24,11 @@ class Onenewspage extends Searchengine
if
(
sizeof
(
$res
)
<
3
)
{
continue
;
}
$title
=
$res
[
0
];
$link
=
$res
[
2
];
$anzeigeLink
=
$link
;
$descr
=
$res
[
1
];
$title
=
$res
[
0
];
$link
=
$res
[
2
];
$anzeigeLink
=
$link
;
$descr
=
$res
[
1
];
$additionalInformation
=
sizeof
(
$res
)
>
3
?
[
'date'
=>
intval
(
$res
[
3
])]
:
[];
$this
->
counter
++
;
$this
->
results
[]
=
new
\
App\Models\Result
(
...
...
@@ -37,7 +38,8 @@ class Onenewspage extends Searchengine
$anzeigeLink
,
$descr
,
$this
->
gefVon
,
$this
->
counter
$this
->
counter
,
$additionalInformation
);
}
if
(
count
(
$this
->
results
)
>
$this
->
resultCount
)
{
...
...
app/Models/parserSkripte/Onenewspagegermany.php
View file @
fee8d80c
...
...
@@ -27,15 +27,22 @@ class Onenewspagegermany extends Searchengine
if
(
sizeof
(
$result
)
<
3
)
{
continue
;
}
$title
=
$result
[
0
];
$link
=
$result
[
2
];
$anzeigeLink
=
$link
;
$descr
=
$result
[
1
];
$additionalInformation
=
sizeof
(
$result
)
>
3
?
[
'date'
=>
intval
(
$result
[
3
])]
:
[];
$counter
++
;
$this
->
results
[]
=
new
Result
(
$this
->
engine
,
trim
(
strip_tags
(
$result
[
0
]))
,
$
result
[
2
]
,
$
result
[
2
]
,
$
r
es
ult
[
1
]
,
$title
,
$
link
,
$
anzeigeLink
,
$
d
es
cr
,
$this
->
gefVon
,
$counter
$this
->
counter
,
$additionalInformation
);
}
...
...
app/Models/parserSkripte/Onenewspagevideo.php
View file @
fee8d80c
...
...
@@ -23,10 +23,11 @@ class Onenewspagevideo extends Searchengine
if
(
sizeof
(
$res
)
<
3
)
{
continue
;
}
$title
=
$res
[
0
];
$link
=
$res
[
2
];
$anzeigeLink
=
$link
;
$descr
=
$res
[
1
];
$title
=
$res
[
0
];
$link
=
$res
[
2
];
$anzeigeLink
=
$link
;
$descr
=
$res
[
1
];
$additionalInformation
=
sizeof
(
$res
)
>
3
?
[
'date'
=>
intval
(
$res
[
3
])]
:
[];
$this
->
counter
++
;
$this
->
results
[]
=
new
\
App\Models\Result
(
...
...
@@ -36,7 +37,8 @@ class Onenewspagevideo extends Searchengine
$anzeigeLink
,
$descr
,
$this
->
gefVon
,
$this
->
counter
$this
->
counter
,
$additionalInformation
);
}
if
(
count
(
$this
->
results
)
>
$this
->
resultCount
)
{
...
...
resources/views/layouts/result.blade.php
View file @
fee8d80c
...
...
@@ -75,7 +75,11 @@
{!! $result->descr !!}
</div>
@else
@if( $metager->getFokus() == "nachrichten" )
<div
class=
"description"
>
{{ date("Y-m-d H:i:s", $result->additionalInformation["date"]) }} {{ $result->descr }}
</div>
@else
<div
class=
"description"
>
{{ $result->descr }}
</div>
@endif
@endif
</div>
</div>
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