From 2d83cd6e789d567345af5ba52247cb1fafe5703c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 26 Jun 2012 14:45:09 +0200 Subject: [PATCH] Update HTML links to the new methods --- book.php | 11 +++++++++++ bookdetail.php | 4 ++-- data.php | 4 ++++ index.php | 4 ++-- 4 files changed, 19 insertions(+), 4 deletions(-) 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)) { ?> - +