var $tmpl;
var $tags;
var $avail_tags;
- var $photos;
- var $avail_photos;
- var $current_photo;
var $current_tags;
public function __construct()
$this->tmpl = new PHPFSPOT_TMPL($this);
$this->get_tags();
- $this->get_photos();
-
- if(isset($_GET['id']) && is_numeric($_GET['id']))
- $this->current_photo = $_GET['id'];
} // __construct()
public function show()
{
-
- $this->tmpl->assign('tags', $this->tags);
+ $this->tmpl->assign('page_title', $this->cfg->page_title);
$this->tmpl->show("index.tpl");
-
} // show()
private function get_tags()
} // get_tags()
- private function get_photos()
- {
- $this->avail_photos = Array();
- $count = 0;
-
- $result = $this->db->db_query("
- SELECT id, name
- FROM photos
- ORDER BY time ASC
- ");
-
- while($row = $this->db->db_fetch_object($result)) {
-
- $photo_id = $row['id'];
- $photo_name = $row['name'];
-
- $this->photos[$photo_id] = $photo_name;
- $this->avail_photos[$count] = $photo_id;
-
- if(!isset($this->current_photo))
- $this->current_photo = $count;
-
- $count++;
-
- }
-
- } // get_photos()
-
public function get_photo_details($idx)
{
$result = $this->db->db_query("
public function showPhoto($photo)
{
+ $all_photos = $this->getAllTagPhotos();
+
+ foreach($all_photos as $all_photo) {
+
+ if($get_next) {
+ $next_img = $all_photo;
+ break;
+ }
+
+ if($all_photo == $photo) {
+ $get_next = 1;
+ }
+ else {
+ $previous_img = $all_photo;
+ }
+ }
+
if(isset($photo)) {
$this->tmpl->assign('image_url', 'phpfspot_img.php?idx='. $photo ."&width=". $this->cfg->photo_width);
}
- if($photo > 0) {
- $this->tmpl->assign('previous_url', "javascript:showImage(". ($photo-1) .");");
+ if($previous_img) {
+ $this->tmpl->assign('previous_url', "javascript:showImage(". $previous_img .");");
}
- if($photo < count($this->photos)) {
- $this->tmpl->assign('next_url', "javascript:showImage(". ($photo+1) .");");
+ if($next_img) {
+ $this->tmpl->assign('next_url', "javascript:showImage(". $next_img .");");
}
$this->tmpl->show("single_photo.tpl");
}
- print "<a href=\"javascript:Tags('reset', 0);\">Reset Tags</a>";
-
} // getSelectedTags()
public function addTag($tag)