diff options
author | Andreas Unterkircher <unki@netshadow.at> | 2007-06-05 21:06:05 +0000 |
---|---|---|
committer | Andreas Unterkircher <unki@netshadow.at> | 2007-06-05 21:06:05 +0000 |
commit | 495fee6e4ea622177353c74425d546aedf467991 (patch) | |
tree | 38b3bb324724a89ce9448ba73b16a79ba4f68437 | |
parent | 60b6594fad70d2d49676e02b6123385173bcdae3 (diff) |
limit displayed photos within index to tag selection
git-svn-id: file:///var/lib/svn/phpfspot/trunk@21 fa6a889d-dae6-447d-9e79-4ba9a3039384
-rw-r--r-- | phpfspot.class.php | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php index 20ab36d..168d081 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -186,10 +186,34 @@ class PHPFSPOT { } // resetTags() + public function getAllTagPhotos() + { + $selected = ""; + foreach($_SESSION['selected_tags'] as $tag) + $selected.= $tag .","; + $selected = substr($selected, 0, strlen($selected)-1); + + $tagged_photos = Array(); + + $result = $this->db->db_query(" + SELECT DISTINCT photo_id + FROM photo_tags + WHERE tag_id IN (". $selected .") + "); + + while($row = $this->db->db_fetch_object($result)) { + array_push($tagged_photos, $row['photo_id']); + } + + + return $tagged_photos; + + } // getAllTagPhotos() + public function showPhotoIndex() { - foreach($this->avail_photos as $photo) + foreach($this->getAllTagPhotos() as $photo) { print "<img src=\"phpfspot_img.php?idx=". $photo ."&width=". $this->cfg->thumb_width ."\" /><br />\n"; } |