diff --git a/book.php b/book.php
index 3a9a071..ae49e4c 100644
--- a/book.php
+++ b/book.php
@@ -154,6 +154,17 @@ class Book extends Base {
}
}
+ public function getDataFormat ($format) {
+ foreach ($this->getDatas () as $data)
+ {
+ if ($data->format == $format)
+ {
+ return $data;
+ }
+ }
+ return NULL;
+ }
+
public function getFilePath ($extension, $idData = NULL, $relative = false)
{
$file = NULL;
diff --git a/bookdetail.php b/bookdetail.php
index 9dae567..50eb4b0 100644
--- a/bookdetail.php
+++ b/bookdetail.php
@@ -24,10 +24,10 @@ $book->getLinkArray ();
format as $key => $format)
+ foreach ($book->getDatas() as $data)
{
?>
-
+
diff --git a/data.php b/data.php
index 815e6d5..ed3864a 100644
--- a/data.php
+++ b/data.php
@@ -47,6 +47,10 @@ class Data extends Base {
return self::getLink ($this->book, $this->extension, $this->getMimeType (), $rel, $this->getFilename (), $this->id, $title);
}
+ public function getHtmlLink () {
+ return "download/" . $this->id . "/" . urlencode ($this->getFilename ());
+ }
+
public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL)
{
global $config;
diff --git a/index.php b/index.php
index 6647763..246a9c1 100644
--- a/index.php
+++ b/index.php
@@ -161,9 +161,9 @@
book->format)) {
+ if ($data = $entry->book->getDataFormat ($format)) {
?>
-
+