highestvotecount.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * Images with highest vote count - 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:highestvotecount'));
  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' => 'fivestar',
  16. 'calculation' => 'count',
  17. 'order_by' => 'annotation_calculation desc',
  18. 'full_view' => false,
  19. 'list_type' => 'gallery',
  20. 'gallery_class' => 'tidypics-gallery'
  21. );
  22. $result = elgg_list_entities_from_annotation_calculation($options);
  23. $title = elgg_echo('tidypics:highestvotecount');
  24. if (elgg_is_logged_in()) {
  25. $logged_in_guid = elgg_get_logged_in_user_guid();
  26. elgg_register_menu_item('title', array('name' => 'addphotos',
  27. 'href' => "ajax/view/photos/selectalbum/?owner_guid=" . $logged_in_guid,
  28. 'text' => elgg_echo("photos:addphotos"),
  29. 'link_class' => 'elgg-button elgg-button-action elgg-lightbox'));
  30. }
  31. // only show slideshow link if slideshow is enabled in plugin settings and there are images
  32. if (elgg_get_plugin_setting('slideshow', 'tidypics') && !empty($result)) {
  33. $url = elgg_get_site_url() . "photos/highestvotecount?limit=64&offset=$offset&view=rss";
  34. $url = elgg_format_url($url);
  35. $slideshow_link = "javascript:PicLensLite.start({maxScale:0, feedUrl:'$url'})";
  36. elgg_register_menu_item('title', array('name' => 'slideshow',
  37. 'href' => $slideshow_link,
  38. 'text' => "<img src=\"".elgg_get_site_url() ."mod/tidypics/graphics/slideshow.png\" alt=\"".elgg_echo('album:slideshow')."\">",
  39. 'title' => elgg_echo('album:slideshow'),
  40. 'link_class' => 'elgg-button elgg-button-action'));
  41. }
  42. if (!empty($result)) {
  43. $area2 = $result;
  44. } else {
  45. $area2 = elgg_echo('tidypics:highestvotecount:nosuccess');
  46. }
  47. $body = elgg_view_layout('content', array(
  48. 'filter_override' => '',
  49. 'content' => $area2,
  50. 'title' => $title,
  51. 'sidebar' => elgg_view('photos/sidebar', array('page' => 'all')),
  52. ));
  53. // Draw it
  54. echo elgg_view_page(elgg_echo('tidypics:highestvotecount'), $body);