/** * List all groups */ function groups_handle_all_page() { // all groups doesn't get link to self elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('groups')); if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) { elgg_register_title_button(); } $selected_tab = get_input('filter', 'newest'); switch ($selected_tab) { case 'popular': $content = elgg_list_entities_from_relationship_count(array('type' => 'group', 'relationship' => 'member', 'inverse_relationship' => false, 'full_view' => false, 'no_results' => elgg_echo('groups:none'))); break; case 'discussion': $content = elgg_list_entities(array('type' => 'object', 'subtype' => 'groupforumtopic', 'order_by' => 'e.last_action desc', 'limit' => 40, 'full_view' => false, 'no_results' => elgg_echo('discussion:none'), 'distinct' => false, 'preload_containers' => true)); break; case 'featured': $content = elgg_list_entities_from_metadata(array('type' => 'group', 'metadata_name' => 'featured_group', 'metadata_value' => 'yes', 'full_view' => false)); if (!$content) { $content = elgg_echo('groups:nofeatured'); } break; case 'newest': default: $content = elgg_list_entities(array('type' => 'group', 'full_view' => false, 'no_results' => elgg_echo('groups:none'), 'distinct' => false)); break; } $filter = elgg_view('groups/group_sort_menu', array('selected' => $selected_tab)); $sidebar = elgg_view('groups/sidebar/find'); $sidebar .= elgg_view('groups/sidebar/featured'); $params = array('content' => $content, 'sidebar' => $sidebar, 'filter' => $filter); $body = elgg_view_layout('content', $params); echo elgg_view_page(elgg_echo('groups:all'), $body); }
/** * List all groups */ function groups_handle_all_page() { $display_subgroups = elgg_get_plugin_setting('display_subgroups', 'au_subgroups'); $db_prefix = elgg_get_config('dbprefix'); // all groups doesn't get link to self elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('groups')); if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) { elgg_register_title_button(); } $gsa_tab = get_input('gsa'); if ($gsa_tab) { switch ($gsa_tab) { case 'discussion': $options = array('type' => 'object', 'subtype' => 'groupforumtopic', 'no_results' => elgg_echo('discussion:none')); $content = elgg_list_entities($options); break; case 'groups': $options = array('type' => 'group', 'inverse_relationship' => false, 'no_results' => elgg_echo('groups:none')); $content = elgg_list_entities($options); break; default: // cyu - in theory this should never invoke break; } } else { $selected_tab = get_input('filter', 'newest'); switch ($selected_tab) { case 'popular': $options = array('type' => 'group', 'relationship' => 'member', 'inverse_relationship' => false, 'full_view' => false, 'no_results' => elgg_echo('groups:none')); if ($display_subgroups != 'yes') { $options['wheres'] = array("NOT EXISTS ( SELECT 1 FROM {$db_prefix}entity_relationships WHERE guid_one = e.guid AND relationship = 'au_subgroup_of' )"); } $content = elgg_list_entities_from_relationship_count($options); break; case 'discussion': $options = array('type' => 'object', 'subtype' => 'groupforumtopic', 'order_by' => 'e.last_action desc', 'limit' => 40, 'full_view' => false, 'no_results' => elgg_echo('discussion:none')); if ($display_subgroups != 'yes') { $options['wheres'] = array("NOT EXISTS ( SELECT 1 FROM {$db_prefix}entity_relationships WHERE guid_one = e.guid AND relationship = 'au_subgroup_of' )"); } $content = elgg_list_entities($options); break; case 'newest': default: $options = array('type' => 'group', 'full_view' => false, 'no_results' => elgg_echo('groups:none')); if ($display_subgroups != 'yes') { $options['wheres'] = array("NOT EXISTS ( SELECT 1 FROM {$db_prefix}entity_relationships WHERE guid_one = e.guid AND relationship = 'au_subgroup_of' )"); } $content = elgg_list_entities($options); break; } } // end if clause $filter = elgg_view('groups/group_sort_menu', array('selected' => $selected_tab)); $sidebar = elgg_view('groups/sidebar/find'); $sidebar .= elgg_view('groups/sidebar/featured'); $params = array('content' => $content, 'sidebar' => $sidebar, 'filter' => $filter); $body = elgg_view_layout('content', $params); echo elgg_view_page(elgg_echo('groups:all'), $body); }
/** * List all groups */ function groups_handle_all_page() { // all groups doesn't get link to self elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('groups')); elgg_register_title_button(); $selected_tab = get_input('filter', 'newest'); switch ($selected_tab) { case 'pop': $content = elgg_list_entities_from_relationship_count(array('type' => 'group', 'relationship' => 'member', 'inverse_relationship' => false, 'full_view' => false)); break; case 'active': $content = elgg_list_entities(array('type' => 'object', 'subtype' => 'groupforumtopic', 'order_by' => 'e.last_action desc', 'limit' => 40, 'full_view' => false)); break; case 'newest': default: $content = elgg_list_entities(array('type' => 'group', 'full_view' => false)); break; } $filter = elgg_view('groups/group_sort_menu', array('selected' => $selected_tab)); $sidebar = elgg_view('groups/sidebar/find'); $sidebar .= elgg_view('groups/sidebar/featured'); $params = array('content' => $content, 'sidebar' => $sidebar, 'filter' => $filter); $body = elgg_view_layout('content', $params); echo elgg_view_page(elgg_echo('groups:all'), $body); }
/** * List all discussion topics */ function discussion_handle_all_page() { elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('discussion')); $content = elgg_list_entities(array('type' => 'object', 'subtype' => 'groupforumtopic', 'order_by' => 'e.last_action desc', 'limit' => 20, 'full_view' => false)); $params = array('content' => $content, 'title' => elgg_echo('discussion:latest'), 'filter' => ''); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); }
function tblog_get_page_content_list($guid) { $container_guid = NULL; $return = array(); $return['filter_context'] = $container_guid ? 'mine' : 'all'; $options = array('type' => 'object', 'subtype' => 'blog', 'full_view' => FALSE); $loggedin_userid = elgg_get_logged_in_user_guid(); if ($container_guid) { // access check for closed groups group_gatekeeper(); $options['container_guid'] = $container_guid; $container = get_entity($container_guid); if (!$container) { } $return['title'] = elgg_echo('blog:title:user_blogs', array($container->name)); $crumbs_title = $container->name; elgg_push_breadcrumb($crumbs_title); if ($container_guid == $loggedin_userid) { $return['filter_context'] = 'mine'; } else { if (elgg_instanceof($container, 'group')) { $return['filter'] = false; } else { // do not show button or select a tab when viewing someone else's posts $return['filter_context'] = 'none'; } } } else { $return['filter_context'] = 'all'; $return['title'] = elgg_echo('blogbook:select a blog'); elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('blog:blogs')); } //elgg_register_title_button(); // show all posts for admin or users looking at their own blogs // show only published posts for other users. if (!(elgg_is_admin_logged_in() || elgg_is_logged_in() && $container_guid == $loggedin_userid)) { $options['metadata_name_value_pairs'] = array(array('name' => 'status', 'value' => 'published')); } $tblog = get_entity($guid); $bidlist = explode(",", $tblog->bids); foreach ($bidlist as $value) { $aBlog = get_entity($value); $form_data .= "<input type='checkbox' name='bids[]' value='{$value}' /> {$aBlog->title}<br />"; } $form_data .= "<input type='hidden' name='guid' value='{$guid}' />"; // TODO the problem is thst $guid is empty $form_data .= elgg_view('input/submit', array('value' => elgg_echo('Remove'))); $list .= elgg_view("input/form", array("body" => $form_data, "action" => "/action/blogbook/remove", "id" => "tblog_insert_form", "class" => "elgg-form-alt")); if (!$list) { $return['content'] = elgg_echo('blog:none'); } else { $return['content'] = $list; } return $return; }
/** * Get page components to list a user's or all blogs. * * @param int $container_guid The GUID of the page owner or NULL for all blogs * @return array */ function blog_get_page_content_list($container_guid = NULL) { $return = array(); $return['filter_context'] = $container_guid ? 'mine' : 'all'; $order = get_input('order'); $order ? $order = $order : ($order = "DESC"); $order == "DESC" ? $currentSort = elgg_echo('hj:forum:latest') : ($currentSort = elgg_echo('hj:forum:oldest')); $options = array('type' => 'object', 'subtype' => 'blog', 'full_view' => false, 'order_by' => 'e.time_created ' . $order); $current_user = elgg_get_logged_in_user_entity(); if ($container_guid) { // access check for closed groups group_gatekeeper(); $options['container_guid'] = $container_guid; $container = get_entity($container_guid); if (!$container) { } $return['title'] = elgg_echo('blog:title:user_blogs', array($container->name)); $crumbs_title = $container->name; elgg_push_breadcrumb($crumbs_title); if ($current_user && $container_guid == $current_user->guid) { $return['filter_context'] = 'mine'; } else { if (elgg_instanceof($container, 'group')) { $return['filter'] = false; } else { // do not show button or select a tab when viewing someone else's posts $return['filter_context'] = 'none'; } } $list = "<div id='filter-dropdown' class='clearfix blog-filter'><span>" . elgg_echo('blog:sort') . "</span><a href=''>" . $currentSort . "</a>\n\t\t\t<ul>\n\t\t\t\t<li>" . elgg_view('output/url', array('href' => 'blog/group/' . $container->guid . '/all?order=DESC', 'text' => '' . elgg_echo('hj:forum:latest') . '')) . "</li>\n\t\t\t\t<li>" . elgg_view('output/url', array('href' => 'blog/group/' . $container->guid . '/all?order=ASC', 'text' => '' . elgg_echo('hj:forum:oldest') . '')) . "</li>\n\t\t\t</ul>\n\t\t</div>"; } else { $return['filter_context'] = 'all'; $return['title'] = elgg_echo('blog:title:all_blogs'); elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('blog:blogs')); } elgg_register_title_button(); // show all posts for admin or users looking at their own blogs // show only published posts for other users. $show_only_published = true; if ($current_user) { if ($current_user->guid == $container_guid || $current_user->isAdmin()) { $show_only_published = false; } } if ($show_only_published) { $options['metadata_name_value_pairs'] = array(array('name' => 'status', 'value' => 'published')); } $list .= elgg_list_entities_from_metadata($options); if (!$list) { $return['content'] = elgg_echo('blog:none'); } else { $return['content'] = $list; } return $return; }
/** * List all discussion topics */ function discussion_handle_all_page() { elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('discussion')); $content = elgg_list_entities(array('type' => 'object', 'subtype' => 'groupforumtopic', 'order_by' => 'e.last_action desc', 'limit' => max(20, elgg_get_config('default_limit')), 'full_view' => false, 'no_results' => elgg_echo('discussion:none'), 'preload_owners' => true)); $title = elgg_echo('discussion:latest'); $params = array('content' => $content, 'title' => $title, 'sidebar' => elgg_view('discussion/sidebar'), 'filter' => ''); $body = elgg_view_layout('content', $params); echo elgg_view_page($title, $body); }
/** * Get page components to list a user's or all blogs. * * @param int $container_guid The GUID of the page owner or NULL for all blogs * @return array */ function blog_get_page_content_list($container_guid = NULL) { $return = array(); $return['filter_context'] = $container_guid ? 'mine' : 'all'; $options = array('type' => 'object', 'subtype' => 'blog', 'full_view' => false); $current_user = elgg_get_logged_in_user_entity(); if ($container_guid) { // access check for closed groups group_gatekeeper(); // COLDTRICK: FIXES listing of users blogs $container = get_entity($container_guid); if ($container instanceof ElggGroup) { $options['container_guid'] = $container_guid; } else { $options['owner_guid'] = $container_guid; } $return['title'] = elgg_echo('blog:title:user_blogs', array($container->name)); $crumbs_title = $container->name; elgg_push_breadcrumb($crumbs_title); if ($current_user && $container_guid == $current_user->guid) { $return['filter_context'] = 'mine'; } else { if (elgg_instanceof($container, 'group')) { $return['filter'] = false; } else { // do not show button or select a tab when viewing someone else's posts $return['filter_context'] = 'none'; } } } else { $return['filter_context'] = 'all'; $return['title'] = elgg_echo('blog:title:all_blogs'); elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('blog:blogs')); } elgg_register_title_button(); // show all posts for admin or users looking at their own blogs // show only published posts for other users. $show_only_published = true; if ($current_user) { if ($current_user->guid == $container_guid || $current_user->isAdmin()) { $show_only_published = false; } } if ($show_only_published) { $options['metadata_name_value_pairs'] = array(array('name' => 'status', 'value' => 'published')); } $list = elgg_list_entities_from_metadata($options); if (!$list) { $return['content'] = elgg_echo('blog:none'); } else { $return['content'] = $list; } return $return; }
/** * List all groups */ function groups_handle_all_page() { $display_subgroups = elgg_get_plugin_setting('display_subgroups', 'au_subgroups'); $db_prefix = elgg_get_config('dbprefix'); // all groups doesn't get link to self elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('groups')); if (elgg_get_plugin_setting('limited_groups', 'groups') != 'yes' || elgg_is_admin_logged_in()) { elgg_register_title_button(); } $selected_tab = get_input('filter', 'newest'); switch ($selected_tab) { case 'popular': $options = array('type' => 'group', 'relationship' => 'member', 'inverse_relationship' => false, 'full_view' => false); if ($display_subgroups != 'yes') { $options['wheres'] = array("NOT EXISTS ( SELECT 1 FROM {$db_prefix}entity_relationships WHERE guid_one = e.guid AND relationship = '" . AU_SUBGROUPS_RELATIONSHIP . "' )"); } $content = elgg_list_entities_from_relationship_count($options); if (!$content) { $content = elgg_echo('groups:none'); } break; case 'discussion': $content = elgg_list_entities(array('type' => 'object', 'subtype' => 'groupforumtopic', 'order_by' => 'e.last_action desc', 'limit' => 40, 'full_view' => false)); if (!$content) { $content = elgg_echo('discussion:none'); } break; case 'featured': $content = elgg_list_entities_from_metadata(array('type' => 'group', 'metadata_name' => 'featured_group', 'metadata_value' => 'yes', 'full_view' => false)); if (!$content) { $content = elgg_echo('groups:nofeatured'); } break; case 'newest': default: $options = array('type' => 'group', 'full_view' => false); if ($display_subgroups != 'yes') { $options['wheres'] = array("NOT EXISTS ( SELECT 1 FROM {$db_prefix}entity_relationships WHERE guid_one = e.guid AND relationship = '" . AU_SUBGROUPS_RELATIONSHIP . "' )"); } $content = elgg_list_entities($options); if (!$content) { $content = elgg_echo('groups:none'); } break; } $filter = elgg_view('groups/group_sort_menu', array('selected' => $selected_tab)); // $sidebar = elgg_view('groups/sidebar/find'); // $sidebar .= elgg_view('groups/sidebar/featured'); $params = array('content' => $content, 'sidebar' => $sidebar, 'filter' => $filter); $body = elgg_view_layout('content', $params); echo elgg_view_page(elgg_echo('groups:all'), $body); }
/** * Get page components to list a user's or all podcast episodes. * * @param int $container_guid The GUID of the page owner or NULL for all podcasts * * @return array */ function podcasts_get_page_content_list($container_guid = NULL) { $return = array(); $return['filter_context'] = $container_guid ? 'mine' : 'all_episodes'; $options = array('type' => 'object', 'subtype' => 'podcast', 'full_view' => false, 'podcast_list_class' => 'elgg-list-podcast-episodes', 'podcast_item_class' => 'elgg-podcast-episode'); $current_user = elgg_get_logged_in_user_entity(); if ($container_guid) { // access check for closed groups group_gatekeeper(); $options['container_guid'] = $container_guid; $container = get_entity($container_guid); if (!$container) { } $return['title'] = elgg_echo('podcasts:title:owner_podcasts', array($container->name)); $crumbs_title = $container->name; elgg_push_breadcrumb($crumbs_title); if ($current_user && $container_guid == $current_user->guid) { $return['filter_context'] = 'mine'; } else { if (elgg_instanceof($container, 'group')) { $return['filter'] = false; } else { // do not show button or select a tab when viewing someone else's podcasts $return['filter_context'] = 'none'; } } // Default feed $return['feed_description'] = elgg_echo('podcasts:feed:description', array($container->name)); elgg_extend_view('page/elements/owner_block', 'podcasts/info_sidebar', 1); //$return['sidebar'] = elgg_view('podcasts/info_sidebar'); } else { set_input('show_podcast_container', 1); $return['filter_context'] = 'all'; $return['title'] = elgg_echo('podcasts:title:allpodcastepisodes'); elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('podcasts'), 'podcasts/all'); elgg_push_breadcrumb(elgg_echo('podcasts:filter:allepisodes')); } elgg_register_title_button(); $list = elgg_list_entities($options, 'elgg_get_entities_from_metadata', 'podcasts_list'); if ($list) { $return['content'] = $list; } else { if (elgg_get_viewtype() == 'default') { $return['content'] = elgg_echo('podcasts:episodes:none'); } } return $return; }
/** * Get page components to list a user's or all izap-videos. * * @param integer $container_guid * * @return array array of content for rendering video list * * @version 5.0 */ function izap_video_get_page_content_list($container_guid = NULL) { $return = array(); $return['filter_context'] = $container_guid ? 'mine' : 'all'; $options = array('type' => 'object', 'subtype' => GLOBAL_IZAP_VIDEOS_SUBTYPE, 'full_view' => false, 'no_results' => elgg_echo('izap-videos:none')); $url_id = elgg_get_logged_in_user_guid(); $current_user = elgg_get_logged_in_user_entity(); if ($container_guid) { $url_id = $container_guid; // access check for closed groups izap_group_gatekeeper(); $options['container_guid'] = $container_guid; $container = get_entity($container_guid); $return['title'] = elgg_echo('izap-videos:title:user_videos', array($container->name)); $crumbs_title = $container->name; elgg_push_breadcrumb($crumbs_title); if ($current_user && $container_guid == $current_user->guid) { $return['filter_context'] = 'mine'; } else { if (elgg_instanceof($container, 'group')) { $return['filter'] = false; } else { // do not show button or select a tab when viewing someone else's posts $return['filter_context'] = 'none'; } } } else { $return['filter_context'] = 'all'; $return['title'] = elgg_echo('izap-videos:title:all_videos'); elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('izap-videos')); } if (elgg_is_logged_in()) { $title = 'Add New Video'; } $url = GLOBAL_IZAP_VIDEOS_PAGEHANDLER . '/add/'; if (izap_is_onserver_enabled_izap_videos() == 'yes') { $url .= $url_id . '/onserver'; } elseif (izap_is_onserver_enabled_izap_videos() == 'youtube') { $url .= $url_id . '/youtube'; } elseif (izap_is_offserver_enabled_izap_videos() == 'yes') { $url .= $url_id . '/offserver'; } else { $url .= $url_id . '/offserver'; } elgg_register_menu_item('title', array('name' => elgg_get_friendly_title($title), 'href' => $url, 'text' => $title, 'link_class' => 'elgg-button elgg-button-action')); $return['content'] = elgg_list_entities($options); return $return; }
public function testCrumbTitlesAreEscaped() { $this->markTestIncomplete('Needs DB'); // TODO make this unnecessary elgg_set_view_location('output/url', __DIR__ . '/../../../views/'); elgg_set_view_location('navigation/breadcrumbs', __DIR__ . '/../../../views/'); elgg_push_breadcrumb('Me < & you'); $escaped = 'Me < & you'; $html = elgg_view('navigation/breadcrumbs'); $this->assertNotFalse(strpos($html, $escaped)); // links uses different view elgg_pop_breadcrumb(); elgg_push_breadcrumb('Me < & you', 'link'); $html = elgg_view('navigation/breadcrumbs'); $this->assertNotFalse(strpos($html, $escaped)); }
/** * Get page components to list a user's or all blogs. * * @param int $owner_guid The GUID of the page owner or NULL for all blogs * @return array */ function blog_get_page_content_list($container_guid = NULL) { $return = array(); $return['filter_context'] = $container_guid ? 'mine' : 'all'; $options = array('type' => 'object', 'subtype' => 'blog', 'full_view' => FALSE); $loggedin_userid = elgg_get_logged_in_user_guid(); if ($container_guid) { $options['container_guid'] = $container_guid; $container = get_entity($container_guid); if (!$container) { } $return['title'] = elgg_echo('blog:title:user_blogs', array($container->name)); $crumbs_title = $container->name; elgg_push_breadcrumb($crumbs_title); if ($container_guid == $loggedin_userid) { $return['filter_context'] = 'mine'; } else { if (elgg_instanceof($container, 'group')) { $return['filter'] = false; } else { // do not show button or select a tab when viewing someone else's posts $return['filter_context'] = 'none'; } } } else { $return['filter_context'] = 'all'; $return['title'] = elgg_echo('blog:title:all_blogs'); elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('blog:blogs')); } elgg_register_title_button(); // show all posts for admin or users looking at their own blogs // show only published posts for other users. if (!(elgg_is_admin_logged_in() || elgg_is_logged_in() && $container_guid == $loggedin_userid)) { $options['metadata_name_value_pairs'] = array(array('name' => 'status', 'value' => 'published')); } $list = elgg_list_entities_from_metadata($options); if (!$list) { $return['content'] = elgg_echo('blog:none'); } else { $return['content'] = $list; } return $return; }
/** * Get page components to list a user's or all news. * * @param int $container_guid The GUID of the page owner or null for all news * @return array */ function news_get_page_content_list($container_guid = null) { $return = array(); $return['filter_context'] = $container_guid ? 'mine' : 'all'; $return['filter'] = ''; $options = array('type' => 'object', 'subtype' => 'news', 'full_view' => false, 'no_results' => elgg_echo('news:none'), 'preload_owners' => true, 'distinct' => false); $current_user = elgg_get_logged_in_user_entity(); if ($container_guid) { // access check for closed groups elgg_group_gatekeeper(); $container = get_entity($container_guid); if ($container instanceof ElggGroup) { $options['container_guid'] = $container_guid; } else { $options['owner_guid'] = $container_guid; } $return['title'] = elgg_echo('news:title:user_news', array($container->name)); $crumbs_title = $container->name; elgg_push_breadcrumb($crumbs_title); if ($current_user && $container_guid == $current_user->guid) { $return['filter_context'] = 'mine'; } else { if (elgg_instanceof($container, 'group')) { $return['filter'] = false; } else { // do not show button or select a tab when viewing someone else's posts $return['filter_context'] = 'none'; } } } else { $options['preload_containers'] = true; $return['filter_context'] = 'all'; $return['title'] = elgg_echo('news:title:all_news'); elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('news:news')); } if (elgg_is_admin_logged_in() || $container_guid && elgg_instanceof($container, 'group') && ($container->owner_guid == $current_user->guid || check_entity_relationship($current_user->guid, "group_admin", $container->guid))) { elgg_register_title_button(); } $return['content'] = elgg_list_entities($options); return $return; }
/** * Get page components to list a user's or all blogs. * * @param int $container_guid The GUID of the page owner or NULL for all blogs * @return array */ function blog_get_page_content_list($container_guid = NULL) { $return = array(); $return['filter_context'] = $container_guid ? 'mine' : 'all'; $options = array('type' => 'object', 'subtype' => 'blog', 'full_view' => false, 'no_results' => elgg_echo('blog:none'), 'preload_owners' => true, 'distinct' => false); $current_user = elgg_get_logged_in_user_entity(); if ($container_guid) { // access check for closed groups elgg_group_gatekeeper(); $options['container_guid'] = $container_guid; $container = get_entity($container_guid); if (!$container) { } $return['title'] = elgg_echo('blog:title:user_blogs', array($container->name)); $crumbs_title = $container->name; elgg_push_breadcrumb($crumbs_title); if ($current_user && $container_guid == $current_user->guid) { $return['filter_context'] = 'mine'; } else { if (elgg_instanceof($container, 'group')) { $return['filter'] = false; } else { // do not show button or select a tab when viewing someone else's posts $return['filter_context'] = 'none'; } } } else { $options['preload_containers'] = true; $return['filter_context'] = 'all'; $return['title'] = elgg_echo('blog:title:all_blogs'); elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('blog:blogs')); } elgg_register_title_button(); $return['content'] = elgg_list_entities($options); return $return; }
function au_subgroups_handle_openclosed_tabs() { $display_subgroups = elgg_get_plugin_setting('display_subgroups', 'au_subgroups'); $display_alphabetically = elgg_get_plugin_setting('display_alphabetically', 'au_subgroups'); $db_prefix = elgg_get_config('dbprefix'); // all groups doesn't get link to self elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('groups')); elgg_register_title_button(); $selected_tab = get_input('filter'); // default group options $group_options = array("type" => "group", "full_view" => false); if ($display_subgroups != 'yes') { $group_options['wheres'] = array("NOT EXISTS ( SELECT 1 FROM {$db_prefix}entity_relationships WHERE guid_one = e.guid AND relationship = '" . AU_SUBGROUPS_RELATIONSHIP . "' )"); } if ($display_alphabetically != 'no') { $group_options['joins'] = array("JOIN {$db_prefix}groups_entity ge ON e.guid = ge.guid"); $group_options['order_by'] = 'ge.name ASC'; } switch ($selected_tab) { case "open": $group_options["metadata_name_value_pairs"] = array("name" => "membership", "value" => ACCESS_PUBLIC); break; case "closed": $group_options["metadata_name_value_pairs"] = array("name" => "membership", "value" => ACCESS_PUBLIC, "operand" => "<>"); break; case "alpha": $dbprefix = elgg_get_config("dbprefix"); $group_options["joins"] = array("JOIN " . $dbprefix . "groups_entity ge ON e.guid = ge.guid"); $group_options["order_by"] = "ge.name ASC"; break; } if (!($content = elgg_list_entities_from_metadata($group_options))) { $content = elgg_echo("groups:none"); } $filter = elgg_view('groups/group_sort_menu', array('selected' => $selected_tab)); $sidebar = elgg_view('groups/sidebar/find'); $sidebar .= elgg_view('groups/sidebar/featured'); $params = array('content' => $content, 'sidebar' => $sidebar, 'filter' => $filter); $body = elgg_view_layout('content', $params); echo elgg_view_page(elgg_echo('groups:all'), $body); }
/** * Get page components to list a user's or all webinars. * * @param array $page * @return array */ function webinar_get_page_content_list($page = array()) { //compilcated input analysing $guid_type = $page[0]; $href = "webinar/{$guid_type}"; if (isset($page[1])) { if ($guid_type == 'all') { $guid = 0; $filter = $page[1]; } else { if ($guid_type == 'owner' || $guid_type == 'friends') { $user = get_user_by_username($page[1]); if ($user) { $guid = $user->getGUID(); } else { register_error(elgg_echo('webinar:error:not_user')); forward("webinar/all"); } $href .= "/{$page['1']}"; $filter = 'all'; } else { if ($guid_type = 'group' && is_numeric($page[1])) { $guid = $page[1]; $href .= "/{$page['1']}"; $filter = 'all'; } else { register_error(elgg_echo('webinar:error:wrong_request')); forward("webinar/all"); } } } if (isset($page[2])) { $filter = $page[2]; } } else { $guid = 0; $filter = 'all'; } $return = array(); $options = array('type' => 'object', 'subtype' => 'webinar', 'full_view' => FALSE); $filters = array('all', 'upcoming', 'running', 'done'); //if is valid filter set options for calling metadata search if ($filter != 'all' && in_array($filter, $filters)) { $options['metadata_names'] = 'status'; $options['metadata_values'] = $filter; } //register menu page foreach ($filters as $f) { elgg_register_menu_item('page', array('name' => "webinar:{$f}", 'text' => elgg_echo("webinar:menu:page:{$f}"), 'href' => $f == 'all' ? $href : "{$href}/{$f}", 'selected' => $f == $filter)); } if (!$guid) { $return['filter_context'] = 'all'; $return['title'] = elgg_echo('webinar:title:site:all'); //remove the link in the breadcrumb elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('webinar:webinars')); //create webinar button elgg_register_title_button(); } else { $entity = get_entity($guid); if ($entity) { switch ($guid_type) { case 'owner': case 'group': //set options $options['container_guid'] = $guid; //set filter if ($guid == elgg_get_logged_in_user_guid()) { $return['filter_context'] = 'mine'; $return['title'] = elgg_echo('webinar:title:user:mine'); elgg_register_title_button(); } else { if (elgg_instanceof($entity, 'group')) { // access check for closed groups group_gatekeeper(); $return['filter'] = false; $return['title'] = elgg_echo('webinar:title:group:all', array($entity->name)); elgg_register_title_button(); } else { // do not show button or select a tab when viewing someone else's posts $return['filter'] = false; $return['title'] = elgg_echo('webinar:title:user:all', array($entity->name)); } } //set breadcrumb elgg_push_breadcrumb($entity->name, $entity->getURL()); elgg_push_breadcrumb(elgg_echo('webinar:all')); break; case 'friends': //set options if (!($friends = get_user_friends($entity->getGUID(), ELGG_ENTITIES_ANY_VALUE, 0))) { register_error(elgg_echo('friends:none:you')); forward("webinar/all"); } else { foreach ($friends as $friend) { $options['container_guids'][] = $friend->getGUID(); } } //set filter if ($guid == elgg_get_logged_in_user_guid()) { $return['filter_context'] = 'friend'; $return['title'] = elgg_echo('webinar:title:friend:mine'); } else { $return['filter'] = false; $return['title'] = elgg_echo('webinar:title:friend:user', array($entity->name)); } //set breadcrumb elgg_push_breadcrumb($entity->name, "webinar/owner/{$entity->username}"); elgg_push_breadcrumb(elgg_echo('friends')); break; case 'all': default: register_error(elgg_echo('webinar:error:not_found')); forward("webinar/all"); break; } } else { register_error(elgg_echo('webinar:error:not_found')); forward("webinar/all"); } } $list = elgg_list_entities_from_metadata($options); if (!$list) { $return['content'] = elgg_echo('webinar:error:not_found'); } else { $return['content'] = $list; } return $return; }
/** * Podcasts page handler * * URL layout * All podcasts: podcasts/all * All episodes: podcasts/episodes/all * User's podcastss: podcasts/owner/<username> * Friends' podcasts: podcasts/friends/<username> * View podcast: podcasts/view/<guid>/<title> * New podcast: podcasts/add/<guid> * Edit podcast: podcasts/edit/<guid>/<revision> * Group podcasts: podcasts/group/<guid>/all * Group podcast settings: podcasts/group/<guid>/edit * Download podcast: podcasts/download/<guid> * Serve podcast: podcasts/serve/<guid> * User podcast settings: podcasts/settings * * Title is ignored * * @param array $page * @return bool */ function podcasts_page_handler($page) { // Load lib elgg_load_library('elgg:podcasts'); // Load JS elgg_load_js('elgg.podcasts'); elgg_load_js('soundmanager2'); // Load CSS elgg_load_css('elgg.podcasts'); // Push an 'all' podcasts breadcrumb elgg_push_breadcrumb(elgg_echo('podcasts'), "podcasts/all"); // Pages dir $pages_dir = elgg_get_plugins_path() . 'podcasts/pages/podcasts'; if (!isset($page[0])) { $page[0] = 'all'; } $page_type = $page[0]; switch ($page_type) { case 'owner': $user = get_user_by_username($page[1]); $params = podcasts_get_page_content_list($user->guid); break; case 'friends': $user = get_user_by_username($page[1]); $params = podcasts_get_page_content_friends($user->guid); break; case 'view': $params = podcasts_get_page_content_view($page[1]); break; case 'add': gatekeeper(); $params = podcasts_get_page_content_edit($page_type, $page[1]); break; case 'edit': gatekeeper(); $params = podcasts_get_page_content_edit($page_type, $page[1], $page[2]); break; case 'group': if ($page[2] == 'all') { $params = podcasts_get_page_content_list($page[1]); } else { if ($page[2] == 'edit') { $page_owner = get_entity($page[1]); elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('groups'), 'groups/all'); elgg_push_breadcrumb($page_owner->name, $page_owner->getURL()); elgg_push_breadcrumb(elgg_echo('podcasts:editpodcastsettings')); $params = elgg_set_page_owner_guid($page[1]); $params = podcasts_get_settings_content(); } } break; case 'all': $params = podcasts_get_page_content_list_podcasts(); break; case 'episodes': if ($page[1] == 'all') { $params = podcasts_get_page_content_list(); } else { forward('podcasts'); } break; case 'download': set_input('guid', $page[1]); include "{$pages_dir}/download.php"; break; case 'serve': set_input('guid', $page[1]); include "{$pages_dir}/serve.php"; break; case 'settings': if (!elgg_is_logged_in()) { forward(REFERER); } $username = $page[1]; if (!$username) { $user = elgg_get_logged_in_user_entity(); } else { $user = get_user_by_username($username); } elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('settings'), "settings/user/{$user->username}"); elgg_push_breadcrumb(elgg_echo('podcasts:title:usersettings')); if ($user && $user->canEdit()) { elgg_set_page_owner_guid($user->guid); $params = podcasts_get_settings_content(); } else { forward('podcasts/settings/' . elgg_get_logged_in_user_entity()->username); } break; default: return false; } if (isset($params['sidebar'])) { $params['sidebar'] .= elgg_view('podcasts/sidebar', array('page' => $page_type)); } else { $params['sidebar'] = elgg_view('podcasts/sidebar', array('page' => $page_type)); } $body = elgg_view_layout($params['layout'] ? $params['layout'] : 'content', $params); // Passing additional description thru vars echo elgg_view_page($params['title'], $body, 'default', array('description' => $params['feed_description'])); return true; }
$subtitle = "{$author_text} {$date} {$comments_link} {$categories}"; // title if (empty($title)) { $title = elgg_echo("untitled"); } // entity actions $entity_menu = ""; if (!elgg_in_context("widgets")) { $entity_menu = elgg_view_menu("entity", array("entity" => $file, "handler" => "file", "sort_by" => "priority", "class" => "elgg-menu-hz")); } if ($full_view && !elgg_in_context("gallery")) { // normal full view // add folder structure to the breadcrumbs if (file_tools_use_folder_structure()) { // @todo this should probably be moved to the file view page, but that is currently not under control of file_tools $endpoint = elgg_pop_breadcrumb(); $parent_folder = elgg_get_entities_from_relationship(array('relationship' => 'folder_of', 'relationship_guid' => $file->getGUID(), 'inverse_relationship' => true)); $folders = array(); if ($parent_folder) { $parent_guid = (int) $parent_folder[0]->guid; while (!empty($parent_guid) && ($parent = get_entity($parent_guid))) { $folders[] = $parent; $parent_guid = (int) $parent->parent_guid; } } while ($p = array_pop($folders)) { elgg_push_breadcrumb($p->title, $p->getURL()); } elgg_push_breadcrumb($file->title); } $extra = "";
/** * Get page components to edit/create a blog post. * * @param string $page 'edit' or 'new' * @param int $guid GUID of blog post or container * @param int $revision Annotation id for revision to edit (optional) * @return array */ function blog_get_page_content_edit($page, $guid = 0, $revision = NULL) { elgg_load_js('elgg.blog'); $return = array('filter' => ''); $vars = array(); $vars['id'] = 'blog-post-edit'; $vars['name'] = 'blog_post'; $vars['class'] = 'elgg-form-alt'; if ($page == 'edit') { $blog = get_entity((int) $guid); $title = elgg_echo('blog:edit'); if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { $vars['entity'] = $blog; $title .= ": \"{$blog->title}\""; if ($revision) { $revision = elgg_get_annotation_from_id((int) $revision); $vars['revision'] = $revision; $title .= ' ' . elgg_echo('blog:edit_revision_notice'); if (!$revision || !($revision->entity_guid == $guid)) { $content = elgg_echo('blog:error:revision_not_found'); $return['content'] = $content; $return['title'] = $title; return $return; } } $body_vars = blog_prepare_form_vars($blog, $revision); $container = $blog->getContainerEntity(); if ($container instanceof ElggGroup) { elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo("gvgroups:" . $container->grouptype . "groups"), "groups/" . $container->grouptype); elgg_push_breadcrumb($container->name, "blog/group/{$container->guid}/all"); } elgg_push_breadcrumb($blog->title, $blog->getURL()); elgg_push_breadcrumb(elgg_echo('edit')); elgg_load_js('elgg.blog'); $content = elgg_view_form('blog/save', $vars, $body_vars); $sidebar = elgg_view('blog/sidebar/revisions', $vars); } else { $content = elgg_echo('blog:error:cannot_edit_post'); } } else { if (!$guid) { $container = elgg_get_logged_in_user_entity(); } else { $container = get_entity($guid); } if ($container instanceof ElggGroup) { elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo("gvgroups:" . $container->grouptype . "groups"), "groups/" . $container->grouptype); elgg_push_breadcrumb($container->name, "blog/group/{$container->guid}/all"); } elgg_push_breadcrumb(elgg_echo('blog:add')); $body_vars = blog_prepare_form_vars($blog); $title = elgg_echo('blog:add'); $content = elgg_view_form('blog/save', $vars, $body_vars); } $return['title'] = $title; $return['content'] = $content; $return['sidebar'] = $sidebar; return $return; }
/** * Extends groups page handler * * URLs take the form of * Local groups: groups/local * Working groups: groups/working * Add local group: groups/local/add * Edit local group: groups/local/edit/<guid> * Add working group: groups/working/add * Edit working group: groups/working/edit/<guid> * */ function gvgroups_route_groups_handler($hook, $type, $return_value, $params) { elgg_load_library('elgg:groups'); /** * $return_value contains: * $return_value['handler'] => requested handler * $return_value['segments'] => url parts ($page) */ $result = $return_value; if (!empty($return_value) && is_array($return_value)) { $page = $return_value['segments']; switch ($page[0]) { case 'all': // remove this url to avoid normal group access forward(REFERER); $result = false; break; case 'add': // remove this url to avoid normal group creation forward(REFERER); $result = false; break; case 'profile': $group = get_entity($page[1]); elgg_pop_breadcrumb(); if ($group instanceof ElggGroup) { if ($group->grouptype == 'local') { elgg_push_breadcrumb(elgg_echo('gvgroups:localgroups'), "groups/local"); } else { elgg_push_breadcrumb(elgg_echo('gvgroups:workinggroups'), "groups/working"); } groups_handle_profile_page($page[1]); } $result = false; break; case 'edit': groups_handle_edit_page('edit', 'default', $page[1]); $result = false; break; case 'local': if ($page[1] == 'add') { groups_handle_add_local_page($page[2]); } elseif ($page[1] == 'edit') { groups_handle_edit_page('edit', $page[0], $page[2]); } else { groups_handle_all_page($page[0]); } $result = false; break; case 'working': if ($page[1] == 'add') { groups_handle_edit_page('add', $page[0]); } elseif ($page[1] == 'edit') { groups_handle_edit_page('edit', $page[0], $page[2]); } else { groups_handle_all_page($page[0]); } $result = false; break; } } return $result; }
} $subtitle = "{$author_text} {$date} {$comments_link} {$categories}"; // title if (empty($title)) { $title = elgg_echo("untitled"); } // entity actions $entity_menu = ""; if (!elgg_in_context("widgets")) { $entity_menu = elgg_view_menu("entity", array("entity" => $bookmark, "handler" => "bookmarks", "sort_by" => "priority", "class" => "elgg-menu-hz")); } if ($full_view) { // add folder structure to the breadcrumbs if (bookmark_tools_use_folder_structure()) { $endpoint = elgg_pop_breadcrumb(); $owner = elgg_pop_breadcrumb(); $parent_folder = elgg_get_entities_from_relationship(array('relationship' => 'folder_of', 'relationship_guid' => $bookmark->guid, 'inverse_relationship' => TRUE)); $folders = array(); if ($parent_folder) { $parent_guid = (int) $parent_folder[0]->guid; while (!empty($parent_guid) && ($parent = get_entity($parent_guid))) { $folders[] = $parent; $parent_guid = (int) $parent->parent_guid; } } elgg_push_breadcrumb($owner['title'], $owner['link']); elgg_push_breadcrumb(elgg_echo('bookmark_tools:list:folder:main'), $owner['link']); while ($p = array_pop($folders)) { elgg_push_breadcrumb($p->title, $p->getURL()); } elgg_push_breadcrumb($endpoint['title'], $endpoint['link']);
<?php /** * Elgg videos plugin everyone page * Author : Sarath C | Team Webgalli * Team Webgalli | Elgg developers and consultants * Mail : webgalli@gmail.com * Web : http://webgalli.com | http://plugingalaxy.com * Skype : 'team.webgalli' or 'drsanupmoideen' * @package Elgg-videos * Plugin info : Upload/ Embed videos. Save uploaded videos in youtube and save your bandwidth and server space * Licence : GNU2 * Copyright : Team Webgalli 2011-2015 */ elgg_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo('videos')); elgg_register_title_button(); $offset = (int) get_input('offset', 0); $content = elgg_list_entities(array('type' => 'object', 'subtype' => 'videos', 'limit' => 10, 'offset' => $offset, 'full_view' => false, 'view_toggle_type' => false)); $title = elgg_echo('videos:everyone'); $body = elgg_view_layout('content', array('filter_context' => 'all', 'content' => $content, 'title' => $title, 'sidebar' => elgg_view('videos/sidebar'))); echo elgg_view_page($title, $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_pop_breadcrumb(); elgg_push_breadcrumb(elgg_echo("gvgroups:" . $group->grouptype . "groups"), "groups/" . $group->grouptype); elgg_push_breadcrumb($group->name, "groups/activity/" . $group->guid); $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); }