diff options
Diffstat (limited to 'views/default/object')
-rw-r--r-- | views/default/object/album.php | 192 | ||||
-rw-r--r-- | views/default/object/image.php | 295 |
2 files changed, 244 insertions, 243 deletions
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 @@ <?php - /** - * Tidypics Album Gallery View - */ +/** + * Tidypics Album Gallery View + */ - global $CONFIG; - - $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; +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 = '<img src="' . $vars['url'] . 'pg/photos/thumbnail/' . $album->cover . '/small/" class="tidypics_album_cover" alt="' . $title . '"/>'; - else - $album_cover = '<img src="' . $vars['url'] . 'mod/tidypics/graphics/empty_album.png" class="tidypics_album_cover" alt="new album">'; - + //get album cover if one was set + if ($album->cover) { + $album_cover = '<img src="' . $vars['url'] . 'pg/photos/thumbnail/' . $album->cover . '/small/" class="tidypics_album_cover" alt="' . $title . '"/>'; + } else { + $album_cover = '<img src="' . $vars['url'] . 'mod/tidypics/graphics/empty_album.png" class="tidypics_album_cover" alt="new album">'; + } ?> <div class="tidypics_album_gallery_item"> <div class="tidypics_gallery_title"> <a href="<?php echo $album->getURL();?>"><?php echo $title;?></a> </div> <a href="<?php echo $album->getURL();?>"><?php echo $album_cover;?></a><br> - <small><a href="<?php echo $vars['url'];?>pg/profile/<?php echo $owner->username;?>"><?php echo $owner->name;?></a> - <br /><?php echo $friendlytime;?><br /> -<?php - //get the number of comments - $numcomments = elgg_count_comments($album); - if ($numcomments) - echo "<a href=\"{$album->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>"; + <small><a href="<?php echo $vars['url'];?>pg/profile/<?php echo $owner->username;?>"><?php echo $owner->name;?></a> + <br /><?php echo $friendlytime;?><br /> + <?php + //get the number of comments + $numcomments = elgg_count_comments($album); + if ($numcomments) { + echo "<a href=\"{$album->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>"; + } ?> </small> </div> <?php - } else { + } else { /****************************************************************************** * * List view of an album object @@ -60,22 +61,23 @@ * *****************************************************************************/ - $info = '<p><a href="' . $album->getURL() . '">' . $title . '</a></p>'; - $info .= "<p class=\"owner_timestamp\"><a href=\"{$vars['url']}pg/profile/{$owner->username}\">{$owner->name}</a> {$friendlytime}"; - $numcomments = elgg_count_comments($album); - if ($numcomments) - $info .= ", <a href=\"{$album->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>"; - $info .= "</p>"; - - //get album cover if one was set - if ($album->cover) - $icon = "<a href=\"{$album->getURL()}\">" . '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $album->cover . '&size=thumb" alt="thumbnail" /></a>'; - else - $icon = "<a href=\"{$album->getURL()}\">" . '<img src="' . $vars['url'] . 'mod/tidypics/graphics/image_error_thumb.png" alt="new album"></a>'; - - echo elgg_view_listing($icon, $info); + $info = '<p><a href="' . $album->getURL() . '">' . $title . '</a></p>'; + $info .= "<p class=\"owner_timestamp\"><a href=\"{$vars['url']}pg/profile/{$owner->username}\">{$owner->name}</a> {$friendlytime}"; + $numcomments = elgg_count_comments($album); + if ($numcomments) { + $info .= ", <a href=\"{$album->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>"; } - } else { + $info .= "</p>"; + + //get album cover if one was set + if ($album->cover) { + $icon = "<a href=\"{$album->getURL()}\">" . '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $album->cover . '&size=thumb" alt="thumbnail" /></a>'; + } else { + $icon = "<a href=\"{$album->getURL()}\">" . '<img src="' . $vars['url'] . 'mod/tidypics/graphics/image_error_thumb.png" alt="new album"></a>'; + } + 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); ?> <div class="contentWrapper"> <div id="tidypics_breadcrumbs"> - <?php echo elgg_view('tidypics/breadcrumbs', array() ); ?> + <?php echo elgg_view('tidypics/breadcrumbs', array() ); ?> </div> -<?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; +<?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; + } + ?> <div class="clearfloat"></div> <div class="tidypics_info"> -<?php +<?php - if (!is_null($tags)) { + if (!is_null($tags)) { ?> <div class="object_tag_string"><?php echo elgg_view('output/tags',array('value' => $tags));?></div> -<?php - } +<?php + } ?> - <?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('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 - $categories = elgg_view('categories/view',$vars); - if (!empty($categories)) { + $categories = elgg_view('categories/view',$vars); + if (!empty($categories)) { ?> <br /> -<b><?php echo elgg_echo('categories'); ?>:</b> - <?php + <b><?php echo elgg_echo('categories'); ?>:</b> +<?php - echo $categories; + echo $categories; - } + } ?> </div> <?php - if ($vars['full']) { - echo elgg_view_comments($album); - } - - echo '</div>'; - } // end of individual album view -?> + if ($vars['full']) { + echo elgg_view_comments($album); + } + + echo '</div>'; +} // 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 @@ <?php - /** - * - * Tidypics image object views - */ +/** + * + * Tidypics image object views + */ - global $CONFIG; - include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/lib/exif.php"; +global $CONFIG; +include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/lib/exif.php"; - $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); +$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") { - ?> - <div class="tidypics_album_images"> - <a href="<?php echo $image->getURL();?>"><img src="<?php echo $vars['url'];?>mod/tidypics/thumbnail.php?file_guid=<?php echo $image_guid;?>&size=small" alt="thumbnail"/></a> - </div> - <?php - } - else{ - // list view displays a thumbnail icon of the image, its title, and the number of comments - $info = '<p><a href="' .$image->getURL(). '">'.$title.'</a></p>'; - $info .= "<p class=\"owner_timestamp\"><a href=\"{$vars['url']}pg/profile/{$owner->username}\">{$owner->name}</a> {$friendlytime}"; - $numcomments = elgg_count_comments($image); - if ($numcomments) - $info .= ", <a href=\"{$image->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>"; - $info .= "</p>"; - $icon = "<a href=\"{$image->getURL()}\">" . '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $image_guid . '&size=thumb" alt="' . $title . '" /></a>'; - - echo elgg_view_listing($icon, $info); + // gallery view is a matrix view showing just the image - size: small + if (get_input('search_viewtype') == "gallery") { +?> +<div class="tidypics_album_images"> + <a href="<?php echo $image->getURL();?>"><img src="<?php echo $vars['url'];?>mod/tidypics/thumbnail.php?file_guid=<?php echo $image_guid;?>&size=small" alt="thumbnail"/></a> +</div> +<?php + } else { + // list view displays a thumbnail icon of the image, its title, and the number of comments + $info = '<p><a href="' .$image->getURL(). '">'.$title.'</a></p>'; + $info .= "<p class=\"owner_timestamp\"><a href=\"{$vars['url']}pg/profile/{$owner->username}\">{$owner->name}</a> {$friendlytime}"; + $numcomments = elgg_count_comments($image); + if ($numcomments) { + $info .= ", <a href=\"{$image->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>"; } + $info .= "</p>"; + $icon = "<a href=\"{$image->getURL()}\">" . '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $image_guid . '&size=thumb" alt="' . $title . '" /></a>'; + + 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 ?> <a href="<?php echo $image->getURL(); ?>"> -<img src="<?php echo $vars['url'];?>mod/tidypics/thumbnail.php?file_guid=<?php echo $image_guid;?>&size=thumb" class="tidypics_album_cover" alt="<?php echo $title; ?>" title="<?php echo $title; ?>" /> + <img src="<?php echo $vars['url'];?>mod/tidypics/thumbnail.php?file_guid=<?php echo $image_guid;?>&size=thumb" class="tidypics_album_cover" alt="<?php echo $title; ?>" title="<?php echo $title; ?>" /> </a> -<?php - } else { + <?php +} else { /******************************************************************** * * listing of photos in an album * *********************************************************************/ - if (!$vars['full']) { - -?> -<?php - // plugins can override the image link to add lightbox code here - $image_html = false; - $image_html = trigger_plugin_hook('tp_thumbnail_link', 'album', array('image' => $image), $image_html); - - if ($image_html) { - echo $image_html; - } else { - // default link to image if no one overrides -?> - <div class="tidypics_album_images"> - <a href="<?php echo $image->getURL();?>"><img src="<?php echo $vars['url'];?>pg/photos/thumbnail/<?php echo $image_guid;?>/small/" alt="<?php echo $image->title; ?>"/></a> - </div> -<?php - } + if (!$vars['full']) { + + // plugins can override the image link to add lightbox code here + $image_html = false; + $image_html = trigger_plugin_hook('tp_thumbnail_link', 'album', array('image' => $image), $image_html); + + if ($image_html) { + echo $image_html; + } else { + // default link to image if no one overrides ?> +<div class="tidypics_album_images"> + <a href="<?php echo $image->getURL();?>"><img src="<?php echo $vars['url'];?>pg/photos/thumbnail/<?php echo $image_guid;?>/small/" alt="<?php echo $image->title; ?>"/></a> +</div> <?php - } else { + } + } else { /******************************************************************** * @@ -91,66 +87,68 @@ * *********************************************************************/ - - $viewer = get_loggedin_user(); - - // Build back and next links - $back = ''; - $next = ''; + $viewer = get_loggedin_user(); - $album = get_entity($image->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 = '<a href="' .$vars['url'] . 'pg/photos/view/' . $_SESSION['image_sort'][$current-1] . '">« ' . elgg_echo('image:back') . '</a>'; + if ($_SESSION['image_sort']) { + $current = array_search($image_guid, $_SESSION['image_sort']); + } + } - if (sizeof($_SESSION['image_sort']) > $current + 1) - $next = '<a href="' . $vars['url'] . 'pg/photos/view/' . $_SESSION['image_sort'][$current+1] . '">' . elgg_echo('image:next') . ' »</a>'; + if ($current != 0) { + $back = '<a href="' .$vars['url'] . 'pg/photos/view/' . $_SESSION['image_sort'][$current-1] . '">« ' . elgg_echo('image:back') . '</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') . ' »</a>'; + } ?> <div class="contentWrapper"> <div id="tidypics_wrapper"> <div id="tidypics_breadcrumbs"> - <?php echo elgg_view('tidypics/breadcrumbs', array('album' => $album,) ); ?> <br /> - <?php - if (get_plugin_setting('view_count', 'tidypics') != "disabled") { - - $image->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']); + <?php echo elgg_view('tidypics/breadcrumbs', array('album' => $album,) ); ?> <br /> +<?php + if (get_plugin_setting('view_count', 'tidypics') != "disabled") { + + $image->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']); + } + } } } - } - ?> +?> </div> <div id="tidypics_desc"> - <?php echo autop($desc); ?> + <?php echo autop($desc); ?> </div> <div id="tidypics_image_nav"> <ul> @@ -159,73 +157,74 @@ </ul> </div> <div id="tidypics_image_wrapper"> - <?php - // this code controls whether the photo is a hyperlink or not and what it links to - if (get_plugin_setting('download_link', 'tidypics') != "disabled") { - // admin allows downloads so default to inline download link - $image_html = "<a href=\"{$vars['url']}pg/photos/download/{$image_guid}/inline/\" title=\"{$title}\" >"; - $image_html .= "<img id=\"tidypics_image\" src=\"{$vars['url']}pg/photos/thumbnail/{$image_guid}/large/\" alt=\"{$title}\" />"; - $image_html .= "</a>"; - } else { - $image_html = "<img id=\"tidypics_image\" src=\"{$vars['url']}pg/photos/thumbnail/{$image_guid}/large/\" alt=\"{$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; - ?> + <?php + // this code controls whether the photo is a hyperlink or not and what it links to + if (get_plugin_setting('download_link', 'tidypics') != "disabled") { + // admin allows downloads so default to inline download link + $image_html = "<a href=\"{$vars['url']}pg/photos/download/{$image_guid}/inline/\" title=\"{$title}\" >"; + $image_html .= "<img id=\"tidypics_image\" src=\"{$vars['url']}pg/photos/thumbnail/{$image_guid}/large/\" alt=\"{$title}\" />"; + $image_html .= "</a>"; + } else { + $image_html = "<img id=\"tidypics_image\" src=\"{$vars['url']}pg/photos/thumbnail/{$image_guid}/large/\" alt=\"{$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; + ?> <div class="clearfloat"></div> </div> -<?php - // image menu (start tagging, download, etc.) - - echo '<div id="tidypics_controls"><ul>'; - echo elgg_view('tidypics/image_menu', array('image_guid' => $image_guid, - 'viewer' => $viewer, - 'owner' => $owner, - 'anytags' => $image->isPhotoTagged(), - 'album' => $album, ) ); - echo '</ul></div>'; - - // 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") { + <?php + // image menu (start tagging, download, etc.) + + echo '<div id="tidypics_controls"><ul>'; + echo elgg_view('tidypics/image_menu', array( + 'image_guid' => $image_guid, + 'viewer' => $viewer, + 'owner' => $owner, + 'anytags' => $image->isPhotoTagged(), + 'album' => $album, ) ); + echo '</ul></div>'; + + // 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)); + } ?> - <?php echo elgg_view('tidypics/exif', array('guid'=> $image_guid)); ?> -<?php } ?> <div class="tidypics_info"> -<?php if (!is_null($tags)) { ?> +<?php + if (!is_null($tags)) { +?> <div class="object_tag_string"><?php echo elgg_view('output/tags',array('value' => $tags));?></div> -<?php } - if (get_plugin_setting('photo_ratings', 'tidypics') == "enabled") { +<?php + } + if (get_plugin_setting('photo_ratings', 'tidypics') == "enabled") { ?> <div id="rate_container"> - <?php echo elgg_view('rate/rate', array('entity'=> $vars['entity'])); ?> -</div> + <?php echo elgg_view('rate/rate', array('entity'=> $vars['entity'])); ?> + </div> <?php - } - - echo elgg_echo('image:by');?> <b><a href="<?php echo $vars['url']; ?>pg/profile/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a></b> <?php echo $friendlytime; + } + + echo elgg_echo('image:by');?> <b><a href="<?php echo $vars['url']; ?>pg/profile/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a></b> <?php echo $friendlytime; ?> </div> </div> <!-- tidypics wrapper--> <?php - echo elgg_view_comments($image); - - echo '<div class="clearfloat"></div>'; - - echo '</div>'; // content wrapper + echo elgg_view_comments($image); - } // end of individual image display + echo '<div class="clearfloat"></div>'; - } - -?> + echo '</div>'; // content wrapper + } // end of individual image display +} |