diff options
author | Cash Costello <cash.costello@gmail.com> | 2009-12-12 02:41:16 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2009-12-12 02:41:16 +0000 |
commit | 1738eb457318068194571f337cff52f9a2bbb29b (patch) | |
tree | ea7d3931ab9419d0babe7571acee0ff875cc1479 /pages/lists/mostviewedimages.php | |
parent | 58fd575a7b28936455baea2856b1d5613d29b477 (diff) | |
download | elgg-1738eb457318068194571f337cff52f9a2bbb29b.tar.gz elgg-1738eb457318068194571f337cff52f9a2bbb29b.tar.bz2 |
using image rss view for album display and condensed most viewed pages
Diffstat (limited to 'pages/lists/mostviewedimages.php')
-rw-r--r-- | pages/lists/mostviewedimages.php | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/pages/lists/mostviewedimages.php b/pages/lists/mostviewedimages.php index b8cc67b51..16b9d7295 100644 --- a/pages/lists/mostviewedimages.php +++ b/pages/lists/mostviewedimages.php @@ -1,8 +1,7 @@ <?php /** - * Tidypics full view of an image - * Given a GUID, this page will try and display any entity + * Most viewed images - either for a user or all site * */ @@ -13,9 +12,24 @@ $prefix = $CONFIG->dbprefix; $max = 24; + $owner_guid = page_owner(); + + //$start = microtime(true); + $photos = tp_get_entities_from_annotations_calculate_x( + 'count', + 'object', + 'image', + 'tp_view', + '', + '', + $owner_guid, + $max); + //error_log("elgg query is " . (float)(microtime(true) - $start)); + //this works but is wildly inefficient //$annotations = get_annotations(0, "object", "image", "tp_view", "", "", 5000); - +/* + $start = microtime(true); $sql = "SELECT ent.guid, count( * ) AS views FROM " . $prefix . "entities ent INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id @@ -33,15 +47,26 @@ foreach($result as $entity) { $entities[] = get_entity($entity->guid); } - $title = elgg_echo("tidypics:mostviewed"); +*/ + //error_log("custom query is " . (float)(microtime(true) - $start)); + + if ($owner_guid) { + if ($owner_guid == get_loggedin_userid()) { + $title = elgg_echo("tidypics:yourmostviewed"); + } else { + $title = sprintf(elgg_echo("tidypics:friendmostviewed"), page_owner_entity()->name); + } + } else { + $title = elgg_echo("tidypics:mostviewed"); + } $area2 = elgg_view_title($title); // grab the html to display the images - $images = tp_view_entity_list($entities, $max, 0, $max, false); + $content = tp_view_entity_list($photos, $max, 0, $max, false); // this view takes care of the title on the main column and the content wrapper - $area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $images,)); - if( empty( $area2 )) $area2 = $images; + $area2 = elgg_view('tidypics/content_wrapper', array('title' => $title, 'content' => $content,)); + if( empty( $area2 )) $area2 = $content; $body = elgg_view_layout('two_column_left_sidebar', '', $area2); page_draw($title, $body); |