diff options
-rw-r--r-- | actions/settings.php | 7 | ||||
-rw-r--r-- | languages/en.php | 1 | ||||
-rw-r--r-- | start.php | 48 | ||||
-rw-r--r-- | views/default/object/image.php | 62 | ||||
-rw-r--r-- | views/default/tidypics/forms/admin.php | 5 |
5 files changed, 77 insertions, 46 deletions
diff --git a/actions/settings.php b/actions/settings.php index 903802dd8..ae74b8945 100644 --- a/actions/settings.php +++ b/actions/settings.php @@ -36,11 +36,16 @@ else
set_plugin_setting('photo_ratings', 'disabled', 'tidypics');
- if (is_array(get_input('exif')))
+ if (is_array(get_input('exif')))
set_plugin_setting('exif', 'enabled', 'tidypics');
else
set_plugin_setting('exif', 'disabled', 'tidypics');
+ if (is_array(get_input('view_count')))
+ set_plugin_setting('view_count', 'enabled', 'tidypics');
+ else
+ set_plugin_setting('view_count', 'disabled', 'tidypics');
+
if (is_array(get_input('grp_perm_override')))
set_plugin_setting('grp_perm_override', 'enabled', 'tidypics');
else
diff --git a/languages/en.php b/languages/en.php index f71a1fb89..fca507407 100644 --- a/languages/en.php +++ b/languages/en.php @@ -50,6 +50,7 @@ 'tidypics:settings:tagging' => "Enable photo tagging",
'tidypics:settings:photo_ratings' => "Enable photo ratings (requires rate plugin of Miguel Montes or compatible)",
'tidypics:settings:exif' => "Show EXIF data",
+ 'tidypics:settings:view_count' => "View counter",
'tidypics:settings:grp_perm_override' => "Allow group members full access to group albums",
'tidypics:settings:maxfilesize' => "Maximum image size in megabytes (MB):",
'tidypics:settings:quota' => "User/Group Quota (MB) - 0 equals no quota",
@@ -77,9 +77,11 @@ }
}
}
- // context is only set to photos on individual pages, not on group pages
+ // context is only set to photos on individual pages, not on group pages
else if (get_context() == "photos") {
+ $view_count = get_plugin_setting('view_count', 'tidypics');
+
// owner gets "your albumn", "your friends albums", "your most viewed", "your most recent"
if (get_loggedin_userid() == $page_owner->guid && get_loggedin_userid()) {
add_submenu_item( elgg_echo('album:create'),
@@ -93,10 +95,12 @@ add_submenu_item( elgg_echo('album:yours:friends'),
$CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username,
'tidypics-a');
-
- add_submenu_item( elgg_echo('tidypics:yourmostviewed'),
- $CONFIG->wwwroot . 'pg/photos/yourmostviewed',
- 'tidypics-a');
+
+ if ($view_count != 'disabled') {
+ add_submenu_item( elgg_echo('tidypics:yourmostviewed'),
+ $CONFIG->wwwroot . 'pg/photos/yourmostviewed',
+ 'tidypics-a');
+ }
add_submenu_item( elgg_echo('tidypics:yourmostrecent'),
$CONFIG->wwwroot . 'pg/photos/yourmostrecent',
@@ -106,9 +110,12 @@ add_submenu_item( elgg_echo("album:yours"),
$CONFIG->wwwroot . "pg/photos/owned/" . $_SESSION['user']->username,
'tidypics-b' );
- add_submenu_item( elgg_echo('tidypics:yourmostviewed'),
- $CONFIG->wwwroot . 'pg/photos/yourmostviewed',
- 'tidypics-b');
+
+ if ($view_count != 'disabled') {
+ add_submenu_item( elgg_echo('tidypics:yourmostviewed'),
+ $CONFIG->wwwroot . 'pg/photos/yourmostviewed',
+ 'tidypics-b');
+ }
add_submenu_item( elgg_echo('tidypics:yourmostrecent'),
$CONFIG->wwwroot . 'pg/photos/yourmostrecent',
@@ -121,9 +128,13 @@ add_submenu_item( sprintf(elgg_echo('album:friends'),$page_owner->name),
$CONFIG->wwwroot . "pg/photos/friends/". $page_owner->username,
'tidypics-a');
- add_submenu_item( sprintf(elgg_echo('tidypics:friendmostviewed'),$page_owner->name),
- $CONFIG->wwwroot . "pg/photos/friendmostviewed/". $page_owner->username,
- 'tidypics-a');
+
+ if ($view_count != 'disabled') {
+ add_submenu_item( sprintf(elgg_echo('tidypics:friendmostviewed'),$page_owner->name),
+ $CONFIG->wwwroot . "pg/photos/friendmostviewed/". $page_owner->username,
+ 'tidypics-a');
+ }
+
add_submenu_item( sprintf(elgg_echo('tidypics:friendmostrecent'),$page_owner->name),
$CONFIG->wwwroot . "pg/photos/friendmostrecent/". $page_owner->username,
'tidypics-a');
@@ -141,15 +152,18 @@ add_submenu_item( sprintf(elgg_echo('album:all'),$page_owner->name),
$CONFIG->wwwroot . "pg/photos/world/",
'tidypics-z');
- add_submenu_item( elgg_echo('tidypics:mostviewed'),
- $CONFIG->wwwroot . 'pg/photos/mostviewed',
- 'tidypics-z');
add_submenu_item( elgg_echo('tidypics:mostrecent'),
$CONFIG->wwwroot . 'pg/photos/mostrecent',
'tidypics-z');
- add_submenu_item( elgg_echo('tidypics:recentlyviewed'),
- $CONFIG->wwwroot . 'pg/photos/recentlyviewed',
- 'tidypics-z');
+
+ if ($view_count != 'disabled') {
+ add_submenu_item( elgg_echo('tidypics:mostviewed'),
+ $CONFIG->wwwroot . 'pg/photos/mostviewed',
+ 'tidypics-z');
+ add_submenu_item( elgg_echo('tidypics:recentlyviewed'),
+ $CONFIG->wwwroot . 'pg/photos/recentlyviewed',
+ 'tidypics-z');
+ }
}
diff --git a/views/default/object/image.php b/views/default/object/image.php index 1ab2e921a..bd81e238e 100644 --- a/views/default/object/image.php +++ b/views/default/object/image.php @@ -101,33 +101,37 @@ if ($photo_tags) { // //////////////////////////////////////////////////////// - // Get view information + $view_count = get_plugin_setting('view_count', 'tidypics'); $viewer = get_loggedin_user(); - - //who is viewing? - if($viewer->guid) { - $the_viewer = $viewer->guid; - } else { - $the_viewer = 0; - } + + if ($view_count != 'disabled') { + // Get view information + + //who is viewing? + if($viewer->guid) { + $the_viewer = $viewer->guid; + } else { + $the_viewer = 0; + } + + create_annotation($file_guid, "tp_view", "1", "integer", $the_viewer, ACCESS_PUBLIC); + $views_a = get_annotations($file_guid, "object", "image", "tp_view", "", 0, 9999); + $views = count($views_a); - create_annotation($file_guid, "tp_view", "1", "integer", $the_viewer, 2); - $views_a = get_annotations($file_guid, "object", "image", "tp_view", "", 0, 9999); - $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; + $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; } - //remove the owner's views from the total count (prevents artificially inflated view counts) - $views = $views - $owner_views; // Build back and next links $back = ''; @@ -163,11 +167,13 @@ if ($photo_tags) { <div id="tidypics_breadcrumbs"> <?php echo elgg_view('tidypics/breadcrumbs', array('album' => $album,) ); ?> <br /> - <? - 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); + <?php + if ($view_count != 'disabled') { + 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> diff --git a/views/default/tidypics/forms/admin.php b/views/default/tidypics/forms/admin.php index 564b89987..6094a776c 100644 --- a/views/default/tidypics/forms/admin.php +++ b/views/default/tidypics/forms/admin.php @@ -55,6 +55,11 @@ if(!$exif) $exif = "disabled";
$form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:exif') => 'enabled'), 'internalname' => 'exif', 'value' => $exif )) . "</p>";
+ // Show EXIF
+ $view_count = $plugin->view_count;
+ if(!$view_count) $view_count = "enabled";
+ $form_body .= '<p class="admin_debug">' . elgg_view("input/checkboxes", array('options' => array(elgg_echo('tidypics:settings:view_count') => 'enabled'), 'internalname' => 'view_count', 'value' => $view_count )) . "</p>";
+
// Watermark Text
$form_body .= "<p>" . elgg_echo('tidypics:settings:watermark') . "<br />";
$form_body .= elgg_view("input/text",array('internalname' => 'params[watermark_text]', 'value' => $plugin->watermark_text)) . "</p>";
|