Permalink
Browse files

Move single video page from pages/show.php to lib/kaltura_video.php.

  • Loading branch information...
1 parent 248f2bf commit 8144fb1c59b1d86e3cc9389d3d96fd878d4a8f50 @juho-jaakkola committed Apr 30, 2012
Showing with 53 additions and 15 deletions.
  1. +1 −0 languages/en.php
  2. +1 −0 languages/fi.php
  3. +40 −0 lib/kaltura_video.php
  4. +11 −8 start.php
  5. +0 −7 views/default/kaltura/view.php
View
@@ -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",
View
@@ -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",
View
@@ -9,6 +9,46 @@
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.
*
* @param string $page 'edit' or 'new'
View
@@ -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();
@@ -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;
}
}
@@ -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.