gallery.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Display an album in a gallery
  4. *
  5. * @uses $vars['entity'] TidypicsAlbum
  6. *
  7. * @author Cash Costello
  8. * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
  9. */
  10. $album = elgg_extract('entity', $vars);
  11. $album_cover = elgg_view_entity_icon($album, 'small');
  12. $album_title = $album->getTitle();
  13. if (strlen($album_title) > 20) {
  14. $album_title = substr($album_title, 0, 17).'...';
  15. }
  16. $header = elgg_view('output/url', array(
  17. 'text' => $album_title,
  18. 'href' => $album->getURL(),
  19. 'is_trusted' => true,
  20. 'class' => 'tidypics-heading',
  21. ));
  22. $container = $album->getContainerEntity();
  23. if ($container) {
  24. $footer = '<div class="elgg-subtext">' . elgg_echo('album:created_by') . elgg_view('output/url', array(
  25. 'text' => $album->getContainerEntity()->name,
  26. 'href' => $album->getContainerEntity()->getURL(),
  27. 'is_trusted' => true,
  28. ));
  29. $footer .= '<br>' . elgg_echo('album:num', array($album->getSize())) . '</div>';
  30. } else {
  31. $footer = '<div class="elgg-subtext">' . elgg_echo('album:created_by') . ' - ';
  32. $footer .= '<br>' . elgg_echo('album:num', array($album->getSize())) . '</div>';
  33. }
  34. $params = array(
  35. 'footer' => $footer,
  36. );
  37. echo elgg_view_module('tidypics-album', $header, $album_cover, $params);