Prepare a feature to send the book by email (Send to Kindle). re #53

This commit is contained in:
Sébastien Lucas 2013-05-15 19:32:18 +02:00
父節點 a56184153c
當前提交 4bbb2fab8c
共有 1 個檔案被更改,包括 15 行新增0 行删除

查看文件

@ -199,6 +199,21 @@ class Book extends Base {
}
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)
{