more documentation

master
Gilles Crettenand 11 years ago
parent 3032ceba96
commit 265ed19543

@ -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;
}

Loading…
Cancel
Save