From 73403645808a81425381f43c25e0ea2c92705312 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 25 Jul 2010 02:01:36 +0000 Subject: first go at brining tidypics up to code standards --- views/default/object/album.php | 192 ++++++++++++++------------- views/default/object/image.php | 295 ++++++++++++++++++++--------------------- 2 files changed, 244 insertions(+), 243 deletions(-) (limited to 'views/default/object') diff --git a/views/default/object/album.php b/views/default/object/album.php index 85dd69ac9..0db0d3e49 100644 --- a/views/default/object/album.php +++ b/views/default/object/album.php @@ -1,22 +1,22 @@ getGUID(); - $owner = $album->getOwnerEntity(); - $tags = $album->tags; - $title = $album->title; - $desc = $album->description; - $friendlytime = friendly_time($album->time_created); - $mime = $album->mimetype; +global $CONFIG; - if (get_context() == "search") { +$album = $vars['entity']; +$album_guid = $album->getGUID(); +$owner = $album->getOwnerEntity(); +$tags = $album->tags; +$title = $album->title; +$desc = $album->description; +$friendlytime = friendly_time($album->time_created); +$mime = $album->mimetype; - if (get_input('search_viewtype') == "gallery") { +if (get_context() == "search") { + + if (get_input('search_viewtype') == "gallery") { /****************************************************************************** * @@ -27,30 +27,31 @@ * *****************************************************************************/ - //get album cover if one was set - if ($album->cover) - $album_cover = '' . $title . ''; - else - $album_cover = 'new album'; - + //get album cover if one was set + if ($album->cover) { + $album_cover = '' . $title . ''; + } else { + $album_cover = 'new album'; + } ?> ' . $title . '

'; - $info .= "

username}\">{$owner->name} {$friendlytime}"; - $numcomments = elgg_count_comments($album); - if ($numcomments) - $info .= ", getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")"; - $info .= "

"; - - //get album cover if one was set - if ($album->cover) - $icon = "getURL()}\">" . 'thumbnail'; - else - $icon = "getURL()}\">" . 'new album'; - - echo elgg_view_listing($icon, $info); + $info = '

' . $title . '

'; + $info .= "

username}\">{$owner->name} {$friendlytime}"; + $numcomments = elgg_count_comments($album); + if ($numcomments) { + $info .= ", getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")"; } - } else { + $info .= "

"; + + //get album cover if one was set + if ($album->cover) { + $icon = "getURL()}\">" . 'thumbnail'; + } else { + $icon = "getURL()}\">" . 'new album'; + } + echo elgg_view_listing($icon, $info); + } +} else { /****************************************************************************** * @@ -86,76 +88,76 @@ * *****************************************************************************/ - $page = get_input("page"); - list($album_placeholder, $album_id, $album_title) = split("/", $page); - - $photo_ratings = get_plugin_setting('photo_ratings', 'tidypics'); - if ($photo_ratings == "enabled") - add_submenu_item( elgg_echo("tidypics:highestrated"), - $CONFIG->wwwroot . "pg/photos/highestrated/group:" . $album_id, - 'photos'); - - echo elgg_view_title($title); + $page = get_input("page"); + list($album_placeholder, $album_id, $album_title) = split("/", $page); + + $photo_ratings = get_plugin_setting('photo_ratings', 'tidypics'); + if ($photo_ratings == "enabled") { + add_submenu_item( elgg_echo("tidypics:highestrated"), + $CONFIG->wwwroot . "pg/photos/highestrated/group:" . $album_id, + 'photos'); + } + echo elgg_view_title($title); ?>
- +
-' . autop($desc) . '
'; - - $images = get_entities("object", "image", $album_guid, '', 999); - - //build array for back | next links - $_SESSION['image_sort'] = array(); - - if (is_array($images)) { - foreach ($images as $image) { - array_push($_SESSION['image_sort'], $image->guid); - } - - // display the simple image views. Uses 'object/image' view - echo list_entities("object", "image", $album_guid, 24, false); - - $num_images = count($images); - } else { - echo '
' . elgg_echo('image:none') . '
'; - $num_images = 0; +' . autop($desc) . ''; + + $images = get_entities("object", "image", $album_guid, '', 999); + + //build array for back | next links + $_SESSION['image_sort'] = array(); + + if (is_array($images)) { + foreach ($images as $image) { + array_push($_SESSION['image_sort'], $image->guid); } - + + // display the simple image views. Uses 'object/image' view + echo list_entities("object", "image", $album_guid, 24, false); + + $num_images = count($images); + } else { + echo '
' . elgg_echo('image:none') . '
'; + $num_images = 0; + } + ?>
-
$tags));?>
- - name; ?>
-
+ name; ?>
+

-: - : +
'; - } // end of individual album view -?> + if ($vars['full']) { + echo elgg_view_comments($album); + } + + echo ''; +} // end of individual album view + diff --git a/views/default/object/image.php b/views/default/object/image.php index ee81d800f..cd53120de 100644 --- a/views/default/object/image.php +++ b/views/default/object/image.php @@ -1,19 +1,19 @@ getGUID(); - $tags = $image->tags; - $title = $image->title; - $desc = $image->description; - $owner = $image->getOwnerEntity(); - $friendlytime = friendly_time($image->time_created); +$image = $vars['entity']; +$image_guid = $image->getGUID(); +$tags = $image->tags; +$title = $image->title; +$desc = $image->description; +$owner = $image->getOwnerEntity(); +$friendlytime = friendly_time($image->time_created); /******************************************************************** @@ -21,69 +21,65 @@ * search view of an image * ********************************************************************/ - if (get_context() == "search") { +if (get_context() == "search") { - // gallery view is a matrix view showing just the image - size: small - if (get_input('search_viewtype') == "gallery") { - ?> -
- thumbnail -
- '.$title.'

'; - $info .= "

username}\">{$owner->name} {$friendlytime}"; - $numcomments = elgg_count_comments($image); - if ($numcomments) - $info .= ", getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")"; - $info .= "

"; - $icon = "getURL()}\">" . '' . $title . ''; - - echo elgg_view_listing($icon, $info); + // gallery view is a matrix view showing just the image - size: small + if (get_input('search_viewtype') == "gallery") { +?> +
+ thumbnail +
+'.$title.'

'; + $info .= "

username}\">{$owner->name} {$friendlytime}"; + $numcomments = elgg_count_comments($image); + if ($numcomments) { + $info .= ", getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")"; } + $info .= "

"; + $icon = "getURL()}\">" . '' . $title . ''; + + echo elgg_view_listing($icon, $info); + } /*************************************************************** * * front page view * ****************************************************************/ - } else if (get_context() == "front") { - // the front page view is a clikcable thumbnail of the image +} else if (get_context() == "front") { + // the front page view is a clickable thumbnail of the image ?> -<?php echo $title; ?> + <?php echo $title; ?> - - $image), $image_html); - - if ($image_html) { - echo $image_html; - } else { - // default link to image if no one overrides -?> -
- <?php echo $image->title; ?> -
- $image), $image_html); + + if ($image_html) { + echo $image_html; + } else { + // default link to image if no one overrides ?> +
+ <?php echo $image->title; ?> +
container_guid); - $current = array_search($image_guid, $_SESSION['image_sort']); + // Build back and next links + $back = ''; + $next = ''; - if (!$current) { // means we are no longer using the correct album array + $album = get_entity($image->container_guid); - //rebuild the array - $count = get_entities("object","image", $album->guid, '', 999); - $_SESSION['image_sort'] = array(); + $current = array_search($image_guid, $_SESSION['image_sort']); - foreach ($count as $img) { - array_push($_SESSION['image_sort'], $img->guid); - } + if (!$current) { // means we are no longer using the correct album array - if ($_SESSION['image_sort']) - $current = array_search($image_guid, $_SESSION['image_sort']); + //rebuild the array + $count = get_entities("object","image", $album->guid, '', 999); + $_SESSION['image_sort'] = array(); + + foreach ($count as $img) { + array_push($_SESSION['image_sort'], $img->guid); } - if ($current != 0) - $back = '« ' . elgg_echo('image:back') . ''; + if ($_SESSION['image_sort']) { + $current = array_search($image_guid, $_SESSION['image_sort']); + } + } - if (sizeof($_SESSION['image_sort']) > $current + 1) - $next = '' . elgg_echo('image:next') . ' »'; + if ($current != 0) { + $back = '« ' . elgg_echo('image:back') . ''; + } + if (sizeof($_SESSION['image_sort']) > $current + 1) { + $next = '' . elgg_echo('image:next') . ' »'; + } ?>
- $album,) ); ?>
- addView($viewer->guid); - $views = $image->getViews($viewer->guid); - if (is_array($views)) { - echo sprintf(elgg_echo("tidypics:views"), $views['total']); - if ($owner->guid == $viewer->guid) { - echo ' ' . sprintf(elgg_echo("tidypics:viewsbyowner"), $views['unique']); - } - else { - if ($views['mine']) - echo ' ' . sprintf(elgg_echo("tidypics:viewsbyothers"), $views['mine']); + $album,) ); ?>
+addView($viewer->guid); + $views = $image->getViews($viewer->guid); + if (is_array($views)) { + echo sprintf(elgg_echo("tidypics:views"), $views['total']); + if ($owner->guid == $viewer->guid) { + echo ' ' . sprintf(elgg_echo("tidypics:viewsbyowner"), $views['unique']); + } else { + if ($views['mine']) { + echo ' ' . sprintf(elgg_echo("tidypics:viewsbyothers"), $views['mine']); + } + } } } - } - ?> +?>
- +
    @@ -159,73 +157,74 @@
- "; - $image_html .= "\"{$title}\""; - $image_html .= ""; - } else { - $image_html = "\"{$title}\""; - } - // does any plugin want to override the link - $image_html = trigger_plugin_hook('tp_thumbnail_link', 'image', array('image' => $image), $image_html); - echo $image_html; - ?> + "; + $image_html .= "\"{$title}\""; + $image_html .= ""; + } else { + $image_html = "\"{$title}\""; + } + // does any plugin want to override the link + $image_html = trigger_plugin_hook('tp_thumbnail_link', 'image', array('image' => $image), $image_html); + echo $image_html; + ?>
-
    '; - echo elgg_view('tidypics/image_menu', array('image_guid' => $image_guid, - 'viewer' => $viewer, - 'owner' => $owner, - 'anytags' => $image->isPhotoTagged(), - 'album' => $album, ) ); - echo '
'; - - // tagging code - photo tags on images, photo tag listing and hidden divs used in tagging - if (get_plugin_setting('tagging', 'tidypics') != "disabled") { - echo elgg_view('tidypics/tagging', array( 'image' => $image, - 'viewer' => $viewer, - 'owner' => $owner, ) ); - } - - - if (get_plugin_setting('exif', 'tidypics') == "enabled") { +
    '; + echo elgg_view('tidypics/image_menu', array( + 'image_guid' => $image_guid, + 'viewer' => $viewer, + 'owner' => $owner, + 'anytags' => $image->isPhotoTagged(), + 'album' => $album, ) ); + echo '
'; + + // tagging code - photo tags on images, photo tag listing and hidden divs used in tagging + if (get_plugin_setting('tagging', 'tidypics') != "disabled") { + echo elgg_view('tidypics/tagging', array( + 'image' => $image, + 'viewer' => $viewer, + 'owner' => $owner, ) ); + } + + + if (get_plugin_setting('exif', 'tidypics') == "enabled") { + echo elgg_view('tidypics/exif', array('guid'=> $image_guid)); + } ?> - $image_guid)); ?> -
- +
$tags));?>
-
- $vars['entity'])); ?> -
+ $vars['entity'])); ?> +
name; ?> name; ?> '; - - echo ''; // content wrapper + echo elgg_view_comments($image); - } // end of individual image display + echo '
'; - } - -?> + echo ''; // content wrapper + } // end of individual image display +} -- cgit v1.2.3