aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Froese <greg.froese@gmail.com>2009-06-08 14:38:45 +0000
committerGreg Froese <greg.froese@gmail.com>2009-06-08 14:38:45 +0000
commited5bf08b0a312cfc4bb6b885b0ca293d4b10869b (patch)
treeb0f89fda59e3a4bac71508aab5b8b5609d988dba
parent0b4487d2200a4818fd52d6fbbb1f252e053141c6 (diff)
downloadelgg-ed5bf08b0a312cfc4bb6b885b0ca293d4b10869b.tar.gz
elgg-ed5bf08b0a312cfc4bb6b885b0ca293d4b10869b.tar.bz2
removed owner counts from mostviewed pages and updated view info on image view
-rw-r--r--languages/en.php2
-rw-r--r--mostviewedimages.php5
-rw-r--r--mostviewedimageslastmonth.php2
-rw-r--r--mostviewedimagesthismonth.php2
-rw-r--r--mostviewedimagesthisyear.php2
-rw-r--r--mostviewedimagestoday.php2
-rw-r--r--views/default/object/image.php17
7 files changed, 23 insertions, 9 deletions
diff --git a/languages/en.php b/languages/en.php
index 18259fc52..bbeb9a634 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -37,6 +37,8 @@
'tidypics:friendmostviewed' => "%s's most viewed images",
'tidypics:friendmostrecent' => "%s's most recent images",
'tidypics:highestrated' => "Highest rated images",
+ 'tidypics:viewsbyowner' => "Views: %s by %s users (not including you)",
+ 'tidypics:viewsbyothers' => "Views: %s (%s by you)",
//settings
'tidypics:adminsettings' => 'Tidypics Settings',
diff --git a/mostviewedimages.php b/mostviewedimages.php
index 9d2831bf7..66266f5e7 100644
--- a/mostviewedimages.php
+++ b/mostviewedimages.php
@@ -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);
diff --git a/mostviewedimageslastmonth.php b/mostviewedimageslastmonth.php
index 157738d8a..c57a74233 100644
--- a/mostviewedimageslastmonth.php
+++ b/mostviewedimageslastmonth.php
@@ -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
diff --git a/mostviewedimagesthismonth.php b/mostviewedimagesthismonth.php
index 5bc9c7151..e950f0f20 100644
--- a/mostviewedimagesthismonth.php
+++ b/mostviewedimagesthismonth.php
@@ -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
diff --git a/mostviewedimagesthisyear.php b/mostviewedimagesthisyear.php
index d0f246634..807260769 100644
--- a/mostviewedimagesthisyear.php
+++ b/mostviewedimagesthisyear.php
@@ -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
diff --git a/mostviewedimagestoday.php b/mostviewedimagestoday.php
index 04f051317..b971771ba 100644
--- a/mostviewedimagestoday.php
+++ b/mostviewedimagestoday.php
@@ -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
diff --git a/views/default/object/image.php b/views/default/object/image.php
index ebac9c775..64109f1a2 100644
--- a/views/default/object/image.php
+++ b/views/default/object/image.php
@@ -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">