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>';