album.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Image icon view
  4. *
  5. * @uses $vars['entity'] The entity the icon represents - uses getIconURL() method
  6. * @uses $vars['size'] tiny, small (default), large, master
  7. * @uses $vars['href'] Optional override for link
  8. * @uses $vars['img_class'] Optional CSS class added to img
  9. * @uses $vars['link_class'] Optional CSS class added to link
  10. *
  11. * @author Cash Costello
  12. * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
  13. */
  14. $album = $vars['entity'];
  15. $cover_guid = $album->getCoverImageGuid();
  16. if ($cover_guid) {
  17. $vars['title'] = $album->getTitle();
  18. $vars['href'] = $album->getURL();
  19. echo elgg_view_entity_icon(get_entity($cover_guid), $vars['size'], $vars);
  20. } else {
  21. $url = "mod/tidypics/graphics/empty_album_{$vars['size']}.png";
  22. $url = elgg_normalize_url($url);
  23. $img = elgg_view('output/img', array(
  24. 'src' => $url,
  25. 'class' => 'elgg-photo',
  26. 'title' => $album->getTitle(),
  27. 'alt' => $album->getTitle(),
  28. ));
  29. $params = array(
  30. 'href' => $album->getURL(),
  31. 'text' => $img,
  32. 'is_trusted' => true,
  33. );
  34. if (isset($vars['link_class'])) {
  35. $params['class'] = $vars['link_class'];
  36. }
  37. echo elgg_view('output/url', $params);
  38. }