recentlyviewed.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Most recently viewed images - world view only
  4. *
  5. */
  6. // set up breadcrumbs
  7. elgg_push_breadcrumb(elgg_echo('photos'), 'photos/siteimagesall');
  8. elgg_push_breadcrumb(elgg_echo('tidypics:recentlyviewed'));
  9. $offset = (int)get_input('offset', 0);
  10. $limit = (int)get_input('limit', 16);
  11. $options = array('type' => 'object',
  12. 'subtype' => 'image',
  13. 'limit' => $limit,
  14. 'offset' => $offset,
  15. 'annotation_name' => 'tp_view',
  16. 'order_by_annotation' => "n_table.time_created desc",
  17. 'full_view' => false,
  18. 'list_type' => 'gallery',
  19. 'gallery_class' => 'tidypics-gallery'
  20. );
  21. $result = elgg_list_entities_from_annotations($options);
  22. $title = elgg_echo('tidypics:recentlyviewed');
  23. if (elgg_is_logged_in()) {
  24. $logged_in_guid = elgg_get_logged_in_user_guid();
  25. elgg_register_menu_item('title', array('name' => 'addphotos',
  26. 'href' => "ajax/view/photos/selectalbum/?owner_guid=" . $logged_in_guid,
  27. 'text' => elgg_echo("photos:addphotos"),
  28. 'link_class' => 'elgg-button elgg-button-action elgg-lightbox'));
  29. }
  30. // only show slideshow link if slideshow is enabled in plugin settings and there are images
  31. if (elgg_get_plugin_setting('slideshow', 'tidypics') && !empty($result)) {
  32. $url = elgg_get_site_url() . "photos/recentlyviewed?limit=64&offset=$offset&view=rss";
  33. $url = elgg_format_url($url);
  34. $slideshow_link = "javascript:PicLensLite.start({maxScale:0, feedUrl:'$url'})";
  35. elgg_register_menu_item('title', array('name' => 'slideshow',
  36. 'href' => $slideshow_link,
  37. 'text' => "<img src=\"".elgg_get_site_url() ."mod/tidypics/graphics/slideshow.png\" alt=\"".elgg_echo('album:slideshow')."\">",
  38. 'title' => elgg_echo('album:slideshow'),
  39. 'link_class' => 'elgg-button elgg-button-action'));
  40. }
  41. if (!empty($result)) {
  42. $area2 = $result;
  43. } else {
  44. $area2 = elgg_echo('tidypics:recentlyviewed:nosuccess');
  45. }
  46. $body = elgg_view_layout('content', array(
  47. 'filter_override' => '',
  48. 'content' => $area2,
  49. 'title' => $title,
  50. 'sidebar' => elgg_view('photos/sidebar', array('page' => 'all')),
  51. ));
  52. // Draw it
  53. echo elgg_view_page(elgg_echo('tidypics:recentlyviewed'), $body);