コード例 #1
0
ファイル: post.php プロジェクト: rongandat/vatfairfoot
 public function displayList()
 {
     $id_lang = $this->context->language->id;
     $id_shop = $this->context->shop->id;
     $limit_per_page = intval($this->conf['list_limit_page']);
     $current_page = isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 1;
     $start = ($current_page - 1) * $limit_per_page;
     $list = VideoCategory::getCategories();
     $listCategories = array();
     if (isset($list) && is_array($list) && count($list)) {
         /** pagination * */
         //            $nb_pages = ceil($nb_articles / $limit_per_page);
         //            $next = $current_page > 1 ? true : false; //articles plus recents
         //            $back = $current_page >= 1 && ($current_page < $nb_pages) ? true : false; //articles precedents
         $i = 0;
         foreach ($list as $cat) {
             $videos = Videos::getVideoByCategory($cat['id_video_cat']);
             $list_video = array();
             foreach ($videos as $key => $val) {
                 $video = $val;
                 $video['average'] = VideosRatting::getAverage($val['id_video']);
                 $list_video[] = $video;
             }
             $cat['videos'] = $list_video;
             $listCategories[] = $cat;
         }
         //            echo '<pre>';
         //            print_r($listCategories);
         //            echo '</pre>';
         $this->context->smarty->assign(array('list_categories' => $listCategories, 'img_video_dir' => _THEME_VIDEO_DIR_, 'customer' => $this->context->customer->id));
     }
     $this->setTemplate('list.tpl');
 }