MoreLikeThis API
This commit is contained in:
@@ -711,6 +711,39 @@ class NetBiblio extends WebService
|
||||
return array_merge($data, $this->AddBookData($results['books']));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method return books similar to the one given.
|
||||
*
|
||||
* @param int|array $ids One or multiple book ids
|
||||
* @return array
|
||||
*/
|
||||
public function MoreLikeThis($ids)
|
||||
{
|
||||
$bs = new BookSearch(false);
|
||||
$bs->addOrQuery(is_array($ids) ? $ids : array($ids), 'id');
|
||||
$bs->setHandler('more');
|
||||
$results = $bs->getResults(0, 5);
|
||||
return $results['books'];
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns books similar to the books already
|
||||
* loaned by the current user.
|
||||
*
|
||||
* @return array
|
||||
* @throws AuthenticationException
|
||||
*/
|
||||
public function MoreLikeLoans()
|
||||
{
|
||||
$_SESSION["user"]["login"] = 35;
|
||||
|
||||
$loans = $this->getUser()->GetOldLoans();
|
||||
$ids = array_map(function($l) {
|
||||
return $l['id'];
|
||||
}, $loans);
|
||||
return $this->MoreLikeThis($ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method return a list of suggested titles for the given search terms
|
||||
* @param string $text
|
||||
|
||||
Reference in New Issue
Block a user