Update HTML links to the new methods
This commit is contained in:
parent
4473037ae8
commit
2d83cd6e78
11
book.php
11
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)
|
public function getFilePath ($extension, $idData = NULL, $relative = false)
|
||||||
{
|
{
|
||||||
$file = NULL;
|
$file = NULL;
|
||||||
|
|
|
@ -24,10 +24,10 @@ $book->getLinkArray ();
|
||||||
</div>
|
</div>
|
||||||
<div class="download">
|
<div class="download">
|
||||||
<?php
|
<?php
|
||||||
foreach ($book->format as $key => $format)
|
foreach ($book->getDatas() as $data)
|
||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<div class="button buttonEffect"><a href="<?php echo "download/" . $format[0] . "/" . urlencode ($format[1]) ?>"><?php echo $key ?></a></div>
|
<div class="button buttonEffect"><a href="<?php echo $data->getHtmlLink () ?>"><?php echo $data->format ?></a></div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
4
data.php
4
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);
|
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)
|
public static function getLink ($book, $type, $mime, $rel, $filename, $idData, $title = NULL)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
|
@ -161,9 +161,9 @@
|
||||||
<?php
|
<?php
|
||||||
foreach ($config['cops_prefered_format'] as $format)
|
foreach ($config['cops_prefered_format'] as $format)
|
||||||
{
|
{
|
||||||
if (array_key_exists($format, $entry->book->format)) {
|
if ($data = $entry->book->getDataFormat ($format)) {
|
||||||
?>
|
?>
|
||||||
<div class="button buttonEffect"><a href="<?php echo "download/" . $entry->book->format [$format][0] . "/" . urlencode ($entry->book->format [$format][1]) ?>"><?php echo $format ?></a></div>
|
<div class="button buttonEffect"><a href="<?php echo $data->getHtmlLink () ?>"><?php echo $format ?></a></div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue