*
 * @package Simplekaltura
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Jeff Tilson
 * @copyright THINK Global School 2010 - 2013
 * @link http://www.thinkglobalschool.com/
 *
 * @uses $vars['entity']
 * @uses $vars['name']
 */
$video = elgg_extract('entity', $vars);
if (!elgg_instanceof($video, 'object', 'simplekaltura_video')) {
    return;
}
$thumbnail_second = $video->thumbnail_second;
$thumbnail_second_formatted = simplekaltura_sec2hms($thumbnail_second, TRUE);
if (!$thumbnail_second_formatted) {
    $thumbnail_second_formatted = elgg_echo('simplekaltura:label:default');
}
// Get field name
$name = elgg_extract('name', $vars);
if (!$name) {
    $name = 'thumbnail_second';
}
// Get video duration
$duration = $video->duration;
// Get current thumbnail
$current_thumb = elgg_view('output/img', array('src' => simplekaltura_build_thumbnail_url($video->kaltura_entryid, 'large', $thumbnail_second)));
$select_thumb = elgg_view('output/img', array('src' => simplekaltura_build_thumbnail_url($video->kaltura_entryid, 'large', 1), 'id' => 'simplekaltura-select-thumbnail'));
$current_label = elgg_echo('simplekaltura:label:currentthumbnail');
$select_label = elgg_echo('simplekaltura:label:selectthumbnail');
<?php

/**
 * Modules Simplekaltura video view
 * 
 * @package Modules
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Jeff Tilson
 * @copyright THINK Global School 2010
 * @link http://www.thinkglobalschool.com/
 * 
 */
$entity = $vars['entity'];
if (!$entity) {
    return '';
}
$owner = $entity->getOwnerEntity();
$friendlytime = elgg_view_friendly_time($entity->time_created);
$length = elgg_echo('simplekaltura:label:vidlength', array(simplekaltura_sec2hms($entity->duration)));
$play_count = is_int($entity->plays) ? $entity->plays : elgg_echo('simplekaltura:label:unavailable');
$plays = elgg_echo('simplekaltura:label:vidplays', array($play_count));
$info .= "<a href=\"{$entity->getURL()}\">{$entity->title}</a>";
$info .= elgg_view_menu('simpleicon-entity', array('entity' => $vars['entity'], 'sort_by' => 'priority', 'class' => 'elgg-menu-hz'));
$info .= "<p class='elgg-subtext'><a href=\"{$vars['url']}profile/{$owner->username}\">{$owner->name}</a> {$friendlytime} <br /> {$length} <br /> {$plays}</p>";
$pop_url = elgg_get_site_url() . 'ajax/view/simplekaltura/popup?entity_guid=' . $entity->guid;
$icon = "<a class='simplekaltura-lightbox' href='{$pop_url}'><img src='{$entity->getIconURL('tiny')}' border='0' /></a>";
//display
echo elgg_view_image_block($icon, $info);
    return true;
}
$owner = $video->getOwnerEntity();
$container = $video->getContainerEntity();
$categories = elgg_view('output/categories', $vars);
$title = $video->title;
$description = $video->description;
$excerpt = elgg_get_excerpt($description);
$owner_icon = elgg_view_entity_icon($owner, 'tiny');
$owner_link = elgg_view('output/url', array('href' => "videos/owner/{$owner->username}", 'text' => $owner->name));
$author_text = elgg_echo('byline', array($owner_link));
$tags = elgg_view('output/tags', array('tags' => $video->tags));
$date = elgg_view_friendly_time($video->time_created);
$video_icon = '';
$plays = is_int($vars['entity']->plays) ? $vars['entity']->plays : elgg_echo('simplekaltura:label:unavailable');
$duration = simplekaltura_sec2hms($vars['entity']->duration);
if (!$duration) {
    $duration = elgg_echo('simplekaltura:label:unavailable');
}
$kaltura_metadata = elgg_echo('simplekaltura:label:vidlength', array($duration));
$kaltura_metadata .= elgg_echo('simplekaltura:label:vidplays', array($plays));
// The "on" status changes for comments, so best to check for !Off
$comments_link = '';
if ($video->comments_on != 'Off') {
    $comments_count = $video->countComments();
    //only display if there are commments
    if ($comments_count != 0) {
        $text = elgg_echo("comments") . " ({$comments_count})";
        $comments_link = elgg_view('output/url', array('href' => $video->getURL() . '#comments', 'text' => $text));
    }
}