示例#1
0
 public function series_detail($page = "series_detail")
 {
     $pageNum = isset($_GET['p']) ? intval($_GET['p']) : 1;
     $uri = $this->uri->segment(2);
     $seriesId = getIdFromUri($uri);
     $cacheName = "series_detail." . $seriesId . '.p.' . $pageNum;
     $html = $this->getCacheHtml($cacheName);
     if (empty($html)) {
         $series = $this->Series_model->getById($seriesId);
         if ($series) {
             $offset = ($pageNum - 1) * ITEM_PER_PAGE_8;
             $videosOfSeries = $this->Video_model->getRange("series_id=" . $seriesId, $offset, ITEM_PER_PAGE_8, 'episode DESC');
             $data['videosOfSeries'] = $videosOfSeries;
             $total = $this->Video_model->getTotal("series_id=" . $seriesId);
             $newestVideoOfSeries = $this->Video_model->getNewVideoOfSeries($seriesId, 1);
             $data['total'] = $total;
             $data['max'] = ITEM_PER_PAGE_8;
             $data['offset'] = $offset;
             $data['newestVideo'] = isset($newestVideoOfSeries[0]) ? $newestVideoOfSeries[0] : array();
             $this->layout->title("Series " . $series['title']);
             $metaData['page_link'] = rtrim(base_url(), '/') . $_SERVER['REDIRECT_URL'];
             $this->layout->setMeta($metaData);
             $data['series'] = $series;
             $data['videosOfSeries'] = $videosOfSeries;
             $html = $this->layout->view('series/' . $page, $data, true);
             $this->setCacheHtml($cacheName, $html);
         } else {
             $this->layout->view('home/nodata', array());
         }
     }
     if ($html) {
         echo $html;
     }
 }
示例#2
0
 public function video($page = "video")
 {
     //$this->output->cache(15);
     $uri = $this->uri->segment(2);
     $videoId = getIdFromUri($uri);
     $video = $this->Video_model->getByIdFull($videoId);
     $data = array();
     if ($video) {
         $data['video'] = $video;
         $data['server_type'] = $this->_config['server_type'];
         $seriesId = $video['series_id'];
         $series = $this->Series_model->getByIdFull($seriesId);
         $videosOfSeries = $this->Video_model->getRange("series_id=" . $seriesId, 0, 0, 'episode DESC');
         $randomGenreId = $series['genre'] ? array_rand($series['genre']) : 0;
         $suggestSeriesList = $this->Series_model->listSeriesByGenre($randomGenreId, 0, 8, TRUE, $seriesId);
         $data['videoOfSeries'] = $videosOfSeries;
         //echo "<pre>"; print_r($videosOfSeries); die();
         $data['suggestSeriesList'] = $suggestSeriesList;
         $data['randomGenre'] = $randomGenreId ? array('id' => $randomGenreId, 'name' => $series['genre'][$randomGenreId]) : array();
         $this->layout->title($video['title']);
         $metaData['description'] = getVideoDescription($video);
         $metaData['page_link'] = makeLink($video['id'], $video['title'], 'video');
         $metaData['image'] = getThumbnail($series['thumbnail'], 'series');
         $this->layout->setMeta($metaData);
         $this->layout->view('video/' . $page, $data);
     } else {
         $this->layout->view('home/nodata', array());
     }
 }