]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
removed owner counts from mostviewed pages and updated view info on image view
authorGreg Froese <greg.froese@gmail.com>
Mon, 8 Jun 2009 14:38:45 +0000 (14:38 +0000)
committerGreg Froese <greg.froese@gmail.com>
Mon, 8 Jun 2009 14:38:45 +0000 (14:38 +0000)
languages/en.php
mostviewedimages.php
mostviewedimageslastmonth.php
mostviewedimagesthismonth.php
mostviewedimagesthisyear.php
mostviewedimagestoday.php
views/default/object/image.php

index 18259fc52871e984e1c9b245786a6ac1bf101f91..bbeb9a634758fce86359751504ef2e9ad1d321d3 100644 (file)
@@ -37,6 +37,8 @@
                        'tidypics:friendmostviewed' => "%s's most viewed images",\r
                        'tidypics:friendmostrecent' => "%s's most recent images",\r
                        'tidypics:highestrated' => "Highest rated images",\r
+                       'tidypics:viewsbyowner' => "Views: %s by %s users (not including you)",\r
+                       'tidypics:viewsbyothers' => "Views: %s (%s by you)",\r
        \r
                //settings\r
                        'tidypics:adminsettings' => 'Tidypics Settings',\r
index 9d2831bf785d2a52cde6398f18f0e99f008b1600..66266f5e7a322823fedb6de63ad5092e45f8ad7a 100644 (file)
@@ -20,7 +20,7 @@
                        FROM " . $prefix . "entities ent
                        INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
                        AND sub.subtype = 'image'
-                       INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
+                       INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid
                        INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
                        AND ms.string = 'tp_view'
                        GROUP BY ent.guid
@@ -33,8 +33,7 @@
        foreach($result as $entity) {
                $entities[] = get_entity($entity->guid);
        }
-       
-       $title = "Most viewed images";
+       $title = elgg_echo("tidypics:mostviewed");
        $area2 = elgg_view_title($title);
        $area2 .= elgg_view_entity_list($entities, $max, 0, $max);
        $body = elgg_view_layout('two_column_left_sidebar', '', $area2);
index 157738d8a487048e39305134ea84c45da7742c7f..c57a74233ec0b60749efb693c9f9e482a7649ea8 100644 (file)
@@ -26,7 +26,7 @@
                        FROM " . $prefix . "entities ent
                        INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
                        AND sub.subtype = 'image'
-                       INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
+                       INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid
                        INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
                        AND ms.string = 'tp_view'
                        WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end
index 5bc9c71518185c4228cb5194be885b4090a81979..e950f0f208b4dd83ba5917b61ac3286899171621 100644 (file)
@@ -26,7 +26,7 @@
                        FROM " . $prefix . "entities ent
                        INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
                        AND sub.subtype = 'image'
-                       INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
+                       INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid
                        INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
                        AND ms.string = 'tp_view'
                        WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end
index d0f2466341841cf0f24ced39b73ae99b53fe02ca..8072607690f62bef6393008160a4c48fa82b473e 100644 (file)
@@ -26,7 +26,7 @@
                        FROM " . $prefix . "entities ent
                        INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
                        AND sub.subtype = 'image'
-                       INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
+                       INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid
                        INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
                        AND ms.string = 'tp_view'
                        WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end
index 04f0513173036d2df215758b5aba9ca0c62eeea2..b971771badd729bf86bae6b58d888bddff7c912d 100644 (file)
@@ -26,7 +26,7 @@
                        FROM " . $prefix . "entities ent
                        INNER JOIN " . $prefix . "entity_subtypes sub ON ent.subtype = sub.id
                        AND sub.subtype = 'image'
-                       INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid
+                       INNER JOIN " . $prefix . "annotations ann1 ON ann1.entity_guid = ent.guid AND ann1.owner_guid != ent.owner_guid
                        INNER JOIN " . $prefix . "metastrings ms ON ms.id = ann1.name_id
                        AND ms.string = 'tp_view'
                        WHERE ann1.time_created BETWEEN $time_info->start AND $time_info->end
index ebac9c775ce4b5384065424af7e12befcd35e5d3..64109f1a2cdb96bb920fe7f58197442b0c32e13a 100644 (file)
@@ -116,10 +116,17 @@ if ($photo_tags) {
                        $views = count($views_a);
                
                        $my_views = 0;
+                       $owner_views = 0;
+                       $diff_viewers = array();
+//                     echo "<pre>"; var_dump($owner); echo "</pre>";
                        foreach($views_a as $view) {
                                if($view->owner_guid == $the_viewer && $the_viewer != 0) $my_views++;
+                               if($owner->guid == $view->owner_guid) $owner_views++;
+                               //count how many different people have viewed it
+                               if($owner->guid != $view->owner_guid) $diff_viewers[$view->owner_guid] = 1;
                        }
-                       
+                       //remove the owner's views from the total count (prevents artificially inflated view counts)
+                       $views = $views - $owner_views;
                        
                        // Build back and next links
                        $back = '';
@@ -155,7 +162,13 @@ if ($photo_tags) {
 
                <div id="tidypics_breadcrumbs">
                        <?php echo elgg_view('tidypics/breadcrumbs', array('album' => $album,) ); ?> <br />
-                       Views: <?=$views ?> <?= $my_views ? " ($my_views by me)" : ""; ?>
+                       <?
+                               if($owner->guid == $the_viewer) {
+                                       echo sprintf(elgg_echo("tidypics:viewsbyowner"), $views, count($diff_viewers));
+                               } else {
+                                       echo sprintf(elgg_echo("tidypics:viewsbyothers"), $views, $my_views);
+                               }
+                       ?>
                </div>
 
                <div id="tidypics_desc">