add a specific method to speed up Dashboard display

This commit is contained in:
Gilles Crettenand
2015-06-19 13:32:22 +02:00
parent 85c1c5d785
commit cae5f7cb7c
2 changed files with 41 additions and 7 deletions

View File

@@ -13,7 +13,7 @@ use BSR\Lib\WebService;
class NetBiblio extends WebService
{
/** @var string $version version number */
public static $version = '1.1.3';
public static $version = '1.1.4';
private $login = '';
private $client = 'website';
@@ -473,6 +473,30 @@ class NetBiblio extends WebService
return array_values($this->AddBookData($circulations));
}
/**
* This method return information for the user dashboard :
*
* ° 'loans' : number of current loans
* ° 'oldLoans' : number of past loans
* ° 'wishes' : number of wishes
* ° 'novelties' : new books
* ° 'recommendations' : recommended books
*
* @return array
* @throws AuthenticationException
*/
public function GetDashboardData()
{
$user = $this->getUser();
return array(
'loans' => $user->GetLoans(true),
'oldLoans' => $user->GetOldLoans(true),
'wishes' => $user->getWishes(true),
'novelties' => $this->LastBooksByType('', 15),
'recommendations' => $this->MoreLikeLoans(),
);
}
/**
* This method adds a book to the currently authenticated user wishlist
* based on its code.