Example #1
0
/**
 * Get page components to view a podcast
 *
 * @param int $guid GUID of a podcast entity.
 *
 * @return array
 */
function podcasts_get_page_content_view($guid = NULL)
{
    $return = array();
    $podcast = get_entity($guid);
    // no header or tabs for viewing an individual podcast
    $return['filter'] = '';
    if (!elgg_instanceof($podcast, 'object', 'podcast')) {
        register_error(elgg_echo('noaccess'));
        $_SESSION['last_forward_from'] = current_page_url();
        forward('');
    }
    $return['title'] = elgg_echo('podcasts:episode_title', array(podcasts_get_episode_number($podcast), $podcast->title));
    $container = $podcast->getContainerEntity();
    $crumbs_title = $container->name;
    if (elgg_instanceof($container, 'group')) {
        elgg_push_breadcrumb($crumbs_title, "podcasts/group/{$container->guid}/all");
    } else {
        elgg_push_breadcrumb($crumbs_title, "podcasts/owner/{$container->username}");
    }
    elgg_push_breadcrumb($podcast->title);
    $return['content'] = elgg_view_entity($podcast, array('full_view' => true));
    $return['content'] .= elgg_view_comments($podcast);
    $return['layout'] = 'one_sidebar';
    return $return;
}
Example #2
0
$comments_count = $podcast->countComments();
// If theres commments, show the link
if ($comments_count != 0) {
    $text = elgg_echo("comments") . " ({$comments_count})";
    $comments_link = elgg_view('output/url', array('href' => $podcast->getURL() . '#podcast-comments', 'text' => $text, 'is_trusted' => true));
} else {
    $comments_link = '';
}
$metadata = elgg_view_menu('entity', array('entity' => $vars['entity'], 'handler' => 'podcasts', 'sort_by' => 'priority', 'class' => 'elgg-menu-hz'));
$subtitle = "{$author_text} {$date} {$comments_link} {$categories}";
// Don't show metadata in widgets view
if (elgg_in_context('widgets')) {
    $metadata = '';
}
$player = elgg_view('podcasts/player', array('entity_guid' => $podcast->guid));
$episode_title = elgg_echo('podcasts:episode_title', array(podcasts_get_episode_number($podcast), $podcast->title));
$podcast_title = elgg_view('output/url', array('text' => $episode_title, 'href' => $podcast->getURL()));
if ($full) {
    $body = elgg_view('output/longtext', array('value' => $podcast->description, 'class' => 'elgg-podcast-episode-description'));
    $body .= $player;
    $params = array('entity' => $podcast, 'title' => false, 'metadata' => $metadata, 'subtitle' => $subtitle);
    $params = $params + $vars;
    $summary = elgg_view('object/elements/summary', $params);
    echo elgg_view('object/elements/full', array('summary' => $summary, 'icon' => $owner_icon, 'body' => $body, 'class' => 'elgg-podcast-episode', 'title' => 'sd'));
} else {
    // Brief view
    $params = array('entity' => $podcast, 'metadata' => $metadata, 'subtitle' => $subtitle, 'title' => false);
    $params = $params + $vars;
    $list_body = elgg_view('object/elements/summary', $params);
    $body .= "<h3 class='elgg-podcast-title'>" . $podcast_title . "</h3>";
    $body .= elgg_view_image_block($owner_icon, $list_body);