aboutsummaryrefslogtreecommitdiff
path: root/viewimage.php
diff options
context:
space:
mode:
authorGreg Froese <greg.froese@gmail.com>2009-05-10 23:36:42 +0000
committerGreg Froese <greg.froese@gmail.com>2009-05-10 23:36:42 +0000
commit0911bafdcddddd2104e696e6fb44cd77247ade7b (patch)
treecc668805470738d0b4edde0b39778e297598d51c /viewimage.php
parentfe1cce6c8cbf2ee781619ff21b571518aa1a28e9 (diff)
downloadelgg-0911bafdcddddd2104e696e6fb44cd77247ade7b.tar.gz
elgg-0911bafdcddddd2104e696e6fb44cd77247ade7b.tar.bz2
adding in most viewed and recent images pages
Diffstat (limited to 'viewimage.php')
-rw-r--r--viewimage.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/viewimage.php b/viewimage.php
index fa05bda00..5b51725d7 100644
--- a/viewimage.php
+++ b/viewimage.php
@@ -31,6 +31,21 @@
$CONFIG->wwwroot . "pg/photos/owned/" . $page_owner->username);
}
+ $views = get_metadata_byname($photo_guid, "tp_views");
+ if(!$views || intval($views["value"] == 0)) $views["value"] = 0;
+ $views["value"] = $views["value"] + 1; //TODO: only add views for non-owner
+ create_metadata($photo_guid, "tp_views", $views["value"], "integer", 0, 2);
+
+ $viewer = get_loggedin_user();
+
+ $metadatas = get_metadata_for_entity($photo_guid);
+ $rating = 0;
+ foreach($metadatas as $metadata) {
+ if($metadata["owner_guid"] == $viewer["guid"]) {
+ if($metadata["name"] == "rating") $rating = $metadata["value"];
+ }
+ }
+
if (can_write_to_container(0, $album->container_guid)) {
add_submenu_item( elgg_echo('image:edit'),
$CONFIG->wwwroot . 'pg/photos/edit/' . $photo_guid,
@@ -41,9 +56,11 @@
true);
}
- $title = $photo->title;
+
+ $title = $photo->title . " - views: $views[value]";
$area2 = elgg_view_title($title);
$area2 .= elgg_view_entity($photo, true);
+ $area2 .= "<a href='$CONFIG->wwwroot" . "pg/photos/rate/$photo_guid'>Rate *</a>";
$body = elgg_view_layout('two_column_left_sidebar', '', $area2);