summaryrefslogtreecommitdiffstats
path: root/phpfspot.class.php
diff options
context:
space:
mode:
authorAndreas Unterkircher <unki@netshadow.at>2008-05-24 09:26:11 +0200
committerAndreas Unterkircher <unki@netshadow.at>2008-05-24 09:57:13 +0200
commit2ea665ef86c5573c244ebbba797fb31cadf6752b (patch)
treede710c3e5df056d63b9a280c2e1fc24ad12b5f2a /phpfspot.class.php
parentaab7d4d07c16dc78a6d2a41223d469a1a60e5022 (diff)
issue121, show rating value in photo-index- and single-photo-view
Signed-off-by: Andreas Unterkircher <unki@netshadow.at>
Diffstat (limited to 'phpfspot.class.php')
-rw-r--r--phpfspot.class.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index e6c4aff..0711499 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -507,6 +507,28 @@ class PHPFSPOT {
} // getPhotoName()
/**
+ * get photo rating level
+ *
+ * this function will return the integer-based rating
+ * level of the photo. This can only be done, if the F-Spot
+ * database is at a specific level. If rating value can not
+ * be found, zero will be returned indicating no rating value
+ * is available.
+ * @param integer idx
+ * @return integer
+ */
+ public function get_photo_rating($idx)
+ {
+ if($detail = $this->get_photo_details($idx)) {
+ if(isset($detail['rating']))
+ return $detail['rating'];
+ }
+
+ return 0;
+
+ } // get_photo_rating()
+
+ /**
* shrink text according provided limit
*
* If the length of the name exceeds $limit the
@@ -643,6 +665,7 @@ class PHPFSPOT {
$this->tmpl->assign('description', $details['description']);
$this->tmpl->assign('image_name', $this->parse_uri($details['uri'], 'filename'));
+ $this->tmpl->assign('image_rating', $this->get_photo_rating($photo));
$this->tmpl->assign('width', $info_thumb[0]);
$this->tmpl->assign('height', $info_thumb[1]);
@@ -1232,6 +1255,7 @@ class PHPFSPOT {
$img_name[$thumbs] = Array();
$img_fullname[$thumbs] = Array();
$img_title = Array();
+ $img_rating = Array();
for($i = $begin_with; $i < $end_with; $i++) {
@@ -1242,6 +1266,7 @@ class PHPFSPOT {
$img_name[$thumbs] = htmlspecialchars($this->getPhotoName($photos[$i], 15));
$img_fullname[$thumbs] = htmlspecialchars($this->getPhotoName($photos[$i], 0));
$img_title[$thumbs] = "Click to view photo ". htmlspecialchars($this->getPhotoName($photos[$i], 0));
+ $img_rating[$thumbs] = $this->get_photo_rating($photos[$i]);
$thumb_path = $this->get_thumb_path($this->cfg->thumb_width, $photos[$i]);
@@ -1389,6 +1414,7 @@ class PHPFSPOT {
$this->tmpl->assign('img_name', $img_name);
$this->tmpl->assign('img_fullname', $img_fullname);
$this->tmpl->assign('img_title', $img_title);
+ $this->tmpl->assign('img_rating', $img_rating);
$this->tmpl->assign('thumbs', $thumbs);
$this->tmpl->assign('selected_tags', $this->getSelectedTags('img'));