pagination on random books

This commit is contained in:
Gilles Crettenand
2015-06-08 14:51:44 +02:00
parent 9752f81ca0
commit eff4f44ce4

View File

@@ -509,10 +509,11 @@ class NetBiblio extends WebService
* *
* @param int $number Number of random books to return * @param int $number Number of random books to return
* @param null $seed * @param null $seed
* @param int $page
* @return array * @return array
* @throws WebException * @throws WebException
*/ */
public function GetRandomBooks($number = 100, $seed = null) { public function GetRandomBooks($number = 100, $seed = null, $page = 0) {
if(is_null($seed)) { if(is_null($seed)) {
$seed = time(); $seed = time();
} }
@@ -520,7 +521,7 @@ class NetBiblio extends WebService
$bs = new BookSearch(); $bs = new BookSearch();
$bs->addSortField('random_'.$seed); $bs->addSortField('random_'.$seed);
$bs->addQuery(1, 'visible'); $bs->addQuery(1, 'visible');
$results = $bs->getResults(0, $number); $results = $bs->getResults($page, $number);
return $this->AddBookData($results['books']); return $this->AddBookData($results['books']);
} }