view.php 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /**
  3. * This displays the photos that belong to an album
  4. *
  5. * @author Cash Costello
  6. * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
  7. */
  8. group_gatekeeper();
  9. // get the album entity
  10. $album_guid = (int) get_input('guid');
  11. $album = get_entity($album_guid);
  12. if (!$album) {
  13. register_error(elgg_echo('noaccess'));
  14. $_SESSION['last_forward_from'] = current_page_url();
  15. forward('');
  16. }
  17. $container = $album->getContainerEntity();
  18. if (!$container) {
  19. register_error(elgg_echo('noaccess'));
  20. $_SESSION['last_forward_from'] = current_page_url();
  21. forward('');
  22. }
  23. elgg_set_page_owner_guid($album->getContainerGUID());
  24. $owner = elgg_get_page_owner_entity();
  25. $title = elgg_echo($album->getTitle());
  26. // set up breadcrumbs
  27. elgg_push_breadcrumb(elgg_echo('photos'), 'photos/siteimagesall');
  28. elgg_push_breadcrumb(elgg_echo('tidypics:albums'), 'photos/all');
  29. if (elgg_instanceof($owner, 'group')) {
  30. elgg_push_breadcrumb($owner->name, "photos/group/$owner->guid/all");
  31. } else {
  32. elgg_push_breadcrumb($owner->name, "photos/owner/$owner->username");
  33. }
  34. elgg_push_breadcrumb($album->getTitle());
  35. $content = elgg_view_entity($album, array('full_view' => true));
  36. if (elgg_is_logged_in()) {
  37. if (elgg_instanceof($owner, 'group')) {
  38. $logged_in_guid = $owner->guid;
  39. } else {
  40. $logged_in_guid = elgg_get_logged_in_user_guid();
  41. }
  42. elgg_register_menu_item('title', array('name' => 'addphotos',
  43. 'href' => "ajax/view/photos/selectalbum/?owner_guid=" . $logged_in_guid,
  44. 'text' => elgg_echo("photos:addphotos"),
  45. 'link_class' => 'elgg-button elgg-button-action elgg-lightbox'));
  46. }
  47. if ($album->getContainerEntity()->canWriteToContainer()) {
  48. elgg_register_menu_item('title', array(
  49. 'name' => 'upload',
  50. 'href' => 'photos/upload/' . $album->getGUID(),
  51. 'text' => elgg_echo('images:upload'),
  52. 'link_class' => 'elgg-button elgg-button-action',
  53. ));
  54. }
  55. // only show sort button if there are images
  56. if ($album->canEdit() && $album->getSize() > 0) {
  57. elgg_register_menu_item('title', array(
  58. 'name' => 'sort',
  59. 'href' => "photos/sort/" . $album->getGUID(),
  60. 'text' => elgg_echo('album:sort'),
  61. 'link_class' => 'elgg-button elgg-button-action',
  62. 'priority' => 200,
  63. ));
  64. }
  65. // only show slideshow link if slideshow is enabled in plugin settings and there are images
  66. if (elgg_get_plugin_setting('slideshow', 'tidypics') && $album->getSize() > 0) {
  67. $offset = (int)get_input('offset', 0);
  68. $url = $album->getURL() . "?limit=64&offset=$offset&view=rss";
  69. $url = elgg_format_url($url);
  70. $slideshow_link = "javascript:PicLensLite.start({maxScale:0, feedUrl:'$url'})";
  71. elgg_register_menu_item('title', array('name' => 'slideshow',
  72. 'href' => $slideshow_link,
  73. 'text' => "<img src=\"".elgg_get_site_url() ."mod/tidypics/graphics/slideshow.png\" alt=\"".elgg_echo('album:slideshow')."\">",
  74. 'title' => elgg_echo('album:slideshow'),
  75. 'link_class' => 'elgg-button elgg-button-action',
  76. 'priority' => 300));
  77. }
  78. $body = elgg_view_layout('content', array(
  79. 'filter' => false,
  80. 'content' => $content,
  81. 'title' => $album->getTitle(),
  82. 'sidebar' => elgg_view('photos/sidebar', array('page' => 'album')),
  83. ));
  84. echo elgg_view_page($title, $body);