Skip to content

Commit

Permalink
Move single video page from pages/show.php to lib/kaltura_video.php.
Browse files Browse the repository at this point in the history
  • Loading branch information
Juho Jaakkola committed Apr 30, 2012
1 parent 248f2bf commit 8144fb1
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 15 deletions.
1 change: 1 addition & 0 deletions languages/en.php
Expand Up @@ -15,6 +15,7 @@
'kalturavideo:error:missingks' => 'Probably you have a mistake in the "Administrator Secret" or "Web Service Secret" configuration.',
'kalturavideo:error:partnerid' => "This error normaly appears if you are not a partner of Kaltura. Please read the README file and configure this plugin!",
'kalturavideo:error:readme' => "Please read the README file and configure this plugin!",
'kaltura_video:error:video_not_found' => "Video was not found.",
'kalturavideo:label:closewindow' => "Close window",
'kalturavideo:label:select_size' => "Select player size",
'kalturavideo:label:large' => "Large",
Expand Down
1 change: 1 addition & 0 deletions languages/fi.php
Expand Up @@ -14,6 +14,7 @@
'kalturavideo:error:missingks' => 'Järjestelmässä on todennäköisesti virhe "Administrator Secret"- tai "Web Service Secret"-asetuksessa.',
'kalturavideo:error:partnerid' => "Tämä virhe tapahtuu yleensä, jos et ole Kalturan yhteistyökumppani. Lue README-tiedosto ja tee tarvittavat konfiguraatiot.",
'kalturavideo:error:readme' => "Lue README-tiedosto ja konfiguroi liitännäinen.",
'kaltura_video:error:video_not_found' => "Videota ei löytynyt.",
'kalturavideo:label:closewindow' => "Sulje ikkuna",
'kalturavideo:label:select_size' => "Valitse soittimen koko",
'kalturavideo:label:large' => "Suuri",
Expand Down
40 changes: 40 additions & 0 deletions lib/kaltura_video.php
Expand Up @@ -8,6 +8,46 @@
// @todo What would be the best way to include the api libraries?
include_once(elgg_get_plugins_path() . 'kaltura_video/kaltura/api_client/includes.php');

/**
* Get page components to view a video.
*
* @param int $guid GUID of a video entity.
* @return array
*/
function kaltura_video_get_page_content_read($guid = NULL) {

$return = array();

$video = get_entity($guid);

// no header or tabs for viewing an individual video
$return['filter'] = '';

if (!elgg_instanceof($video, 'object', 'kaltura_video')) {
$return['content'] = elgg_echo('kaltura_video:error:post_not_found');
return $return;
}

$return['title'] = htmlspecialchars($video->title);

$container = $video->getContainerEntity();
$crumbs_title = $container->name;
if (elgg_instanceof($container, 'group')) {
elgg_push_breadcrumb($crumbs_title, "kaltura_video/group/$container->guid/all");
} else {
elgg_push_breadcrumb($crumbs_title, "kaltura_video/owner/$container->username");
}

elgg_push_breadcrumb($video->title);
$return['content'] = elgg_view_entity($video, array('full_view' => true));
//check to see if comment are on
if ($video->comments_on != 'Off') {
$return['content'] .= elgg_view_comments($video);
}

return $return;
}

/**
* Get page components to edit/create a video.
*
Expand Down
19 changes: 11 additions & 8 deletions start.php
Expand Up @@ -352,6 +352,7 @@ function kaltura_video_page_handler($page) {
}

$page_type = $page[0];
$view_params = null;
switch ($page_type) {
case 'owner':
kaltura_video_register_toggle();
Expand All @@ -364,35 +365,37 @@ function kaltura_video_page_handler($page) {
case 'add':
gatekeeper();
set_input('entry_id', $page[1]);
$params = kaltura_video_get_page_content_edit();
$view_params = kaltura_video_get_page_content_edit();
//include "$file_dir/edit.php";
break;
case 'edit':
gatekeeper();
set_input('guid', $page[1]);
$params = kaltura_video_get_page_content_edit('edit', $page[1]);
$view_params = kaltura_video_get_page_content_edit('edit', $page[1]);
//include "$file_dir/edit.php";
break;
case 'view':
set_input('guid', $page[1]);
include("$file_dir/show.php");
$view_params = kaltura_video_get_page_content_read($page[1]);
//include("$file_dir/show.php");
break;
case 'group':
kaltura_video_register_toggle();
$params = kaltura_video_get_page_content_list($page[1]);
$view_params = kaltura_video_get_page_content_list($page[1]);
break;
case 'all':
default:
kaltura_video_register_toggle();
$params = kaltura_video_get_page_content_list();
$view_params = kaltura_video_get_page_content_list();
//include "$file_dir/everyone.php";
break;
}

if (!empty($params)) {
$body = elgg_view_layout('content', $params);
if (!empty($view_params)) {
//var_dump($view_params);
$body = elgg_view_layout('content', $view_params);

echo elgg_view_page($params['title'], $body);
echo elgg_view_page($view_params['title'], $body);
return true;
}
}
Expand Down
7 changes: 0 additions & 7 deletions views/default/kaltura/view.php
Expand Up @@ -135,10 +135,3 @@
<hr />
<?php endif; ?>
</p>

<?php
//check to see if comment are on
if ($entity->comments_on != 'Off') {
echo elgg_view_comments($entity);
}
?>

0 comments on commit 8144fb1

Please sign in to comment.