content.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * Assemblies -- User assembly widget display view
  4. *
  5. * @package Lorea
  6. * @subpackage Assemblies
  7. *
  8. * Copyright 2012-2013 Lorea Faeries <federation@lorea.org>
  9. *
  10. * This file is part of the Assemblies plugin for Elgg.
  11. *
  12. * Assemblies is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License as
  14. * published by the Free Software Foundation, either version 3 of the
  15. * License, or (at your option) any later version.
  16. *
  17. * Assemblies is distributed in the hope that it will be useful, but
  18. * WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. * Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public
  23. * License along with this program. If not, see
  24. * <http://www.gnu.org/licenses/>.
  25. */
  26. elgg_load_library('elgg:assemblies');
  27. $user = elgg_get_logged_in_user_entity();
  28. $num = $vars['entity']->num_display;
  29. $options = array(
  30. 'types' => 'group',
  31. 'relationship' => 'member',
  32. 'relationship_guid' => $user->guid,
  33. 'inverse_relationship' => FALSE,
  34. 'limit' => $num,
  35. 'full_view' => FALSE,
  36. 'pagination' => FALSE,
  37. 'metadata_name' => 'assembly_location',
  38. );
  39. $groups = elgg_get_entities_from_relationship($options);
  40. $assemblies = array();
  41. $list_body = "";
  42. foreach($groups as $group) {
  43. $next_assembly = assemblies_get_next_assembly();
  44. if ($next_assembly) {
  45. $icon = elgg_view_entity_icon($group, 'tiny');
  46. $link = elgg_view('output/url', array(
  47. 'href' => $next_assembly->getURL(),
  48. 'text' => $next_assembly->getTitle(),
  49. ));
  50. $params = array(
  51. 'entity' => $group,
  52. 'title' => $group->name,
  53. 'subtitle' => $link,
  54. 'tags' => false,
  55. );
  56. $params = $params;
  57. $list_body = elgg_view('object/elements/summary', $params);
  58. }
  59. }
  60. $content = elgg_view_image_block($icon, $list_body);
  61. if ($content) {
  62. echo $content;
  63. } else {
  64. echo elgg_echo('assemblies:noassembly');
  65. }