/**
  * Default action
  */
 public function indexAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     //Set category id for block_cate user in block
     $this->_request->setParam('block_cate', CATE_ID_PHOTO);
     //Get album
     $newsModel = Thethao_Model_News::getInstance();
     $intLimit = LIMIT_PHOTO + 3;
     //format param
     $arrParam = array('category_id' => CATE_ID_PHOTO, 'limit' => $intLimit, 'offset' => 0);
     //get all article by rule 2
     $arrAlbum = $newsModel->getListArticleIdsByRule2($arrParam);
     if (!empty($arrAlbum['data'])) {
         //set id
         $this->view->objArticle->setIdBasic($arrAlbum['data']);
     }
     $arrTop3 = array_splice($arrAlbum['data'], 0, 3);
     //get Instance Block
     $objBlock = Thethao_Plugin_Block::getInstance();
     //set exclude article id from arrHot
     $objBlock->setExclude($arrTop3);
     //set cateid
     $this->_request->setParam('cateid', CATE_ID_PHOTO);
     $intTotalAlbum = $arrAlbum['total'];
     //InitParam Paging
     $arrParamPaging = array('total' => $intTotalAlbum, 'page' => 1, 'perpage' => LIMIT_PHOTO, 'classPagination' => 'pagination_news right');
     // Assign to view
     $this->view->assign(array('arrTop' => $arrTop3, 'arrData' => $arrAlbum['data'], 'intOffset' => $intLimit, 'intTotalAlbum' => $intTotalAlbum, 'arrParamPaging' => $arrParamPaging, 'breakCumbOther' => array(), 'intCategoryId' => CATE_ID_PHOTO, 'paramsBlock' => Zend_Json::encode(array('pagecode' => 'default_photo_index_' . CATE_ID_PHOTO, 'exclude' => implode(',', $objBlock->getExclude()))), 'ogType' => 'website', 'ogTitle' => 'Lưu trữ hình ảnh cầu thủ, trận đấu các giải bóng đá trong nước và thế giới - ảnh thể thao – Golf thể thao', 'ogUrl' => $this->view->configView['url'], 'ogImage' => 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => 'Tin nhanh video clip hình ảnh các môn thể thao: bóng đá quyền anh đua xe bóng chuyền cầu lông… đang diễn ra ở VN & thế giới.'));
     /* END */
     $this->view->headTitle('Lưu trữ hình ảnh cầu thủ, trận đấu các giải bóng đá trong nước và thế giới - ảnh thể thao – Golf thể thao');
     $this->view->headMeta()->setName('description', 'Lưu trữ hình ảnh của các cầu thủ, pha ghi bàn, bàn thắng đẹp, sự kiện các trận đấu của các giải bóng đá trong nước và quốc tế.');
     $this->view->headMeta()->setName('keywords', 'Hinh anh,bong da,the thao');
 }
 /**
  * Get Player Info
  * @param player id, seoname
  * @author dungdv8
  */
 public function cauThuAction()
 {
     //get player id
     $player_id = $this->_request->getParam('id', NULL);
     $arrParam = $this->_request->getParams();
     $player_name = $arrParam[3];
     //get model player
     $playerModel = Thethao_Model_Player::getInstance();
     // detail infomation player
     $modelObject = $this->view->objObject->getPlayer();
     $modelObject->setId($player_id);
     $arrPlayer = $modelObject->getDetailObjectBasic($player_id);
     $seoName = Fpt_Filter::setSeoLink($arrPlayer['name']);
     //get information of player
     // If seo name not match with title in url
     if ($player_name != $seoName) {
         $this->_redirect($this->view->ShareurlWorldcup($arrPlayer['share_url']));
     }
     //danh gia cau thu
     $assessment = $playerModel->getDetailPlayerRatingTerm($player_id);
     $modelNews = $this->view->objArticle;
     //init param get news of playser
     $arrParam = array('object_id' => $player_id, 'object_type' => OBJECT_TYPE_PLAYER, 'limit' => LIMIT_RELATED_PLAYER, 'offset' => 0);
     $objectNews = $modelNews->getObjectNews($arrParam);
     unset($arrParam);
     //set id
     $modelNews->setIdBasic($objectNews['data']);
     //get Instance Block
     $objBlock = Thethao_Plugin_Block::getInstance();
     //set exclude article id from objectNews
     $objBlock->setExclude($objectNews['data']);
     // Award local
     $localAward = $playerModel->getDetailPlayerByID($player_id, 1);
     // Group award local
     $local = $playerModel->groupPlayerAward($localAward);
     // Award international
     $interAward = $playerModel->getDetailPlayerByID($player_id, 2);
     // Group award international
     $inter = $playerModel->groupPlayerAward($interAward);
     //set award's names
     $awardType = array(1 => 'Vô địch', 2 => 'Á quân', 3 => 'Hạng 3');
     // information transfer player
     $infotr = $playerModel->getInformationTransfer($player_id);
     //assign to view
     $this->view->assign(array('arrPlayer' => $arrPlayer, 'assessment' => $assessment, 'newsPlayer' => $objectNews['data'], 'locals' => $local, 'inter' => $inter, 'awardType' => $awardType, 'arrInfotr' => $infotr, 'objArticle' => $modelNews, 'seoName' => $seoName, 'intCategoryId' => WORLD_CUP, 'strCateCode' => $this->_request->getParam('action')));
     //gan meta data
     $titleMeta = 'Thông tin cầu thủ ' . $arrPlayer['name'] . ' World Cup 2014 - VnExpress';
     $keywords = 'World cup 2014, tin tuc , bong da';
     $description = '';
     // Init Menu
     $this->_request->setParam('cateid', WORLD_CUP);
     $this->view->headMeta()->setName('object_id', $player_id);
     $this->view->headTitle($titleMeta);
     $this->view->headMeta()->setName('description', $description);
     $this->view->headMeta()->setName('keywords', $keywords);
 }
Beispiel #3
0
 public function GetBlock($pos = null, $pagecode = false)
 {
     /*if (DEVICE_ENV == 1 && $pagecode == false)
       {
           return '<div id="ajax_block_' . $pos . '"><script type="text/javascript">$(document).ready(function() {if(typeof (partialVne) != \'undefined\'){ partialVne.setBlock(\'' . $pos . '\'); }})</script></div>';
       }
       else
       {*/
     $block = Thethao_Plugin_Block::getInstance();
     return $block->renderBlock($pos, $pagecode);
     //}
 }
 /**
  * Default action
  */
 public function indexAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     //Set category id for block_cate user in block
     $this->_request->setParam('block_cate', CATE_ID_PHOTO);
     //Get album
     $newsModel = Thethao_Model_News::getInstance();
     $intLimit = LIMIT_LIST_PHOTO + 1;
     //format param
     $arrParam = array('category_id' => CATE_ID_PHOTO, 'limit' => $intLimit, 'offset' => 0);
     //get all article by rule 2
     $arrAlbum = $newsModel->getListArticleIdsByRule2($arrParam);
     $arrListExclude = array();
     if (!empty($arrAlbum['data'])) {
         //set id
         $this->view->objArticle->setIdBasic($arrAlbum['data']);
         //get Instance Block
         $objBlock = Thethao_Plugin_Block::getInstance();
         // set exclude article id from arrData
         $objBlock->setExclude($arrAlbum['data']);
         //get Exclude
         $arrListExclude = $objBlock->getExclude();
     }
     $arrTop = array_shift($arrAlbum['data']);
     //get Instance Block
     $objBlock = Thethao_Plugin_Block::getInstance();
     //set exclude article id from arrHot
     $objBlock->setExclude($arrTop);
     //set cateid
     $this->_request->setParam('cateid', CATE_ID_PHOTO);
     $arrAlbum['total'] = $arrAlbum['total'] - 1;
     $intTotalAlbum = $arrAlbum['total'];
     //InitParam Paging
     $arrParamPaging = array('total' => $intTotalAlbum, 'page' => 1, 'perpage' => LIMIT_LIST_PHOTO, 'classPagination' => 'pagination_news right');
     //gan meta data
     $titleMeta = 'Hình ảnh World Cup 2014 - VnExpress';
     $keywords = 'World cup 2014, tin tuc , bong da';
     $description = 'Fifa World Cup 2014 - tin nhanh , hình ảnh , video clip bóng đá, lịch thi đấu WC 2014 tại Brazil, tường thuật bình luận bóng đá World Cup 2014';
     // Assign to view
     $this->view->assign(array('arrTop' => $arrTop, 'arrData' => $arrAlbum['data'], 'intOffset' => $intLimit, 'intTotalAlbum' => $intTotalAlbum, 'arrParamPaging' => $arrParamPaging, 'breakCumbOther' => array(), 'intCategoryId' => CATE_ID_PHOTO, 'arrListExclude' => $arrListExclude, 'ogType' => 'website', 'ogTitle' => $titleMeta, 'ogUrl' => $this->view->configView['url'] . '/photo', 'ogImage' => 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => 'Fifa World Cup 2014 - tin nhanh , hình ảnh , video clip bóng đá, lịch thi đấu WC 2014 tại Brazil, tường thuật bình luận bóng đá World Cup 2014'));
     /* END */
     //init cate for set menu
     //set cate active
     $this->_request->setParam('cateActiveId', CATE_ID_PHOTO);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', WORLD_CUP);
     $this->view->headTitle($titleMeta);
     $this->view->headMeta()->setName('description', $description);
     $this->view->headMeta()->setName('keywords', $keywords);
     //$this->view->headScript()->appendFile($this->view->config['js'] . '/wordcup.js');
 }
 /**
  * @todo - Worldcup home page
  * @author PhongTX
  */
 public function indexAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     // Get block cate
     $intCateId = $this->_request->getParam('cateid', SEA_GAMES);
     //get Instance New
     $objNews = Thethao_Model_News::getInstance();
     //get Instance Block
     $objBlock = Thethao_Plugin_Block::getInstance();
     //get Instance News
     $objArticle = $this->view->objArticle;
     $arrHotNews = $arrListExclude = array();
     //get 1 tin build top for seagame
     $arrParams = array('area' => array(array('category_id' => SITE_ID, 'showed_area' => 'seagames')), 'offset' => 0, 'limit' => 1);
     //get Box Hot News
     $arrHotNews = $objArticle->getTopHotArticleByArr($arrParams);
     //khoi tao arrHotExclude
     $arrHotExclude = $arrListExclude = array();
     if (!empty($arrHotNews)) {
         //each data $arrHotNews
         foreach ($arrHotNews[0] as $key => $rows) {
             //check $arrHotNews is article
             if ($rows['article_id'] > 0) {
                 //set article Hot to Exclude
                 $arrHotExclude[] = $rows['article_id'];
             }
         }
     }
     //get 5 tin with rule 3 of cate seagames
     $paramTopNews = array('category_id' => SEA_GAMES, 'offset' => 0, 'limit' => LIMIT_TOP_NEWS + 1);
     $arrDataRule3 = $objNews->getListArticleIdsByRule3($paramTopNews);
     //check and remove hot news in top news
     $arrTopNews = array_slice(array_diff($arrDataRule3['data'], $arrHotExclude), 0, LIMIT_TOP_NEWS);
     $arrDataExclude = array_merge($arrHotExclude, $arrTopNews);
     //set exclude
     $objBlock->setExclude($arrDataExclude);
     //set obj get Article
     $objArticle->setIdBasic($arrDataExclude);
     //get video with rule 1
     $arrParamVideo = array('category_id' => CATE_SEA_GAMES_VIDEO, 'article_type' => TYPE_VIDEO, 'limit' => LIMIT_VIDEO + LIMIT_TOP_NEWS + 1, 'offset' => 0, 'withcore' => FALSE);
     //category_id, article_type, limit, offset, withcore
     //get list video with rule 1
     $arrTmp = $objNews->getListArticleIdsByRule1($arrParamVideo);
     $arrListVideo = array_slice(array_diff($arrTmp['data'], $arrDataExclude), 0, LIMIT_VIDEO);
     // set id from $arrListPaging to get article
     $objArticle->setIdBasic($arrListVideo);
     //get photo seagame with rule 1
     $arrParamPhoto = array('category_id' => CATE_SEA_GAMES_ANH, 'limit' => LIMIT_PHOTO + LIMIT_TOP_NEWS + 1, 'offset' => 0, 'article_type' => TYPE_PHOTO);
     //get list video with rule 1
     $arrTmp = $objNews->getListArticleIdsByRule1($arrParamPhoto);
     $arrListPhoto = array_slice(array_diff($arrTmp['data'], $arrDataExclude), 0, LIMIT_PHOTO);
     // set id from $arrListPaging to get article
     $objArticle->setIdBasic($arrListPhoto);
     //init list cate to get rule 1
     $arrListCate = array(CATE_SEA_GAMES_BONGDA => 3, CATE_SEA_GAMES_CACMONKHAC => 3, CATE_SEA_GAMES_BENLE => 4, CATE_SEA_GAMES_BINHLUAN => 4);
     $arrParamOther = array('category_id' => 0, 'limit' => LIMIT_TOP_NEWS + 1, 'offset' => 0);
     $arrListOther = array();
     foreach ($arrListCate as $cateId => $limit) {
         //init param to get data
         $arrParamOther['category_id'] = $cateId;
         $arrParamOther['limit'] = $arrParamOther['limit'] + $limit;
         $arrTmp = $objNews->getListArticleIdsByRule1($arrParamOther);
         $arrListOther[$cateId] = array_slice(array_diff($arrTmp['data'], $arrDataExclude), 0, $limit);
         // set id from $arrListPaging to get article
         $objArticle->setIdBasic($arrListOther[$cateId]);
     }
     //set block cate and cate active
     $this->_request->setParam('block_cate', $intCateId);
     //init cate for set menu
     //set cate active
     $this->_request->setParam('cateActiveId', $intCateId);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', SEA_GAMES);
     //Assign to view
     $this->view->assign(array('intCategoryId' => SEA_GAMES, 'arrHotNews' => $arrHotNews[0], 'arrTopNews' => $arrTopNews, 'arrListVideo' => $arrListVideo, 'arrListPhoto' => $arrListPhoto, 'arrOtherNews' => $arrListOther, 'offsetMore' => LIMIT_LIST, 'arrListExclude' => $arrDataExclude, 'isHome' => 1, 'ogType' => 'website', 'ogTitle' => 'SEA Games 28, tin tức, video, lịch thi đấu SEA Games - VnExpress', 'ogUrl' => $this->view->configView['url'], 'ogImage' => 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => 'SEA Games 28 - tin nhanh , hình ảnh , video clip bóng đá, lịch thi đấu SEA Games 28 tại Singapore, tường thuật bình luận bóng đá SEA Games 28.'));
     // Set metadata tags
     $this->view->headTitle()->prepend('SEA Games 28, tin tức, video, lịch thi đấu SEA Games - VnExpress');
     $this->view->headMeta()->setName('description', 'SEA Games 28 - tin nhanh , hình ảnh , video clip bóng đá, lịch thi đấu SEA Games 28 tại Singapore, tường thuật bình luận bóng đá SEA Games 28.')->setName('keywords', 'SEA Games 28, tin tuc , bong da');
 }
 public function GetBlockOther($pos = null, $pagecode = false)
 {
     $block = Thethao_Plugin_Block::getInstance();
     return $block->renderBlock($pos, $pagecode);
 }
 /**
  * cate folder page
  * @author HungNT1
  */
 public function indexAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     //get instance Cate
     $objCate = Thethao_Model_Category::getInstance();
     //get cate id by cate code
     $intCateId = $objCate->getIdByCode($this->_request->getParam('cate_code', SITE_ID));
     //get page of cate
     $intPage = $this->_request->getParam('page', 1);
     //check cate id is not exists
     if ($intCateId < 1) {
         $this->_redirect("/");
     }
     // Get Category detail
     $cateDetail = $objCate->getDetailByCateId($intCateId);
     //str link
     $strLink = $this->_request->getPathInfo();
     if (strpos(rtrim($strLink, '/'), $cateDetail['link']) === FALSE) {
         $this->_redirect($this->view->configView['url'] . $cateDetail['link'], array('code' => 301));
     }
     //init param to get list data with rule 2
     $arrParamNews = array('category_id' => $intCateId, 'article_type' => NULL, 'limit' => LIMIT_LIST, 'offset' => ($intPage - 1) * LIMIT_LIST);
     //init model news
     $objNews = Thethao_Model_News::getInstance();
     //get list article with rule 2 list on Thethao
     $arrListData = $objNews->getListArticleIdsByRule2($arrParamNews);
     $arrArticleExclude = array();
     $arrHotNews = array();
     //get Instance Block
     $objBlock = Thethao_Plugin_Block::getInstance();
     if (1 == $intPage && !empty($arrListData['data'])) {
         //check bai thuong mai, chi so sanh o trang 1 ma thoi
         $zoneID = Thethao_Global::getZoneByCateId($intCateId);
         if ($zoneID != 0) {
             $modelBlock = Fpt_Data_News_Block::getInstance();
             $modelBlock->setZoneId($zoneID);
             $arrListData['data'] = $modelBlock->getNewsByZone($zoneID, $arrListData['data']);
         }
         $arrArticleExclude = $arrListData['data'];
         // set exclude article id from arrData
         $objBlock->setExclude($arrListData['data']);
         $arrHotNews = array_slice($arrListData['data'], 0, LIMIT_TOP);
         $arrListData['data'] = array_diff($arrListData['data'], $arrHotNews);
         // set id from $arrListPaging to get article
         $this->view->objArticle->setIdBasic($arrHotNews);
     }
     // set id from $arrListPaging to get article
     $this->view->objArticle->setIdBasic($arrListData['data']);
     //check if page > max page then return to max page
     if ($arrListData['total'] > 0) {
         $maxPage = ceil($arrListData['total'] / LIMIT_LIST);
         if ($intPage > $maxPage) {
             $this->_redirect($this->configView['url'] . $cateDetail['link'] . '/page/' . $maxPage . '.html');
         }
     }
     //InitParam Paging
     $arrParamPaging = array('total' => $arrListData['total'], 'page' => $intPage, 'url' => $this->view->configView['url'] . $cateDetail['link'] . '/page', 'perpage' => LIMIT_LIST, 'classPagination' => 'pagination_news right', 'extEnd' => '.html', 'separate' => '/');
     //Set param
     $this->_request->setParam('block_cate', $intCateId);
     //Param calendar
     $parserParent = SITE_ID;
     $parserChild = $intCateId;
     $parserChildRecursive = 0;
     if (!empty($cateDetail['full_parent']) && DEVICE_ENV != 1) {
         $nParser = count($cateDetail['full_parent']);
         switch ($nParser) {
             case 1:
                 $parserChild = $cateDetail['full_parent'][0];
                 $parserChildRecursive = $intCateId;
                 break;
             case 2:
             default:
                 $parserChild = $cateDetail['full_parent'][0];
                 $parserChildRecursive = $cateDetail['full_parent'][1];
                 break;
         }
         //end switch
     }
     //end if
     //gan meta data
     $titleMenta = $keywords = $cateDetail['catename'] . ' - VnExpress Thể Thao';
     $description = $cateDetail['catename'] . ' - VnExpress Thể Thao';
     switch ($intCateId) {
         case CATE_ID_BONGDA:
             $titleMenta = 'Lưu trữ tin tức bóng đá thể thao – Bóng đá thể thao';
             $description = 'Lưu trữ tin tức hình ảnh các ngôi sao thể thao,bóng đá,hậu trường thể thao';
             $keywords = 'Bong da,the thao,tin tuc bong đá, bóng đá 24h';
             break;
         case CATE_ID_BONGDATRONGNUOC:
             $titleMenta = 'Tin tức, bình luận, Tin tức thể thao trong nước mới nhất, V-League, VFF – Bóng đá trong nước';
             $description = 'Thông tin mới nhất về THỂ THAO TRONG NƯỚC, Liên đoàn Bóng Đá Việt Nam, các giải đấu, lịch thi đấu V League, VFF, ĐTQG, Cúp Quốc Gia, Giải Hạng Nhất, U19, U23';
             $keywords = 'Tin tức, bong da, bóng đá việt nam,V-League, VFF bóng đá trong nước';
             break;
         case CATE_ID_NGOAIHANGANH:
             $titleMenta = 'Tin tức, bình luận, video, lịch thi đấu bóng đá giải - Ngoại hạng Anh';
             $description = 'Ngoại hạng Anh - Tin tức giải Premier League , Video bàn thắng, bảng xếp hạng, lịch thi đấu Ngoại hạng Anh, liên tục trên thể thao vnexpress';
             $keywords = 'Giải ngoại hạng Anh , ngoai hang anh , bong da ngoai hang anh , bong da anh , tin bong da , bong da quoc te , bao bong da';
             break;
         case CATE_ID_BEHINDS_SCENES:
             $titleMenta = 'Lưu trữ tin tức hậu trường thể thao';
             $description = 'Lưu trữ tin tức hình ảnh các ngôi sao thể thao,bóng đá,hậu trường thể thao';
             $keywords = 'Hau truong,the thao,bong da';
             break;
         case CATE_ID_CACMONKHAC:
             $titleMenta = 'Tin nhanh,hình ảnh,video kết quả thi đấu các môn thể thao khác';
             $description = 'Tin tức,hình ảnh,video các môn thể thao khác';
             $keywords = 'Bong da,the thao,tin tuc';
             break;
         case CATE_ID_TENNIS:
             $titleMenta = 'Tin tức quần vợt, tennis, lịch thi đấu, video trực tuyến - Tennis';
             $description = 'Cập nhật nhanh tin tức Quần vợt mới nhất hôm nay. Xem kết quả, lịch thi đấu, video clip thể thao Tennis trực tuyến Online tại Việt Nam & Thế giới.';
             $keywords = 'tennis 24h, quan vot, tennis truc tuyen , tennis online, tin tuc tennis, lich thi dau tennis';
             break;
         case CATE_ID_RACING:
             $titleMenta = 'Đua xe - Thể thao VnExpress';
             $description = 'Cập nhật nhanh tin tức, video các giải đua xe trong và ngoài nước.';
             $keywords = 'Đua xe, tay dua, cong thuc 1 , du axe F1';
             break;
         case CATE_ID_AFFCUP:
             $titleMenta = 'Aff Cup 2012 - Tin tức, hình ảnh ,video mới nhất về AFF Cup 2012 - VnExpress';
             $description = 'Cập nhật liên tục tin tức mới nhất về giải bóng đá Đông Nam Á - AFF cup 2012 tổ chức tại Malaysia và Thái Lan';
             $keywords = 'aff cup 2012,bong da,the thao';
             break;
         case CATE_ID_CHESS:
             $titleMenta = 'Cờ Vua: Lịch thi đấu, giải thi đấu cờ vua - VnExpress Thể Thao';
             $description = 'Tin tức nhanh về thông tin các giải thi đấu cờ vua Quốc tế, giải thi đấu tại Việt Nam cùng các cờ thủ xuất sắc nhất';
             $keywords = 'Tin tức nhanh về thông tin các giải thi đấu cờ vua Quốc tế, giải thi đấu tại Việt Nam cùng các cờ thủ xuất sắc nhất';
             break;
         case CATE_ID_GOLF:
             $titleMenta = 'Tin Golf Việt Nam: Giải đấu và lịch thi đấu môn đánh Golf – Golf thể thao';
             $description = 'Tin tức, video đánh giá bình luận về Golf, nhận xét các giải đấu trong nước, quốc tế cùng hướng dẫn các kỹ năng chơi Golf dành cho giới kinh doanh, Golf thủ Việt Nam..';
             $keywords = 'Golf thủ, tay golf,tin tức golf, giải golf, Presidents Cup, FLC Golf Championship 2015';
             break;
         default:
             $titleMenta = 'Tin tức, bình luận, video, lịch thi đấu bóng đá giải - ' . $cateDetail['catename'];
             $description = 'Tin nhanh,tin tức với hình ảnh,Video clip,bình luận về các giải bóng đá: ' . $cateDetail['catename'];
             $keywords = 'Tin tức, bong da, the gioi';
     }
     //Assign to view
     $this->view->assign(array('intCategoryId' => $intCateId, 'arrHotNews' => $arrHotNews, 'arrParamPaging' => $arrParamPaging, 'arrData' => $arrListData['data'], 'parserParent' => $parserParent, 'parserChild' => $parserChild, 'parserChildRecursive' => $parserChildRecursive, 'arrArticleExclude' => $arrArticleExclude, 'paramsBlock' => Zend_Json::encode(array('pagecode' => 'default_category_index_' . $intCateId, 'exclude' => implode(',', $objBlock->getExclude()))), 'ogType' => 'website', 'ogTitle' => $titleMenta, 'ogUrl' => $this->view->configView['url'] . $cateDetail['link'], 'ogImage' => 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => $description));
     //init cate for set menu
     $idCateMenu = $cateDetail['parent_id'] == SITE_ID ? $intCateId : $cateDetail['parent_id'];
     //set cate active
     $this->_request->setParam('cateActiveId', $intCateId);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', $idCateMenu);
     // Set metadata tags
     $this->view->headTitle()->prepend($titleMenta);
     $this->view->headMeta()->setName('description', $description)->setName('keywords', $keywords);
     if (DEVICE_ENV != 1) {
         //ad js
         $this->view->headScript()->appendFile($this->view->configView['vnecdn']['js'] . '/utils/calendar/calendar.js');
     } else {
         //Set no render view
         $this->_helper->viewRenderer->setNoRender(true);
         echo $this->view->render('mobile/index.phtml');
     }
 }
 public function blockAction()
 {
     $this->_helper->layout->disableLayout(true);
     $this->_helper->viewRenderer->setNoRender(true);
     $this->_request->setParam('cache_file', 1);
     $arrParams = $this->_request->getParams();
     $arrParams['pagecode'] = trim(strip_tags($arrParams['pagecode']));
     $arrParams['exclude'] = trim(strip_tags($arrParams['exclude']));
     $exclude = explode(',', $arrParams['exclude']);
     $objBlock = Thethao_Plugin_Block::getInstance();
     $objBlock->setExclude($exclude);
     $html = array();
     if (isset($arrParams['part']) && !empty($arrParams['part'])) {
         if (!empty($arrParams['pagecode'])) {
             foreach ($arrParams['part'] as $position) {
                 $html[$position] = $this->view->GetBlock($position, $arrParams['pagecode']);
             }
         }
     }
     echo Zend_Json::encode($html);
 }
 /**
  * tong thuat football match
  * @return void
  */
 public function tongThuatAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     //get article detail to check link then redirect of false
     $intArticleId = (int) $this->_request->getParam('id');
     $viewApp = $this->_request->getParam('view', '');
     //get detail article
     $arrArticleDetail = $this->view->objArticle->getArticleFull($intArticleId);
     //check link info
     $strLink = $this->_request->getParam(2) . '-' . $intArticleId . '.html';
     if (strpos($arrArticleDetail['share_url'], rtrim($strLink, '/')) === FALSE) {
         $strLink = preg_replace('#/tin-tuc/sea-games/#', '/tong-thuat/', $arrArticleDetail['share_url']);
         $strLink = $strLink . ($viewApp == 'app' ? '?view=app' : '');
         $this->_redirect($strLink, array('code' => 301));
     }
     //get all block of the article
     //init model live data
     $objLive = Fpt_Data_News_Live::getInstance();
     //init param to get block
     $arrParamBlock = array('article_id' => $intArticleId, 'order' => 0, 'from_time' => NULL);
     $arrBlockDataId = $objLive->getListBlockByArticleId($arrParamBlock);
     //set block id if not null
     if (!empty($arrBlockDataId['data'])) {
         $objLive->setBlockId($arrBlockDataId['data']);
     }
     //end get all block of the article
     //check and get tong thuat if have
     $isReview = false;
     $arrDataExtend = $this->view->objArticle->getDetailPageExtend($intArticleId, 2);
     if (!empty($arrDataExtend) && !empty($arrDataExtend['content'])) {
         unset($arrDataExtend['creation_time'], $arrDataExtend['publish_time_format'], $arrDataExtend['publish_time']);
         //merge page extend to data detail
         $arrArticleDetail['content_review'] = $arrDataExtend['content'];
         $isReview = true;
     }
     //get Instance Block
     $objBlock = Thethao_Plugin_Block::getInstance();
     //set exclude for detail
     $objBlock->setExclude(array($intArticleId));
     //replace image size for mobile
     if (DEVICE_ENV == 1) {
         $content = $arrArticleDetail['content_review'];
         $content = preg_replace('/src="(.[^>]*)_500x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $content = preg_replace('/src="(.[^>]*).(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $content = preg_replace('/src="(.[^>]*)_m_460x0_m_460x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $arrArticleDetail['content_review'] = $content;
     }
     //Trim data
     $arrArticleDetail['title'] = trim($arrArticleDetail['title']);
     $arrArticleDetail['title_format'] = trim($arrArticleDetail['title_format']);
     $arrArticleDetail['lead'] = trim($arrArticleDetail['lead']);
     // Assign to view
     $this->view->assign(array('arrArticleDetail' => $arrArticleDetail, 'intCategoryId' => $arrArticleDetail['category_id'], 'intArticleId' => $intArticleId, 'isArticleHotVnE' => $arrArticleDetail['privacy'] & 512, 'timeUpdate' => $arrBlockDataId['time'], 'strLinkTuongThuat' => '/tuong-thuat/' . $strLink . (empty($viewApp) ? '' : '?view=app'), 'ogType' => 'website', 'ogTitle' => $arrArticleDetail['title_format'] . ' - VnExpress SEA Games', 'ogUrl' => preg_replace('#/tin-tuc/sea-games/#', '/tong-thuat/', $arrArticleDetail['share_url']), 'ogImage' => !empty($arrArticleDetail['thumbnail_url']) ? $this->view->ImageurlArticle($arrArticleDetail, 'size2') : 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8')))));
     // SEO
     $arrKeyword = array();
     $arrArticleDetail['title'] = html_entity_decode($arrArticleDetail['title'], ENT_QUOTES, 'UTF-8');
     $this->view->headTitle($arrArticleDetail['title'] . ' - VnExpress SEA Games');
     $this->view->headMeta()->setName('description', trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8'))))->setName('keywords', join(',', $arrKeyword));
     //check view app
     if (!empty($viewApp) && $viewApp == 'app') {
         //Disable layout
         $this->_helper->layout->disableLayout(true);
         echo $this->view->render('detail/app-tong-thuat.phtml');
         exit;
     }
     //Set category id for block_cate user in block & menu breakumb
     $this->_request->setParam('block_cate', $arrArticleDetail['category_id']);
     //set cate active
     $this->_request->setParam('cateActiveId', $arrArticleDetail['category_id']);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', SEA_GAMES);
 }
 /**
  * Action article Live
  */
 public function liveAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     //get article detail to check link then redirect of false
     $intArticleId = (int) $this->_request->getParam('id');
     $viewApp = $this->_request->getParam('view', '');
     //get detail article
     $arrArticleDetail = $this->view->objArticle->getArticleFull($intArticleId);
     //str link
     $strLink = $this->_request->getPathInfo();
     if (strpos($arrArticleDetail['share_url'], rtrim($strLink, '/')) === FALSE) {
         //$this->_redirect($arrArticleDetail['share_url'], array('code' => 301));
     }
     //get all block of the article
     //init model live data
     $objLive = Fpt_Data_News_Live::getInstance();
     //init param to get block
     $arrParamBlock = array('article_id' => $intArticleId, 'order' => 0, 'from_time' => NULL);
     $arrBlockDataId = $objLive->getListBlockByArticleId($arrParamBlock);
     //set block id if not null
     if (!empty($arrBlockDataId['data'])) {
         $objLive->setBlockId($arrBlockDataId['data']);
     }
     //end get all block of the article
     //Set category id for block_cate user in block & menu breakumb
     $this->_request->setParam('block_cate', $arrArticleDetail['category_id']);
     //get Instance Block
     $objBlock = Thethao_Plugin_Block::getInstance();
     //set exclude for detail
     $objBlock->setExclude(array($intArticleId));
     //replace image size for mobile
     if (DEVICE_ENV == 1) {
         $content = $arrArticleDetail['content'];
         $content = preg_replace('/src="(.[^>]*)_500x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $content = preg_replace('/src="(.[^>]*).(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $content = preg_replace('/src="(.[^>]*)_m_460x0_m_460x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $arrArticleDetail['content'] = $content;
     }
     //Trim data
     $arrArticleDetail['title'] = trim($arrArticleDetail['title']);
     $arrArticleDetail['title_format'] = trim($arrArticleDetail['title_format']);
     $arrArticleDetail['lead'] = trim($arrArticleDetail['lead']);
     $arrArticleDetail['share_url'] = $this->view->ShareurlWorldcup($arrArticleDetail['share_url']);
     // Assign to view
     $this->view->assign(array('arrBlockDataId' => $arrBlockDataId['data'], 'objLive' => $objLive, 'isArticleHotVnE' => $arrArticleDetail['privacy'] & 512, 'arrArticleDetail' => $arrArticleDetail, 'intCategoryId' => $arrArticleDetail['category_id'], 'intArticleId' => $intArticleId, 'timeUpdate' => $arrBlockDataId['time'], 'intCateIdPolyAds' => $arrArticleDetail['category_id'], 'articleTrackingId' => $intArticleId, 'ogType' => 'website', 'ogTitle' => $arrArticleDetail['title_format'] . ' - VnExpress World Cup', 'ogUrl' => $arrArticleDetail['share_url'], 'ogImage' => !empty($arrArticleDetail['thumbnail_url']) ? $this->view->ImageurlArticle($arrArticleDetail, 'size2') : 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8')))));
     //set cate active
     $this->_request->setParam('cateActiveId', $arrArticleDetail['category_id']);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', WORLD_CUP);
     //add js
     $this->view->headScript()->appendFile($this->view->configView['vnecdn']['js'] . '/require.min.js');
     // SEO
     $arrKeyword = array();
     $arrArticleDetail['title'] = html_entity_decode($arrArticleDetail['title'], ENT_QUOTES, 'UTF-8');
     $this->view->headTitle($arrArticleDetail['title'] . ' - VnExpress Thể Thao');
     $this->view->headMeta()->setName('description', trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8'))))->setName('keywords', join(',', $arrKeyword));
     //check view app
     if (!empty($viewApp) && $viewApp == 'app') {
         //Disable layout
         $this->_helper->layout->disableLayout(true);
         echo $this->view->render('detail/applive.phtml');
         exit;
     }
 }
 /**
  * tong thuat football match
  * @return void
  */
 public function tongThuatAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     //get article detail to check link then redirect of false
     $intArticleId = (int) $this->_request->getParam('id');
     $viewApp = $this->_request->getParam('view', '');
     //get detail article
     $arrArticleDetail = $this->view->objArticle->getArticleFull($intArticleId);
     //get topic of article detail
     //set topic show style
     $topic_show_style = 1;
     //init topic default
     $arrTopic = array();
     $arrTopicDetail = array();
     if (!empty($arrArticleDetail['list_topic_id'])) {
         //init model topic
         $modelTopic = new Fpt_Data_News_Topic();
         // init topic params
         $arrTopicParams = array('site_id' => 1000000, 'topic_id' => $arrArticleDetail['list_topic_id'], 'limit' => LIMIT_TOPIC_DETAIL + 1, 'offset' => 0, 'withscore' => true, 'article_type' => NULL);
         // get list article by topic
         $arrTopic = $modelTopic->getTopicNewsByScore($arrTopicParams);
         // check array topic data
         if (!empty($arrTopic)) {
             $score = 0;
             $temp_topic_id = 0;
             foreach ($arrArticleDetail['list_topic_id'] as $index => $topic_id) {
                 if (isset($arrTopic[$topic_id]['data'][$intArticleId])) {
                     unset($arrTopic[$topic_id]['data'][$intArticleId]);
                 }
                 if (empty($arrTopic[$topic_id]['data'])) {
                     unset($arrArticleDetail['list_topic_id'][$index]);
                     continue;
                 }
                 // get first article to compare
                 $firstCore = current($arrTopic[$topic_id]['data']);
                 if ($firstCore > $score) {
                     $temp_topic_id = $topic_id;
                     $score = $firstCore;
                 }
             }
             // get detail of topic id list
             $arrTopicDetail = $modelTopic->getDetailTopicByArrId(array($temp_topic_id));
             //shift data
             $arrShift = isset($arrArticleDetail['list_topic_full'][$temp_topic_id]) ? $arrArticleDetail['list_topic_full'][$temp_topic_id] : array_shift($arrArticleDetail['list_topic_full']);
             //set topic style topic
             $topic_show_style = $arrShift['show_style'] != 2 ? 1 : $arrShift['show_style'];
             //array slice list article
             $arrTopic = array_slice(array_keys($arrTopic[$temp_topic_id]['data']), 0, $topic_show_style == 1 ? LIMIT_TOPIC_DETAIL_STYLE_1 : LIMIT_TOPIC_DETAIL_STYLE_2);
             //set id basic
             $this->view->objArticle->setIdBasic($arrTopic);
         }
     }
     //end get topic of article detail
     //check link info
     $strLink = $this->_request->getParam(2) . '-' . $intArticleId . '.html';
     if (strpos($arrArticleDetail['share_url'], rtrim($strLink, '/')) === FALSE) {
         $strLink = preg_replace('#/tin-tuc/tuong-thuat/#', '/tong-thuat/', $arrArticleDetail['share_url']);
         $strLink = $strLink . (in_array($viewApp, array('app', 'app_sport_live')) ? '?view=' . $viewApp : '');
         $this->_redirect($strLink, array('code' => 301));
     }
     //get all block of the article
     //init model live data
     $objLive = Fpt_Data_News_Live::getInstance();
     //init param to get block
     $arrParamBlock = array('article_id' => $intArticleId, 'order' => 0, 'from_time' => NULL);
     $arrBlockDataId = $objLive->getListBlockByArticleId($arrParamBlock);
     //set block id if not null
     if (!empty($arrBlockDataId['data'])) {
         $objLive->setBlockId($arrBlockDataId['data']);
     }
     //end get all block of the article
     //check and get tong thuat if have
     $isReview = false;
     $arrDataExtend = $this->view->objArticle->getDetailPageExtend($intArticleId, 2);
     if (!empty($arrDataExtend) && !empty($arrDataExtend['content'])) {
         unset($arrDataExtend['creation_time'], $arrDataExtend['publish_time_format'], $arrDataExtend['publish_time']);
         //merge page extend to data detail
         $arrArticleDetail['content_review'] = $arrDataExtend['content'];
         $isReview = true;
     }
     //Set category id for block_cate user in block & menu breakumb
     $this->_request->setParam('block_cate', $arrArticleDetail['category_id']);
     //set cate active
     $this->_request->setParam('cateActiveId', $arrArticleDetail['category_id']);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', $arrArticleDetail['category_id']);
     //get Instance Block
     $objBlock = Thethao_Plugin_Block::getInstance();
     //set exclude for detail
     $objBlock->setExclude(array($intArticleId));
     //replace image size for mobile
     if (DEVICE_ENV == 1) {
         $content = $arrArticleDetail['content_review'];
         $content = preg_replace('/src="(.[^>]*)_500x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $content = preg_replace('/src="(.[^>]*).(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $content = preg_replace('/src="(.[^>]*)_m_460x0_m_460x0.(jpg|gif|png|jpeg)"/', 'src="$1_m_460x0.$2"', $content);
         $arrArticleDetail['content_review'] = $content;
     }
     //Trim data
     $arrArticleDetail['title'] = trim($arrArticleDetail['title']);
     $arrArticleDetail['title_format'] = trim($arrArticleDetail['title_format']);
     $arrArticleDetail['lead'] = trim($arrArticleDetail['lead']);
     // Assign to view
     $this->view->assign(array('arrArticleDetail' => $arrArticleDetail, 'intCategoryId' => $arrArticleDetail['category_id'], 'intArticleId' => $intArticleId, 'isArticleHotVnE' => $arrArticleDetail['privacy'] & 512, 'timeUpdate' => $arrBlockDataId['time'], 'arrTopic' => $arrTopic, 'arrTopicDetail' => $arrTopicDetail[$temp_topic_id], 'topic_show_style' => $topic_show_style, 'strLinkTuongThuat' => '/tuong-thuat/' . $strLink . (in_array($viewApp, array('app', 'app_sport_live')) ? '?view=' . $viewApp : ''), 'ogType' => 'website', 'ogTitle' => $arrArticleDetail['title_format'] . ' - VnExpress Thể Thao', 'ogUrl' => preg_replace('#/tin-tuc/tuong-thuat/#', '/tong-thuat/', $arrArticleDetail['share_url']), 'ogImage' => !empty($arrArticleDetail['thumbnail_url']) ? $this->view->ImageurlArticle($arrArticleDetail, 'size2') : 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8')))));
     // SEO
     $arrKeyword = array();
     $arrArticleDetail['title'] = html_entity_decode($arrArticleDetail['title'], ENT_QUOTES, 'UTF-8');
     $this->view->headTitle($arrArticleDetail['title'] . ' - VnExpress Thể Thao');
     $this->view->headMeta()->setName('description', trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8'))))->setName('keywords', join(',', $arrKeyword));
     //check view app
     if (!empty($viewApp) && in_array($viewApp, array('app', 'app_sport_live'))) {
         $this->view->assign(array('viewApp' => $viewApp));
         //Disable layout
         $this->_helper->layout->disableLayout(true);
         echo $this->view->render('detail/app-tong-thuat.phtml');
         exit;
     }
 }
 /**
  * Get suggest video
  */
 function vneMoreAction()
 {
     $this->_helper->layout()->disableLayout();
     //Get video id
     $intVideoID = (int) $this->getRequest()->getParam('id', 0);
     $exclude = $this->getRequest()->getParam('exclude', '');
     //dataExclude bao gom ID dang xem va 2 video lien quan
     $dataExclude = isset($exclude) && !empty($exclude) ? explode(',', $exclude) : array();
     $countExclude = count($dataExclude);
     $arrArticle = array();
     if ($intVideoID > 0) {
         //Get model isntance
         $newsModel = Thethao_Model_News::getInstance();
         $modelTag = new Fpt_Data_News_Tag();
         $arrVideoInfo = $this->view->objArticle->getArticleFull($intVideoID);
         $cateID = $intVideoID > 0 && !empty($arrVideoInfo) ? $arrVideoInfo["category_id"] : CATE_ID_VIDEO;
         //get video lien quan
         if (!empty($arrVideoInfo['list_tag_id'])) {
             $arrParams = array('tag_id' => $arrVideoInfo['list_tag_id'], 'article_type' => VIDEO, 'limit' => LIMIT_VIDEO_MORE + $countExclude, 'offset' => 0);
             //get list article by tag
             $arrArticle = $modelTag->getArticleUnionTag($arrParams);
         }
         //excluse video dang xem va 2 video lien quan
         $arrArticle = array_diff($arrArticle, $dataExclude);
         //toltal media
         $totalMedia = count($arrArticle);
         //if total media < 9 then get new video
         if ($totalMedia < LIMIT_VIDEO_MORE) {
             $limit_more = LIMIT_VIDEO_MORE - $totalMedia + $countExclude;
             //( $limitTopHot là total top & hot video)
             $arrParams = array('category_id' => $cateID, 'limit' => $limit_more, 'offset' => 0, 'article_type' => VIDEO);
             //get list articleid new
             $arrNewVideo = $newsModel->getListArticleIdsByRule2($arrParams);
             if (!empty($arrNewVideo["data"])) {
                 //merge media & new video
                 $arrArticle = array_merge($arrArticle, $arrNewVideo["data"]);
             }
         }
         //lay dung so luong hien thi
         $arrArticle = array_slice($arrArticle, 0, LIMIT_VIDEO_MORE);
         if (is_array($arrArticle) && count($arrArticle) > 0) {
             $this->view->objArticle->setIdBasic($arrArticle);
             //get Instance Block
             $objBlock = Thethao_Plugin_Block::getInstance();
             //set excluses
             $objBlock->setExclude($arrArticle);
             $arrArticleResult = array();
             foreach ($arrArticle as $intArticleID) {
                 $arrParams = array('article_id' => $intArticleID, 'limit' => 1, 'offset' => 0);
                 $arrMedia = $this->view->objArticle->getObjectReferenceByArticleId($arrParams);
                 $duration = 0;
                 if (!empty($arrMedia)) {
                     $arrMedia = current($arrMedia);
                     if ($arrMetaData = Zend_Json::decode($arrMedia['meta_data'])) {
                         $duration = (int) $arrMetaData['duration'];
                     }
                 }
                 $arrArticleDetail = $this->view->objArticle->getArticleBasic($intArticleID);
                 $arrArticleDetail['duration'] = $duration;
                 $arrArticleResult[] = $arrArticleDetail;
             }
         }
         $this->view->arrData = $arrArticleResult;
     }
 }
 /**
  * @todo - Worldcup home page
  * @author PhongTX
  */
 public function indexAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     // Get block cate
     $intCateId = $this->_request->getParam('cateid', WORLD_CUP);
     //get page
     $intPage = $this->_request->getParam('page', 1);
     //get Instance New
     $objNews = Thethao_Model_News::getInstance();
     //get Instance Block
     $objBlock = Thethao_Plugin_Block::getInstance();
     //get Instance News
     $objArticle = $this->view->objArticle;
     $arrHotNews = $arrListExclude = array();
     if (1 == $intPage) {
         // Params get hot news
         $arrParams = array('area' => array(array('category_id' => SITE_ID, 'showed_area' => 'worldcup')), 'offset' => 0, 'limit' => 1);
         // Get Box Hot News
         $arrHotNews = $objArticle->getTopHotArticleByArr($arrParams);
         //khoi tao arrHotExclude
         $arrHotExclude = $arrListExclude = array();
         if (!empty($arrHotNews)) {
             //each data $arrHotNews
             foreach ($arrHotNews[0] as $key => $rows) {
                 //check $arrHotNews is article
                 if ($rows['article_id'] > 0) {
                     //set article Hot to Exclude
                     $arrHotExclude[] = $rows['article_id'];
                 }
             }
         }
         //init params to get list article with rule 2, list on folder Thethao
         $arrParamNews = array('category_id' => $intCateId, 'limit' => LIMIT_LIST, 'offset' => 0, 'article_type' => NULL);
         //get list article with rule 2 list on Thethao
         $arrListData = $objNews->getListArticleIdsByRule2($arrParamNews);
         if (!empty($arrHotExclude)) {
             //set obj get Article
             $objArticle->setIdBasic($arrHotExclude);
             $arrListData['data'] = array_diff($arrListData['data'], $arrHotExclude);
         }
         $arrExclude = array_merge($arrHotExclude, $arrListData['data']);
         $objBlock->setExclude($arrExclude);
         //get Exclude
         $arrListExclude = $objBlock->getExclude();
     } else {
         //init params to get list article with rule 2, list on folder Thethao
         $arrParamNews = array('category_id' => $intCateId, 'limit' => LIMIT_LIST, 'offset' => ($intPage - 1) * LIMIT_LIST, 'article_type' => NULL);
         //get list article with rule 2 list on Thethao
         $arrListData = $objNews->getListArticleIdsByRule2($arrParamNews);
     }
     //set obj get Article
     $objArticle->setIdBasic($arrListData['data']);
     //get video
     $arrParamVideo = array('category_id' => CATE_ID_VIDEO, 'limit' => LIMIT_VIDEO + LIMIT_LIST, 'offset' => 0, 'article_type' => TYPE_VIDEO);
     //get list video with rule 1
     $arrListVideo = $objNews->getListArticleIdsByRule1($arrParamVideo);
     if (1 == $intPage && !empty($arrListVideo['data'])) {
         $arrListVideo['data'] = array_diff($arrListVideo['data'], $arrListExclude);
     }
     if (count($arrListVideo['data']) > LIMIT_VIDEO) {
         $arrListVideo['data'] = array_slice($arrListVideo['data'], 0, LIMIT_VIDEO);
     }
     // set id from $arrListPaging to get article
     $objArticle->setIdBasic($arrListVideo['data']);
     //get video
     $arrParamPhoto = array('category_id' => CATE_ID_PHOTO, 'limit' => LIMIT_PHOTO + LIMIT_LIST, 'offset' => 0, 'article_type' => TYPE_PHOTO);
     //get list video with rule 1
     $arrListPhoto = $objNews->getListArticleIdsByRule1($arrParamPhoto);
     if (1 == $intPage && !empty($arrListPhoto['data'])) {
         $arrListPhoto['data'] = array_diff($arrListPhoto['data'], $arrListExclude);
     }
     if (count($arrListPhoto['data']) > LIMIT_PHOTO) {
         $arrListPhoto['data'] = array_slice($arrListPhoto['data'], 0, LIMIT_PHOTO);
     }
     // set id from $arrListPaging to get article
     $objArticle->setIdBasic($arrListPhoto['data']);
     //check if page > max page then return to max page
     if ($arrListData['total'] > 0) {
         $maxPage = ceil($arrListData['total'] / LIMIT_LIST);
         if ($intPage > $maxPage) {
             $this->_redirect($this->configView['url'] . '/page/' . $maxPage . '.html');
         }
     }
     //InitParam Paging
     $arrParamPaging = array('total' => $arrListData['total'], 'page' => $intPage, 'url' => $this->view->configView['url'] . '/page', 'perpage' => LIMIT_LIST, 'classPagination' => 'pagination_news', 'extEnd' => '.html', 'separate' => '/');
     //Set param
     $this->_request->setParam('block_cate', $intCateId);
     //init cate for set menu
     //set cate active
     $this->_request->setParam('cateActiveId', $intCateId);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', WORLD_CUP);
     //Assign to view
     $this->view->assign(array('intCategoryId' => WORLD_CUP, 'arrHotNews' => $arrHotNews[0], 'arrParamPaging' => $arrParamPaging, 'arrData' => $arrListData['data'], 'arrListVideo' => $arrListVideo['data'], 'arrListPhoto' => $arrListPhoto['data'], 'offsetMore' => LIMIT_LIST, 'arrListExclude' => $arrListExclude, 'isHome' => 1, 'ogType' => 'website', 'ogTitle' => 'World Cup 2014 Brazil, tin tức, video, lịch thi đấu World Cup - VnExpress', 'ogUrl' => $this->view->configView['url'], 'ogImage' => 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => 'Fifa World Cup 2014 - tin nhanh , hình ảnh , video clip bóng đá, lịch thi đấu WC 2014 tại Brazil, tường thuật bình luận bóng đá World Cup 2014'));
     if (DEVICE_ENV != 1) {
         //ad js
         $this->view->headScript()->appendFile($this->view->configView['vnecdn']['js'] . '/utils/calendar/calendar.js');
     } else {
         //Set no render view
         $this->_helper->viewRenderer->setNoRender(true);
         echo $this->view->render('mobile/index.phtml');
     }
     // Set metadata tags
     $this->view->headTitle()->prepend('World Cup 2014 Brazil, tin tức, video, lịch thi đấu World Cup - VnExpress');
     $this->view->headMeta()->setName('description', 'Fifa World Cup 2014 - tin nhanh , hình ảnh , video clip bóng đá, lịch thi đấu WC 2014 tại Brazil, tường thuật bình luận bóng đá World Cup 2014.')->setName('keywords', 'World Cup 2014, tin tuc , bong da');
 }
 /**
  * cate folder page
  * @author HungNT1
  */
 public function indexAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     $strCateCode = $this->_request->getParam('cate_code');
     //set render view if cate code is lich-thi-dau
     if ($strCateCode == 'lich-thi-dau') {
         return $this->_forward('lich-thi-dau');
     }
     //get instance Cate
     $objCate = Thethao_Model_Category::getInstance();
     //get cate id by cate code
     $intCateId = $objCate->getIdByCode($strCateCode, SEA_GAMES);
     //get page of cate
     $intPage = $this->_request->getParam('page', 1);
     //check cate id is not exists
     if ($intCateId < 1) {
         $this->_redirect("/");
     }
     // Get Category detail
     $cateDetail = $objCate->getDetailByCateId($intCateId);
     //str link
     $strLink = $this->_request->getPathInfo();
     if (strpos(rtrim($strLink, '/'), $cateDetail['link']) === FALSE) {
         //$this->_redirect($this->view->configView['url'] . $cateDetail['link'], array('code' => 301));
     }
     if ($intPage > 1) {
         $limit = LIMIT_LIST_CATE;
         $offset = ($intPage - 1) * LIMIT_LIST_CATE + LIMIT_TOP_NEWS_CATE;
     } else {
         $limit = LIMIT_LIST_CATE + LIMIT_TOP_NEWS_CATE;
         $offset = 0;
     }
     //init param to get list data with rule 2
     $arrParamNews = array('category_id' => $intCateId, 'article_type' => NULL, 'limit' => $limit, 'offset' => $offset);
     //init model news
     $objNews = Thethao_Model_News::getInstance();
     //get list article with rule 2 list on Thethao
     $arrListData = $objNews->getListArticleIdsByRule2($arrParamNews);
     // set id from $arrListPaging to get article
     $this->view->objArticle->setIdBasic($arrListData['data']);
     $arrArticleExclude = array();
     $arrHotNews = $arrListExclude = array();
     if (1 == $intPage && !empty($arrListData['data'])) {
         $arrArticleExclude = $arrListData['data'];
         //get Instance Block
         $objBlock = Thethao_Plugin_Block::getInstance();
         // set exclude article id from arrData
         $objBlock->setExclude($arrArticleExclude);
         $arrHotNews = array_slice($arrListData['data'], 0, LIMIT_TOP_NEWS_CATE);
         $arrListData['data'] = array_diff($arrListData['data'], $arrHotNews);
         //get Exclude
         $arrListExclude = $objBlock->getExclude();
     }
     //get video for box right
     $arrParamVideo = array('category_id' => CATE_SEA_GAMES_VIDEO, 'limit' => LIMIT_RELATED_VIDEO + LIMIT_LIST_CATE, 'offset' => 0, 'article_type' => TYPE_VIDEO);
     //get list article with rule 1 list on folder video
     $arrListVideo = $objNews->getListArticleIdsByRule1($arrParamVideo);
     if (1 == $intPage && !empty($arrListVideo['data'])) {
         $arrListVideo['data'] = array_diff($arrListVideo['data'], $arrListExclude);
     }
     if (count($arrListVideo['data']) > LIMIT_RELATED_VIDEO) {
         $arrListVideo['data'] = array_slice($arrListVideo['data'], 0, LIMIT_RELATED_VIDEO);
     }
     // set id from $arrListPaging to get article
     $this->view->objArticle->setIdBasic($arrListVideo['data']);
     //check if page > max page then return to max page
     if ($arrListData['total'] > 0) {
         $maxPage = ceil($arrListData['total'] / LIMIT_LIST_CATE);
         if ($intPage > $maxPage) {
             //$this->_redirect($this->configView['url'] . $cateDetail['link'] . '/page/' . $maxPage . '.html');
         }
     }
     //InitParam Paging
     $arrParamPaging = array('total' => $arrListData['total'] - LIMIT_TOP_NEWS_CATE, 'page' => $intPage, 'url' => $this->view->configView['url'] . $cateDetail['link'] . '/page', 'perpage' => LIMIT_LIST_CATE, 'classPagination' => 'pagination_news center', 'extEnd' => '.html', 'separate' => '/');
     //Set param
     $this->_request->setParam('block_cate', $intCateId);
     //gan meta data
     $titleMeta = $cateDetail['catename'] . ' SEA Games 28 - VnExpress';
     $keywords = 'SEA Games 28, tin tuc , bong da';
     $description = 'SEA Games 28 - tin nhanh , hình ảnh , video clip bóng đá, lịch thi đấu SEA Games 28, tường thuật bình luận bóng đá SEA Games 28';
     //Assign to view
     $this->view->assign(array('intCategoryId' => $intCateId, 'arrHotNews' => $arrHotNews, 'arrParamPaging' => $arrParamPaging, 'arrData' => $arrListData['data'], 'arrListVideo' => $arrListVideo['data'], 'arrArticleExclude' => $arrArticleExclude, 'arrListExclude' => $arrListExclude, 'ogType' => 'website', 'ogTitle' => $titleMeta, 'ogUrl' => $this->view->configView['url'] . $cateDetail['link'], 'ogImage' => 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => $description));
     //init cate for set menu
     //set cate active
     $this->_request->setParam('cateActiveId', $intCateId);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', SEA_GAMES);
     // Set metadata tags
     $this->view->headTitle()->prepend($titleMeta);
     $this->view->headMeta()->setName('description', $description)->setName('keywords', $keywords);
 }
 /**
  * cate folder page
  * @author HungNT1
  */
 public function indexAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     $strCateCode = $this->_request->getParam('cate_code');
     //get instance Cate
     $objCate = Thethao_Model_Category::getInstance();
     //get cate id by cate code
     $intCateId = $objCate->getIdByCode($strCateCode, WORLD_CUP);
     //get page of cate
     $intPage = $this->_request->getParam('page', 1);
     //check cate id is not exists
     if ($intCateId < 1) {
         $this->_redirect("/");
     }
     // Get Category detail
     $cateDetail = $objCate->getDetailByCateId($intCateId);
     //str link
     $strLink = $this->_request->getPathInfo();
     if (strpos(rtrim($strLink, '/'), $cateDetail['link']) === FALSE) {
         //$this->_redirect($this->view->configView['url'] . $cateDetail['link'], array('code' => 301));
     }
     //init param to get list data with rule 2
     $arrParamNews = array('category_id' => $intCateId, 'article_type' => NULL, 'limit' => LIMIT_LIST_CATE, 'offset' => ($intPage - 1) * LIMIT_LIST_CATE);
     //init model news
     $objNews = Thethao_Model_News::getInstance();
     //get list article with rule 2 list on Thethao
     $arrListData = $objNews->getListArticleIdsByRule2($arrParamNews);
     // set id from $arrListPaging to get article
     $this->view->objArticle->setIdBasic($arrListData['data']);
     $arrArticleExclude = array();
     $arrHotNews = $arrListExclude = array();
     if (1 == $intPage && !empty($arrListData['data'])) {
         $arrArticleExclude = $arrListData['data'];
         //get Instance Block
         $objBlock = Thethao_Plugin_Block::getInstance();
         // set exclude article id from arrData
         $objBlock->setExclude($arrArticleExclude);
         $arrHotNews = array_slice($arrListData['data'], 0, LIMIT_TOP);
         $arrListData['data'] = array_diff($arrListData['data'], $arrHotNews);
         //get Exclude
         $arrListExclude = $objBlock->getExclude();
     }
     //get video
     $arrParamVideo = array('category_id' => CATE_ID_VIDEO, 'limit' => LIMIT_VIDEO + LIMIT_LIST_CATE, 'offset' => 0, 'article_type' => TYPE_VIDEO);
     //get list article with rule 2 list on Thethao
     $arrListVideo = $objNews->getListArticleIdsByRule1($arrParamVideo);
     if (1 == $intPage && !empty($arrListVideo['data'])) {
         $arrListVideo['data'] = array_diff($arrListVideo['data'], $arrListExclude);
     }
     if (count($arrListVideo['data']) > LIMIT_VIDEO) {
         $arrListVideo['data'] = array_slice($arrListVideo['data'], 0, LIMIT_VIDEO);
     }
     // set id from $arrListPaging to get article
     $this->view->objArticle->setIdBasic($arrListVideo['data']);
     //get video
     $arrParamPhoto = array('category_id' => CATE_ID_PHOTO, 'limit' => LIMIT_PHOTO + LIMIT_LIST_CATE, 'offset' => 0, 'article_type' => TYPE_PHOTO);
     //get list article with rule 2 list on Thethao
     $arrListPhoto = $objNews->getListArticleIdsByRule1($arrParamPhoto);
     if (1 == $intPage && !empty($arrListPhoto['data'])) {
         $arrListPhoto['data'] = array_diff($arrListPhoto['data'], $arrListExclude);
     }
     if (count($arrListPhoto['data']) > LIMIT_PHOTO) {
         $arrListPhoto['data'] = array_slice($arrListPhoto['data'], 0, LIMIT_PHOTO);
     }
     // set id from $arrListPaging to get article
     $this->view->objArticle->setIdBasic($arrListPhoto['data']);
     //check if page > max page then return to max page
     if ($arrListData['total'] > 0) {
         $maxPage = ceil($arrListData['total'] / LIMIT_LIST_CATE);
         if ($intPage > $maxPage) {
             //$this->_redirect($this->configView['url'] . $cateDetail['link'] . '/page/' . $maxPage . '.html');
         }
     }
     //InitParam Paging
     $arrParamPaging = array('total' => $arrListData['total'], 'page' => $intPage, 'url' => $this->view->configView['url'] . $cateDetail['link'] . '/page', 'perpage' => LIMIT_LIST_CATE, 'classPagination' => 'pagination_news', 'extEnd' => '.html', 'separate' => '/');
     //Set param
     $this->_request->setParam('block_cate', $intCateId);
     //gan meta data
     $titleMeta = $cateDetail['catename'] . ' World Cup 2014 - VnExpress';
     $keywords = 'World cup 2014, tin tuc , bong da';
     $description = 'Fifa World Cup 2014 - tin nhanh , hình ảnh , video clip bóng đá, lịch thi đấu WC 2014 tại Brazil, tường thuật bình luận bóng đá World Cup 2014';
     //Assign to view
     $this->view->assign(array('intCategoryId' => $intCateId, 'arrHotNews' => $arrHotNews, 'arrParamPaging' => $arrParamPaging, 'arrData' => $arrListData['data'], 'arrListVideo' => $arrListVideo['data'], 'arrListPhoto' => $arrListPhoto['data'], 'arrArticleExclude' => $arrArticleExclude, 'arrListExclude' => $arrListExclude, 'ogType' => 'website', 'ogTitle' => $titleMenta, 'ogUrl' => $this->view->configView['url'] . $cateDetail['link'], 'ogImage' => 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => $description));
     if (DEVICE_ENV != 1) {
         //ad js
         $this->view->headScript()->appendFile($this->view->configView['vnecdn']['js'] . '/utils/calendar/calendar.js');
     } else {
         //Set no render view
         $this->_helper->viewRenderer->setNoRender(true);
         echo $this->view->render('mobile/category.phtml');
     }
     //init cate for set menu
     //set cate active
     $this->_request->setParam('cateActiveId', $intCateId);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', WORLD_CUP);
     // Set metadata tags
     $this->view->headTitle()->prepend($titleMeta);
     $this->view->headMeta()->setName('description', $description)->setName('keywords', $keywords);
 }
 private function _getInfoMatch()
 {
     $params = $this->_request->getParams();
     $this->view->isMatch = true;
     $this->_matchID = intval($params['id'], 0);
     $matchSeoName = $params[3] ? $params[3] : NULL;
     // Models instance
     $modelMatch = $this->view->objObject->getMatch();
     $modelTeam = $this->view->objObject->getTeam();
     $modelMatch->setId($this->_matchID);
     // Get match detail
     $this->_matchDetail = $modelMatch->getDetailObjectBasic($this->_matchID);
     if (empty($this->_matchDetail)) {
         $this->_redirect($this->view->configView['linkerror'][DEVICE_ENV], array('code' => 301));
     }
     // Set id and type
     $this->_matchDetail['article_id'] = $this->_matchID;
     $this->_matchDetail['article_type'] = OBJECT_TYPE_MATCH;
     $modelTeam->setId(array($this->_matchDetail['team1'], $this->_matchDetail['team2']));
     //get detail team
     $team1 = $modelTeam->getDetailObjectBasic($this->_matchDetail['team1']);
     $team2 = $modelTeam->getDetailObjectBasic($this->_matchDetail['team2']);
     $title = Fpt_Filter::setSeoLink('tran-' . $team1['name'] . ' vs ' . $team2['name']);
     $viewApp = $this->_request->getParam('view', '');
     if ($title != $matchSeoName) {
         $this->_redirect($this->_matchDetail['share_url'] . ($viewApp == 'app' ? '?view=app' : ''));
     }
     //get Instance Block
     $this->_objBlock = Thethao_Plugin_Block::getInstance();
     // Assign to view
     $currTimeGmt = time() - 25200;
     // Int the end to show box danh gia (happen + 45phut)
     $theEnd = $currTimeGmt < $this->_matchDetail['datetime_happen'] + 2700 ? FALSE : TRUE;
     $this->view->assign(array('matchDetail' => $this->_matchDetail, 'team1' => $team1, 'team2' => $team2, 'actionName' => $this->_request->getActionName(), 'seoTitle' => $title, 'currTime' => $currTimeGmt, 'theEnd' => $theEnd, 'shareUrl' => $this->_matchDetail['share_url']));
     // Set title
     $this->view->headTitle(' - Trận ' . $team1['name'] . ' vs ' . $team2['name']);
     // Set metadata
     $this->view->headMeta()->setName('keywords', 'Trận đấu, ảnh và video, điểm tin, thống kê và đội hình, tường thuật, đánh giá, ' . $team1['name'] . ', ' . $team2['name']);
 }
Beispiel #17
0
 /**
  * Get news by topic_id: order by  publish_time desc
  * @param array $arrParam array(topic_id, offset, limit)
  * @return array
  * @author HungNT1
  * @todo Topic - Thethao
  */
 public function getArticleByTopic($arrParam)
 {
     //init param return
     $arrReturn = array('data' => array(), 'total' => 0);
     //New object
     $objTopic = new Fpt_Data_News_Topic();
     if ($arrParam['exclude']) {
         //get Instance Block
         $objBlock = Thethao_Plugin_Block::getInstance();
         //get limit data for block
         $intLimit = $arrParam['limit'];
         //match limit add to exclude
         $arrParam['limit'] += $objBlock->getTotalExclude();
         //get Data main
         $arrReturn = $objTopic->getArticleByTopicId($arrParam);
         //calc limit
         $arrReturn['data'] = array_slice(array_diff($arrReturn['data'], $objBlock->getExclude()), 0, $intLimit);
     } else {
         //get Data main
         $arrReturn = $objTopic->getArticleByTopicId($arrParam);
     }
     $arrTopicInfo = $objTopic->getDetailTopic($arrParam['topic_id']);
     $arrTopicInfo['name'] = $arrTopicInfo['title'];
     $arrReturn['info'] = $arrTopicInfo;
     $arrReturn['info']['link'] = $arrTopicInfo['share_url'];
     if (!empty($arrReturn['data'])) {
         //set id
         $this->_article->setIdBasic($arrReturn['data']);
     }
     //return
     return $arrReturn;
 }