Пример #1
0
 public function competitionInfo($competitionInfo, $arrTeams, $activeTeam = FALSE, $teamActiveID = 0)
 {
     $formatLink = '<a class="txt_black_hover_blue" href="%s" title="%s">%s</a>';
     $p1 = sprintf($formatLink, '/doi-bong/' . Fpt_Filter::setSeoLink($arrTeams[$competitionInfo['team1']]['name'] . ' ' . $competitionInfo['team1']) . '.html', $arrTeams[$competitionInfo['team1']]['name'], $arrTeams[$competitionInfo['team1']]['name']);
     $p2 = sprintf($formatLink, '/thong-tin-truoc-tran/tran-' . Fpt_Filter::setSeoLink($arrTeams[$competitionInfo['team1']]['name'] . ' vs ' . $arrTeams[$competitionInfo['team2']]['name']) . '-' . $competitionInfo['id'], $arrTeams[$competitionInfo['team1']]['name'] . ' vs ' . $arrTeams[$competitionInfo['team2']]['name'], "{$competitionInfo['goal1']} - {$competitionInfo['goal2']}");
     $p3 = sprintf($formatLink, '/doi-bong/' . Fpt_Filter::setSeoLink($arrTeams[$competitionInfo['team2']]['name'] . ' ' . $competitionInfo['team2']) . '.html', $arrTeams[$competitionInfo['team2']]['name'], $arrTeams[$competitionInfo['team2']]['name']);
     if (!$activeTeam) {
         if ($competitionInfo['goal1'] > $competitionInfo['goal2']) {
             $p1 = "<b>{$p1}</b>";
         } else {
             if ($competitionInfo['goal1'] < $competitionInfo['goal2']) {
                 $p3 = "<b>{$p3}</b>";
             }
         }
     } else {
         if ($competitionInfo['team1'] == $teamActiveID) {
             $p1 = "<b>{$p1}</b>";
         } else {
             if ($competitionInfo['team2'] == $teamActiveID) {
                 $p3 = "<b>{$p3}</b>";
             }
         }
     }
     return "{$p1} {$p2} {$p3}";
 }
Пример #2
0
 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
     $objMatch = $this->view->objObject->getMatch();
     $objTeam = $this->view->objObject->getTeam();
     $objMatch->setId($this->_matchID);
     // Get match detail
     $this->_matchDetail = $objMatch->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;
     $objTeam->setId(array($this->_matchDetail['team1'], $this->_matchDetail['team2']));
     //get object match
     $matchModel = Thethao_Model_Match::getInstance();
     //get match extend
     $extend = $matchModel->getDetailMatchExtend(array($this->_matchID));
     $this->_matchDetail['scoreCard'] = isset($extend[$this->_matchID]['scoreCard']) ? $extend[$this->_matchID]['scoreCard'] : array();
     $this->_matchDetail['formGuide'] = isset($extend[$this->_matchID]['formGuide']) ? $extend[$this->_matchID]['formGuide'] : array();
     //get detail team
     $team1 = $objTeam->getDetailObjectBasic($this->_matchDetail['team1']);
     $team2 = $objTeam->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' : ''), array('code' => 301));
     }
     // Get tuong-thuat data
     $arrData = $matchModel->getTuongThuat($this->_matchID);
     $arrData['relate_id'] = intval($arrData['relate_id']);
     $this->_matchDetail['isReport'] = 0;
     $this->_matchDetail['dataReport'] = '';
     if ($arrData['relate_id'] > 0) {
         //get page 2 report
         $arrDataExtend = $this->view->objArticle->getDetailPageExtend($arrData['relate_id'], 2);
         $this->_matchDetail['isReport'] = empty($arrDataExtend['content']) ? 0 : 1;
         $this->_matchDetail['dataReport'] = $arrDataExtend['content'];
     }
     if (!$this->_matchDetail['isReport']) {
         $this->_matchDetail['share_url'] = str_replace('/report/', '/tuong-thuat/', $this->_matchDetail['share_url']);
     }
     $this->_matchDetail['share_url'] = str_replace('/thong-ke/', '/tuong-thuat/', $this->_matchDetail['share_url']);
     /* End dien bien tran dau */
     $this->view->assign(array('matchDetail' => $this->_matchDetail, 'team1' => $team1, 'team2' => $team2, 'actionName' => $this->_request->getActionName(), 'seoTitle' => $title));
     if (DEVICE_ENV == 1) {
         //Append css
         $this->view->headLink()->appendStylesheet($this->view->configView['css'] . '/m_trandau.css');
     }
     //gan meta data
     $this->_metaTitle = $team1['name'] . ' vs ' . $team2['name'] . ' World Cup 2014 - VnExpress';
 }
Пример #3
0
 /**
  * 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);
 }
Пример #4
0
 /**
  * Initialize data
  * @param array $entity
  * @return Thethao_Business_Football_Metadata_Football
  */
 public function init($entity)
 {
     $this->_creationTime = intval($entity['creation_time']);
     $this->_leagueId = intval($entity['league_id']);
     $this->_name = !isset($entity['name']) ? '' : $entity['name'];
     $this->_order = intval($entity['order']);
     $this->_parameterA = intval($entity['parameter_a']);
     $this->_status = intval($entity['status']);
     $this->_updateTime = intval($entity['update_time']);
     $this->_nameSeo = Fpt_Filter::setSeoLink($entity['name']);
     return $this;
 }
Пример #5
0
 /**
  * Initialize data
  * @param array $entity
  * @return Fpt_Business_Season_Metadata_Season
  */
 public function init($entity)
 {
     $this->_beginDate = !isset($entity['begin_date']) || empty($entity['begin_date']) ? NULL : $entity['begin_date'];
     $this->_endDate = !isset($entity['end_date']) || empty($entity['end_date']) ? NULL : $entity['end_date'];
     $this->_leagueId = intval($entity['league_id']);
     $this->_numTeam = intval($entity['num_team']);
     $this->_seasonId = intval($entity['season_id']);
     $this->_nameSeason = !isset($entity['name_season']) || empty($entity['name_season']) ? NULL : $entity['name_season'];
     $this->_status = intval($entity['status']);
     $this->_nameSeo = Fpt_Filter::setSeoLink($entity['name_season']);
     return $this;
 }
Пример #6
0
 public function playerInfo($playerInfo, $substitution = FALSE, $bool = FALSE)
 {
     $arrEvents = array(1 => '<img alt="Ghi bàn phút %s" title="Ghi bàn phút %s" src="' . $this->view->configView['images'] . '/icons/icon_goal.gif">', 2 => '<img alt="Thẻ vàng phút %s" title="Thẻ vàng phút %s" src="' . $this->view->configView['images'] . '/icons/icon_thevang_tk.gif">', 3 => '<img alt="Thẻ đỏ phút %s" title="Thẻ đỏ phút %s" src="' . $this->view->configView['images'] . '/icons/icon_thedo.gif">', 4 => '<img alt="Vào sân phút %s" title="Vào sân phút %s" src="' . $this->view->configView['images'] . '/icons/icon_vaosan.gif">', 5 => '<img alt="Ra sân phút %s" title="Ra sân phút %s" src="' . $this->view->configView['images'] . '/icons/icon_rasan.gif">');
     $arrPositions = array('G' => 'Thủ môn', 'D' => 'Hậu vệ', 'M' => 'Trung vệ', 'F' => 'Tiền đạo');
     $playerInfo['PlayerName'] = '<a title="' . $playerInfo['PlayerName'] . '" href="/cau-thu/' . Fpt_Filter::setSeoLink($playerInfo['PlayerName']) . '-' . $playerInfo['PlayerID'] . '.html" class="txt_black_hover_blue">' . $playerInfo['PlayerName'] . '</a>';
     $html = NULL;
     $divTemplate = '<div class="item_cauthu %s">
                     <div class="w70">
                     %s
                     <span class="so_ao">%s</span>
                     </div>
                     <div class="w190">
                     <b>%s</b>
                     %s
                     </div>
                     <div class="w50">
                     <b>%s</b>
                     </div>
                     <div class="clear">
                     </div>
                     </div>';
     if (!$substitution && $playerInfo['Type'] != 2 || $bool == TRUE) {
         if (empty($playerInfo['Event'])) {
             if ($playerInfo['Type'] != 2) {
                 $html = sprintf($divTemplate, NULL, NULL, $playerInfo['NumCoat'], $playerInfo['PlayerName'], NULL, $arrPositions[$playerInfo['Position']]);
             }
         } else {
             $arrGroupEvent = explode('|', $playerInfo['Event']);
             $tempEvent = '';
             $pos1 = $pos2 = NULL;
             foreach ($arrGroupEvent as $groupEvent) {
                 $event = explode(':', $groupEvent);
                 $tempEvent .= sprintf($arrEvents[$event[1]], $event[0], $event[0]);
                 if ($event[1] == 4) {
                     $pos1 = 'cauthu_vaosan';
                     $pos2 = '<span class="tree_vao_ra_san">&nbsp;</span>';
                 } else {
                     if ($event[1] == 5) {
                         $pos1 = 'cauthu_rasan';
                     }
                 }
             }
             $html = sprintf($divTemplate, $pos1, $pos2, $playerInfo['NumCoat'], $playerInfo['PlayerName'], $tempEvent, $arrPositions[$playerInfo['Position']]);
         }
     } else {
         if ($playerInfo['Type'] == '2') {
             $html = sprintf($divTemplate, NULL, NULL, $playerInfo['NumCoat'], $playerInfo['PlayerName'], NULL, $arrPositions[$playerInfo['Position']]);
         }
     }
     return $html;
 }
Пример #7
0
 public function CropWord($text = '', $numWord = 0, $link = '')
 {
     //Dem tu
     $wordCount = str_word_count(Fpt_Filter::setSeoLink($text, ' '));
     if ($wordCount <= $numWord) {
         return $text;
     } else {
         $arrWord = explode(' ', $text);
         foreach ($arrWord as $word) {
             if ($word === '0' || $word) {
                 $tmp[] = $word;
             }
         }
         $str = implode(' ', array_slice($tmp, 0, $numWord));
         if (empty($link)) {
             $str = $str . '...';
         } else {
             $str = $str . ' <a href="' . $link . '" title=""><img src="http://st.f1.vnecdn.net/responsive/i/v5/icons/icon_more2.gif" title=""/></a>';
         }
         return $str;
     }
 }
Пример #8
0
 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']);
 }
Пример #9
0
 /**
  * @todo - Worldcup video page
  * @author PhongTX
  */
 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_SEA_GAMES_VIDEO);
     //get instance Cate
     $objCate = Thethao_Model_Category::getInstance();
     //get page
     $intPage = max(1, $this->_request->getParam('p', 1));
     //Get article id
     $intVideoId = $this->_request->getParam('id', 0);
     //New object
     $objNews = new Thethao_Model_News();
     //Get instance
     $objArticle = $this->view->objArticle;
     $totalNew = 1;
     //trang chu video
     if ($intVideoId <= 0) {
         //Init params
         $arrParams = array('category_id' => CATE_SEA_GAMES_VIDEO, 'limit' => 1, 'offset' => 0);
         //get all article by rule 2
         $arrListVideo = $objNews->getListArticleIdsByRule2($arrParams);
         //get Video new
         $intVideoId = array_shift($arrListVideo['data']);
         //Get detail video
         $arrVideoInfo = $objArticle->getArticleFull($intVideoId);
         //Id tracking
         $articleTrackingId = $intVideoId;
     } else {
         //Id tracking
         $articleTrackingId = $intVideoId;
         //Get detail video
         $arrVideoInfo = $objArticle->getArticleFull($intVideoId);
         //check data not empty
         if (empty($arrVideoInfo)) {
             $this->_redirect("/video");
         }
         //check publish
         if (intval($arrVideoInfo['publish_time']) > time()) {
             $sig = md5($intVideoId . $arrVideoInfo['creation_time']);
             //gen sig
             if ($sig != $this->_request->getParam('sig')) {
                 $this->_redirect($this->view->configView['linkerror'][DEVICE_ENV], array('code' => 301));
             }
         }
         //str link
         $strLink = $this->_request->getPathInfo();
         $arrVideoInfo['share_url'] = $this->view->ShareurlSeagame($arrVideoInfo['share_url']);
         //check link
         //check redirect link
         if (strpos($arrVideoInfo['share_url'], $strLink) === false && APPLICATION_ENV != 'development') {
             $this->_redirect($arrVideoInfo['share_url'], array('code' => 301));
         }
     }
     //check pvtt
     if ($arrVideoInfo['privacy'] & 64) {
         $this->_redirect($this->view->configView['url_vne'] . "/phong-van-truc-tuyen/" . Fpt_Filter::setSeoLink($arrVideoInfo['title_format']) . '-' . $arrVideoInfo['article_id'] . '.html');
     }
     /* Get video lien quan */
     //video exclude
     $videoExclude = array($intVideoId);
     //khoi tao so luong video lien quan
     $mRelateVideo = 0;
     //khoi tao data arrVideoRelate
     $arrVideoRelate = array();
     //get video lien quan -> by tag
     if (!empty($arrVideoInfo['list_tag_id'])) {
         //New object
         $obj = new Fpt_Data_News_Tag();
         $arrParams = array('tag_id' => $arrVideoInfo['list_tag_id'], 'site_id' => CATE_SEA_GAMES_VIDEO, 'article_type' => TYPE_VIDEO, 'limit' => LIMIT_RELATED_VIDEO + 1, 'offset' => 0);
         //get list video lien quan
         $arrVideoResult = $obj->getArticleUnionTag($arrParams);
         //neu co video lien quan
         if (!empty($arrVideoResult)) {
             //loai tru tin dang xem
             $arrVideoRelate = array_slice(array_diff($arrVideoResult, $videoExclude), 0, LIMIT_RELATED_VIDEO);
             $videoExclude = array_unique(array_merge($videoExclude, $arrVideoRelate));
         }
         unset($arrVideoResult);
     }
     //tong so video lien quan nho hon so luong can lay
     //Nếu không đủ 2 video thì lấy thêm video cùng chuyên mục
     //Loại trừ Video đang xem
     //Sắp xếp Video mới lên trên
     //tinh tong so video lien quan + exclude
     $mRelateVideo = count($arrVideoRelate);
     if ($mRelateVideo < LIMIT_RELATED_VIDEO) {
         //Init params
         $arrParamsVideoRule2 = array('category_id' => CATE_SEA_GAMES_VIDEO, 'limit' => 2 * LIMIT_RELATED_VIDEO - $mRelateVideo + 1, 'offset' => 0);
         //Get news by rule 2 : set folder  X  +  ListOn vao folder  X  => order by publish_time
         $arrListVideoLasest = $objNews->getListArticleIdsByRule2($arrParamsVideoRule2);
         //Loai tru video dang xem + tin have
         $arrListVideoLasest = array_diff($arrListVideoLasest['data'], $videoExclude);
         //merge list video folder vao video lien de lay them cac video moi nhat
         // cung folder dang xem
         $arrVideoRelate = array_merge($arrVideoRelate, $arrListVideoLasest);
         //lay dung so luong hien thi
         $arrVideoRelate = array_slice(array_unique($arrVideoRelate), 0, LIMIT_RELATED_VIDEO);
         unset($arrListVideoLasest);
     }
     $videoExclude = array_unique(array_merge($videoExclude, $arrVideoRelate));
     //get list video of page video
     //Init params
     $arrParams = array('category_id' => CATE_SEA_GAMES_VIDEO, 'limit' => LIMIT_LIST_VIDEO + LIMIT_RELATED_VIDEO + 1, 'offset' => 0);
     //get all article by rule 2
     $arrListVideo = $objNews->getListArticleIdsByRule2($arrParams);
     if (!empty($arrListVideo['data'])) {
         $arrListVideo['data'] = array_diff($arrListVideo['data'], $videoExclude);
     }
     $arrListVideo['data'] = array_slice($arrListVideo['data'], 0, LIMIT_LIST_VIDEO);
     //set vao article detail
     $objArticle->setIdBasic(array_merge($arrListVideo['data'], $videoExclude));
     ////////////////////get detail reference video //////////////////
     $list_object = $arrVideoInfo['list_object'];
     if (!empty($list_object)) {
         foreach ($list_object as $object) {
             $object_type = $object['object_type'];
             $object_id = $object['object_id'];
         }
     }
     if ($object_type == 202) {
         // lấy detail video từ library
         $arrDataRV = $objArticle->getDetailVideo(array($object_id));
         if (!empty($arrDataRV)) {
             $arrDataRV = array('url' => $arrDataRV[$object_id]['url'], 'object_id' => $object_id, 'object_type' => $object_type, 'have_license' => $arrDataRV[$object_id]['have_license']);
         }
     } else {
         $arrParamRV = array('article_id' => $intVideoId, 'limit' => 1, 'offset' => 0);
         $arrDataRV = $objArticle->getObjectReferenceByArticleId($arrParamRV);
         if (isset($arrDataRV['data']) && !empty($arrDataRV['data'])) {
             $arrDataRV = current($arrDataRV['data']);
             //$arrDataRV['have_license'] = 0;
         } else {
             $arrDataRV = array();
         }
     }
     $arrVideoInfo['share_url'] = str_replace('http://thethao.vnexpress.net/', 'http://seagames.vnexpress.net/', $arrVideoInfo['share_url']);
     //init cate for set menu
     //set cate active
     $this->_request->setParam('cateActiveId', CATE_SEA_GAMES_VIDEO);
     //set cate id to show active in menu
     $this->_request->setParam('cateid', SEA_GAMES);
     //meta title + image + description
     $strMetaTitle = html_entity_decode($arrVideoInfo['title'], ENT_COMPAT, 'UTF-8') . ' SEA Games 28 - VnExpress';
     $strMetaImage = !empty($arrVideoInfo['thumbnail_url']) ? $this->view->Imageurl($arrVideoInfo['thumbnail_url'], 'size2') : 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg';
     $strMetaDescript = trim(strip_tags(html_entity_decode($arrVideoInfo['lead'], ENT_COMPAT, 'UTF-8'))) . ' - VnExpress';
     //Assign to views
     $this->view->assign(array('arrEx' => $videoExclude, 'data' => $arrVideoInfo, 'arrData' => $arrListVideo['data'], 'arrVideoRelate' => $arrVideoRelate, 'intArticleId' => $articleTrackingId, 'intCategoryId' => CATE_SEA_GAMES_VIDEO, 'notRefreshPage' => 1, 'strMetaTitle' => htmlspecialchars($strMetaTitle), 'strMetaImage' => $strMetaImage, 'strMetaDescript' => htmlspecialchars($strMetaDescript), 'isArticleHotVnE' => $arrVideoInfo['privacy'] & 512, 'arrDataRV' => $arrDataRV, 'ogType' => 'website', 'ogTitle' => $strMetaTitle, 'ogUrl' => $arrVideoInfo['share_url'], 'ogImage' => !empty($arrVideoInfo['thumbnail_url']) ? $this->view->Imageurl($arrVideoInfo['thumbnail_url'], 'size2') : 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => $strMetaDescript));
     //Add js
     /*$this->view->->headScript()->appendFile($this->view->configView['js'] . '/video.js')
       ->headScript()->appendFile($this->view->configView['eclick']['ads']['js']);*/
     $keywords = 'SEA Games 28, tin tuc , bong da';
     $this->view->headTitle($strMetaTitle);
     $this->view->headMeta()->setName('description', $strMetaDescript);
     $this->view->headMeta()->setName('keywords', $keywords);
     //init cate for set menu
     //set cate active
     $this->_request->setParam('cateActiveId', CATE_SEA_GAMES_VIDEO);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', SEA_GAMES);
 }
Пример #10
0
 /**
  * Action show table ranking detail by season and league
  * @author QuangTM
  */
 public function bangXepHangAction()
 {
     $leagueId = intval($this->_request->getParam('lid', 1));
     $seasonId = intval($this->_request->getParam('sid', 0));
     //Set category id for block_cate user in block
     $this->_request->setParam('block_cate', 'league_' . $leagueId);
     // Get models instance
     $modelFootball = Thethao_Model_Football::getInstance();
     if (!$seasonId) {
         // Get season by league
         $arrSeasonByLeague = $modelFootball->getListSeasonByLeagueID($leagueId);
         $currentYear = date('Y');
         foreach ($arrSeasonByLeague as $value) {
             if (substr($value['NameSeason'], 0, 4) == $currentYear) {
                 $currentSeasonByLeague = $value;
             }
         }
         if (isset($currentSeasonByLeague)) {
             $seasonByLeague = $currentSeasonByLeague;
         } else {
             $currentYear = $currentYear - 1;
             foreach ($arrSeasonByLeague as $value) {
                 if (substr($value['NameSeason'], 0, 4) == $currentYear) {
                     $currentSeasonByLeague = $value;
                 }
             }
             if (isset($currentSeasonByLeague)) {
                 $seasonByLeague = $currentSeasonByLeague;
             } else {
                 $seasonByLeague = $arrSeasonByLeague[0];
             }
         }
         // Get league detail
         $leagueDetail = $modelFootball->getListLeagueByIDs(array($leagueId));
         // Get link to redirect
         $directUrL = $this->view->configView['url'] . '/bang-xep-hang/' . Fpt_Filter::setSeoLink($leagueDetail[0]['Name']) . '-' . $seasonByLeague['NameSeason'] . '-' . $leagueId . '-' . $seasonByLeague['SeasonID'] . '.html';
         // Redirect
         $this->_redirect($directUrL);
         exit;
     }
     // Get detail table ranking by league and season
     $tableRanking = $modelFootball->getListTableRanking($seasonId, $leagueId);
     if (!empty($tableRanking)) {
         //set id object
         $this->view->objObject->getTeam()->setId(array_keys($tableRanking));
         $temp = current($tableRanking);
         $maxUpdateTime = $temp['UpdateTime'];
     } else {
         $maxUpdateTime = time();
     }
     // Get all league
     $allLeague = $modelFootball->getLeagueAll();
     // Get league to json
     $arrLeagues = array();
     foreach ($allLeague as $league) {
         $arrLeagues[$league['LeagueID']] = Fpt_Filter::setSeoLink($league['Name']);
     }
     // Get league detail
     $leagueDetail = $modelFootball->getListLeagueByIDs(array($leagueId));
     // Get season by league
     $arrSeasonByLeague = $modelFootball->getListSeasonByLeagueID($leagueId);
     $arrSeasons = array();
     //Sort descending list season
     if (is_array($arrSeasonByLeague) && count($arrSeasonByLeague)) {
         foreach ($arrSeasonByLeague as $value) {
             $arrSeasons[$value['SeasonID']] = $value['NameSeason'];
         }
     }
     arsort($arrSeasons);
     // Get season detail
     $seasonDetail = $modelFootball->getListSeasonByIDs(array($seasonId));
     switch ($leagueId) {
         case 1:
             $cateActiveId = CATE_ID_NGOAIHANGANH;
             break;
         case 2:
             $cateActiveId = CATE_ID_LALIGA;
             break;
         case 3:
             $cateActiveId = CATE_ID_SERIA;
             break;
         case 6:
         case 7:
             $cateActiveId = CATE_ID_BONGDATRONGNUOC;
             break;
         default:
             $cateActiveId = CATE_ID_CACGIAIKHAC;
             break;
     }
     $directUrL = $this->view->configView['url'] . '/bang-xep-hang/' . Fpt_Filter::setSeoLink($leagueDetail[0]['Name']) . '-' . $seasonDetail[0]['NameSeason'] . '-' . $leagueId . '-' . $seasonDetail[0]['SeasonID'] . '.html';
     $title = 'Bảng xếp hạng ' . $leagueDetail[0]['Name'];
     $description = 'Bảng xếp hạng ' . $leagueDetail[0]['Name'] . ' - Tin nhanh mới nhất, lịch thi đấu, video, hình ảnh, kết quả bảng xếp hạng các giải Bóng đá.';
     $keywords = 'bang xep hang ngoai hang Anh, bang xep hang seri a, bang xep hang bungdesliga, bang xep hang la liga';
     // Assign to view
     $this->view->assign(array('tableRanking' => $tableRanking, 'allLeague' => $allLeague, 'arrLeagueJson' => Zend_Json::encode($arrLeagues), 'leagueDetail' => $leagueDetail[0], 'arrSeasonByLeague' => $arrSeasons, 'arrSeasonJson' => Zend_Json::encode($arrSeasons), 'seasonDetail' => $seasonDetail[0], 'leagueID' => $leagueId, 'seasonID' => $seasonId, 'maxUpdateTime' => $maxUpdateTime, 'intCategoryId' => $cateActiveId, 'ogType' => 'website', 'ogTitle' => $title, 'ogUrl' => $directUrL, 'ogImage' => 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => $description));
     // Init menu
     $this->_request->setParam('cateid', CATE_ID_BONGDA);
     $this->_request->setParam('cateActiveId', $cateActiveId);
     $this->view->headTitle($title . ' - VnExpress');
     $this->view->headMeta()->setName('description', $description);
     $this->view->headMeta()->setName('keywords', $keywords);
     //Append JS
     $this->view->headScript()->appendFile($this->view->configView['js'] . '/table_ranking.js');
 }
Пример #11
0
 /**
  *
  * @param string $action
  * @param string $teamName1
  * @param string $teamName2
  * @param int $matchID
  * @return string 
  */
 public function matchDetailUrl($action, $teamName1, $teamName2, $matchID)
 {
     return "/{$action}/tran-" . Fpt_Filter::setSeoLink("{$teamName1} vs {$teamName2} {$matchID}");
 }
Пример #12
0
 /**
  * @todo - VnE Thethao detail page
  * @author HungNT1
  */
 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', '');
     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'];
     //check other
     $arrCateOther = array(SEA_GAMES, CATE_SEA_GAMES_BENLE, CATE_SEA_GAMES_BONGDA, CATE_SEA_GAMES_BINHLUAN, CATE_SEA_GAMES_CACMONKHAC, CATE_SEA_GAMES_THONGTIN);
     //check cate in array other
     if (in_array($intCategoryId, $arrCateOther)) {
         $link_other = str_replace('http://thethao.vnexpress.net', 'http://seagames.vnexpress.net', $arrArticleDetail['share_url']);
         if ($intPage > 1) {
             $link_other = str_replace('.html', '-p' . $intPage . '.html', $link_other);
         }
         $this->_redirect($link_other . (in_array($viewApp, array('app', 'app_sport_live')) ? '?view=' . $viewApp : ''), array('code' => 301));
     }
     //check public time and now time
     if (intval($arrArticleDetail['publish_time']) > time()) {
         $sig = md5($intArticleId . $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("/");
     }
     if ($arrArticleDetail['privacy'] & 64) {
         $this->_redirect($this->view->configView['url_vne'] . "/phong-van-truc-tuyen/" . Fpt_Filter::setSeoLink($arrArticleDetail['title_format']) . '-' . $arrArticleDetail['article_id'] . '.html');
     }
     //str link
     $strLink = $this->view->configView['url'] . $this->_request->getPathInfo();
     //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_other = str_replace('/thong-ke/', '/tuong-thuat/', $matchDetail['share_url']) . (in_array($viewApp, array('app', 'app_sport_live')) ? '?view=' . $viewApp : '');
                     $this->_redirect($link_other, array('code' => 301));
                 }
             }
         }
         //check page tuong thuat and redirect to tuong thuat or tong thuat
         if ($arrArticleDetail['category_id'] == CATE_ID_TUONGTHUAT) {
             //check living or not
             if (($arrArticleDetail['privacy'] & 8) == 8) {
                 $strLink = preg_replace('#/tin-tuc/tuong-thuat/#', '/tuong-thuat/', $strLink);
             } else {
                 //get data page extend
                 $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 = array_merge($arrArticleDetail, (array) $arrDataExtend);
                     //get link remove -p2
                     $strLink = preg_replace('#/tin-tuc/tuong-thuat/#', '/tong-thuat/', $strLink);
                 } else {
                     $strLink = preg_replace('#/tin-tuc/tuong-thuat/#', '/tuong-thuat/', $strLink);
                 }
             }
             if (strpos($strLink, '/tuong-thuat/') !== FALSE || strpos($strLink, '/tong-thuat/') !== FALSE) {
                 $strLink = $strLink . (in_array($viewApp, array('app', 'app_sport_live')) ? '?view=' . $viewApp : '');
                 $this->_redirect($strLink, array('code' => 301));
             }
         }
         return $this->_forward('live');
     }
     //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 ($strLink != $arrArticleDetail['share_url'] && APPLICATION_ENV != 'development') {
         $link_more = $arrArticleDetail['share_url'];
         if ($page > 1) {
             $link_more = str_replace('.html', '-p' . $page . '.html', $arrArticleDetail['share_url']);
         }
         $this->_redirect($link_more . ($viewApp == 'app' ? '?view=app' : ''), 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('arrArticleDetail' => $arrArticleDetail, 'intCategoryId' => $intCategoryId, 'intArticleId' => $intArticleId, 'ogType' => 'website', 'ogTitle' => $arrArticleDetail['title_format'] . ' - VnExpress Thể Thao', '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')))));
         // 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));
         echo $this->view->render('detail/app.phtml');
         exit;
     }
     //get topic of article detail
     //set topic show style
     $topic_show_style = 1;
     //init topic default
     $arrTopic = array();
     $arrTopicDetail = array();
     //set recommend
     $arrRecommend = array('data' => array(), 'total' => 0);
     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]);
                     $arrTopic[$topic_id]['total'] = $arrTopic[$topic_id]['total'] - 1;
                 }
                 if (empty($arrTopic[$topic_id]['data'])) {
                     unset($arrArticleDetail['list_topic_id'][$index]);
                     unset($arrTopic[$topic_id]);
                     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);
         }
     }
     //check neu empty data topic + link cheo moi xuat recommend
     if (empty($arrTopic) && empty($arrArticleDetail['list_reference_sites_id'])) {
         // Recommendation
         $arrRecommendParams = array('article_id' => $intArticleId, 'limit' => LIMIT_TOPIC_DETAIL_STYLE_1 + 1, 'offset' => 0);
         $arrRecommend = $this->view->objArticle->getRecommendationById($arrRecommendParams);
         //valid data
         if (!empty($arrRecommend['data'])) {
             $arrRecommend['data'] = array_diff($arrRecommend['data'], array($intArticleId));
             $arrRecommend['data'] = array_slice($arrRecommend['data'], 0, LIMIT_TOPIC_DETAIL_STYLE_1);
             // set to article instance
             $this->view->objArticle->setIdBasic($arrRecommend['data']);
         }
     }
     //end get topic of article detail
     //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 other news of article detail from commendation
     $arrOrtherArticle = array();
     $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
     //end get other news of article detail
     //get top view article
     $arrTopViewID = array();
     if (DEVICE_ENV != 1) {
         //get top view with rule 4
         $arrTopViewData = $instanceNews->getListArticleIdsByRule4(array('category_id' => $intOtherCate, 'offset' => 0, 'limit' => LIMIT_TOP_VIEW + 1));
         if (!empty($arrTopViewData)) {
             //excluse current article
             $arrTopViewID = array_diff($arrTopViewData, array($intArticleId));
             $arrTopViewID = array_slice($arrTopViewID, 0, LIMIT_TOP_VIEW);
         }
     }
     //end get top view article
     //array merge article id to set id basic
     $arrArticleIds = array_unique(array_merge($arrTopic, $arrOrtherArticle, $arrTopViewID));
     $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']);
     // Assign to view
     $this->view->assign(array('arrRecommend' => $arrRecommend, 'arrNewsArticle' => $arrNewsArticle, 'arrOrtherArticle' => $arrOrtherArticle, 'flagExc' => $flag, 'totalPageOtherNews' => intval(ceil($arrNewsArticle['total'] / LIMIT_OTHER_NEWS)), 'isArticleHotVnE' => $arrArticleDetail['privacy'] & 512, 'arrTopViewID' => $arrTopViewID, 'parentCategoryID' => $arrCateInfo['parent_id'], 'arrArticleDetail' => $arrArticleDetail, 'intCategoryId' => $intCategoryId, 'intArticleId' => $intArticleId, 'intOtherCate' => $intOtherCate, 'intViewApp' => empty($viewApp) ? 0 : 1, 'isAdsFullScreen' => $arrArticleDetail['privacy'] & 2048, 'topic_show_style' => $topic_show_style, 'arrTopic' => $arrTopic, 'arrTopicDetail' => $arrTopicDetail[$temp_topic_id], 'ogType' => 'website', 'ogTitle' => $arrArticleDetail['title_format'] . ' - VnExpress Thể Thao', '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')))));
     // 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));
 }
Пример #13
0
 /**
  * Init data
  * @param array $entity
  * @return Thethao_Business_Football_Metadata_TeamSeason
  */
 public function init($entity)
 {
     $this->_teamId = intval($entity['team_id']);
     $this->_awayDrawn = intval($entity['away_drawn']);
     $this->_awayGoalAgainst = intval($entity['away_goal_against']);
     $this->_awayGoalScore = intval($entity['away_goal_score']);
     $this->_awayLost = intval($entity['away_lost']);
     $this->_awayWon = intval($entity['away_won']);
     $this->_goalDiffenrence = intval($entity['goal_diffenrence']);
     $this->_homeDrawn = intval($entity['home_drawn']);
     $this->_homeGoalAgainst = intval($entity['home_goal_against']);
     $this->_homeGoalScore = intval($entity['home_goal_score']);
     $this->_homeLost = intval($entity['home_lost']);
     $this->_homeWon = intval($entity['home_won']);
     $this->_numMatch = intval($entity['num_match']);
     $this->_point = intval($entity['point']);
     $this->_posChange = intval($entity['pos_change']);
     $this->_position = intval($entity['position']);
     $this->_seasonId = intval($entity['season_id']);
     $this->_table = empty($entity['table']) || !isset($entity['table']) ? NULL : $entity['table'];
     $this->_won = !isset($entity['won']) ? $this->_homeWon + $this->_awayWon : $entity['won'];
     $this->_lost = !isset($entity['lost']) ? $this->_homeLost + $this->_awayLost : $entity['lost'];
     $this->_drawn = !isset($entity['drawn']) ? $this->_homeDrawn + $this->_awayDrawn : $entity['drawn'];
     $this->_goalAgainst = !isset($entity['goal_against']) ? $this->_homeGoalAgainst + $this->_awayGoalAgainst : $entity['goal_against'];
     $this->_goalScore = !isset($entity['goal_score']) ? $this->_homeGoalScore + $this->_awayGoalScore : $entity['goal_score'];
     $this->_leagueId = intval($entity['league_id']);
     $this->_lastGamesResult = $entity['last_games_result'];
     $this->_name = $entity['name'];
     $this->_updateTime = $entity['update_time'];
     $this->_nameSeo = Fpt_Filter::setSeoLink($entity['name']);
     return $this;
 }
Пример #14
0
 /**
  * revert from web routes url to mobile url and redirect
  * @author: NhuanTP
  */
 public function mobilerevertAction()
 {
     //Disable layout
     $this->_helper->layout->disableLayout(true);
     $this->_helper->viewRenderer->setNoRender(true);
     //Get params
     $params = $this->_request->getParams();
     //Set COOKIE for PDA !important
     setcookie("VNEPDA", 1, time() + 3600, '/', '.vnexpress.net');
     //Get model article
     $objArticle = $this->view->objArticle;
     //Set href redirect
     $href = $this->view->configView['url'];
     if ($params['a'] > 0 && $params['c'] == 0) {
         $modelObject = Fpt_Data_Materials_Object::getInstance();
         $modelMatch = $modelObject->getMatch();
         $modelTeam = $modelObject->getTeam();
         // Set list matches' id
         $modelMatch->setId($params['a']);
         $matchDetail = $modelMatch->getDetailObjectBasic($params['a']);
         if (!empty($matchDetail)) {
             $team1 = $team2 = array();
             $modelTeam->setId(array($matchDetail['team1'], $matchDetail['team2']));
             $team1 = $modelTeam->getDetailObjectBasic($matchDetail['team1']);
             $team2 = $modelTeam->getDetailObjectBasic($matchDetail['team2']);
             $title = Fpt_Filter::setSeoLink($team1['name'] . ' vs ' . $team2['name']);
             $href .= "/tuong-thuat/tran-{$title}-{$params['a']}";
         }
     } elseif ($params['a'] > 0) {
         $objArticle->setIdBasic($params['a']);
         $arrArticleDetail = $objArticle->getArticleBasic($params['a']);
         $arrArticleDetail['product_id'] = 130;
         //Check detail article
         if (is_array($arrArticleDetail) && isset($arrArticleDetail['product_id'])) {
             //kiem tra mot lan nua xem co nhieu hon mot bai viet khong
             //Get model news
             $objNews = Thethao_Model_News::getInstance();
             $arrArticleId = $objNews->getArticleIdByProductId($arrArticleDetail['product_id']);
             if ($arrArticleId != -1) {
                 foreach ($arrArticleId as $index => $id) {
                     if ($id == $params['a']) {
                         unset($arrArticleId[$index]);
                     }
                 }
                 if (count($arrArticleId) > 0) {
                     //Get detail article
                     $this->view->objArticle->setIdBasic($arrArticleId[0]);
                     $arrArticleDetail = $this->view->objArticle->getArticleBasic($arrArticleId[0]);
                 }
             }
         }
         if (!empty($arrArticleDetail)) {
             //Redirect
             $this->_redirect($arrArticleDetail['share_url'], array('code' => 301));
             exit;
         }
     }
     if ($params['c'] > 0) {
         if ($params['c'] != SITE_ID) {
             //get instance Thethao_Model_Category
             $objCategory = Thethao_Model_Category::getInstance();
             //get detail cate current
             $cateDetail = $objCategory->getDetailByCateId($params['c']);
             //Check menu detail
             if (is_array($cateDetail)) {
                 $href .= $cateDetail['link'];
             }
             //end if
         }
     }
     //Redirec
     $this->_redirect($href, array('code' => 301));
     exit;
 }