aboutsummaryrefslogtreecommitdiff
path: root/views/default/object
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2010-07-31 19:22:47 +0000
committerCash Costello <cash.costello@gmail.com>2010-07-31 19:22:47 +0000
commita1f08342c8b8502197159a9fd78e48e6cead4ea0 (patch)
treeea2e0c175ea7a9f4495b185162585e8d84bb8ed2 /views/default/object
parent28e545574f35f0d6349a395648a7857ee58989c9 (diff)
downloadelgg-a1f08342c8b8502197159a9fd78e48e6cead4ea0.tar.gz
elgg-a1f08342c8b8502197159a9fd78e48e6cead4ea0.tar.bz2
improved the upgrade system and moved albums to use an ordered list for images
Diffstat (limited to 'views/default/object')
-rw-r--r--views/default/object/album.php25
-rw-r--r--views/default/object/image.php30
2 files changed, 14 insertions, 41 deletions
diff --git a/views/default/object/album.php b/views/default/object/album.php
index 0db0d3e49..b87bef444 100644
--- a/views/default/object/album.php
+++ b/views/default/object/album.php
@@ -106,24 +106,11 @@ if (get_context() == "search") {
<?php
echo '<div id="tidypics_desc">' . autop($desc) . '</div>';
- $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 '<div class="tidypics_info">' . elgg_echo('image:none') . '</div>';
- $num_images = 0;
- }
+ $offset = (int)get_input('offset', 0);
+ echo $album->viewImages(8, $offset);
+ // echo '<div class="tidypics_info">' . elgg_echo('image:none') . '</div>';
+ // $num_images = 0;
+ //}
?>
<div class="clearfloat"></div>
@@ -137,7 +124,7 @@ if (get_context() == "search") {
}
?>
<?php echo elgg_echo('album:by');?> <b><a href="<?php echo $vars['url'] ;?>pg/profile/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a></b> <?php echo $friendlytime; ?><br>
- <?php echo elgg_echo('image:total');?> <b><?php echo $num_images; ?></b><br>
+ <?php echo elgg_echo('image:total');?> <b><?php echo $album->getSize(); ?></b><br>
<?php
$categories = elgg_view('categories/view',$vars);
if (!empty($categories)) {
diff --git a/views/default/object/image.php b/views/default/object/image.php
index cd53120de..da3e257a1 100644
--- a/views/default/object/image.php
+++ b/views/default/object/image.php
@@ -94,32 +94,18 @@ if (get_context() == "search") {
// Build back and next links
$back = '';
$next = '';
-
$album = get_entity($image->container_guid);
+ $back_guid = $album->getPreviousImageGuid($image->guid);
+ $next_guid = $album->getNextImageGuid($image->guid);
- $current = array_search($image_guid, $_SESSION['image_sort']);
-
- if (!$current) { // means we are no longer using the correct album array
-
- //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 ($_SESSION['image_sort']) {
- $current = array_search($image_guid, $_SESSION['image_sort']);
- }
- }
-
- if ($current != 0) {
- $back = '<a href="' .$vars['url'] . 'pg/photos/view/' . $_SESSION['image_sort'][$current-1] . '">&laquo; ' . elgg_echo('image:back') . '</a>';
+ if ($back_guid != 0) {
+ $text = elgg_echo('image:back');
+ $back = "<a href=\"{$vars['url']}pg/photos/view/$back_guid\">&laquo; $text</a>";
}
- if (sizeof($_SESSION['image_sort']) > $current + 1) {
- $next = '<a href="' . $vars['url'] . 'pg/photos/view/' . $_SESSION['image_sort'][$current+1] . '">' . elgg_echo('image:next') . ' &raquo;</a>';
+ if ($next_guid != 0) {
+ $text = elgg_echo('image:next');
+ $next = "<a href=\"{$vars['url']}pg/photos/view/$next_guid\">$text &raquo;</a>";
}
?>