Beispiel #1
0
/**
 * Add timeslider to entity menu
 */
function etherpad_entity_menu($hook, $type, $return, $params)
{
    $entity = $params['entity'];
    if (elgg_in_context('widgets')) {
        return $return;
    }
    if (!in_array($entity->getSubtype(), array('etherpad', 'subpad'))) {
        return $return;
    }
    // timeslider button, show only if pages integration is enabled.
    $handler = elgg_get_plugin_setting('integrate_in_pages', 'etherpad') == 'yes' ? 'pages' : 'etherpad';
    if ($handler == 'pages') {
        $options = array('name' => 'etherpad-timeslider', 'text' => elgg_echo('etherpad:timeslider'), 'href' => elgg_get_site_url() . "{$handler}/history/" . $entity->guid, 'priority' => 200);
    } else {
        // fullscreen button
        $entity = new ElggPad($entity->guid);
        $options = array('name' => 'etherpadfs', 'text' => elgg_echo('etherpad:fullscreen'), 'href' => $entity->getPadPath(), 'priority' => 200);
    }
    $return[] = ElggMenuItem::factory($options);
    return $return;
}
Beispiel #2
0
//only display if there are commments
if ($comments_count != 0) {
    $text = elgg_echo("comments") . " ({$comments_count})";
    $comments_link = elgg_view('output/url', array('href' => $etherpad->getURL() . '#page-comments', 'text' => $text, 'is_trusted' => true));
} else {
    $comments_link = '';
}
$metadata = elgg_view_menu('entity', array('entity' => $vars['entity'], 'handler' => 'etherpad', 'sort_by' => 'priority', 'class' => 'elgg-menu-hz'));
$subtitle = "{$editor_text} {$comments_link} {$categories}";
// do not show the metadata and controls in widget view
if (elgg_in_context('widgets')) {
    $metadata = '';
}
if ($full) {
    try {
        $body .= elgg_view('output/iframe', array('value' => $etherpad->getPadPath($timeslider), 'type' => "etherpad"));
    } catch (Exception $e) {
        $body .= $e->getMessage();
    }
    $params = array('entity' => $etherpad, 'metadata' => $metadata, 'subtitle' => $subtitle, 'tags' => $tags);
    $params = $params + $vars;
    $summary = elgg_view('object/elements/summary', $params);
    echo elgg_view('object/elements/full', array('entity' => $etherpad, 'title' => false, 'icon' => $etherpad_icon, 'summary' => $summary, 'body' => $body));
} else {
    // brief view
    $excerpt = elgg_get_excerpt($etherpad->description);
    $params = array('entity' => $etherpad, 'metadata' => $metadata, 'subtitle' => $subtitle, 'tags' => $tags, 'content' => $excerpt);
    $params = $params + $vars;
    $list_body = elgg_view('object/elements/summary', $params);
    echo elgg_view_image_block($etherpad_icon, $list_body);
}