content.php 706 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. $widget = $vars["entity"];
  3. $group = $widget->getOwnerEntity();
  4. $number = sanitise_int($widget->file_count, false);
  5. if (empty($number)) {
  6. $number = 4;
  7. }
  8. //get the group's files
  9. $options = array(
  10. "type" => "object",
  11. "subtype" => "file",
  12. "container_guid" => $group->getGUID(),
  13. "limit" => $number,
  14. "pagination" => false,
  15. "full_view" => false
  16. );
  17. //if there are some files, go get them
  18. if ($files = elgg_list_entities($options)) {
  19. //display in list mode
  20. echo $files;
  21. } else {
  22. echo elgg_echo("file:none");
  23. }
  24. $new_link = elgg_view("output/url", array(
  25. "href" => "file/add/" . $group->getGUID(),
  26. "text" => elgg_echo("file:add"),
  27. "is_trusted" => true,
  28. ));
  29. echo "<div>" . $new_link . "</div>";