Commit 87f5abbf authored by Phil Höfer's avatar Phil Höfer
Browse files

Nachrichten werden nach Datum sortiert

parent 44ea5664
......@@ -180,13 +180,21 @@ 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") {
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 = [];
......
......@@ -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 = "";
......
......@@ -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) {
......
......@@ -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],
$result[1],
$title,
$link,
$anzeigeLink,
$descr,
$this->gefVon,
$counter
$this->counter,
$additionalInformation
);
}
......
......@@ -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) {
......
......@@ -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>
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