more documentation
This commit is contained in:
@@ -527,24 +527,34 @@ class NetBiblio extends WebService
|
|||||||
return AudioBook::inReading();
|
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();
|
$this->CheckSession();
|
||||||
|
|
||||||
$s = new BookSearch();
|
$s = new BookSearch();
|
||||||
if($type == 'Jeunesse') {
|
if($genre == 'Jeunesse') {
|
||||||
$s->addQuery(1, 'jeunesse');
|
$s->addQuery(1, 'jeunesse');
|
||||||
} else {
|
} else {
|
||||||
$s->addQuery($type, 'genre');
|
$s->addQuery($genre, 'genre');
|
||||||
}
|
}
|
||||||
$s->addSortField('availabilityDate');
|
$s->addSortField('availabilityDate');
|
||||||
|
|
||||||
$results = $s->getResults(0, $itemsByGroup);
|
$results = $s->getResults(0, $number);
|
||||||
$books = $this->AddBookData($results['books']);
|
$books = $this->AddBookData($results['books']);
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach($books as $b) {
|
foreach($books as $b) {
|
||||||
$data[$type][] = $b;
|
$data[$genre][] = $b;
|
||||||
}
|
}
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user