Prepare a feature to send the book by email (Send to Kindle). re #53
This commit is contained in:
parent
a56184153c
commit
4bbb2fab8c
15
book.php
15
book.php
|
@ -200,6 +200,21 @@ class Book extends Base {
|
||||||
return $this->datas;
|
return $this->datas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function GetMostInterestingDataToSendToKindle ()
|
||||||
|
{
|
||||||
|
$bestFormatForKindle = array ("PDF", "MOBI");
|
||||||
|
$bestRank = -1;
|
||||||
|
$bestData = NULL;
|
||||||
|
foreach ($this->getDatas () as $data) {
|
||||||
|
$key = array_search ($data->format, $bestFormatForKindle);
|
||||||
|
if ($key !== false && $key > $bestRank) {
|
||||||
|
$bestRank = $key;
|
||||||
|
$bestData = $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $bestData;
|
||||||
|
}
|
||||||
|
|
||||||
public function getDataById ($idData)
|
public function getDataById ($idData)
|
||||||
{
|
{
|
||||||
foreach ($this->getDatas () as $data) {
|
foreach ($this->getDatas () as $data) {
|
||||||
|
|
Loading…
Reference in a new issue