Example #1
0
File: start.php Project: elgg/elgg
/**
 * Messageboard dispatcher for flat message board.
 * Profile (and eventually group) widgets handle their own.
 *
 * URLs take the form of
 *  User's messageboard:               messageboard/owner/<username>
 *  Y's history of posts on X's board: messageboard/owner/<X>/history/<Y>
 *  New post:                          messageboard/add/<guid> (container: user or group)
 *  Group messageboard:                messageboard/group/<guid>/all (not implemented)
 *
 * @param array $page Array of page elements
 * @return bool
 */
function messageboard_page_handler($page)
{
    $vars = [];
    switch ($page[0]) {
        case 'owner':
            //@todo if they have the widget disabled, don't allow this.
            $owner_name = elgg_extract(1, $page);
            $owner = get_user_by_username($owner_name);
            $vars['page_owner_guid'] = $owner->guid;
            $history = elgg_extract(2, $page);
            $username = elgg_extract(3, $page);
            if ($history && $username) {
                $vars['history_username'] = $username;
            }
            echo elgg_view_resource('messageboard/owner', $vars);
            break;
        case 'group':
            elgg_group_gatekeeper();
            $owner_guid = elgg_extract(1, $page);
            $vars['page_owner_guid'] = $owner_guid;
            echo elgg_view_resource('messageboard/owner', $vars);
            break;
        default:
            return false;
    }
    return true;
}
Example #2
0
/**
 * Messageboard dispatcher for flat message board.
 * Profile (and eventually group) widgets handle their own.
 *
 * URLs take the form of
 *  User's messageboard:               messageboard/owner/<username>
 *  Y's history of posts on X's board: messageboard/owner/<X>/history/<Y>
 *  New post:                          messageboard/add/<guid> (container: user or group)
 *  Group messageboard:                messageboard/group/<guid>/all (not implemented)
 *
 * @param array $page Array of page elements
 * @return bool
 */
function messageboard_page_handler($page)
{
    $pages = dirname(__FILE__) . '/pages/messageboard';
    switch ($page[0]) {
        case 'owner':
            //@todo if they have the widget disabled, don't allow this.
            $owner_name = elgg_extract(1, $page);
            $owner = get_user_by_username($owner_name);
            set_input('page_owner_guid', $owner->guid);
            $history = elgg_extract(2, $page);
            $username = elgg_extract(3, $page);
            if ($history && $username) {
                set_input('history_username', $username);
            }
            include "{$pages}/owner.php";
            break;
        case 'add':
            $container_guid = elgg_extract(1, $page);
            set_input('container_guid', $container_guid);
            include "{$pages}/add.php";
            break;
        case 'group':
            elgg_group_gatekeeper();
            $owner_guid = elgg_extract(1, $page);
            set_input('page_owner_guid', $owner_guid);
            include "{$pages}/owner.php";
            break;
        default:
            return false;
    }
    return true;
}
Example #3
0
/**
 * Messageboard dispatcher for flat message board.
 * Profile (and eventually group) widgets handle their own.
 *
 * URLs take the form of
 *  User's messageboard:               messageboard/owner/<username>
 *  Y's history of posts on X's board: messageboard/owner/<X>/history/<Y>
 *  New post:                          messageboard/add/<guid> (container: user or group)
 *  Group messageboard:                messageboard/group/<guid>/all (not implemented)
 *
 * @param array $page Array of page elements
 * @return bool
 */
function messageboard_page_handler($page)
{
    switch ($page[0]) {
        case 'owner':
            //@todo if they have the widget disabled, don't allow this.
            $owner_name = elgg_extract(1, $page);
            $owner = get_user_by_username($owner_name);
            set_input('page_owner_guid', $owner->guid);
            $history = elgg_extract(2, $page);
            $username = elgg_extract(3, $page);
            if ($history && $username) {
                set_input('history_username', $username);
            }
            echo elgg_view('resources/messageboard/owner');
            break;
        case 'add':
            $container_guid = elgg_extract(1, $page);
            set_input('container_guid', $container_guid);
            echo elgg_view('resources/messageboard/add');
            break;
        case 'group':
            elgg_group_gatekeeper();
            $owner_guid = elgg_extract(1, $page);
            set_input('page_owner_guid', $owner_guid);
            echo elgg_view('resources/messageboard/owner');
            break;
        default:
            return false;
    }
    return true;
}
Example #4
0
/**
 * Handles all question pages
 *
 * @param array $segments
 *
 * @return bool
 */
function questions_page_handler($segments)
{
    elgg_push_breadcrumb(elgg_echo('questions'), 'questions/all');
    $pages = dirname(dirname(__FILE__)) . '/pages/questions';
    switch ($segments[0]) {
        case 'all':
            include "{$pages}/all.php";
            break;
        case 'todo':
            if (isset($segments[1]) && is_numeric($segments[1])) {
                set_input('group_guid', $segments[1]);
            }
            include "{$pages}/todo.php";
            break;
        case 'owner':
            if (isset($segments[1]) && is_numeric($segments[1])) {
                elgg_set_page_owner_guid($segments[1]);
            }
            include "{$pages}/owner.php";
            break;
        case 'view':
            set_input('guid', $segments[1]);
            include "{$pages}/view.php";
            break;
        case 'add':
            elgg_gatekeeper();
            include "{$pages}/add.php";
            break;
        case 'edit':
            elgg_gatekeeper();
            set_input('guid', $segments[1]);
            include "{$pages}/edit.php";
            break;
        case 'group':
            elgg_group_gatekeeper();
            include "{$pages}/owner.php";
            break;
        case 'experts':
            if (isset($segments[1]) && is_numeric($segments[1])) {
                elgg_set_page_owner_guid($segments[1]);
            }
            include "{$pages}/experts.php";
            break;
        default:
            forward('questions/all');
            return false;
    }
    return true;
}
Example #5
0
/**
 * 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'));
    $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 {
        $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'));
    }
    $return['content'] = elgg_list_entities_from_metadata($options);
    return $return;
}
Example #6
0
/**
 * 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;
}
Example #7
0
File: blog.php Project: ibou77/elgg
/**
 * 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;
}
Example #8
0
<?php

/**
 * Album sort page
 *
 * This displays a listing of all the photos so that they can be sorted
 */
elgg_gatekeeper();
elgg_group_gatekeeper();
// get the album entity
$album_guid = elgg_extract('guid', $vars);
$album = get_entity($album_guid);
// panic if we can't get it
if (!$album) {
    forward();
}
// container should always be set, but just in case
$owner = $album->getContainerEntity();
elgg_set_page_owner_guid($owner->getGUID());
$title = elgg_echo('tidypics:sort', array($album->getTitle()));
// set up breadcrumbs
elgg_push_breadcrumb(elgg_echo('photos'), 'photos/siteimagesall');
elgg_push_breadcrumb(elgg_echo('tidypics:albums'), 'photos/all');
if (elgg_instanceof($owner, 'group')) {
    elgg_push_breadcrumb($owner->name, "photos/group/{$owner->guid}/all");
} else {
    elgg_push_breadcrumb($owner->name, "photos/owner/{$owner->username}");
}
elgg_push_breadcrumb($album->getTitle(), $album->getURL());
elgg_push_breadcrumb(elgg_echo('album:sort'));
if ($album->getSize()) {
Example #9
0
<?php

$target_guid = elgg_extract('target_guid', $vars);
$post_guids = elgg_extract('post_guids', $vars);
elgg_entity_gatekeeper($target_guid);
elgg_group_gatekeeper(true, $target_guid);
$target = get_entity($target_guid);
elgg_set_page_owner_guid($target->guid);
elgg_push_breadcrumb(elgg_echo('wall'), hypeWall()->router->getPageHandlerId());
if (is_callable(array($target, 'getDisplayName'))) {
    $name = $target->getDisplayName();
} else {
    $name = $target instanceof ElggObject ? $target->title : $target->name;
}
$title = elgg_echo('wall:owner', array($name));
elgg_push_breadcrumb($title, hypeWall()->router->normalize($target->guid));
$content = elgg_view('lists/wall', array('entity' => $target, 'post_guids' => $post_guids));
if (elgg_is_xhr()) {
    echo $content;
} else {
    $layout = elgg_view_layout('content', array('title' => $title, 'content' => $content, 'filter' => false));
    echo elgg_view_page($title, $layout);
}
<?php

/**
 * Search for content in this group
 *
 * @uses vars['entity'] ElggGroup
 */
$entity = elgg_extract('entity', $vars, elgg_get_page_owner_entity());
if (!elgg_group_gatekeeper(false, $entity->guid)) {
    return;
}
$identifier = is_callable('group_subtypes_get_identifier') ? group_subtypes_get_identifier($entity) : 'groups';
$url = elgg_get_site_url() . 'search';
$body = elgg_view_form('groups/search', array('action' => $url, 'method' => 'get', 'disable_security' => true), $vars);
echo elgg_view_module('aside', elgg_echo("{$identifier}:search_in_group"), $body);
<?php

$page_owner = elgg_get_page_owner_entity();
if (!elgg_group_gatekeeper(false, $page_owner->guid)) {
    echo elgg_format_element('p', ['class' => 'elgg-no-results'], elgg_echo('groups:opengroup:membersonly'));
    return;
}
echo elgg_view('lists/groups/members', array('pagination' => false, 'show_rel' => false, 'show_sort' => false));
echo elgg_format_element('span', ['class' => 'elgg-widget-more'], elgg_view('output/url', array('text' => elgg_echo('groups:members:more'), 'href' => "groups/members/{$entity->guid}")));
Example #12
0
File: groups.php Project: n8b/VMN
/**
 * Group members page
 *
 * @param int $guid Group entity GUID
 */
function groups_handle_members_page($guid)
{
    elgg_entity_gatekeeper($guid, 'group');
    $group = get_entity($guid);
    elgg_set_page_owner_guid($guid);
    elgg_group_gatekeeper();
    $title = elgg_echo('groups:members:title', array($group->name));
    elgg_push_breadcrumb($group->name, $group->getURL());
    elgg_push_breadcrumb(elgg_echo('groups:members'));
    $db_prefix = elgg_get_config('dbprefix');
    $content = elgg_list_entities_from_relationship(array('relationship' => 'member', 'relationship_guid' => $group->guid, 'inverse_relationship' => true, 'type' => 'user', 'limit' => (int) get_input('limit', max(20, elgg_get_config('default_limit')), false), 'joins' => array("JOIN {$db_prefix}users_entity u ON e.guid=u.guid"), 'order_by' => 'u.name ASC'));
    $params = array('content' => $content, 'title' => $title, 'filter' => '');
    $body = elgg_view_layout('content', $params);
    echo elgg_view_page($title, $body);
}
Example #13
0
<?php

$guid = elgg_extract('guid', $vars);
// turn this into a core function
global $autofeed;
$autofeed = true;
elgg_entity_gatekeeper($guid, 'group');
$group = get_entity($guid);
elgg_push_breadcrumb($group->name);
groups_register_profile_buttons($group);
$content = elgg_view('groups/profile/layout', array('entity' => $group));
$sidebar = '';
if (elgg_group_gatekeeper(false)) {
    if (elgg_is_active_plugin('search')) {
        $sidebar .= elgg_view('groups/sidebar/search', array('entity' => $group));
    }
    $sidebar .= elgg_view('groups/sidebar/members', array('entity' => $group));
    $subscribed = false;
    if (elgg_is_active_plugin('notifications')) {
        $NOTIFICATION_HANDLERS = _elgg_services()->notifications->getMethodsAsDeprecatedGlobal();
        foreach ($NOTIFICATION_HANDLERS as $method => $foo) {
            $relationship = check_entity_relationship(elgg_get_logged_in_user_guid(), 'notify' . $method, $guid);
            if ($relationship) {
                $subscribed = true;
                break;
            }
        }
    }
    $sidebar .= elgg_view('groups/sidebar/my_status', array('entity' => $group, 'subscribed' => $subscribed));
}
$params = array('content' => $content, 'sidebar' => $sidebar, 'title' => $group->name);
Example #14
0
/**
 * View a discussion topic
 *
 * @param int $guid GUID of topic
 */
function discussion_handle_view_page($guid)
{
    // We now have RSS on topics
    global $autofeed;
    $autofeed = true;
    elgg_entity_gatekeeper($guid, 'object', 'groupforumtopic');
    $topic = get_entity($guid);
    $group = $topic->getContainerEntity();
    if (!elgg_instanceof($group, 'group')) {
        register_error(elgg_echo('group:notfound'));
        forward();
    }
    elgg_load_js('elgg.discussion');
    elgg_set_page_owner_guid($group->getGUID());
    elgg_group_gatekeeper();
    elgg_push_breadcrumb($group->name, "discussion/owner/{$group->guid}");
    elgg_push_breadcrumb($topic->title);
    $params = array('topic' => $topic, 'show_add_form' => false);
    $content = elgg_view_entity($topic, array('full_view' => true));
    if ($topic->status == 'closed') {
        $content .= elgg_view('discussion/replies', $params);
        $content .= elgg_view('discussion/closed');
    } elseif ($group->canWriteToContainer(0, 'object', 'groupforumtopic') || elgg_is_admin_logged_in()) {
        $params['show_add_form'] = true;
        $content .= elgg_view('discussion/replies', $params);
    } else {
        $content .= elgg_view('discussion/replies', $params);
    }
    $params = array('content' => $content, 'title' => $topic->title, 'sidebar' => elgg_view('discussion/sidebar'), 'filter' => '');
    $body = elgg_view_layout('content', $params);
    echo elgg_view_page($topic->title, $body);
}
/**
 * May the current user access item(s) on this page? If the page owner is a group,
 * membership, visibility, and logged in status are taken into account.
 *
 * @param bool $forward         If set to true (default), will forward the page;
 *                              if set to false, will return true or false.
 *
 * @param int  $page_owner_guid The current page owner guid. If not set, this
 *                              will be pulled from elgg_get_page_owner_guid().
 *
 * @return bool Will return if $forward is set to false.
 */
function group_gatekeeper($forward = true, $page_owner_guid = null)
{
    return elgg_group_gatekeeper($forward, $page_owner_guid);
}
Example #16
0
function izap_group_gatekeeper()
{
    if (is_callable('elgg_group_gatekeeper')) {
        return elgg_group_gatekeeper();
    } else {
        return group_gatekeeper();
    }
}
Example #17
0
File: add.php Project: elgg/elgg
<?php

elgg_gatekeeper();
$guid = elgg_extract('guid', $vars);
elgg_entity_gatekeeper($guid);
elgg_group_gatekeeper(true, $guid);
$container = get_entity($guid);
// Make sure user has permissions to add a topic to container
if (!$container->canWriteToContainer(0, 'object', 'discussion')) {
    register_error(elgg_echo('actionunauthorized'));
    forward(REFERER);
}
$title = elgg_echo('discussion:addtopic');
elgg_push_breadcrumb($container->getDisplayName(), "discussion/owner/{$container->guid}");
elgg_push_breadcrumb($title);
$body_vars = discussion_prepare_form_vars();
$content = elgg_view_form('discussion/save', array(), $body_vars);
$params = array('content' => $content, 'title' => $title, 'sidebar' => elgg_view('discussion/sidebar/edit'), 'filter' => '');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($title, $body);
Example #18
0
/**
 * Invite users to a group
 *
 * @param int $guid Group entity GUID
 */
function groups_handle_recommendations_page($guid)
{
    elgg_entity_gatekeeper($guid, 'group');
    elgg_set_page_owner_guid($guid);
    elgg_group_gatekeeper();
    $group = get_entity($guid);
    $title = elgg_echo('groups:recommendations');
    elgg_push_breadcrumb($group->name, $group->getURL());
    elgg_push_breadcrumb($title);
    //	$db_prefix = elgg_get_config('dbprefix');
    $params = array('content' => $content, 'title' => $title, 'filter' => '');
    $body = elgg_view_layout('content', $params);
    echo elgg_view_page($title, $body);
}
/**
 * Dispatcher for bookmarks.
 *
 * URLs take the form of
 *  All bookmarks:        bookmarks/all
 *  User's bookmarks:     bookmarks/owner/<username>
 *  Friends' bookmarks:   bookmarks/friends/<username>
 *  View bookmark:        bookmarks/view/<guid>/<title>
 *  New bookmark:         bookmarks/add/<guid> (container: user, group, parent)
 *  Edit bookmark:        bookmarks/edit/<guid>
 *  Group bookmarks:      bookmarks/group/<guid>/all
 *  Bookmarklet:          bookmarks/bookmarklet/<guid> (user)
 *
 * Title is ignored
 *
 * @param array $page
 * @return bool
 */
function bookmarks_page_handler($page)
{
    elgg_load_library('elgg:bookmarks');
    if (!isset($page[0])) {
        $page[0] = 'all';
    }
    elgg_push_breadcrumb(elgg_echo('bookmarks'), 'bookmarks/all');
    $pages = dirname(__FILE__) . '/pages/bookmarks';
    switch ($page[0]) {
        case "all":
            include "{$pages}/all.php";
            break;
        case "owner":
            include "{$pages}/owner.php";
            break;
        case "friends":
            include "{$pages}/friends.php";
            break;
        case "view":
            set_input('guid', $page[1]);
            include "{$pages}/view.php";
            break;
        case "add":
            elgg_gatekeeper();
            include "{$pages}/add.php";
            break;
        case "edit":
            elgg_gatekeeper();
            set_input('guid', $page[1]);
            include "{$pages}/edit.php";
            break;
        case 'group':
            elgg_group_gatekeeper();
            include "{$pages}/owner.php";
            break;
        case "bookmarklet":
            set_input('container_guid', $page[1]);
            include "{$pages}/bookmarklet.php";
            break;
        default:
            return false;
    }
    elgg_pop_context();
    return true;
}
Example #20
0
/**
 * Filters listing subtitle
 * 
 * @param string $hook   "view_vars"
 * @param string $type   "group/elements/summary"
 * @param array  $return View vars
 * @param array  $params Hook params
 * @return array
 */
function group_list_filter_listing_subtitle($hook, $type, $return, $params)
{
    $entity = elgg_extract('entity', $return);
    if (!$entity instanceof ElggGroup) {
        return;
    }
    if (!elgg_get_plugin_setting('use_membership_view', 'group_list')) {
        return;
    }
    $subtitle = array();
    if ($entity->isPublicMembership()) {
        $mem = elgg_echo('group:membership:open');
        $mem_class = 'group-membership-open';
    } else {
        $mem = elgg_echo('group:membership:closed');
        $mem_class = 'group-membership-closed';
    }
    $subtitle['public_membership'] = elgg_format_element('b', ['class' => $mem_class], $mem);
    if ($entity->featured_group == 'yes') {
        $subtitle['featured'] = elgg_format_element('b', ['class' => 'group-featured'], elgg_echo('group:featured'));
    }
    if (elgg_group_gatekeeper(false, $entity->guid)) {
        $member_count = $entity->getVolatileData('select:member_count');
        if (!isset($member_count)) {
            $member_count = $entity->getMembers(array('count' => true));
        }
        if ($member_count == 1) {
            $subtitle['member_count'] = elgg_echo('group:member:count:single', [$member_count]);
        } else {
            $subtitle['member_count'] = elgg_echo('group:member:count', [$member_count]);
        }
    }
    //$subtitle['time_created'] = elgg_echo('group:time_created', [date('j M, Y', $entity->time_created)]);
    if ($entity->last_action) {
        $subtitle['last_action'] = elgg_echo('group:last_activity', [elgg_get_friendly_time($entity->last_action)]);
    }
    $subtitle_str = '';
    foreach ($subtitle as $s) {
        $subtitle_str .= elgg_format_element('span', ['class' => 'elgg-group-subtitle-element'], $s);
    }
    $view_subtitle = elgg_extract('subtitle', $return);
    if ($view_subtitle) {
        $view_subtitle = $subtitle_str . '<br />' . $view_subtitle;
    } else {
        $view_subtitle = $subtitle_str;
    }
    $return['subtitle'] = $view_subtitle;
    return $return;
}
Example #21
0
<?php

$guid = elgg_extract('guid', $vars);
$reply_guid = elgg_extract('reply_guid', $vars);
elgg_register_rss_link();
elgg_entity_gatekeeper($guid, 'object', 'discussion');
$entity = get_entity($guid);
elgg_group_gatekeeper(true, $entity->container_guid);
$container = $entity->getContainerEntity();
elgg_set_page_owner_guid($container->guid);
if ($container instanceof ElggGroup) {
    $owner_url = "discussion/group/{$container->guid}";
} else {
    $owner_url = "discussion/owner/{$container->guid}";
}
elgg_push_breadcrumb($container->getDisplayName(), $owner_url);
elgg_push_breadcrumb($entity->title);
$content = elgg_view_entity($entity, ['full_view' => true]);
$content .= elgg_view('discussion/replies', ['topic' => $entity, 'reply' => get_entity($reply_guid), 'show_add_form' => $entity->canWriteToContainer(0, 'object', 'discussion_reply'), 'expand_form' => true, 'full_view' => true]);
$params = array('content' => $content, 'title' => $entity->title, 'sidebar' => elgg_view('discussion/sidebar'), 'filter' => '', 'class' => 'elgg-discussion-layout');
$body = elgg_view_layout('content', $params);
echo elgg_view_page($entity->title, $body);