From: Greg Froese Date: Mon, 8 Jun 2009 14:38:45 +0000 (+0000) Subject: removed owner counts from mostviewed pages and updated view info on image view X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=ed5bf08b0a312cfc4bb6b885b0ca293d4b10869b;p=lorea%2Felgg.git removed owner counts from mostviewed pages and updated view info on image view --- 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 "
"; var_dump($owner); echo "
"; 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) {
$album,) ); ?>
- Views: + guid == $the_viewer) { + echo sprintf(elgg_echo("tidypics:viewsbyowner"), $views, count($diff_viewers)); + } else { + echo sprintf(elgg_echo("tidypics:viewsbyothers"), $views, $my_views); + } + ?>