From 774b7c79bfcdb5d3139ec16152e6955a86093699 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sat, 20 Jun 2009 20:32:17 +0000 Subject: still cleaning up album view - this fixes a count bug with an empty album --- views/default/object/album.php | 80 +++++++++++++++++++++++------------------- views/default/object/image.php | 2 +- views/default/tidypics/css.php | 2 +- 3 files changed, 46 insertions(+), 38 deletions(-) (limited to 'views/default') diff --git a/views/default/object/album.php b/views/default/object/album.php index 34174e571..3a5f5a975 100644 --- a/views/default/object/album.php +++ b/views/default/object/album.php @@ -5,19 +5,19 @@ global $CONFIG; - $file = $vars['entity']; - $file_guid = $file->getGUID(); - $tags = $file->tags; - $title = $file->title; - $desc = $file->description; - $owner = $vars['entity']->getOwnerEntity(); - $friendlytime = friendly_time($vars['entity']->time_created); - $mime = $file->mimetype; + $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_context() == "search") { if (get_input('search_viewtype') == "gallery") { - + /****************************************************************************** * * Gallery view of an album object @@ -28,21 +28,21 @@ *****************************************************************************/ //get album cover if one was set - if ($file->cover) - $album_cover = 'thumbnail'; + if ($album->cover) + $album_cover = 'thumbnail'; else - $album_cover = 'new album'; + $album_cover = 'new album'; ?> @@ -57,14 +57,14 @@ * *****************************************************************************/ - $info = '

'.$title.'

'; + $info = '

' . $title . '

'; $info .= "

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

"; - $icon = "getURL()}\">" . elgg_view("tidypics/icon", array('album' => true, 'size' => 'small')) . ""; + $icon = "getURL()}\">" . elgg_view("tidypics/icon", array('album' => true, 'size' => 'small')) . ""; echo elgg_view_listing($icon, $info); } @@ -93,32 +93,40 @@ '.autop($desc).''; - - // display the simple image views. Uses: via 'object/image.php' - $count = get_entities("object","image", $file_guid, '', 999); - + echo '
' . autop($desc) . '
'; + + $images = get_entities("object", "image", $album_guid, '', 999); + //build array for back | next links $_SESSION['image_sort'] = array(); - - if(count($count) > 0) { - foreach($count as $image){ + + if (is_array($images)) { + foreach ($images as $image) { array_push($_SESSION['image_sort'], $image->guid); } - - echo list_entities("object","image", $file_guid, 24, false); + + // 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'); + echo '
' . elgg_echo('image:none') . '
'; + $num_images = 0; } ?>
-
- -
$tags));?>
- +
+ +
$tags));?>
+ name; ?>
-
+
$file_guid)); ?> -
+
$tags));?>