content.php 874 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Group activity widget
  4. */
  5. $num = (int) $vars['entity']->num_display;
  6. $guid = (int) $vars['entity']->group_guid;
  7. $content = '';
  8. if ($guid) {
  9. // backward compatibility when we couldn't set widget title (pre 1.9)
  10. if (!$vars['entity']->title) {
  11. $title = get_entity($guid)->name;
  12. $content = "<h3>$title</h3>";
  13. }
  14. $db_prefix = elgg_get_config('dbprefix');
  15. $activity = elgg_list_river(array(
  16. 'limit' => $num,
  17. 'pagination' => false,
  18. 'joins' => array("JOIN {$db_prefix}entities e1 ON e1.guid = rv.object_guid"),
  19. 'wheres' => array("(e1.container_guid = $guid)"),
  20. ));
  21. if (!$activity) {
  22. $activity = '<p>' . elgg_echo('groups:widget:group_activity:content:noactivity') . '</p>';
  23. }
  24. $content .= $activity;
  25. } else {
  26. // no group selected yet
  27. $content = '<p>' . elgg_echo('groups:widget:group_activity:content:noselect') . '</p>';
  28. }
  29. echo $content;