/** * Get suggest video */ public function vneMoreAction() { //disable layout $this->_helper->layout()->disableLayout(); //get params $params = $this->_request->getParams(); //Get instance $objArticle = $this->view->objArticle; //New object $objNews = new Thethao_Model_News(); //dataExclude bao gom ID dang xem, tags, video cung chuyen muc $dataExclude = isset($params['exclude']) && !empty($params['exclude']) ? explode(',', $params['exclude']) : array(); $countExclude = count($dataExclude); //get detail video $id = $params['cate_code']; $arrVideoInfo = $objArticle->getArticleFull($id); //khoi tao so luong $count $count = 0; //khoi tao data $arrVideoSuggest $arrVideoSuggest = array(); //get data suggest //get video lien quan if (!empty($arrVideoInfo['list_tag'])) { //New object $obj = new Fpt_Data_News_Tag(); $arrParams = array('tag_id' => array(), 'article_type' => TYPE_VIDEO, 'limit' => LIMIT_SUGGEST_VIDEO + $countExclude, 'offset' => 0); foreach ($arrVideoInfo['list_tag'] as $tag) { $arrParams['tag_id'][] = $tag['tag_id']; } //get list video lien quan $arrVideoResult = $obj->getArticleByArrTag($arrParams); foreach ($arrVideoResult as $value) { $arrVideoSuggest = array_unique(array_merge($arrVideoSuggest, $value['data'])); } //neu co video lien quan if (!empty($arrVideoResult)) { //loai tru tin dang xem $arrVideoSuggest = array_diff($arrVideoSuggest, $dataExclude); //tinh tong so video lien quan $count = count($arrVideoSuggest); } unset($arrVideoResult); } //tong so nho hon so luong can lay //Nếu không đủ 9 video thì lấy thêm video cùng chuyên mục //Loại trừ Video đang xem //Sắp xếp Video mới lên trên if ($count < LIMIT_SUGGEST_VIDEO) { //get instance Cate $objCate = Thethao_Model_Category::getInstance(); //Get cate id $intCateId = $arrVideoInfo['category_id']; $arrCateDetail = $objCate->getMenu(BLOCK_CATE_VIDEO); if (!isset($arrCateDetail['child'][$intCateId])) { $intCateId = BLOCK_CATE_VIDEO; } //Init params $arrParamsVideoRule3 = array('category_id' => $intCateId, 'limit' => LIMIT_SUGGEST_VIDEO + $countExclude, 'offset' => 0); //Get news by rule 3 : folder X + subfolder X => order by publish_time $arrListVideoLasest = $objNews->getListArticleIdsByRule3($arrParamsVideoRule3); //Loai tru video dang xem $arrListVideoLasest = array_diff($arrListVideoLasest['data'], $dataExclude); //merge list video folder vao video lien de lay them cac video moi nhat // cung folder dang xem $arrVideoSuggest = array_merge($arrVideoSuggest, $arrListVideoLasest); //lay dung so luong hien thi $arrVideoSuggest = array_slice(array_unique($arrVideoSuggest), 0, LIMIT_SUGGEST_VIDEO); } else { //lay dung so luong hien thi $arrVideoSuggest = array_slice($arrVideoSuggest, 0, LIMIT_SUGGEST_VIDEO); } //set vao article detail $objArticle->setIdBasic($arrVideoSuggest); //var_dump($arrVideoSuggest);die; //assign to view $this->view->assign(array('arrData' => $arrVideoSuggest)); }