/** * Main activity stream list page */ function activity_view_page() { $options = array(); $page_type = preg_replace('[\\W]', '', get_input('page_type', 'all')); $type = preg_replace('[\\W]', '', get_input('type', 'all')); $subtype = preg_replace('[\\W]', '', get_input('subtype', '')); if ($subtype) { $selector = "type={$type}&subtype={$subtype}"; } else { $selector = "type={$type}"; } if ($type != 'all') { $options['type'] = $type; if ($subtype) { $options['subtype'] = $subtype; } } switch ($page_type) { case 'mine': $title = elgg_echo('river:mine'); $page_filter = 'mine'; $options['subject_guid'] = elgg_get_logged_in_user_guid(); break; case 'friends': $title = elgg_echo('river:friends'); $page_filter = 'friends'; $options['relationship_guid'] = elgg_get_logged_in_user_guid(); $options['relationship'] = 'friend'; break; default: $title = elgg_echo('river:all'); $page_filter = 'all'; break; } $create_content = ''; if (elgg_is_logged_in()) { $create_content = elgg_view('activity/create'); } $activity = elgg_list_river($options); if (!$activity) { $activity = elgg_echo('river:none'); } $content = elgg_view('core/river/filter', array('selector' => $selector)); $sidebar = elgg_view('core/river/sidebar'); $sidebar .= elgg_view('activity/module/mentions'); $sidebar .= elgg_view('activity/module/comments'); $sidebar_alt = elgg_view('activity/module/weekly_likes'); $sidebar_alt .= elgg_view('page/elements/tagcloud_block', array('limit' => 30)); $params = array('content' => $create_content . $content . $activity, 'sidebar' => $sidebar, 'sidebar_alt' => $sidebar_alt, 'filter_context' => $page_filter, 'class' => 'elgg-river-layout'); $body = elgg_view_layout('two_sidebar', $params); return elgg_view_page($title, $body); }
/** * Handle requests to activity/owner/<username> * * @param string $hook Hook name * @param string $type Hook type * @param array $return Array of url segments * @param array $params * @return boolean False if the request was handled */ function personal_activity_page_handler($hook, $type, $return, $params) { $segments = $return['segments']; if (isset($segments[0]) && $segments[0] == 'owner') { $user = get_user_by_username($segments[1]); // Use default page handler if no user or user is looking at own activity if (!$user || $user->guid == elgg_get_logged_in_user_guid()) { return $return; } $params['title'] = elgg_echo('personal_activity:owner', array($user->name)); $params['filter_context'] = ''; $params['content'] = elgg_list_river(array('subject_guids' => $user->guid)); if (!$params['content']) { $params['content'] = elgg_echo('river:none'); } $body = elgg_view_layout('content', $params); echo elgg_view_page($params['title'], $body); return false; } return $return; }
<?php $options = get_input('options'); $count = (int) get_input('count'); $options['count'] = true; $newcount = elgg_get_river($options); $options['count'] = false; $returnData['count'] = $newcount; $limit = $newcount - $count; if ($limit > 0) { $options['pagination'] = false; $options['offset'] = 0; $options['limit'] = 1; $returnData['content'] = elgg_list_river($options); $returnData['valid'] = 1; } else { $returnData['valid'] = 0; } echo json_encode($returnData); exit;
if (!empty($field_result)) { $details_result .= $cat_title; $details_result .= "<table class='haarlem-extranet-profile-details'>" . $field_result . "</table>"; } } } if (!empty($details_result)) { echo ""; echo $details_result; echo ""; /*echo "<div id='custom_fields_userdetails'>" . $details_result . "</div>"; if (elgg_get_plugin_setting("display_categories", "profile_manager") == "accordion") { ?> <script type="text/javascript"> $('#custom_fields_userdetails').accordion({ header: 'h3', autoHeight: false }); </script> <?php }*/ } if ($description_position != "top") { echo $about; } $activity = elgg_list_river(array('subject_guid' => $user->guid, 'limit' => 10, 'pagination' => false)); if (!$activity) { $activity = elgg_echo('river:none'); } echo elgg_view_module('info', 'Recente activiteit', $activity); echo '</div>';
function aga_handle_activity_page($group, $page, $options, $titlepart) { //checking for filter $type = preg_replace('[\\W]', '', get_input('type', 'all')); $subtype = preg_replace('[\\W]', '', get_input('subtype', '')); if ($type != 'all') { $options['type'] = $type; if ($subtype) { $options['subtype'] = $subtype; } } if ($subtype) { $selector = "type={$type}&subtype={$subtype}"; } else { $selector = "type={$type}"; } // now start building the page $content = ""; $content .= elgg_view_module('info', elgg_echo('aga:note'), elgg_echo('aga:activitycaution')); elgg_set_page_owner_guid($group->guid); $title = $titlepart; elgg_push_breadcrumb($group->name, $group->getURL()); elgg_push_breadcrumb($title); // this is where we actually build the list of content $content .= elgg_view('core/river/filter', array('selector' => $selector)); $options['pagination'] = true; $results = elgg_list_river($options); if ($results) { $content .= $results; } else { $content .= '<p>' . elgg_echo('groups:activity:none') . '</p>'; } $params = array('filter_context' => 'aga', 'content' => $content, 'title' => $title, 'class' => 'elgg-river-layout'); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); return true; }
/** * Group activity page * * @param int $guid Group entity GUID */ function groups_handle_activity_page($guid) { elgg_entity_gatekeeper($guid, 'group'); elgg_set_page_owner_guid($guid); elgg_group_gatekeeper(); $group = get_entity($guid); $title = elgg_echo('groups:activity'); elgg_push_breadcrumb($group->name, $group->getURL()); elgg_push_breadcrumb($title); $db_prefix = elgg_get_config('dbprefix'); $content = elgg_list_river(array('joins' => array("JOIN {$db_prefix}entities e1 ON e1.guid = rv.object_guid", "LEFT JOIN {$db_prefix}entities e2 ON e2.guid = rv.target_guid"), 'wheres' => array("(e1.container_guid = {$group->guid} OR e2.container_guid = {$group->guid})"), 'no_results' => elgg_echo('groups:activity:none'))); $params = array('content' => $content, 'title' => $title, 'filter' => ''); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); }
<?php $group = get_entity(get_input('group_guid')); $user = elgg_get_logged_in_user_entity(); $offset = get_input('offset'); $options['offset'] = $offset; $base_url = get_input('base_url'); if (!$group || !elgg_instanceof($group, 'group')) { register_error(elgg_echo('groups:notfound')); exit; } //elgg_load_library('elgg:groups'); if (group_gatekeeper(false)) { if (!$group instanceof ElggGroup) { exit; } //put test in if user not part of group don't show composer otherwise goes in lalaland $db_prefix = elgg_get_config('dbprefix'); $options = array('joins' => array("JOIN {$db_prefix}entities e ON e.guid = rv.object_guid"), 'wheres' => array("(e.container_guid = {$group->guid} OR rv.object_guid = {$group->guid}) AND rv.action_type != 'vote' AND rv.action_type != 'join'")); $options['body_class'] = 'new-feed'; $options['base_url'] = $base_url; $activity = elgg_list_river($options); if (!$activity) { $activity = elgg_view('output/longtext', array('value' => elgg_echo('groups:activity:none'))); } echo $activity; }
$bookmark->tags = $wall_post->tags; } else { $bookmark->title = filter_tags($document->meta->title); $bookmark->description = filter_tags($document->meta->description); $bookmark->tags = string_to_tag_array(filter_tags($document->meta->keywords)); } $bookmark->save(); } if ($wall_post->save()) { $message = format_wall_message($wall_post); $params = array('entity' => $wall_post, 'user' => $poster, 'message' => $message, 'url' => $wall_post->getURL(), 'origin' => 'wall'); elgg_trigger_plugin_hook('status', 'user', $params); // Trigger a publish event, so that we can send out notifications elgg_trigger_event('publish', 'object', $wall_post); if (get_input('widget')) { elgg_push_context('widgets'); } if (elgg_is_xhr()) { if (get_input('river') && get_input('river') != 'false') { echo elgg_list_river(array('object_guids' => $wall_post->guid)); } else { elgg_set_page_owner_guid($wall_owner->guid); echo elgg_view_entity($wall_post, array('full_view' => false)); } } system_message(elgg_echo('wall:create:success')); forward($wall_post->getURL()); } } register_error(elgg_echo('wall:create:error')); forward(REFERER);
/** * Web service to get activity feed for a group * * @param int $guid - the guid of the group * @param int $limit default 10 * @param int $offset default 0 * * @return bool */ function group_activity($guid, $limit = 10, $offset = 0) { $group = get_entity($guid); if (!$guid) { $msg = elgg_echo('groups:notfound'); throw new InvalidParameterException($msg); } $db_prefix = elgg_get_config('dbprefix'); global $jsonexport; $content = elgg_list_river(array('limit' => $limit, 'pagination' => false, 'joins' => array("JOIN {$db_prefix}entities e1 ON e1.guid = rv.object_guid"), 'wheres' => array("(e1.container_guid = {$group->guid})"))); return $jsonexport['activity']; }
$content .= elgg_list_river($river_options); $content .= '<div class="elgg-widget-more">'; $content .= elgg_view('output/url', array('text' => elgg_echo('river:mine'), 'href' => "activity/owner/{$owner->username}", 'is_trusted' => true)); $content .= '</div>'; $content .= '</div>'; unset($river_options['subject_guid']); $first = false; // all activity $tabs[] = array('text' => elgg_echo('river:all'), 'href' => '#', 'selected' => $first, 'rel' => 'all'); $first = false; $class = array('theme-haarlem-intranet-dashboard-river', 'theme-haarlem-intranet-dashboard-river-all'); if (!$first) { $class[] = 'hidden'; } $content .= '<div class="' . implode(' ', $class) . '">'; $content .= elgg_list_river($river_options); $content .= '<div class="elgg-widget-more">'; $content .= elgg_view('output/url', array('text' => elgg_echo('river:all'), 'href' => 'activity', 'is_trusted' => true)); $content .= '</div>'; $content .= '</div>'; // content echo elgg_view('navigation/tabs', array('tabs' => $tabs, 'class' => 'theme-haarlem-intranet-dashboard-activity-tabs')); echo $content; ?> <script> $('#elgg-widget-<?php echo $widget->getGUID(); ?> .elgg-tabs a').live('click', function() { var $widget = $('#elgg-widget-<?php
/** * Ajaxmodule page handler * * @param array $page From the page_handler function * @return true|false Depending on success * */ function ajaxmodule_page_handler($page) { switch ($page[0]) { case 'load_activity_ping': // check for last checked time if (!($seconds_passed = get_input('seconds_passed', 0))) { echo ''; exit; } $last_reload = time() - $seconds_passed; // Get current count of entries $current_count = elgg_get_river(array('count' => TRUE)); // Get the count at the last reload $last_count = elgg_get_river(array('count' => TRUE, 'posted_time_upper' => $last_reload)); if ($current_count > $last_count) { $count = $current_count - $last_count; $s = $count == 1 ? '' : 's'; $link = "<a id='refresh-river-module' href='#' class='update_link'>{$count} update{$s}!</a>"; $page_title = "[{$count} update{$s}] "; echo json_encode(array('count' => $count, 'link' => $link)); exit; } break; case 'loadriver': // River options $options['ids'] = get_input('ids'); $options['subject_guids'] = json_decode(get_input('subject_guids')); $options['object_guids'] = json_decode(get_input('object_guids')); $options['annotation_ids'] = json_decode(get_input('annotation_ids')); $options['action_types'] = json_decode(get_input('action_types')); $options['posted_time_lower'] = get_input('posted_time_lower'); $options['posted_time_upper'] = get_input('posted_time_upper'); $options['types'] = get_input('types'); $options['subtypes'] = get_input('subtypes'); $options['type_subtype_pairs'] = json_decode(get_input('type_subtype_pairs')); $options['relationship'] = get_input('relationship'); $options['relationship_guid'] = get_input('relationship_guid'); $options['inverse_relationship'] = get_input('inverse_relationship'); $options['limit'] = get_input('limit', 15); $options['offset'] = get_input('offset', 0); $options['count'] = get_input('count'); $options['order_by'] = get_input('order_by'); $options['group_by'] = get_input('group_by'); // Remove empty options foreach ($options as $key => $option) { if ($option === NULL || empty($options)) { unset($options[$key]); } } $options = elgg_trigger_plugin_hook('get_options', 'river', '', $options); // Display river $river = elgg_list_river($options); if (!$river) { echo "<div style='font-weight: bold; margin-top: 10px; margin-bottom: 10px; border-top: 1px solid #aaa; width: 100%; text-align: center;'>" . elgg_echo('river:none') . "</div>"; } else { //echo $river; echo elgg_trigger_plugin_hook('output', 'page', array(), $river); } break; case 'loadentities': // Entity options $options['container_guid'] = get_input('container_guid'); $options['tag'] = get_input('tag', false); $options['tags'] = json_decode(get_input('tags', false)); $options['types'] = json_decode(get_input('types')); $options['subtypes'] = json_decode(get_input('subtypes')); $options['limit'] = get_input('limit', 10); $options['offset'] = get_input('offset', 0); $options['owner_guids'] = json_decode(get_input('owner_guids')); $options['created_time_upper'] = get_input('created_time_upper'); $options['created_time_lower'] = get_input('created_time_lower'); $options['count'] = get_input('count', FALSE); // Store access status $access_status = access_get_show_hidden_status(); // Check if bypassing hidden entities if (get_input('access_show_hidden_entities')) { // Override access_show_hidden_entities(true); } // Set 'listing type' for new simple listing if supplied if ($listing_type = get_input('listing_type', FALSE)) { set_input('ajaxmodule_listing_type', $listing_type); } // Make sure container guid isn't empty $options['container_guid'] = !empty($options['container_guid']) ? $options['container_guid'] : ELGG_ENTITIES_ANY_VALUE; if (get_input('restrict_tag')) { // Grab content with supplied tags ONLY elgg_set_context('search'); $options['type'] = 'object'; $options['full_view'] = FALSE; // Multiple tags if ($options['tags']) { foreach ($options['tags'] as $tag) { $options['metadata_name_value_pairs'][] = array('name' => 'tags', 'value' => $tag, 'operand' => '=', 'case_sensitive' => FALSE); } } else { // Just one $options['metadata_name_value_pairs'] = array(array('name' => 'tags', 'value' => $options['tag'], 'operand' => '=', 'case_sensitive' => FALSE)); unset($options['tag']); } unset($options['tags']); // Let plugins decide if we want to check the container of the container as well (ie photos) if ($options['container_guid'] && elgg_trigger_plugin_hook('check_parent_container', 'modules', $options['subtypes'], FALSE)) { $dbprefix = elgg_get_config('dbprefix'); $cont = sanitise_int($options['container_guid']); $options['joins'][] = "JOIN {$dbprefix}entities container_e on e.container_guid = container_e.guid"; $options['wheres'][] = "(e.container_guid in ({$cont}) OR container_e.container_guid in ({$cont}))"; unset($options['container_guid']); } if ($options['count']) { $entities = elgg_get_entities_from_metadata($options); echo $entities; break; } else { $content = elgg_list_entities_from_metadata($options); } } else { if (get_input('albums_images')) { // Grab photos with tag, including photos in albums with tag $options['full_view'] = FALSE; $options['list_type'] = 'gallery'; $content = elgg_list_entities($options, 'am_get_entities_from_tag_and_container_tag'); } else { if (!get_input('restrict_tag') && $options['container_guid'] != ELGG_ENTITIES_ANY_VALUE) { // Container supplied, and not restricting tags $options['full_view'] = FALSE; $content = elgg_list_entities($options); } else { // Default to container or tag $content = am_list_entities_by_container_or_tag($options); } } } // Display friendly message if there is no content if (!$content) { echo "<div style='width: 100%; text-align: center; margin: 10px;'><strong>No results</strong></div>"; } else { echo $content; } break; default: access_show_hidden_entities($access_status); return FALSE; } access_show_hidden_entities($access_status); return TRUE; }
<?php $id = (int) get_input('id'); if ($id) { echo elgg_list_river(array('id' => $id, 'limit' => 0, 'list_class' => "", 'item_class' => "")); } ?>
<?php /** * Group activity widget */ $widget = elgg_extract('entity', $vars); $num = (int) $widget->num_display; $guid = (int) $widget->group_guid; if (empty($guid)) { // no group selected yet echo '<p>' . elgg_echo('groups:widget:group_activity:content:noselect') . '</p>'; return; } $db_prefix = elgg_get_config('dbprefix'); echo elgg_list_river(['limit' => $num, 'pagination' => false, 'joins' => ["JOIN {$db_prefix}entities e1 ON e1.guid = rv.object_guid"], 'wheres' => ["(e1.container_guid = {$guid})"], 'no_results' => elgg_echo('groups:widget:group_activity:content:noactivity')]);
<?php $group = elgg_get_page_owner_entity(); if (!$group || !elgg_instanceof($group, 'group')) { register_error(elgg_echo('groups:notfound')); forward(); } elgg_load_library('elgg:groups'); groups_register_profile_buttons($group); $title = $group->name; $composer = ''; if (elgg_is_logged_in()) { $composer = elgg_view('page/elements/composer', array('entity' => $group)); } $db_prefix = elgg_get_config('dbprefix'); $activity = elgg_list_river(array('joins' => array("JOIN {$db_prefix}entities e ON e.guid = rv.object_guid"), 'wheres' => array("e.container_guid = {$group->guid} OR rv.object_guid = {$group->guid}"))); if (!$activity) { $activity = elgg_view('output/longtext', array('value' => elgg_echo('group:activity:none'))); } $body = elgg_view_layout('two_sidebar', array('title' => $title, 'content' => $composer . $activity)); echo elgg_view_page($title, $body);
<?php /** * * return all river items related to a users friends */ $userGuid = elgg_get_logged_in_user_guid(); $river_options_friends = array("pagination" => false, "limit" => 10, "type_subtype_pairs" => array(), "relationship_guid" => $userGuid, "relationship" => 'friend'); $friend_activity = elgg_list_river($river_options_friends); return $friend_activity;
<?php if (elgg_is_logged_in()) { forward('activity'); } $title = elgg_echo('content:latest'); $content = elgg_list_river(['no_results' => elgg_echo('river:none')]); $login_box = elgg_view('core/account/login_box'); $body = elgg_view_layout('one_sidebar', ['title' => $title, 'content' => $content, 'sidebar' => $login_box]); echo elgg_view_page(null, $body);
/** * Front page handler * * @return bool */ function elgg_front_page_handler() { if (elgg_is_logged_in()) { forward('activity'); } $title = elgg_echo('content:latest'); $content = elgg_list_river(); if (!$content) { $content = elgg_echo('river:none'); } $login_box = elgg_view('core/account/login_box'); $params = array('title' => $title, 'content' => $content, 'sidebar' => $login_box); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page(null, $body); return true; }
function follow_tags_get_activity_follow_tags($options) { $dbprefix = elgg_get_config("dbprefix"); $tags = elgg_get_metadata(array(follow_tags_get_tag_guid(elgg_get_logged_in_user_guid()), 'tags')); $cnt = 0; //Count the followTags and Create string for the SQL-query switch (count($tags)) { case 0: break; case 1: $tagid = $tags['value_id']; $value_ids = "value_id = {$tagid}"; break; default: foreach ($tags as $tag) { $tagid = $tag['value_id']; $cnt++; if ($cnt != count($tags)) { $value_ids .= "value_id = {$tagid}"; $value_ids .= " OR "; } else { $value_ids .= "value_id = {$tagid}"; } } break; } //Check if the user have any FollowTags $user = elgg_get_logged_in_user_entity(); $user = $user->username; if (count($tags) != 0) { $sql_where = "object_guid IN (SELECT entity_guid FROM {$dbprefix}metadata WHERE {$value_ids}) AND action_type = 'create'"; $options['wheres'] = array($sql_where); $activity = elgg_list_river($options); } return $activity; }
<?php /** * Action for adding a wire post * */ // don't filter since we strip and filter escapes some characters $body = get_input('body', '', false); $access_id = ACCESS_PUBLIC; $method = 'site'; $parent_guid = (int) get_input('parent_guid'); // make sure the post isn't blank if (empty($body)) { register_error(elgg_echo("thewire:blank")); forward(REFERER); } $guid = thewire_save_post($body, elgg_get_logged_in_user_guid(), $access_id, $parent_guid, $method); if ($guid) { $options = array('pagination' => false, 'limit' => 1); $output = elgg_list_river($options); echo $output; } system_message(elgg_echo("thewire:posted")); forward(REFERER);
<?php gatekeeper(); $user = elgg_get_logged_in_user_entity(); elgg_set_page_owner_guid($user->guid); $title = elgg_echo('newsfeed'); $composer = elgg_view('page/elements/composer', array('entity' => $user)); $db_prefix = elgg_get_config('dbprefix'); $activity = elgg_list_river(array('joins' => array("JOIN {$db_prefix}entities object ON object.guid = rv.object_guid"), 'wheres' => array("\n\t\trv.subject_guid = {$user->guid}\n\t\tOR rv.subject_guid IN (SELECT guid_two FROM {$db_prefix}entity_relationships WHERE guid_one={$user->guid} AND relationship='follower')\n\t\tOR rv.subject_guid IN (SELECT guid_one FROM {$db_prefix}entity_relationships WHERE guid_two={$user->guid} AND relationship='friend')\n\t"), 'base_url' => elgg_get_site_url() . "ajax/view/river/elements/activity?guid={$user->guid}")); elgg_set_page_owner_guid(1); $content = elgg_view_layout('custom_layout', array('title' => $title, 'content' => $composer . $activity)); echo elgg_view_page($title, $content);
<?php $user = elgg_get_page_owner_entity(); if (!$user || !elgg_instanceof($user, 'user')) { register_error(elgg_echo('profile:notfound')); forward(); } $title = $user->name; $composer = ''; if (elgg_is_logged_in()) { $composer = elgg_view('page/elements/composer', array('entity' => $user)); } $db_prefix = elgg_get_config('dbprefix'); $activity = elgg_list_river(array('joins' => array("JOIN {$db_prefix}entities e ON e.guid = rv.object_guid"), 'wheres' => array("e.container_guid = {$user->guid} OR rv.object_guid = {$user->guid}"), 'base_url' => elgg_get_site_url() . "ajax/view/river/elements/activity?guid={$user->guid}")); if (!$activity) { $activity = elgg_view('output/longtext', array('value' => elgg_echo('profile:activity:none'))); } $body = elgg_view_layout('custom_layout', array('content' => $composer . $activity, 'title' => $title)); echo elgg_view_page($title, $body);
<?php /** * Shows the activity of your friends in the Digest * */ $user = elgg_extract("user", $vars, elgg_get_logged_in_user_entity()); $ts_lower = (int) elgg_extract("ts_lower", $vars); $ts_upper = (int) elgg_extract("ts_upper", $vars); $river_options = array("relationship" => "friend", "relationship_guid" => $user->getGUID(), "limit" => 5, "posted_time_lower" => $ts_lower, "posted_time_upper" => $ts_upper, "pagination" => false, "href" => 'none'); if ($vars['email']) { if ($river_items = elgg_get_river($river_options)) { $title = "<h2 class='email'>" . elgg_echo("river:friends") . "</h2>"; $title .= "<h5 class='email'>To view your colleagues activity visit " . elgg_get_site_url() . "activity/friends/" . $user->username . "</h5>"; echo $title; $summary = "<div class='email-section'>"; foreach ($river_items as $item) { $summary .= "<p>" . get_river_item_summary($item) . "</p>"; } $summary .= "</div>"; echo $summary; } } else { if ($river_items = elgg_list_river($river_options)) { $title = elgg_view("output/url", array("text" => elgg_echo("river:friends"))); $title .= "<h5>To view your colleagues activity visit " . elgg_get_site_url() . "activity/friends/" . $user->username . "</h5>"; echo elgg_view_module("digest", $title, $river_items); } }
<?php $guid = get_input('guid'); elgg_entity_gatekeeper($guid, 'group'); elgg_set_page_owner_guid($guid); elgg_group_gatekeeper(); $group = get_entity($guid); $title = elgg_echo('groups:activity'); elgg_push_breadcrumb($group->name, $group->getURL()); elgg_push_breadcrumb($title); $db_prefix = elgg_get_config('dbprefix'); $content = elgg_list_river(array('joins' => array("JOIN {$db_prefix}entities e1 ON e1.guid = rv.object_guid", "LEFT JOIN {$db_prefix}entities e2 ON e2.guid = rv.target_guid"), 'wheres' => array("(e1.container_guid = {$group->guid} OR e2.container_guid = {$group->guid})"), 'no_results' => elgg_echo('groups:activity:none'))); $params = array('content' => $content, 'title' => $title, 'filter' => ''); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body);
*/ elgg_push_context('front'); elgg_push_context('widgets'); $list_params = array('type' => 'object', 'limit' => 4, 'full_view' => false, 'view_type_toggle' => false, 'pagination' => false); //grab the latest 4 blog posts $list_params['subtype'] = 'blog'; $blogs = elgg_list_entities($list_params); //grab the latest bookmarks $list_params['subtype'] = 'bookmarks'; $bookmarks = elgg_list_entities($list_params); //grab the latest files $list_params['subtype'] = 'file'; $files = elgg_list_entities($list_params); //get the newest members who have an avatar $newest_members = elgg_list_entities_from_metadata(array('metadata_names' => 'icontime', 'type' => 'user', 'limit' => 10, 'full_view' => false, 'pagination' => false, 'list_type' => 'gallery', 'gallery_class' => 'elgg-gallery-users', 'size' => 'small')); //newest groups $list_params['type'] = 'group'; unset($list_params['subtype']); $groups = elgg_list_entities($list_params); //grab the login form $login = elgg_view("core/account/login_box"); $content = elgg_view_title(elgg_echo('content:latest')); $content .= elgg_list_river(array('base_url' => elgg_get_site_url() . "ajax/view/river/elements/activity?guid=")); elgg_pop_context(); // lay out the content $params = array('content' => $content, 'blogs' => $blogs, 'bookmarks' => $bookmarks, 'files' => $files, 'groups' => $groups, 'login' => $login, 'members' => $newest_members); $body = elgg_view_layout('custom_index', $params); // no RSS feed with a "widget" front page global $autofeed; $autofeed = FALSE; echo elgg_view_page('', $body);
/** * Group activity page * * @param int $guid Group entity GUID */ function groups_handle_activity_page($guid) { elgg_set_page_owner_guid($guid); $group = get_entity($guid); if (!$group || !elgg_instanceof($group, 'group')) { forward(); } group_gatekeeper(); $title = elgg_echo('groups:activity'); elgg_push_breadcrumb($group->name, $group->getURL()); elgg_push_breadcrumb($title); $db_prefix = elgg_get_config('dbprefix'); $content = elgg_list_river(array('joins' => array("JOIN {$db_prefix}entities e ON e.guid = rv.object_guid"), 'wheres' => array("e.container_guid = {$guid}"))); if (!$content) { $content = '<p>' . elgg_echo('groups:activity:none') . '</p>'; } $params = array('content' => $content, 'title' => $title, 'filter' => ''); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); }
<?php /** * Elgg index page for web-based applications * * @package Elgg * @subpackage Core */ /** * Start the Elgg engine */ require_once dirname(__FILE__) . "/engine/start.php"; elgg_set_context('main'); // allow plugins to override the front page (return true to stop this front page code) if (elgg_trigger_plugin_hook('index', 'system', null, FALSE) != FALSE) { exit; } if (elgg_is_logged_in()) { forward('activity'); } $content = elgg_view_title(elgg_echo('content:latest')); $content .= elgg_list_river(); global $autofeed; $autofeed = FALSE; $login_box = elgg_view('core/account/login_box'); $params = array('content' => $content, 'sidebar' => $login_box); $body = elgg_view_layout('one_sidebar', $params); echo elgg_view_page(null, $body);
<?php /** * Groups latest activity * * @todo add people joining group to activity * * @package Groups */ if ($vars['entity']->activity_enable == 'no') { return true; } $group = $vars['entity']; if (!$group) { return true; } $all_link = elgg_view('output/url', array('href' => "groups/activity/{$group->guid}", 'text' => elgg_echo('link:view:all'), 'is_trusted' => true)); elgg_push_context('widgets'); $db_prefix = elgg_get_config('dbprefix'); $content = elgg_list_river(array('limit' => 4, 'pagination' => false, 'joins' => array("JOIN {$db_prefix}entities e1 ON e1.guid = rv.object_guid"), 'wheres' => array("(e1.container_guid = {$group->guid})"))); elgg_pop_context(); if (!$content) { $content = '<p>' . elgg_echo('groups:activity:none') . '</p>'; } echo elgg_view('groups/profile/module', array('title' => elgg_echo('groups:activity'), 'content' => $content, 'all_link' => $all_link));
<?php $entity = elgg_extract('entity', $vars); $guid = (int) $entity->guid; $identifier = is_callable('group_subtypes_get_identifier') ? group_subtypes_get_identifier($entity) : 'groups'; $base_url = elgg_normalize_url("{$identifier}/activity/{$entity->guid}") . '?' . parse_url(current_page_url(), PHP_URL_QUERY); $list_class = (array) elgg_extract('list_class', $vars, array()); $list_class[] = 'elgg-list-group-activity'; $item_class = (array) elgg_extract('item_class', $vars, array()); $options = (array) elgg_extract('options', $vars, array()); $list_options = array('full_view' => true, 'limit' => elgg_extract('limit', $vars, elgg_get_config('default_limit')) ?: 10, 'list_class' => implode(' ', $list_class), 'item_class' => implode(' ', $item_class), 'no_results' => elgg_echo("{$identifier}:activity:none"), 'pagination' => !elgg_in_context('widgets'), 'pagination_type' => 'infinite', 'base_url' => $base_url, 'list_id' => "group-activity-{$guid}", 'group' => $entity); $dbprefix = elgg_get_config('dbprefix'); $getter_options = array('joins' => array("JOIN {$dbprefix}entities e1 ON e1.guid = rv.object_guid", "LEFT JOIN {$dbprefix}entities e2 ON e2.guid = rv.target_guid"), 'wheres' => array("(e1.container_guid = {$entity->guid} OR e2.container_guid = {$entity->guid})")); $options = array_merge_recursive($list_options, $options, $getter_options); if (elgg_view_exists('lists/activity')) { $params = $vars; $params['options'] = $options; $params['group'] = $entity; echo elgg_view('lists/activity', $params); } else { echo elgg_list_river($options); }
<?php /** * Activity widget content view */ $num = (int) $vars['entity']->num_display; $options = array('limit' => $num, 'pagination' => false); if (elgg_in_context('dashboard')) { if ($vars['entity']->content_type == 'friends') { $options['relationship_guid'] = elgg_get_page_owner_guid(); $options['relationship'] = 'friend'; } } else { $options['subject_guid'] = elgg_get_page_owner_guid(); } $content = elgg_list_river($options); if (!$content) { $content = elgg_echo('river:none'); } echo $content;
$options['wheres'] = array("(rv.type != 'user' AND rv.action_type != 'friend' AND rv.action_type != 'join' AND rv.action_type != 'vote' AND " . $group_guid . ")", "(ge1.guid IS NOT NULL OR ge2.guid IS NOT NULL)"); break; case 'groups': $title = elgg_echo('groups'); $page_filter = 'groups'; $options['joins'] = array("JOIN elgg_entities e1 ON e1.guid = rv.object_guid", "LEFT JOIN elgg_entities e2 ON e2.guid = rv.target_guid", "LEFT JOIN elgg_groups_entity ge1 ON ge1.guid = e1.container_guid", "LEFT JOIN elgg_groups_entity ge2 ON ge2.guid = e2.container_guid"); $options['wheres'] = array("(rv.type != 'user' AND rv.action_type != 'friend' AND rv.action_type != 'join' AND rv.action_type != 'vote')", "(ge1.guid IS NOT NULL OR ge2.guid IS NOT NULL)"); //$options['wheres']=array("(rv.access_id in('1','2') AND rv.type != 'user' AND rv.action_type != 'friend' AND rv.action_type != 'join' AND rv.action_type != 'vote')", "(ge1.guid IS NOT NULL OR ge2.guid IS NOT NULL)"); break; case 'dfatd-maecd': $title = elgg_echo('gc_theme:dfatd'); $page_filter = 'dfatd-maecd'; $options['wheres'] = array("rv.type != 'user' AND rv.action_type != 'friend' AND rv.action_type != 'join' AND rv.action_type != 'vote'"); break; case 'all': $title = elgg_echo('river:all'); $page_filter = 'all'; $options['wheres'] = array("rv.type != 'user' AND rv.type != 'site' AND rv.action_type != 'friend' AND rv.action_type != 'join' AND rv.action_type != 'vote'"); break; case 'friends': default: $title = elgg_echo('river:friends'); $page_filter = 'friends'; $options['relationship_guid'] = elgg_get_logged_in_user_guid(); $options['relationship'] = 'friend'; $options['wheres'] = array("rv.type != 'user' AND rv.action_type != 'friend' AND rv.action_type != 'join' AND rv.action_type != 'vote'"); break; } $options['body_class'] = 'new-feed'; $stream = elgg_list_river($options); echo $stream;