diff --git a/NetBiblio.php b/NetBiblio.php index 893c2f8..c717c27 100644 --- a/NetBiblio.php +++ b/NetBiblio.php @@ -527,24 +527,34 @@ class NetBiblio extends WebService return AudioBook::inReading(); } - public function LastBooksByType($type, $itemsByGroup) + /** + * This method is used by the iOS application to retrieve the last + * books for a given Genre. It may receives the genre 'Jeunesse' which + * is a boolean value on Solr documents. + * + * @param $genre + * @param $number + * @return array + * @throws WebException + */ + public function LastBooksByType($genre, $number) { $this->CheckSession(); $s = new BookSearch(); - if($type == 'Jeunesse') { + if($genre == 'Jeunesse') { $s->addQuery(1, 'jeunesse'); } else { - $s->addQuery($type, 'genre'); + $s->addQuery($genre, 'genre'); } $s->addSortField('availabilityDate'); - $results = $s->getResults(0, $itemsByGroup); + $results = $s->getResults(0, $number); $books = $this->AddBookData($results['books']); $data = array(); foreach($books as $b) { - $data[$type][] = $b; + $data[$genre][] = $b; } return $data; }