X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=application%2Fcontrollers%2Fvideo.php;h=4a15ba57bc685e2b6109d489d04633a66741c3ec;hb=aaa8b077bac73addd05114fd2b2ef0829412fac7;hp=f892349abff772eccafbc9aac59e9e5770613478;hpb=a11428ed0b4651895e27d6920c219d8d2476631c;p=living-lab-site.git diff --git a/application/controllers/video.php b/application/controllers/video.php index f892349..4a15ba5 100644 --- a/application/controllers/video.php +++ b/application/controllers/video.php @@ -1,7 +1,7 @@ lang->load('video'); } public function index() @@ -29,24 +31,49 @@ class Video extends CI_Controller { */ public function watch($id, $name = NULL, $plugin = NULL) { - $this->load->helper('url'); - + // ** + // ** LOADING MODEL + // ** // Retrieve video information. $this->load->model('videos_model'); + $this->videos_model->inc_video_var($id, 'views'); $data['video'] = $this->videos_model->get_video($id, $name); - $data['plugin'] = ($plugin === NULL ? 'auto' : $plugin); + $categories = $this->config->item('categories'); + $data['video']['category_name'] = + $categories[ $data['video']['category_id'] ]; + $data['plugin_type'] = ($plugin === NULL ? 'auto' : $plugin); // Display page. $params = array( 'title' => $data['video']['title'] . ' -- ' . $this->config->item('site_name'), - 'css' => array('jquery-ui.css', 'NextShare_VLC_plugin.css'), - 'js' => array('jquery.min.js', 'jquery-ui.min.js', 'NextShare_VLC_plugin.js', 'video.js'), + 'css' => array( + 'jquery.ui.nsvideo.css', + 'video.css' + ), + 'js' => array( + 'jquery.ui.nsvideo.js' + ), //'metas' => array('description'=>'','keywords'=>'') ); $this->load->library('html_head_params', $params); + + // Preloading video plugin. + // TODO plugin auto: type and format + if ($data['plugin_type'] == 'auto') + $data['plugin_type'] = 'ns-html5'; + $data['asset_index'] = 0; + + // TODO remove old AJAX plugin content +// $data['plugin_content'] = $this->_plugin('ns-html5', +// $data['video']['url'][0], TRUE); + + // ** + // ** LOADING VIEWS + // ** $this->load->view('html_begin', $this->html_head_params); $this->load->view('header'); + //$main_params['content'] = $this->load->view('video/watch_view', $data, TRUE); $this->load->view('video/watch_view', $data); $this->load->view('footer'); @@ -64,10 +91,31 @@ class Video extends CI_Controller { */ public function plugin($type) { - $data['url'] = $this->input->post('url', TRUE); + $url = $this->input->post('url', TRUE); - $this->load->view('video/'. $type . '_plugin_view', $data); + $this->_plugin($type, $url); } + + /** + * Video plugin controller + * + * See plugin function for details. If the second parameter is TRUE + * the output is return instead of being displayed (used in preloading). + */ + public function _plugin($type, $url, $return_output=FALSE) + { + if ($type == 'ns-html5') + $data['url'] = 'tribe://' . $url; + else if ($type == 'ns-vlc') + $data['url'] = $url; + + $output = $this->load->view('video/'. $type . '_plugin_view', $data, + $return_output); + + if ($return_output) + return $output; + } + } /* End of file video.php */