Implement navigation for photo pages.

This commit is contained in:
2016-09-04 16:00:39 +02:00
parent 67a182671f
commit c11c5c2677
5 changed files with 109 additions and 6 deletions

View File

@@ -10,12 +10,24 @@ class PhotoPage extends SubTemplate
{
private $photo;
private $exif;
private $previous_photo_url = '';
private $next_photo_url = '';
public function __construct(Image $photo)
{
$this->photo = $photo;
}
public function setPreviousPhotoUrl($url)
{
$this->previous_photo_url = $url;
}
public function setNextPhotoUrl($url)
{
$this->next_photo_url = $url;
}
protected function html_content()
{
$this->photoNav();
@@ -57,16 +69,16 @@ class PhotoPage extends SubTemplate
private function photoNav()
{
if (false) // $previous_post = $this->post->getPreviousPostUrl())
if ($this->previous_photo_url)
echo '
<a href="', $previous_post, '" id="previous_photo"><em>Previous photo</em></a>';
<a href="', $this->previous_photo_url, '" id="previous_photo"><em>Previous photo</em></a>';
else
echo '
<span id="previous_photo"><em>Previous photo</em></span>';
if (false) //$this->post->getNextPostUrl())
if ($this->next_photo_url)
echo '
<a href="', $next_post, '" id="next_photo"><em>Next photo</em></a>';
<a href="', $this->next_photo_url, '" id="next_photo"><em>Next photo</em></a>';
else
echo '
<span id="next_photo"><em>Next photo</em></span>';

View File

@@ -13,6 +13,7 @@ class PhotosIndex extends SubTemplate
protected $show_labels;
protected $row_limit = 1000;
protected $previous_header = '';
protected $url_suffix;
const PANORAMA_WIDTH = 1280;
const PANORAMA_HEIGHT = null;
@@ -95,7 +96,7 @@ class PhotosIndex extends SubTemplate
<a class="edit" href="', BASEURL, '/editasset/?id=', $image->getId(), '">Edit</a>';
echo '
<a href="', $image->getPageUrl(), '">
<a href="', $image->getPageUrl(), $this->url_suffix, '">
<img src="', $image->getThumbnailUrl($width, $height, $crop, $fit), '" alt="" title="', $image->getTitle(), '">';
if ($this->show_labels)
@@ -262,4 +263,9 @@ class PhotosIndex extends SubTemplate
echo '
</div>';
}
public function setUrlSuffix($suffix)
{
$this->url_suffix = $suffix;
}
}