public function tuongThuatAction() { //set cache $this->_request->setParam('cache_file', 1); //Set param $this->_request->setParam('block_cate', SITE_ID); $viewApp = $this->_request->getParam('view', ''); //get common info of match $this->_getInfoMatch(); // Get models' instance $modelMatch = Thethao_Model_Match::getInstance(); $modelArticle = $this->view->objArticle; // Get tuong-thuat data $arrData = $modelMatch->getTuongThuat($this->_matchID); $arrData['relate_id'] = intval($arrData['relate_id']); $arrBlockDataId = array(); $timeUpdate = time(); if ($arrData['relate_id'] > 0) { $modelArticle->setIdBasic($arrData['relate_id']); $tuongThuat = $modelArticle->getArticleFull($arrData['relate_id']); if (intval($tuongThuat['publish_time']) <= time()) { $tuongThuat['relate_id'] = $arrData['relate_id']; } $tuongThuat['relate_id'] = $arrData['relate_id']; //get all block of article //init model live data $objLive = Fpt_Data_News_Live::getInstance(); //get list block id of article //init param to get block $arrParamBlock = array('article_id' => $tuongThuat['article_id'], 'order' => 0, 'from_time' => NULL); $arrBlockData = $objLive->getListBlockByArticleId($arrParamBlock); $arrBlockDataId = $arrBlockData['data']; $timeUpdate = $arrBlockData['time']; //set block id if not null if (!empty($arrBlockDataId)) { $objLive->setBlockId($arrBlockDataId); } } else { $tuongThuat['relate'] = $arrData['relate']; } $intCateIdPolyAds = isset($tuongThuat['category_id']) ? $tuongThuat['category_id'] : CATE_ID_TUONGTHUAT; $articleTrackingId = isset($tuongThuat['article_id']) ? $tuongThuat['article_id'] : CATE_ID_TUONGTHUAT; // Assign to view $this->view->assign(array('tuongThuat' => !is_array($tuongThuat) ? array('relate' => 'Không có thông tin tường thuật trận đấu') : $tuongThuat, 'intCategoryId' => $intCateIdPolyAds, 'objLive' => $objLive, 'arrBlockDataId' => $arrBlockDataId, 'timeUpdate' => $timeUpdate, 'intArticleId' => $articleTrackingId, 'ogType' => 'website', 'ogTitle' => $tuongThuat['title_format'] . ' - VnExpress Thể Thao', 'ogUrl' => $tuongThuat['share_url'], 'ogImage' => !empty($tuongThuat['thumbnail_url']) ? $this->view->ImageurlArticle($tuongThuat, 'size2') : 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => trim(strip_tags(html_entity_decode($tuongThuat['lead'], ENT_COMPAT, 'UTF-8'))))); // Init menu $this->_request->setParam('cateid', CATE_ID_TUONGTHUAT); $this->view->headMeta()->setName('object_id', $this->_matchID); // Prepend title $this->view->headTitle()->prepend('Tường thuật'); $this->view->headMeta()->setName('object_id', $this->_matchID); // Set interval refresh page $currentTime = time() - 25200; if ($currentTime >= $this->_matchDetail['datetime_happen'] && $currentTime <= $this->_matchDetail['datetime_happen'] + 10800 && $this->_matchDetail['status'] == 1) { $this->view->headMeta()->setHttpEquiv('REFRESH', 180); } // Append title $this->view->headTitle()->append(' - VnExpress'); //check view app if (!empty($viewApp) && $viewApp == 'app') { //Disable layout $this->_helper->layout->disableLayout(true); echo $this->view->render('object/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); //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); }
/** * 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; } }
/** * 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; } }
/** * @todo - Worldcup Match * @author PhongTX */ public function tuongThuatAction() { //set cache $this->_request->setParam('cache_file', 1); //Set param $this->_request->setParam('block_cate', SITE_ID); //Get param $viewApp = $this->_request->getParam('view', ''); //get common info of match $this->_getInfoMatch(); // Get models' instance $modelMatch = Thethao_Model_Match::getInstance(); $modelArticle = $this->view->objArticle; // Get tuong-thuat data $arrData = $modelMatch->getTuongThuat($this->_matchID); $arrData['relate_id'] = intval($arrData['relate_id']); $arrBlockDataId = array(); $timeUpdate = time(); if ($arrData['relate_id'] > 0) { $modelArticle->setIdBasic($arrData['relate_id']); $tuongThuat = $modelArticle->getArticleFull($arrData['relate_id']); if (intval($tuongThuat['publish_time']) <= time()) { $tuongThuat['relate_id'] = $arrData['relate_id']; } //get all block of article //init model live data $objLive = Fpt_Data_News_Live::getInstance(); //get list block id of article //init param to get block $arrParamBlock = array('article_id' => $tuongThuat['article_id'], 'order' => 0, 'from_time' => NULL); $arrBlockData = $objLive->getListBlockByArticleId($arrParamBlock); $arrBlockDataId = $arrBlockData['data']; $timeUpdate = $arrBlockData['time']; //set block id if not null if (!empty($arrBlockDataId)) { $objLive->setBlockId($arrBlockDataId); } } else { $tuongThuat['relate'] = $arrData['relate']; } $intCateIdPolyAds = isset($tuongThuat['category_id']) ? $tuongThuat['category_id'] : WORLD_CUP; $articleTrackingId = isset($tuongThuat['article_id']) ? $tuongThuat['article_id'] : WORLD_CUP; // Assign to view $this->view->assign(array('tuongThuat' => !is_array($tuongThuat) ? array('relate' => 'Không có thông tin tường thuật trận đấu') : $tuongThuat, 'intCategoryId' => WORLD_CUP, 'objLive' => $objLive, 'arrBlockDataId' => $arrBlockDataId, 'timeUpdate' => $timeUpdate, 'strCateCode' => $this->_request->getParam('action'), 'intCateIdPolyAds' => $intCateIdPolyAds, 'articleTrackingId' => $articleTrackingId, 'ogType' => 'website', 'ogTitle' => $tuongThuat['title_format'] . ' - VnExpress World Cup', 'ogUrl' => $this->view->ShareurlWorldcup($this->_matchDetail['share_url']), 'ogImage' => !empty($tuongThuat['thumbnail_url']) ? $this->view->ImageurlArticle($tuongThuat, 'size2') : 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => trim(strip_tags(html_entity_decode($tuongThuat['lead'], ENT_COMPAT, 'UTF-8'))))); //gan meta data $titleMeta = 'Tường thuật trận đấu ' . $this->_metaTitle; $keywords = 'World cup 2014, tin tuc , bong da'; $description = ''; //set cateid to show active in menu $this->_request->setParam('cateid', WORLD_CUP); $this->view->headMeta()->setName('object_id', $this->_matchID); //add js $this->view->headScript()->appendFile($this->view->configView['vnecdn']['js'] . '/require.min.js'); $this->view->headTitle($titleMeta); $this->view->headMeta()->setName('description', $description); $this->view->headMeta()->setName('keywords', $keywords); //check view app if (!empty($viewApp) && $viewApp == 'app') { //Disable layout $this->_helper->layout->disableLayout(true); echo $this->view->render('match/applive.phtml'); exit; } }