Ejemplo n.º 1
0
 public function loadListFixtureAction()
 {
     // Disable render layout
     $this->_helper->layout->disableLayout(true);
     $this->_helper->viewRenderer->setNoRender(true);
     // Get params
     $params = $this->_request->getParams();
     $teamID = $params['id'] ? $params['id'] : 0;
     $ajax = $params['ajax'] ? $params['ajax'] : 0;
     // Get models' instance
     $footballModel = Thethao_Model_Football::getInstance();
     $matchModel = Thethao_Model_Match::getInstance();
     $teamModel = Thethao_Model_Team::getInstance();
     // Get models' Oject instance
     $modelObject = $this->view->objObject;
     if ($ajax == 'fixture') {
         // Default response
         $response = array('error' => 0, 'msg' => 'Success', 'html' => NULL, 'ext' => NULL);
         if ($teamID) {
             $modelTeam = $modelObject->getTeam();
             $modelTeam->setId($teamID);
             // Get match id by team
             $arrMatchIDs = $modelTeam->getMatchIDsByTeam($teamID);
             if (is_array($arrMatchIDs) && count($arrMatchIDs)) {
                 // Get list league and season team attended
                 $arrLeagueSeason = $teamModel->getListLeagueAndSeasonTeamAttend($teamID);
                 $arrLeagueIDs = array_keys($arrLeagueSeason);
                 // Get league detail
                 $arrLeagueDetails = $footballModel->getListLeagueByIDs($arrLeagueIDs);
                 // Assign to view
                 $this->view->assign(array('arrLeagueDetails' => $arrLeagueDetails));
                 // Render HTML
                 $response['html'] = $this->view->render('object/fixture.phtml');
                 // Extend param
                 $response['ext'] = $arrLeagueSeason;
             } else {
                 $response['error'] = 2;
                 $response['msg'] = 'Not found match for team';
             }
         } else {
             $response['error'] = 1;
             $response['msg'] = 'Invalid parameters';
         }
     }
     if ($ajax == 'load-list-fixture') {
         $leagueID = intval($this->_request->getParam('leagueid', 0));
         $seasonID = intval($this->_request->getParam('seasonid', 0));
         // Default response
         $response = array('error' => 0, 'msg' => 'Success', 'html' => NULL);
         if ($teamID) {
             $modelMatch = $modelObject->getMatch();
             $modelTeam = $modelObject->getTeam();
             $modelTeam->setId($teamID);
             // Get all league and season
             if (!$leagueID && !$seasonID) {
                 // Get matchID
                 $arrMatchIDs = array_keys($modelTeam->getMatchIDsByTeam($teamID));
             } else {
                 // Get match id by team, season, league
                 $arrMatchIDs = $matchModel->getMatchIDsByTeamLeagueSeason($teamID, $leagueID, $seasonID);
             }
             //set id
             $modelMatch->setId($arrMatchIDs);
             if (is_array($arrMatchIDs) && count($arrMatchIDs)) {
                 // Split array into many chunks
                 $arrChunks = array_chunk($arrMatchIDs, 10);
                 // Set array match ids again
                 $arrMatchIDs = $arrChunks[0];
                 // Assign to view
                 $this->view->assign(array('arrMatchIDs' => $arrMatchIDs));
                 // Render HTML
                 if (DEVICE_ENV == 1) {
                     $response['html'] = $this->view->render('object/list_fixture_1.phtml');
                 } else {
                     $response['html'] = $this->view->render('object/list_fixture.phtml');
                 }
                 $response['extend'] = $arrChunks;
             } else {
                 $response['error'] = 2;
                 $response['msg'] = 'Not found match for team';
             }
         } else {
             $response['error'] = 1;
             $response['msg'] = 'Invalid parameters';
         }
     }
     if ($ajax == 'load-list-season') {
         // Get params
         $arrSeasonIDs = $this->_request->getParam('arrSeasonIDs', 0);
         // Default response
         $response = array('error' => 0, 'msg' => 'Success', 'data' => NULL);
         if (is_array($arrSeasonIDs) && count($arrSeasonIDs)) {
             // Get list season
             $arrSeaonDetails = $footballModel->getListSeasonByIDs($arrSeasonIDs);
             foreach ($arrSeaonDetails as $season) {
                 $response['data'][] = array('id' => $season['SeasonID'], 'name' => $season['NameSeason']);
             }
         } else {
             $response['error'] = 1;
             $response['msg'] = 'Invalid parameters';
         }
     }
     if ($ajax == 'expand-fixture-list') {
         // Default response
         $response = array('error' => 0, 'msg' => 'Success', 'html' => NULL);
         if ($this->_request->isXmlHttpRequest()) {
             // Get params
             $arrMatchIDs = $this->_request->getParam('arrMatchIDs', NULL);
             // Verify param request
             if (is_array($arrMatchIDs) && count($arrMatchIDs)) {
                 $modelMatch = $modelObject->getMatch();
                 //set id
                 $modelMatch->setId($arrMatchIDs);
                 // Assign to view
                 $this->view->assign(array('arrMatchIDs' => $arrMatchIDs));
                 // Render HTML
                 // Render HTML
                 if (DEVICE_ENV == 1) {
                     $response['html'] = $this->view->render('object/list_fixture_1.phtml');
                 } else {
                     $response['html'] = $this->view->render('object/list_fixture.phtml');
                 }
             } else {
                 $response['error'] = 2;
                 $response['msg'] = 'Invalid parameters';
             }
         } else {
             $response['error'] = 1;
             $response['msg'] = 'Invalid method';
         }
     }
     // Output
     echo Zend_Json::encode($response);
     exit;
 }
Ejemplo n.º 2
0
 public function rewriteTeamCache($params)
 {
     $teamID = intval($params['TeamID']);
     $updateType = $params['UpdateType'];
     if ($teamID) {
         switch ($updateType) {
             case 'team-extend':
                 // Init model Footbal
                 $modelTeam = new Thethao_Model_Team();
                 $modelTeam->rewriteTeamCache($params);
                 break;
             case 'player-of-team':
                 // Init model Player of Footbal
                 $modelFootball = new Thethao_Model_Player();
                 $modelFootball->rewriteListPlayersByTeam($params);
             default:
                 break;
         }
     }
     //init news instance
     $caching = Thethao_Model_Caching::getInstance();
     $caching->clearCacheFile();
 }
Ejemplo n.º 3
0
 /**
  * Get Team Info
  * @param team id, seoname
  * @author HungNT3
  */
 public function doiBongAction()
 {
     //Set param
     $this->_request->setParam('block_cate', SITE_ID);
     // Get param teamId
     $teamID = $this->_request->getParam('id', null);
     $arrParam = $this->_request->getParams();
     $newsModel = $this->view->objArticle;
     $objTeam = $this->view->objObject->getTeam();
     // Get team detail
     $objTeam->setId($teamID);
     $teamDetail = $objTeam->getDetailObjectBasic($teamID);
     //str link
     $strLink = $this->_request->getPathInfo();
     //check redirect link
     if (strpos($teamDetail['share_url'], $strLink) === FALSE && APPLICATION_ENV != 'development') {
         $this->_redirect($this->view->ShareurlWorldcup($teamDetail['share_url']), array('code' => 301));
     }
     //get model football
     $modelTeam = Thethao_Model_Team::getInstance();
     // Get team extend content
     $extend = $modelTeam->getDetailTeamExtendByIDs(array($teamID));
     //init param get news of playser
     $arrParam = array('object_id' => $teamDetail['id'], 'object_type' => OBJECT_TYPE_TEAM, 'limit' => LIMIT_RELATED_PLAYER, 'offset' => 0);
     //get article id
     $objectNews = $newsModel->getObjectNews($arrParam);
     if (!empty($objectNews['data'])) {
         //set id
         $newsModel->setIdBasic($objectNews['data']);
     }
     unset($arrParam);
     $arrFixtureId = array();
     // Get list match id by team with time happened ago 90days
     // Get fixture about team
     $currentTime = time();
     $endTime = 1405382400;
     // ngay 15-7-2014
     $pastTime = 1398902400;
     //ngay 1-5-2014
     // Get list match id by team with time happened from current -> 15/7
     $arrFixtureId = $objTeam->getMatchIDsByTeam($teamID, $endTime, $pastTime, false);
     $arrFixtureId = array_unique($arrFixtureId);
     $countItem = count($arrFixtureId);
     $currentItem = 0;
     if (!empty($arrFixtureId)) {
         $objMatch = $this->view->objObject->getMatch();
         // ksort($arrFixtureId);
         $objMatch->setId(array_keys($arrFixtureId));
         foreach ($arrFixtureId as $happenTime) {
             if ($currentTime > $happenTime) {
                 $currentItem++;
             } else {
                 break;
             }
         }
     }
     $currentItem--;
     if ($currentItem > 0) {
         $arrCurrentItem = array_slice($arrFixtureId, $currentItem, $countItem, true);
         $arrPastItem = array_slice($arrFixtureId, 0, $currentItem, true);
         $arrFixtureId = $arrCurrentItem + $arrPastItem;
         asort($arrFixtureId);
     }
     // Assign to view
     $this->view->assign(array('teamId' => $teamID, 'teamDetail' => $teamDetail, 'arrNewsId' => $objectNews['data'], 'countItem' => $countItem, 'arrFixture' => $arrFixtureId, 'extend' => $extend[$teamDetail['id']], 'intCategoryId' => WORLD_CUP, 'strCateCode' => $this->_request->getParam('action')));
     if (DEVICE_ENV == 1) {
         //Append css
         $this->view->headLink()->appendStylesheet($this->view->configView['css'] . '/m_lichthidau.css');
     }
     //gan meta data
     $titleMeta = 'Thông tin đội bóng ' . $teamDetail['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', $teamID);
     $this->view->headTitle($titleMeta);
     $this->view->headMeta()->setName('description', $description);
     $this->view->headMeta()->setName('keywords', $keywords);
 }
Ejemplo n.º 4
0
 /**
  * @todo - VnE Thethao detail page
  * @author ThuyNT2
  */
 public function indexAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     //Get article id
     $intArticleId = (int) $this->_request->getParam('id', 0);
     //Get page
     $intPage = max(1, $this->_request->getParam('page', 1));
     $viewApp = $this->_request->getParam('view', '');
     $modelTeam = Thethao_Model_Team::getInstance();
     if ($intArticleId < 1) {
         $this->_redirect('/');
         return;
     }
     //get detail full of article
     $arrArticleDetail = $this->view->objArticle->getArticleFull($intArticleId);
     //init category of article detail
     $intCategoryId = $arrArticleDetail['category_id'];
     $arrCateWorldcup = array(WORLD_CUP, CATE_ID_TINTUC, CATE_ID_BINHLUAN, CATE_ID_BENLE, CATE_ID_LICHSU);
     //check cate in array worldcup
     if (!in_array($intCategoryId, $arrCateWorldcup)) {
         $this->_redirect($arrArticleDetail['share_url'] . ($viewApp == 'app' ? '?view=app' : ''), array('code' => 301));
     }
     //forward to live action if article type is 5
     if ($arrArticleDetail['article_type'] == 5) {
         //check live match is redirect to match
         if (isset($arrArticleDetail['list_object_type']) && !empty($arrArticleDetail['list_object_type'])) {
             if (isset($arrArticleDetail['list_object_type'][OBJECT_TYPE_MATCH_ARTICLE]) && count($arrArticleDetail['list_object_type'][OBJECT_TYPE_MATCH_ARTICLE] == 1)) {
                 //get match detail
                 $matchId = $arrArticleDetail['list_object_type'][OBJECT_TYPE_MATCH_ARTICLE][0];
                 $this->view->objObject->getMatch()->setId($matchId);
                 $matchDetail = $this->view->objObject->getMatch()->getDetailObjectBasic($matchId);
                 if (!empty($matchDetail)) {
                     $link_worldcup = str_replace('http://thethao.vnexpress.net/thong-ke/', 'http://worldcup.vnexpress.net/report/', $matchDetail['share_url']);
                     $this->_redirect($link_worldcup . ($viewApp == 'app' ? '?view=app' : ''), array('code' => 301));
                 }
             }
         }
         return $this->_forward('live');
     }
     if (!empty($arrArticleDetail['list_object_type'])) {
         foreach ($arrArticleDetail['list_object_type'] as $type => $arrObjId) {
             $this->view->objObject->getObjectByType($type)->setId($arrObjId);
         }
     }
     // detail infomation player
     $arrPlayerData = array();
     if (isset($arrArticleDetail['list_object_type'][OBJECT_TYPE_PLAYER]) && !empty($arrArticleDetail['list_object_type'][OBJECT_TYPE_PLAYER])) {
         $countPlayer = count($arrArticleDetail['list_object_type'][OBJECT_TYPE_PLAYER]);
         foreach ($arrArticleDetail['list_object_type'][OBJECT_TYPE_PLAYER] as $player_id) {
             $arrPlayerData[$player_id] = $this->view->objObject->getObjectByType(OBJECT_TYPE_PLAYER)->getDetailObjectBasic($player_id);
         }
         if ($countPlayer == 1) {
             $player_id = array_shift($arrArticleDetail['list_object_type'][OBJECT_TYPE_PLAYER]);
             //init param get news of playser
             $arrParamNews = array('object_id' => $player_id, 'object_type' => OBJECT_TYPE_PLAYER, 'limit' => LIMIT_NEWS_PLAYER, 'offset' => 0);
             $objectNews = $this->view->objArticle->getObjectNews($arrParamNews);
             if (!empty($objectNews['data'])) {
                 $objectNews['data'] = array_diff($objectNews['data'], array($intArticleId));
                 $this->view->objArticle->setIdBasic($objectNews['data']);
                 $arrPlayerData[$player_id]['object_news'] = $objectNews['data'];
             }
         }
         if (!empty($arrPlayerData)) {
             $arrPlayerData = array_slice($arrPlayerData, 0, 4);
         }
     }
     //thong tin doi bong va tran dau gan day
     $arrTeamData = array();
     if (isset($arrArticleDetail['list_object_type'][OBJECT_TYPE_TEAM]) && !empty($arrArticleDetail['list_object_type'][OBJECT_TYPE_TEAM])) {
         foreach ($arrArticleDetail['list_object_type'][OBJECT_TYPE_TEAM] as $teamId) {
             $arrTeamData[$teamId] = $this->view->objObject->getObjectByType(OBJECT_TYPE_TEAM)->getDetailObjectBasic($teamId);
             $arrTeamData[$teamId]['extend'] = $modelTeam->getDetailTeamExtendByIDs(array($teamId));
             $minHappenDateTime = $arrArticleDetail['publish_time'];
             $maxHappenDateTime = 1405382400;
             // ngay 15-7-2014
             //get match id
             $arrMatchId[$teamId] = array();
             $arrMatchIdOld = array();
             $arrMatchIdFuture = $this->view->objObject->getObjectByType(OBJECT_TYPE_TEAM)->getMatchIDsByTeam($teamId, $maxHappenDateTime, $minHappenDateTime, false);
             $countMatch = count($arrMatchIdFuture);
             if ($countMatch < 3) {
                 $arrMatchIdOld = $this->view->objObject->getObjectByType(OBJECT_TYPE_TEAM)->getMatchIDsByTeam($teamId, $minHappenDateTime, 1402632000, false);
                 $arrMatchId[$teamId] = $arrMatchIdFuture + $arrMatchIdOld;
                 if (!empty($arrMatchId[$teamId])) {
                     asort($arrMatchId[$teamId]);
                 }
             } else {
                 $arrMatchId[$teamId] = $arrMatchIdFuture;
             }
             if (count($arrMatchId[$teamId]) > 3) {
                 $arrMatchId[$teamId] = array_slice($arrMatchId[$teamId], 0, 3, true);
             }
             $arrMatchId[$teamId] = array_keys($arrMatchId[$teamId]);
             unset($arrMatchIdFuture, $arrMatchIdOld);
             if (!empty($arrMatchId[$teamId])) {
                 $arrMatchId[$teamId] = array_unique($arrMatchId[$teamId]);
                 $this->view->objObject->getObjectByType(OBJECT_TYPE_MATCH)->setId($arrMatchId[$teamId]);
                 //get match detail
                 foreach ($arrMatchId[$teamId] as $matchId) {
                     $arrTeamData[$teamId]['match_detail'][$matchId] = $this->view->objObject->getObjectByType(OBJECT_TYPE_MATCH)->getDetailObjectBasic($matchId);
                 }
             }
         }
         if (!empty($arrTeamData)) {
             $arrTeamData = array_slice($arrTeamData, 0, 4);
         }
     }
     //end
     //Du doan doi vo dich & vua pha luoi
     // Get models instance
     $modelFootball = Thethao_Model_Football::getInstance();
     // Get detail table ranking by league and season
     $arrAllMatch = $modelFootball->getListTableRanking(SEASON_ID, LEAGUE_ID);
     if (!empty($arrAllMatch)) {
         //set id object
         $this->view->objObject->getTeam()->setId(array_keys($arrAllMatch));
     }
     //end
     //check public time and now time
     if (intval($arrArticleDetail['publish_time']) > time()) {
         $sig = md5($id . $arrArticleDetail['creation_time']);
         //gen sig
         if ($sig != $this->_request->getParam('sig')) {
             $this->_redirect($this->view->configView['linkerror'][DEVICE_ENV], array('code' => 301));
         }
     }
     //Valid data
     if (empty($arrArticleDetail)) {
         $this->_redirect("/");
     }
     //str link
     $strLink = $this->_request->getPathInfo();
     //get category on breakcumb (Using when view page > 2)
     $page = 1;
     //check page of detail
     if ($intPage > 1) {
         //get data page extend
         $arrDataExtend = $this->view->objArticle->getDetailPageExtend($intArticleId, $intPage);
         if (!empty($arrDataExtend)) {
             unset($arrDataExtend['creation_time'], $arrDataExtend['publish_time_format'], $arrDataExtend['publish_time']);
             //merge page extend to data detail
             $arrArticleDetail = array_merge($arrArticleDetail, (array) $arrDataExtend);
             //Check page_type popup
             if (2 == $arrDataExtend['page_type']) {
                 //Disable layout
                 $this->_helper->layout->disableLayout(true);
                 //Set no render view
                 $this->_helper->viewRenderer->setNoRender(true);
                 $this->view->assign(array('arrData' => $arrArticleDetail));
                 echo $this->view->render('detail/popup.phtml');
                 exit;
             }
             //end if
             //get link remove -p2
             $strLink = preg_replace('#(-p[\\d]+\\.html)#', '.html', $strLink);
             $page = $intPage;
         } else {
             $strLink = '';
         }
     }
     //check redirect link
     if (strpos($arrArticleDetail['share_url'], $strLink) === FALSE && APPLICATION_ENV != 'development') {
         $link_more = $this->view->ShareurlWorldcup($arrArticleDetail['share_url']);
         if ($page > 1) {
             $link_more = str_replace('.html', '-p' . $page . '.html' . ($viewApp == 'app' ? '?view=app' : ''), $arrArticleDetail['share_url']);
         }
         $this->_redirect($link_more, array('code' => 301));
     }
     //check view app
     if (!empty($viewApp) && $viewApp == 'app') {
         //Disable layout
         $this->_helper->layout->disableLayout(true);
         $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']);
         // Assign to view
         $this->view->assign(array('flagExc' => $flag, 'isArticleHotVnE' => $arrArticleDetail['privacy'] & 512, 'parentCategoryID' => $arrCateInfo['parent_id'], 'arrArticleDetail' => $arrArticleDetail, 'intCategoryId' => $intCategoryId, 'intArticleId' => $intArticleId, 'arrTeamData' => $arrTeamData, 'arrMatchId' => $arrMatchId, 'arrPlayerData' => $arrPlayerData, 'arrAllMatch' => $arrAllMatch, 'intOtherCate' => $intOtherCate, 'arrNewsArticle' => $arrNewsArticle, 'arrOrtherArticle' => $arrOrtherArticle, 'flagExc' => $flag, 'totalPageOtherNews' => $totalPage, 'totalOtherNews' => $arrNewsArticle['total'], 'intPage' => 1, 'intCateIdPolyAds' => $arrArticleDetail['category_id'], 'articleTrackingId' => $arrArticleDetail['article_id'], 'arrTopic' => $arrTopic, 'arrTopicDetail' => $arrTopicDetail[$temp_topic_id], 'isDetail' => 1, 'ogType' => 'website', 'ogTitle' => $arrArticleDetail['title_format'] . ' - VnExpress World Cup', 'ogUrl' => $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 = 'World cup 2014, tin tuc , bong da';
         $arrArticleDetail['title'] = html_entity_decode($arrArticleDetail['title'], ENT_QUOTES, 'UTF-8');
         $this->view->headTitle($arrArticleDetail['title'] . ' - VnExpress');
         $this->view->headMeta()->setName('description', trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8'))))->setName('keywords', $arrKeyword);
         echo $this->view->render('detail/app.phtml');
         exit;
     }
     //get topic of article detail
     //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));
             $arrTopic = array_slice(array_keys($arrTopic[$temp_topic_id]['data']), 0, LIMIT_TOPIC_DETAIL);
             //set id
             $this->view->objArticle->setIdBasic($arrTopic);
         }
     }
     //end get topic of article detail
     //get other news of article detail
     //array default other news
     $arrOrtherArticle = array();
     //get cate instance
     $modelCategory = Thethao_Model_Category::getInstance();
     // Get parent info
     $arrCateInfo = $modelCategory->getDetailbyCateId($intCategoryId);
     $intOtherCate = $intCategoryId;
     //check cate result
     if (!empty($arrCateInfo) && !empty($arrCateInfo['parent_id'])) {
         //check parent_id
         if (SITE_ID != $arrCateInfo['parent_id']) {
             $intOtherCate = $arrCateInfo['parent_id'];
         }
     }
     // Get article detail
     $instanceNews = Thethao_Model_News::getInstance();
     //get list top 15 article with rule 2
     $arrNewsArticle = $instanceNews->getListArticleIdsByRule2(array('category_id' => $intOtherCate, 'limit' => LIMIT_OTHER_NEWS + 1, 'offset' => 0, 'article_type' => NULL));
     if (count($arrNewsArticle['data']) > LIMIT_OTHER_NEWS) {
         $arrDiff = array_diff($arrNewsArticle['data'], array($intArticleId));
         $arrNewsArticle['data'] = array_slice($arrDiff, 0, LIMIT_OTHER_NEWS);
     }
     //set flag check exclude
     $flag = false;
     //check is empty list news
     if (is_array($arrNewsArticle) && !empty($arrNewsArticle['data'])) {
         if (in_array($intArticleId, $arrNewsArticle['data'])) {
             $flag = true;
             //excluse current article
             $arrOrtherArticle = array_diff($arrNewsArticle['data'], array($intArticleId));
         } else {
             $arrOrtherArticle = $arrNewsArticle['data'];
         }
         //then slice to get only 14 item
         $arrOrtherArticle = array_slice($arrOrtherArticle, 0, LIMIT_OTHER_NEWS);
     }
     //end check is empty latest news
     $totalPage = intval(ceil(($arrNewsArticle['total'] - 1) / LIMIT_OTHER_NEWS));
     //end get other news of article detail
     $arrArticleIds = array_unique(array_merge($arrOrtherArticle));
     $this->view->objArticle->setIdBasic($arrArticleIds);
     //Set category id for block_cate user in block & menu breakumb
     $this->_request->setParam('block_cate', $intCategoryId);
     //init cate for set menu
     $idCateMenu = $arrCateInfo['parent_id'] == SITE_ID ? $intCategoryId : $arrCateInfo['parent_id'];
     //set cate active
     $this->_request->setParam('cateActiveId', $intCategoryId);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', $idCateMenu);
     //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']);
     $share_url = str_replace('http://thethao.vnexpress.net', 'http://worldcup.vnexpress.net', $arrArticleDetail['share_url']);
     // Assign to view
     $this->view->assign(array('flagExc' => $flag, 'isArticleHotVnE' => $arrArticleDetail['privacy'] & 512, 'parentCategoryID' => $arrCateInfo['parent_id'], 'arrArticleDetail' => $arrArticleDetail, 'intCategoryId' => $intCategoryId, 'intArticleId' => $intArticleId, 'arrTeamData' => $arrTeamData, 'arrMatchId' => $arrMatchId, 'arrPlayerData' => $arrPlayerData, 'arrAllMatch' => $arrAllMatch, 'intOtherCate' => $intOtherCate, 'arrNewsArticle' => $arrNewsArticle, 'arrOrtherArticle' => $arrOrtherArticle, 'flagExc' => $flag, 'totalPageOtherNews' => $totalPage, 'totalOtherNews' => $arrNewsArticle['total'], 'intPage' => 1, 'intCateIdPolyAds' => $arrArticleDetail['category_id'], 'articleTrackingId' => $arrArticleDetail['article_id'], 'arrTopic' => $arrTopic, 'arrTopicDetail' => $arrTopicDetail[$temp_topic_id], 'isDetail' => 1, 'ogType' => 'website', 'ogTitle' => $arrArticleDetail['title_format'] . ' - VnExpress World Cup', 'ogUrl' => $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 = 'World cup 2014, tin tuc , bong da';
     $arrArticleDetail['title'] = html_entity_decode($arrArticleDetail['title'], ENT_QUOTES, 'UTF-8');
     $this->view->headTitle($arrArticleDetail['title'] . ' - VnExpress');
     $this->view->headMeta()->setName('description', trim(strip_tags(html_entity_decode($arrArticleDetail['lead'], ENT_COMPAT, 'UTF-8'))))->setName('keywords', $arrKeyword);
 }