Skip to content
Snippets Groups Projects
Commit edd60733 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch '202-onenewspage-zur-pagination-hinzufugen' into 'development'

Pagination für Onenewspage implementiert

Closes #202

See merge request !322
parents 3c6d646f 75a08edc
No related branches found
No related tags found
1 merge request!1365Resolve "Filter Options for MetaGer"
...@@ -6,8 +6,10 @@ use App\Models\Searchengine; ...@@ -6,8 +6,10 @@ use App\Models\Searchengine;
class Onenewspage extends Searchengine class Onenewspage extends Searchengine
{ {
public $results = []; public $results = [];
public $resultCount = 0;
private $offset = 0;
public function __construct(\SimpleXMLElement $engine, \App\MetaGer $metager) public function __construct(\SimpleXMLElement $engine, \App\MetaGer $metager)
{ {
parent::__construct($engine, $metager); parent::__construct($engine, $metager);
...@@ -38,6 +40,37 @@ class Onenewspage extends Searchengine ...@@ -38,6 +40,37 @@ class Onenewspage extends Searchengine
$this->counter $this->counter
); );
} }
if (count($this->results) > $this->resultCount) {
$this->resultCount += count($this->results);
}
}
public function getLast(\App\MetaGer $metager, $result)
{
if ($metager->getPage() <= 1) {
return;
}
$last = new Onenewspage(simplexml_load_string($this->engine), $metager);
$last->resultCount = $this->resultCount;
$last->offset = $this->offset - $this->resultCount;
$last->getString .= "&o=" . $last->offset;
$last->hash = md5($last->host . $last->getString . $last->port . $last->name);
$this->last = $last;
}
public function getNext(\App\MetaGer $metager, $result)
{
if (count($this->results) <= 0) {
return;
}
$next = new Onenewspage(simplexml_load_string($this->engine), $metager);
$next->resultCount = $this->resultCount;
$next->offset = $this->offset + $this->resultCount;
$next->getString .= "&o=" . $next->offset;
$next->hash = md5($next->host . $next->getString . $next->port . $next->name);
$this->next = $next;
} }
} }
...@@ -7,8 +7,10 @@ use App\Models\Searchengine; ...@@ -7,8 +7,10 @@ use App\Models\Searchengine;
class Onenewspagegermany extends Searchengine class Onenewspagegermany extends Searchengine
{ {
public $results = []; public $results = [];
public $resultCount = 0;
private $offset = 0;
public function __construct(\SimpleXMLElement $engine, \App\MetaGer $metager) public function __construct(\SimpleXMLElement $engine, \App\MetaGer $metager)
{ {
parent::__construct($engine, $metager); parent::__construct($engine, $metager);
...@@ -38,6 +40,37 @@ class Onenewspagegermany extends Searchengine ...@@ -38,6 +40,37 @@ class Onenewspagegermany extends Searchengine
} }
} }
if (count($this->results) > $this->resultCount) {
$this->resultCount += count($this->results);
}
}
public function getLast(\App\MetaGer $metager, $result)
{
if ($metager->getPage() <= 1) {
return;
}
$last = new Onenewspagegermany(simplexml_load_string($this->engine), $metager);
$last->resultCount = $this->resultCount;
$last->offset = $this->offset - $this->resultCount;
$last->getString .= "&o=" . $last->offset;
$last->hash = md5($last->host . $last->getString . $last->port . $last->name);
$this->last = $last;
}
public function getNext(\App\MetaGer $metager, $result)
{
if (count($this->results) <= 0) {
return;
}
$next = new Onenewspagegermany(simplexml_load_string($this->engine), $metager);
$next->resultCount = $this->resultCount;
$next->offset = $this->offset + $this->resultCount;
$next->getString .= "&o=" . $next->offset;
$next->hash = md5($next->host . $next->getString . $next->port . $next->name);
$this->next = $next;
} }
} }
...@@ -6,8 +6,10 @@ use App\Models\Searchengine; ...@@ -6,8 +6,10 @@ use App\Models\Searchengine;
class Onenewspagevideo extends Searchengine class Onenewspagevideo extends Searchengine
{ {
public $results = []; public $results = [];
public $resultCount = 0;
private $offset = 0;
public function __construct(\SimpleXMLElement $engine, \App\MetaGer $metager) public function __construct(\SimpleXMLElement $engine, \App\MetaGer $metager)
{ {
parent::__construct($engine, $metager); parent::__construct($engine, $metager);
...@@ -37,6 +39,36 @@ class Onenewspagevideo extends Searchengine ...@@ -37,6 +39,36 @@ class Onenewspagevideo extends Searchengine
$this->counter $this->counter
); );
} }
if (count($this->results) > $this->resultCount) {
$this->resultCount += count($this->results);
}
}
public function getLast(\App\MetaGer $metager, $result)
{
if ($metager->getPage() <= 1) {
return;
}
$last = new Onenewspagevideo(simplexml_load_string($this->engine), $metager);
$last->resultCount = $this->resultCount;
$last->offset = $this->offset - $this->resultCount;
$last->getString .= "&o=" . $last->offset;
$last->hash = md5($last->host . $last->getString . $last->port . $last->name);
$this->last = $last;
}
public function getNext(\App\MetaGer $metager, $result)
{
if (count($this->results) <= 0) {
return;
}
$next = new Onenewspagevideo(simplexml_load_string($this->engine), $metager);
$next->resultCount = $this->resultCount;
$next->offset = $this->offset + $this->resultCount;
$next->getString .= "&o=" . $next->offset;
$next->hash = md5($next->host . $next->getString . $next->port . $next->name);
$this->next = $next;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment