Ejemplo n.º 1
0
 /**
  * ajaxpaging action
  */
 public function ajaxpagingAction()
 {
     // Disable render layout
     $this->_helper->layout->disableLayout(true);
     // Set not render view
     $this->_helper->viewRenderer->setNoRender(true);
     // Default response
     $response = array('error' => 0, 'msg' => 'Success', 'html' => NULL);
     //get page of cate
     $intPage = $this->_request->getParam('page', 1);
     //Get album
     $newsModel = Thethao_Model_News::getInstance();
     //trang 1 - offset 0 - get 21
     //trang 2 - offset 21 - get 18
     //trang 3 - offset 39 - get 18
     //trang 4 - offset 57 - get 18
     //format param
     $arrParam = array('category_id' => CATE_ID_PHOTO, 'limit' => 24, 'offset' => ($intPage - 2) * 24 + 27);
     //get all article by rule 2
     $arrAlbum = $newsModel->getListArticleIdsByRule2($arrParam);
     if (!empty($arrAlbum['data'])) {
         //set id
         $this->view->objArticle->setIdBasic($arrAlbum['data']);
     }
     //InitParam Paging
     $arrParamPaging = array('total' => $arrAlbum['total'], 'page' => $intPage, 'perpage' => 27, 'classPagination' => 'pagination_news right');
     // Assign to view
     $this->view->assign(array('arrData' => $arrAlbum['data'], 'arrParamPaging' => $arrParamPaging));
     //Render view
     $response['html'] = $this->view->render('photo/ajax_paging.phtml');
     //Return Json
     echo Zend_Json::encode($response);
 }
Ejemplo n.º 2
0
 function listcategoryAction()
 {
     // get news model
     $modelNews = Thethao_Model_News::getInstance();
     // get params
     $intCateId = $this->_request->getParam('category_id');
     $offset = $this->_request->getParam('offset');
     $limit = $this->_request->getParam('limit');
     $exclude = $this->_request->getParam('exclude', '');
     if (empty($exclude)) {
         $arrExclude = array();
         $totalExclude = 0;
     } else {
         $arrExclude = explode(',', $exclude);
         $totalExclude = count($arrExclude);
     }
     // init params array
     $arrParams = array('category_id' => $intCateId, 'article_type' => NULL, 'offset' => $offset, 'limit' => $limit + $totalExclude);
     // get news by rule 2: set folder X + liston into folder X
     // => order : publish date DESC, priority DESC, publish time DESC
     $arrData = $modelNews->getListArticleIdsByRule2($arrParams);
     $arrResult = array('error' => 0, 'offset' => $offset + $limit, 'total' => count($arrData['data']), 'exclude' => '', 'html' => '');
     if (empty($arrData['data'])) {
         $arrResult['error'] = 1;
         $arrResult['message'] = 'Dữ liệu đã được tải hết';
     } else {
         $arrData['data'] = array_slice(array_diff($arrData['data'], $arrExclude), 0, $limit);
         //set data exclude return
         $arrResult['exclude'] = implode(',', array_slice($arrData['data'], -5, 5));
         $this->view->assign(array('arrData' => $arrData['data'], 'intCategoryId' => $intCateId));
         //set obj get Article
         $this->view->objArticle->setIdBasic($arrData['data']);
         $arrResult['html'] = $this->view->render('mobile/listcategory.phtml');
     }
     echo Zend_Json::encode($arrResult);
 }
Ejemplo n.º 3
0
 /**
  * Get data action
  */
 public function getdataAction()
 {
     //set header
     header('Access-Control-Allow-Origin: *');
     header('Access-Control-Allow-Methods: GET');
     //set cache
     $this->_request->setParam('cache_file', 1);
     //Set no render
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     //Get param
     $arrParam = $this->_request->getParams();
     //XSS
     $arrParam['block'] = trim(strip_tags($arrParam['block']));
     $arrParam['data'] = trim(strip_tags($arrParam['data']));
     //Set response
     $response = array('error' => 1, 'html' => '');
     //check block to get view
     switch ($arrParam['block']) {
         case 'video':
             if (!empty($arrParam['data'])) {
                 //set data to view
                 $dataView = array('data' => explode(',', $arrParam['data']), 'info' => array('share_url' => 'http://video.vnexpress.net/the-thao/', 'name' => 'Video'));
                 //set id basic
                 $this->view->objArticle->setIdBasic($dataView['data']);
                 //assign to view
                 $this->view->assign(array('layout' => array('title' => 'Video Nhạc'), 'data' => $dataView));
                 //set response
                 $response['error'] = 0;
                 $response['html'] = $this->view->render('/block/left_3photo_carousel.phtml');
             }
             //end if
             break;
     }
     //end switch case
     //end code data
     $jsonData = Zend_Json::encode($response);
     # JSON if no callback
     if (!isset($arrParam['callback'])) {
         echo $jsonData;
         exit;
     }
     //init model new
     $modelNew = Thethao_Model_News::getInstance();
     # JSONP if valid callback
     if ($modelNew->isValidCallback($arrParam['callback'])) {
         echo "{$arrParam['callback']}({$jsonData})";
         exit;
     }
 }
Ejemplo n.º 4
0
 /**
  * cate folder page
  * @author HungNT1
  */
 public function indexAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     //get instance Cate
     $objCate = Thethao_Model_Category::getInstance();
     //get cate id by cate code
     $intCateId = $objCate->getIdByCode($this->_request->getParam('cate_code', SITE_ID));
     //get page of cate
     $intPage = $this->_request->getParam('page', 1);
     //check cate id is not exists
     if ($intCateId < 1) {
         $this->_redirect("/");
     }
     // Get Category detail
     $cateDetail = $objCate->getDetailByCateId($intCateId);
     //str link
     $strLink = $this->_request->getPathInfo();
     if (strpos(rtrim($strLink, '/'), $cateDetail['link']) === FALSE) {
         $this->_redirect($this->view->configView['url'] . $cateDetail['link'], array('code' => 301));
     }
     //init param to get list data with rule 2
     $arrParamNews = array('category_id' => $intCateId, 'article_type' => NULL, 'limit' => LIMIT_LIST, 'offset' => ($intPage - 1) * LIMIT_LIST);
     //init model news
     $objNews = Thethao_Model_News::getInstance();
     //get list article with rule 2 list on Thethao
     $arrListData = $objNews->getListArticleIdsByRule2($arrParamNews);
     $arrArticleExclude = array();
     $arrHotNews = array();
     //get Instance Block
     $objBlock = Thethao_Plugin_Block::getInstance();
     if (1 == $intPage && !empty($arrListData['data'])) {
         //check bai thuong mai, chi so sanh o trang 1 ma thoi
         $zoneID = Thethao_Global::getZoneByCateId($intCateId);
         if ($zoneID != 0) {
             $modelBlock = Fpt_Data_News_Block::getInstance();
             $modelBlock->setZoneId($zoneID);
             $arrListData['data'] = $modelBlock->getNewsByZone($zoneID, $arrListData['data']);
         }
         $arrArticleExclude = $arrListData['data'];
         // set exclude article id from arrData
         $objBlock->setExclude($arrListData['data']);
         $arrHotNews = array_slice($arrListData['data'], 0, LIMIT_TOP);
         $arrListData['data'] = array_diff($arrListData['data'], $arrHotNews);
         // set id from $arrListPaging to get article
         $this->view->objArticle->setIdBasic($arrHotNews);
     }
     // set id from $arrListPaging to get article
     $this->view->objArticle->setIdBasic($arrListData['data']);
     //check if page > max page then return to max page
     if ($arrListData['total'] > 0) {
         $maxPage = ceil($arrListData['total'] / LIMIT_LIST);
         if ($intPage > $maxPage) {
             $this->_redirect($this->configView['url'] . $cateDetail['link'] . '/page/' . $maxPage . '.html');
         }
     }
     //InitParam Paging
     $arrParamPaging = array('total' => $arrListData['total'], 'page' => $intPage, 'url' => $this->view->configView['url'] . $cateDetail['link'] . '/page', 'perpage' => LIMIT_LIST, 'classPagination' => 'pagination_news right', 'extEnd' => '.html', 'separate' => '/');
     //Set param
     $this->_request->setParam('block_cate', $intCateId);
     //Param calendar
     $parserParent = SITE_ID;
     $parserChild = $intCateId;
     $parserChildRecursive = 0;
     if (!empty($cateDetail['full_parent']) && DEVICE_ENV != 1) {
         $nParser = count($cateDetail['full_parent']);
         switch ($nParser) {
             case 1:
                 $parserChild = $cateDetail['full_parent'][0];
                 $parserChildRecursive = $intCateId;
                 break;
             case 2:
             default:
                 $parserChild = $cateDetail['full_parent'][0];
                 $parserChildRecursive = $cateDetail['full_parent'][1];
                 break;
         }
         //end switch
     }
     //end if
     //gan meta data
     $titleMenta = $keywords = $cateDetail['catename'] . ' - VnExpress Thể Thao';
     $description = $cateDetail['catename'] . ' - VnExpress Thể Thao';
     switch ($intCateId) {
         case CATE_ID_BONGDA:
             $titleMenta = 'Lưu trữ tin tức bóng đá thể thao – Bóng đá thể thao';
             $description = 'Lưu trữ tin tức hình ảnh các ngôi sao thể thao,bóng đá,hậu trường thể thao';
             $keywords = 'Bong da,the thao,tin tuc bong đá, bóng đá 24h';
             break;
         case CATE_ID_BONGDATRONGNUOC:
             $titleMenta = 'Tin tức, bình luận, Tin tức thể thao trong nước mới nhất, V-League, VFF – Bóng đá trong nước';
             $description = 'Thông tin mới nhất về THỂ THAO TRONG NƯỚC, Liên đoàn Bóng Đá Việt Nam, các giải đấu, lịch thi đấu V League, VFF, ĐTQG, Cúp Quốc Gia, Giải Hạng Nhất, U19, U23';
             $keywords = 'Tin tức, bong da, bóng đá việt nam,V-League, VFF bóng đá trong nước';
             break;
         case CATE_ID_NGOAIHANGANH:
             $titleMenta = 'Tin tức, bình luận, video, lịch thi đấu bóng đá giải - Ngoại hạng Anh';
             $description = 'Ngoại hạng Anh - Tin tức giải Premier League , Video bàn thắng, bảng xếp hạng, lịch thi đấu Ngoại hạng Anh, liên tục trên thể thao vnexpress';
             $keywords = 'Giải ngoại hạng Anh , ngoai hang anh , bong da ngoai hang anh , bong da anh , tin bong da , bong da quoc te , bao bong da';
             break;
         case CATE_ID_BEHINDS_SCENES:
             $titleMenta = 'Lưu trữ tin tức hậu trường thể thao';
             $description = 'Lưu trữ tin tức hình ảnh các ngôi sao thể thao,bóng đá,hậu trường thể thao';
             $keywords = 'Hau truong,the thao,bong da';
             break;
         case CATE_ID_CACMONKHAC:
             $titleMenta = 'Tin nhanh,hình ảnh,video kết quả thi đấu các môn thể thao khác';
             $description = 'Tin tức,hình ảnh,video các môn thể thao khác';
             $keywords = 'Bong da,the thao,tin tuc';
             break;
         case CATE_ID_TENNIS:
             $titleMenta = 'Tin tức quần vợt, tennis, lịch thi đấu, video trực tuyến - Tennis';
             $description = 'Cập nhật nhanh tin tức Quần vợt mới nhất hôm nay. Xem kết quả, lịch thi đấu, video clip thể thao Tennis trực tuyến Online tại Việt Nam & Thế giới.';
             $keywords = 'tennis 24h, quan vot, tennis truc tuyen , tennis online, tin tuc tennis, lich thi dau tennis';
             break;
         case CATE_ID_RACING:
             $titleMenta = 'Đua xe - Thể thao VnExpress';
             $description = 'Cập nhật nhanh tin tức, video các giải đua xe trong và ngoài nước.';
             $keywords = 'Đua xe, tay dua, cong thuc 1 , du axe F1';
             break;
         case CATE_ID_AFFCUP:
             $titleMenta = 'Aff Cup 2012 - Tin tức, hình ảnh ,video mới nhất về AFF Cup 2012 - VnExpress';
             $description = 'Cập nhật liên tục tin tức mới nhất về giải bóng đá Đông Nam Á - AFF cup 2012 tổ chức tại Malaysia và Thái Lan';
             $keywords = 'aff cup 2012,bong da,the thao';
             break;
         case CATE_ID_CHESS:
             $titleMenta = 'Cờ Vua: Lịch thi đấu, giải thi đấu cờ vua - VnExpress Thể Thao';
             $description = 'Tin tức nhanh về thông tin các giải thi đấu cờ vua Quốc tế, giải thi đấu tại Việt Nam cùng các cờ thủ xuất sắc nhất';
             $keywords = 'Tin tức nhanh về thông tin các giải thi đấu cờ vua Quốc tế, giải thi đấu tại Việt Nam cùng các cờ thủ xuất sắc nhất';
             break;
         case CATE_ID_GOLF:
             $titleMenta = 'Tin Golf Việt Nam: Giải đấu và lịch thi đấu môn đánh Golf – Golf thể thao';
             $description = 'Tin tức, video đánh giá bình luận về Golf, nhận xét các giải đấu trong nước, quốc tế cùng hướng dẫn các kỹ năng chơi Golf dành cho giới kinh doanh, Golf thủ Việt Nam..';
             $keywords = 'Golf thủ, tay golf,tin tức golf, giải golf, Presidents Cup, FLC Golf Championship 2015';
             break;
         default:
             $titleMenta = 'Tin tức, bình luận, video, lịch thi đấu bóng đá giải - ' . $cateDetail['catename'];
             $description = 'Tin nhanh,tin tức với hình ảnh,Video clip,bình luận về các giải bóng đá: ' . $cateDetail['catename'];
             $keywords = 'Tin tức, bong da, the gioi';
     }
     //Assign to view
     $this->view->assign(array('intCategoryId' => $intCateId, 'arrHotNews' => $arrHotNews, 'arrParamPaging' => $arrParamPaging, 'arrData' => $arrListData['data'], 'parserParent' => $parserParent, 'parserChild' => $parserChild, 'parserChildRecursive' => $parserChildRecursive, 'arrArticleExclude' => $arrArticleExclude, 'paramsBlock' => Zend_Json::encode(array('pagecode' => 'default_category_index_' . $intCateId, 'exclude' => implode(',', $objBlock->getExclude()))), 'ogType' => 'website', 'ogTitle' => $titleMenta, 'ogUrl' => $this->view->configView['url'] . $cateDetail['link'], 'ogImage' => 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => $description));
     //init cate for set menu
     $idCateMenu = $cateDetail['parent_id'] == SITE_ID ? $intCateId : $cateDetail['parent_id'];
     //set cate active
     $this->_request->setParam('cateActiveId', $intCateId);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', $idCateMenu);
     // Set metadata tags
     $this->view->headTitle()->prepend($titleMenta);
     $this->view->headMeta()->setName('description', $description)->setName('keywords', $keywords);
     if (DEVICE_ENV != 1) {
         //ad js
         $this->view->headScript()->appendFile($this->view->configView['vnecdn']['js'] . '/utils/calendar/calendar.js');
     } else {
         //Set no render view
         $this->_helper->viewRenderer->setNoRender(true);
         echo $this->view->render('mobile/index.phtml');
     }
 }
Ejemplo n.º 5
0
 /**
  * delete related list news when delete article from BE editor
  * @param array $arrArticleDetail old detail article
  * @return array
  * @author PhuongTN
  * @todo thethao
  */
 public function deleteArticle($arrArticleDetail)
 {
     try {
         $arrResponse = array();
         //get app conf
         $config = Thethao_Global::getApplicationIni();
         //get list rule category
         $this->getArticleForJob($arrArticleDetail);
         //get news nosql instance
         $newsNosql = $this->factory('Article', $config['database']['nosql']['adapter']);
         //call deletea list
         $arrResponse['nosql_article'] = $newsNosql->deleteArticle($arrArticleDetail);
         //init model news
         $modelNews = Thethao_Model_News::getInstance();
         //precache rule 3 cho site seagames
         $param_rule3 = array('category_id' => SEA_GAMES, 'offset' => 0, 'limit' => 1);
         $arrResponse['rule3'] = $modelNews->getListArticleIdsByRule3($param_rule3);
     } catch (Exception $ex) {
         Thethao_Global::sendLog($ex);
     }
     //return data
     return $arrResponse;
 }
Ejemplo n.º 6
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;
 }
Ejemplo n.º 7
0
 /**
  * @author      : VinhNT
  * @name        : photoAction
  * @copyright   : FPT Online
  * @todo        : photo Action
  */
 public function photoAction()
 {
     // set cache
     $this->_request->setParam('cache_file', 1);
     // get article id
     $id = (int) $this->_request->getParam('id', 0);
     // get view app
     $viewApp = $this->_request->getParam('view', '');
     // get article instance
     $artInstance = $this->view->objArticle;
     // get full detail article
     $arrData = $artInstance->getArticleFull($id);
     $intCategoryId = $arrData['category_id'];
     //check sea games
     $arrCateOther = array(SEA_GAMES, CATE_SEA_GAMES_BENLE, CATE_SEA_GAMES_BONGDA, CATE_SEA_GAMES_BINHLUAN, CATE_SEA_GAMES_CACMONKHAC, CATE_SEA_GAMES_THONGTIN, CATE_SEA_GAMES_ANH);
     //check cate in array other
     if (in_array($intCategoryId, $arrCateOther)) {
         $link_other = str_replace('http://thethao.vnexpress.net', 'http://seagames.vnexpress.net', $arrData['share_url']);
         $this->_redirect($link_other . ($viewApp == 'app' ? '?view=app' : ''), array('code' => 301));
     }
     // check $arraData
     if (empty($arrData)) {
         $this->_redirect('/');
     }
     // check publish time security
     // bai hen gio
     if (intval($arrData['publish_time']) > time()) {
         $sig = md5($id . $arrData['creation_name']);
         if ($sig != $this->_request->getParam('sig')) {
             $this->_redirect($this->view->configView['linkerror'][DEVICE_ENV], array('code' => 301));
         }
     }
     // link string
     $strLink = $this->view->configView['url'] . $this->_request->getPathInfo();
     if (APPLICATION_ENV != 'development' && $strLink != $arrData['share_url']) {
         $this->_redirect($arrData['share_url'] . ($viewApp == 'app' ? '?view=app' : ''), array('code' => 301));
     }
     // set category id into cateid param
     $this->_request->setParam('cateid', CATE_ID_PHOTO);
     // set category id into block_cate param
     $this->_request->setParam('block_cate', CATE_ID_PHOTO);
     //Set params
     $arrParams = array('article_id' => $arrData['article_id'], 'limit' => LIMIT_PHOTO, 'offset' => 0);
     // Get list object reference
     $arrReference = $artInstance->getObjectReferenceByArticleId($arrParams);
     //chia se anh
     $refer = $this->_request->getParam('refer', 0);
     $selected = 0;
     $thumbImage = '';
     if ($refer > 0) {
         $i = 1;
         foreach ($arrReference['data'] as $dt) {
             if ($refer == $dt['reference_id']) {
                 $selected = $i;
                 /// xac dinh vi tri can share
                 $thumbImage = $this->view->Imageurl($dt['url'], 'size2');
                 break;
             }
             //end if
             $i++;
         }
         //end foreach
     }
     //end if
     //check view app
     if (!empty($viewApp) && $viewApp == 'app') {
         //Disable layout
         $this->_helper->layout->disableLayout(true);
         //Trim data
         $arrData['title'] = trim($arrData['title']);
         $arrData['title_format'] = trim($arrData['title_format']);
         $arrData['lead'] = trim($arrData['lead']);
         // Assign to view
         $this->view->assign(array('arrArticleDetail' => $arrData, 'arrPhoto' => $arrReference['data'], 'intCategoryId' => $intCategoryId, 'intArticleId' => $id, 'ogType' => 'website', 'ogTitle' => $arrData['title_format'] . ' - VnExpress Thể Thao', 'ogUrl' => $arrData['share_url'], 'ogImage' => !empty($arrData['thumbnail_url']) ? $this->view->ImageurlArticle($arrData, 'size2', -1) : 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => trim(strip_tags(html_entity_decode($arrData['lead'], ENT_COMPAT, 'UTF-8')))));
         // SEO
         $arrKeyword = array();
         $arrData['title'] = html_entity_decode($arrData['title'], ENT_QUOTES, 'UTF-8');
         $this->view->headTitle($arrData['title'] . ' - VnExpress Thể Thao');
         $this->view->headMeta()->setName('description', trim(strip_tags(html_entity_decode($arrData['lead'], ENT_COMPAT, 'UTF-8'))))->setName('keywords', join(',', $arrKeyword));
         echo $this->view->render('detail/app-photo.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($arrData['list_topic_id'])) {
         //init model topic
         $modelTopic = new Fpt_Data_News_Topic();
         // init topic params
         $arrTopicParams = array('site_id' => 1000000, 'topic_id' => $arrData['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 ($arrData['list_topic_id'] as $index => $topic_id) {
                 if (isset($arrTopic[$topic_id]['data'][$id])) {
                     unset($arrTopic[$topic_id]['data'][$id]);
                     $arrTopic[$topic_id]['total'] = $arrTopic[$topic_id]['total'] - 1;
                 }
                 if (empty($arrTopic[$topic_id]['data'])) {
                     unset($arrData['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($arrData['list_topic_full'][$temp_topic_id]) ? $arrData['list_topic_full'][$temp_topic_id] : array_shift($arrData['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);
             $artInstance->setIdBasic($arrTopic);
         }
     }
     //end get topic of article detail
     //check neu empty data topic + link cheo moi xuat recommend
     if (empty($arrTopic) && empty($arrData['list_reference_sites_id'])) {
         // Recommendation
         $arrRecommendParams = array('article_id' => $id, '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($id));
             $arrRecommend['data'] = array_slice($arrRecommend['data'], 0, LIMIT_TOPIC_DETAIL_STYLE_1);
             // set to article instance
             $this->view->objArticle->setIdBasic($arrRecommend['data']);
         }
     }
     // GET OTHER NEWS
     // get news model
     $newsModel = Thethao_Model_News::getInstance();
     // array param for other news
     $arrOtherNewsParams = array('category_id' => $arrData['category_id'], 'offset' => 0, 'limit' => LIMIT_OTHER_NEWS + 1, 'article_type' => NULL);
     //  get other news
     $arrOtherNews = $newsModel->getListArticleIdsByRule2($arrOtherNewsParams);
     // check data empty
     $intKeyExists = false;
     if (is_array($arrOtherNews) && !empty($arrOtherNews['data'])) {
         // find id in array other news data
         $intKeyExists = array_search($id, $arrOtherNews['data']);
         // if id exist in other news
         if ($intKeyExists !== false) {
             unset($arrOtherNews['data'][$intKeyExists]);
         }
         $arrOtherNews['data'] = array_slice($arrOtherNews['data'], 0, LIMIT_OTHER_NEWS);
     }
     // set id to article instance
     if (!empty($arrOtherNews['data'])) {
         $artInstance->setIdBasic($arrOtherNews['data']);
     }
     //Trim data
     $arrData['title'] = trim($arrData['title']);
     $arrData['title_format'] = trim($arrData['title_format']);
     $arrData['lead'] = trim($arrData['lead']);
     ///////////////get audio ///////////////////////
     $urlSongMp3 = '';
     if (!empty($arrData['list_object_type']) && !empty($arrData['list_object_type'][OBJECT_TYPE_SONG])) {
         $fwSong = $this->view->objObject->getSong();
         $songId = $arrData['list_object_type'][OBJECT_TYPE_SONG][0];
         //OBJECT_SONG=1
         $songDetail = $fwSong->setId($songId)->getDetailObjectBasic($songId);
         if (!empty($songDetail)) {
             $urlSongMp3 = $songDetail['link_url'] . '/' . $songDetail['location'];
         }
         //end if
     }
     //end if
     $strMetaImage = !empty($arrData['thumbnail_url']) ? $this->view->ImageurlArticle($arrData, 'size2') : 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg';
     // assign params to view
     $this->view->assign(array('arrRecommend' => $arrRecommend, 'arrArticleDetail' => $arrData, 'arrPhoto' => $arrReference['data'], 'arrOrtherArticle' => $arrOtherNews['data'], 'flagExc' => $intKeyExists !== false ? 1 : 0, 'totalPageOtherNews' => $arrOtherNews['total'], 'intPage' => 1, 'intCategoryId' => CATE_ID_PHOTO, 'intOtherCate' => $arrData['category_id'], 'intArticleId' => $id, 'isArticleHotVnE' => $arrData['privacy'] & 512, 'isArticlePhoto' => true, 'topic_show_style' => $topic_show_style, 'arrTopic' => $arrTopic, 'arrTopicDetail' => $arrTopicDetail[$temp_topic_id], 'ogType' => 'website', 'ogTitle' => $arrData['title_format'] . ' - VnExpress Thể Thao', 'ogUrl' => $arrData['share_url'], 'ogImage' => !empty($thumbImage) ? $thumbImage : $strMetaImage, 'ogDescription' => trim(strip_tags(html_entity_decode($arrData['lead'], ENT_COMPAT, 'UTF-8'))), 'breakCumbOther' => array(), 'imageShare' => $selected, 'urlSongMp3' => $urlSongMp3));
     if (DEVICE_ENV != 1) {
         $this->view->headScript()->appendFile($this->view->configView['vnecdn']['js'] . '/utils/slideshow/ImgFullscreen.js');
     }
     //end if
     // Prepend title
     $this->view->headTitle()->prepend(html_entity_decode($arrData['title'], ENT_COMPAT, 'UTF-8') . ' - VnExpress Thể thao');
     $this->view->headMeta()->setName('description', trim(strip_tags(html_entity_decode($arrData['lead'], ENT_COMPAT, 'UTF-8'))) . ' - VnExpress Thể Thao')->setName('keywords', $arrData['title_format'] . ' - VnExpress Thể Thao');
 }
Ejemplo n.º 8
0
 /**
  * @todo - Worldcup home page
  * @author PhongTX
  */
 public function indexAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     // Get block cate
     $intCateId = $this->_request->getParam('cateid', SEA_GAMES);
     //get Instance New
     $objNews = Thethao_Model_News::getInstance();
     //get Instance Block
     $objBlock = Thethao_Plugin_Block::getInstance();
     //get Instance News
     $objArticle = $this->view->objArticle;
     $arrHotNews = $arrListExclude = array();
     //get 1 tin build top for seagame
     $arrParams = array('area' => array(array('category_id' => SITE_ID, 'showed_area' => 'seagames')), 'offset' => 0, 'limit' => 1);
     //get Box Hot News
     $arrHotNews = $objArticle->getTopHotArticleByArr($arrParams);
     //khoi tao arrHotExclude
     $arrHotExclude = $arrListExclude = array();
     if (!empty($arrHotNews)) {
         //each data $arrHotNews
         foreach ($arrHotNews[0] as $key => $rows) {
             //check $arrHotNews is article
             if ($rows['article_id'] > 0) {
                 //set article Hot to Exclude
                 $arrHotExclude[] = $rows['article_id'];
             }
         }
     }
     //get 5 tin with rule 3 of cate seagames
     $paramTopNews = array('category_id' => SEA_GAMES, 'offset' => 0, 'limit' => LIMIT_TOP_NEWS + 1);
     $arrDataRule3 = $objNews->getListArticleIdsByRule3($paramTopNews);
     //check and remove hot news in top news
     $arrTopNews = array_slice(array_diff($arrDataRule3['data'], $arrHotExclude), 0, LIMIT_TOP_NEWS);
     $arrDataExclude = array_merge($arrHotExclude, $arrTopNews);
     //set exclude
     $objBlock->setExclude($arrDataExclude);
     //set obj get Article
     $objArticle->setIdBasic($arrDataExclude);
     //get video with rule 1
     $arrParamVideo = array('category_id' => CATE_SEA_GAMES_VIDEO, 'article_type' => TYPE_VIDEO, 'limit' => LIMIT_VIDEO + LIMIT_TOP_NEWS + 1, 'offset' => 0, 'withcore' => FALSE);
     //category_id, article_type, limit, offset, withcore
     //get list video with rule 1
     $arrTmp = $objNews->getListArticleIdsByRule1($arrParamVideo);
     $arrListVideo = array_slice(array_diff($arrTmp['data'], $arrDataExclude), 0, LIMIT_VIDEO);
     // set id from $arrListPaging to get article
     $objArticle->setIdBasic($arrListVideo);
     //get photo seagame with rule 1
     $arrParamPhoto = array('category_id' => CATE_SEA_GAMES_ANH, 'limit' => LIMIT_PHOTO + LIMIT_TOP_NEWS + 1, 'offset' => 0, 'article_type' => TYPE_PHOTO);
     //get list video with rule 1
     $arrTmp = $objNews->getListArticleIdsByRule1($arrParamPhoto);
     $arrListPhoto = array_slice(array_diff($arrTmp['data'], $arrDataExclude), 0, LIMIT_PHOTO);
     // set id from $arrListPaging to get article
     $objArticle->setIdBasic($arrListPhoto);
     //init list cate to get rule 1
     $arrListCate = array(CATE_SEA_GAMES_BONGDA => 3, CATE_SEA_GAMES_CACMONKHAC => 3, CATE_SEA_GAMES_BENLE => 4, CATE_SEA_GAMES_BINHLUAN => 4);
     $arrParamOther = array('category_id' => 0, 'limit' => LIMIT_TOP_NEWS + 1, 'offset' => 0);
     $arrListOther = array();
     foreach ($arrListCate as $cateId => $limit) {
         //init param to get data
         $arrParamOther['category_id'] = $cateId;
         $arrParamOther['limit'] = $arrParamOther['limit'] + $limit;
         $arrTmp = $objNews->getListArticleIdsByRule1($arrParamOther);
         $arrListOther[$cateId] = array_slice(array_diff($arrTmp['data'], $arrDataExclude), 0, $limit);
         // set id from $arrListPaging to get article
         $objArticle->setIdBasic($arrListOther[$cateId]);
     }
     //set block cate and cate active
     $this->_request->setParam('block_cate', $intCateId);
     //init cate for set menu
     //set cate active
     $this->_request->setParam('cateActiveId', $intCateId);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', SEA_GAMES);
     //Assign to view
     $this->view->assign(array('intCategoryId' => SEA_GAMES, 'arrHotNews' => $arrHotNews[0], 'arrTopNews' => $arrTopNews, 'arrListVideo' => $arrListVideo, 'arrListPhoto' => $arrListPhoto, 'arrOtherNews' => $arrListOther, 'offsetMore' => LIMIT_LIST, 'arrListExclude' => $arrDataExclude, 'isHome' => 1, 'ogType' => 'website', 'ogTitle' => 'SEA Games 28, tin tức, video, lịch thi đấu SEA Games - VnExpress', 'ogUrl' => $this->view->configView['url'], 'ogImage' => 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => 'SEA Games 28 - tin nhanh , hình ảnh , video clip bóng đá, lịch thi đấu SEA Games 28 tại Singapore, tường thuật bình luận bóng đá SEA Games 28.'));
     // Set metadata tags
     $this->view->headTitle()->prepend('SEA Games 28, tin tức, video, lịch thi đấu SEA Games - VnExpress');
     $this->view->headMeta()->setName('description', 'SEA Games 28 - tin nhanh , hình ảnh , video clip bóng đá, lịch thi đấu SEA Games 28 tại Singapore, tường thuật bình luận bóng đá SEA Games 28.')->setName('keywords', 'SEA Games 28, tin tuc , bong da');
 }
Ejemplo n.º 9
0
 /**
  * @todo - Worldcup home page
  * @author PhongTX
  */
 public function indexAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     // Get block cate
     $intCateId = $this->_request->getParam('cateid', WORLD_CUP);
     //get page
     $intPage = $this->_request->getParam('page', 1);
     //get Instance New
     $objNews = Thethao_Model_News::getInstance();
     //get Instance Block
     $objBlock = Thethao_Plugin_Block::getInstance();
     //get Instance News
     $objArticle = $this->view->objArticle;
     $arrHotNews = $arrListExclude = array();
     if (1 == $intPage) {
         // Params get hot news
         $arrParams = array('area' => array(array('category_id' => SITE_ID, 'showed_area' => 'worldcup')), 'offset' => 0, 'limit' => 1);
         // Get Box Hot News
         $arrHotNews = $objArticle->getTopHotArticleByArr($arrParams);
         //khoi tao arrHotExclude
         $arrHotExclude = $arrListExclude = array();
         if (!empty($arrHotNews)) {
             //each data $arrHotNews
             foreach ($arrHotNews[0] as $key => $rows) {
                 //check $arrHotNews is article
                 if ($rows['article_id'] > 0) {
                     //set article Hot to Exclude
                     $arrHotExclude[] = $rows['article_id'];
                 }
             }
         }
         //init params to get list article with rule 2, list on folder Thethao
         $arrParamNews = array('category_id' => $intCateId, 'limit' => LIMIT_LIST, 'offset' => 0, 'article_type' => NULL);
         //get list article with rule 2 list on Thethao
         $arrListData = $objNews->getListArticleIdsByRule2($arrParamNews);
         if (!empty($arrHotExclude)) {
             //set obj get Article
             $objArticle->setIdBasic($arrHotExclude);
             $arrListData['data'] = array_diff($arrListData['data'], $arrHotExclude);
         }
         $arrExclude = array_merge($arrHotExclude, $arrListData['data']);
         $objBlock->setExclude($arrExclude);
         //get Exclude
         $arrListExclude = $objBlock->getExclude();
     } else {
         //init params to get list article with rule 2, list on folder Thethao
         $arrParamNews = array('category_id' => $intCateId, 'limit' => LIMIT_LIST, 'offset' => ($intPage - 1) * LIMIT_LIST, 'article_type' => NULL);
         //get list article with rule 2 list on Thethao
         $arrListData = $objNews->getListArticleIdsByRule2($arrParamNews);
     }
     //set obj get Article
     $objArticle->setIdBasic($arrListData['data']);
     //get video
     $arrParamVideo = array('category_id' => CATE_ID_VIDEO, 'limit' => LIMIT_VIDEO + LIMIT_LIST, 'offset' => 0, 'article_type' => TYPE_VIDEO);
     //get list video with rule 1
     $arrListVideo = $objNews->getListArticleIdsByRule1($arrParamVideo);
     if (1 == $intPage && !empty($arrListVideo['data'])) {
         $arrListVideo['data'] = array_diff($arrListVideo['data'], $arrListExclude);
     }
     if (count($arrListVideo['data']) > LIMIT_VIDEO) {
         $arrListVideo['data'] = array_slice($arrListVideo['data'], 0, LIMIT_VIDEO);
     }
     // set id from $arrListPaging to get article
     $objArticle->setIdBasic($arrListVideo['data']);
     //get video
     $arrParamPhoto = array('category_id' => CATE_ID_PHOTO, 'limit' => LIMIT_PHOTO + LIMIT_LIST, 'offset' => 0, 'article_type' => TYPE_PHOTO);
     //get list video with rule 1
     $arrListPhoto = $objNews->getListArticleIdsByRule1($arrParamPhoto);
     if (1 == $intPage && !empty($arrListPhoto['data'])) {
         $arrListPhoto['data'] = array_diff($arrListPhoto['data'], $arrListExclude);
     }
     if (count($arrListPhoto['data']) > LIMIT_PHOTO) {
         $arrListPhoto['data'] = array_slice($arrListPhoto['data'], 0, LIMIT_PHOTO);
     }
     // set id from $arrListPaging to get article
     $objArticle->setIdBasic($arrListPhoto['data']);
     //check if page > max page then return to max page
     if ($arrListData['total'] > 0) {
         $maxPage = ceil($arrListData['total'] / LIMIT_LIST);
         if ($intPage > $maxPage) {
             $this->_redirect($this->configView['url'] . '/page/' . $maxPage . '.html');
         }
     }
     //InitParam Paging
     $arrParamPaging = array('total' => $arrListData['total'], 'page' => $intPage, 'url' => $this->view->configView['url'] . '/page', 'perpage' => LIMIT_LIST, 'classPagination' => 'pagination_news', 'extEnd' => '.html', 'separate' => '/');
     //Set param
     $this->_request->setParam('block_cate', $intCateId);
     //init cate for set menu
     //set cate active
     $this->_request->setParam('cateActiveId', $intCateId);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', WORLD_CUP);
     //Assign to view
     $this->view->assign(array('intCategoryId' => WORLD_CUP, 'arrHotNews' => $arrHotNews[0], 'arrParamPaging' => $arrParamPaging, 'arrData' => $arrListData['data'], 'arrListVideo' => $arrListVideo['data'], 'arrListPhoto' => $arrListPhoto['data'], 'offsetMore' => LIMIT_LIST, 'arrListExclude' => $arrListExclude, 'isHome' => 1, 'ogType' => 'website', 'ogTitle' => 'World Cup 2014 Brazil, tin tức, video, lịch thi đấu World Cup - VnExpress', 'ogUrl' => $this->view->configView['url'], 'ogImage' => 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => 'Fifa World Cup 2014 - tin nhanh , hình ảnh , video clip bóng đá, lịch thi đấu WC 2014 tại Brazil, tường thuật bình luận bóng đá World Cup 2014'));
     if (DEVICE_ENV != 1) {
         //ad js
         $this->view->headScript()->appendFile($this->view->configView['vnecdn']['js'] . '/utils/calendar/calendar.js');
     } else {
         //Set no render view
         $this->_helper->viewRenderer->setNoRender(true);
         echo $this->view->render('mobile/index.phtml');
     }
     // Set metadata tags
     $this->view->headTitle()->prepend('World Cup 2014 Brazil, tin tức, video, lịch thi đấu World Cup - VnExpress');
     $this->view->headMeta()->setName('description', 'Fifa World Cup 2014 - tin nhanh , hình ảnh , video clip bóng đá, lịch thi đấu WC 2014 tại Brazil, tường thuật bình luận bóng đá World Cup 2014.')->setName('keywords', 'World Cup 2014, tin tuc , bong da');
 }
Ejemplo n.º 10
0
 /**
  * Get suggest video
  */
 function vneMoreAction()
 {
     $this->_helper->layout()->disableLayout();
     //Get video id
     $intVideoID = (int) $this->getRequest()->getParam('id', 0);
     $exclude = $this->getRequest()->getParam('exclude', '');
     //dataExclude bao gom ID dang xem va 2 video lien quan
     $dataExclude = isset($exclude) && !empty($exclude) ? explode(',', $exclude) : array();
     $countExclude = count($dataExclude);
     $arrArticle = array();
     if ($intVideoID > 0) {
         //Get model isntance
         $newsModel = Thethao_Model_News::getInstance();
         $modelTag = new Fpt_Data_News_Tag();
         $arrVideoInfo = $this->view->objArticle->getArticleFull($intVideoID);
         $cateID = $intVideoID > 0 && !empty($arrVideoInfo) ? $arrVideoInfo["category_id"] : CATE_ID_VIDEO;
         //get video lien quan
         if (!empty($arrVideoInfo['list_tag_id'])) {
             $arrParams = array('tag_id' => $arrVideoInfo['list_tag_id'], 'article_type' => VIDEO, 'limit' => LIMIT_VIDEO_MORE + $countExclude, 'offset' => 0);
             //get list article by tag
             $arrArticle = $modelTag->getArticleUnionTag($arrParams);
         }
         //excluse video dang xem va 2 video lien quan
         $arrArticle = array_diff($arrArticle, $dataExclude);
         //toltal media
         $totalMedia = count($arrArticle);
         //if total media < 9 then get new video
         if ($totalMedia < LIMIT_VIDEO_MORE) {
             $limit_more = LIMIT_VIDEO_MORE - $totalMedia + $countExclude;
             //( $limitTopHot là total top & hot video)
             $arrParams = array('category_id' => $cateID, 'limit' => $limit_more, 'offset' => 0, 'article_type' => VIDEO);
             //get list articleid new
             $arrNewVideo = $newsModel->getListArticleIdsByRule2($arrParams);
             if (!empty($arrNewVideo["data"])) {
                 //merge media & new video
                 $arrArticle = array_merge($arrArticle, $arrNewVideo["data"]);
             }
         }
         //lay dung so luong hien thi
         $arrArticle = array_slice($arrArticle, 0, LIMIT_VIDEO_MORE);
         if (is_array($arrArticle) && count($arrArticle) > 0) {
             $this->view->objArticle->setIdBasic($arrArticle);
             //get Instance Block
             $objBlock = Thethao_Plugin_Block::getInstance();
             //set excluses
             $objBlock->setExclude($arrArticle);
             $arrArticleResult = array();
             foreach ($arrArticle as $intArticleID) {
                 $arrParams = array('article_id' => $intArticleID, 'limit' => 1, 'offset' => 0);
                 $arrMedia = $this->view->objArticle->getObjectReferenceByArticleId($arrParams);
                 $duration = 0;
                 if (!empty($arrMedia)) {
                     $arrMedia = current($arrMedia);
                     if ($arrMetaData = Zend_Json::decode($arrMedia['meta_data'])) {
                         $duration = (int) $arrMetaData['duration'];
                     }
                 }
                 $arrArticleDetail = $this->view->objArticle->getArticleBasic($intArticleID);
                 $arrArticleDetail['duration'] = $duration;
                 $arrArticleResult[] = $arrArticleDetail;
             }
         }
         $this->view->arrData = $arrArticleResult;
     }
 }
Ejemplo n.º 11
0
 public function trungthuongAction()
 {
     //set cache
     $objNews = Thethao_Model_News::getInstance();
     $this->view->headScript()->appendFile($this->view->configView['vnecdn']['js'] . '/interactions/quiz-game.js');
     $this->_request->setParam('cache_file', 1);
     $strCateCode = $this->_request->getParam('controller');
     $currentDate = new DateTime();
     $currentDate = $currentDate->format('Y-m-d');
     $currentDate = strtotime($currentDate);
     $objNews = Thethao_Model_News::getInstance();
     $date = new DateTime();
     $dateNow = strtotime($date->format('Y-m-d H:i:s'));
     $date8Am = strtotime($date->format('Y-m-d 08:00:00'));
     $minDate = date('Y-m-d', DOVUI_SDATE);
     $minDate = date('Y-m-d 08:00:00', strtotime($minDate . ' + 1 days'));
     $minDate = strtotime($minDate);
     $maxDate = date('Y-m-d', DOVUI_EDATE);
     $maxDate = date('Y-m-d 08:00:00', strtotime($maxDate . ' + 1 days'));
     $maxDate = strtotime($maxDate);
     //var_dump($date->format('Y-m-d H:i:s'),'---',$minDate);die();
     //case 1: Nếu ngày hiện tại lớn hơn SDate + 1 --> Ẩn View danh sách trúng thưởng
     if ($dateNow < $minDate) {
     } else {
         if ($minDate <= $dateNow && $dateNow <= $maxDate) {
             //Nếu thời gian hiện tại lớn hơn 8h sáng thì lấy danh sách trúng thưởng từ 00h đến 23h59 ngày hôm trước (datenow - 1 ngày)
             if ($dateNow >= $date8Am) {
                 $date->sub(new DateInterval('P1D'));
                 $fromDate = strtotime($date->format('Y-m-d 00:00:00'));
                 $toDate = strtotime($date->format('Y-m-d 23:59:59'));
                 //set thời gian truyền vào: fromDate = 00h00p00s & toDate = 23h59p59s của ngày hiện tại - 1
             } else {
                 $date->sub(new DateInterval('P2D'));
                 $fromDate = strtotime($date->format('Y-m-d 00:00:00'));
                 $toDate = strtotime($date->format('Y-m-d 23:59:59'));
                 //set thời gian truyền vào: fromDate = 00h00p00s & toDate = 23h59p59s của ngày hiện tại - 2
             }
         } else {
             //die('456');
             //Nếu thời gian hiện tại lớn hơn 8h sáng thì lấy danh sách trúng thưởng chung cuộc
             if ($dateNow >= $date8Am) {
                 //$date->sub(new DateInterval('P0D'));
                 //                $fromDate = 0;
                 //                $toDate = 0;
                 $date = date('Y-m-d H:i:s', DOVUI_EDATE);
                 $date = new DateTime($date);
                 $date->format('Y-m-d H:i:s');
                 $fromDate = strtotime(date('Y-m-d 00:00:00', DOVUI_EDATE));
                 $toDate = strtotime(date('Y-m-d 23:59:59', DOVUI_EDATE));
                 //set thời gian truyền vào : fromDate = 0 & toDate = 0 (ket qua chung cuộc)
             } else {
                 $date = date('Y-m-d H:i:s', DOVUI_EDATE);
                 $date = new DateTime($date);
                 $date->format('Y-m-d H:i:s');
                 $fromDate = strtotime(date('Y-m-d 00:00:00', DOVUI_EDATE));
                 $toDate = strtotime(date('Y-m-d 23:59:59', DOVUI_EDATE));
                 //set thời gian truyền vào : fromDate = 00h00p00s & toDate = 23h59p59s của EDATE_DOVUI
             }
         }
     }
     $arrAward = $objNews->getListEndAward(array('isGearman' => false, 'object_type' => OBJECT_TYPE_DOVUI, 'award' => AWARD_DOVUI, 'fromdate' => $fromDate, 'todate' => $toDate));
     //Nếu danh sách trả về rỗng
     if (empty($arrAward)) {
         for ($i = 0; $i < 5; $i++) {
             if (empty($arrAward)) {
                 $date->sub(new DateInterval('P1D'));
                 $fromDate = strtotime($date->format('Y-m-d 00:00:00'));
                 $toDate = strtotime($date->format('Y-m-d 23:59:59'));
                 $arrAward = $objNews->getListEndAward(array('isGearman' => false, 'object_type' => OBJECT_TYPE_DOVUI, 'award' => AWARD_DOVUI, 'fromdate' => $fromDate, 'todate' => $toDate));
             } else {
                 break;
             }
         }
     }
     $dateAward = $date;
     $arrAward1 = $objNews->getListAwardByWeek(array('isGearman' => false, 'object_type' => OBJECT_TYPE_DOVUI, 'award' => AWARD_DAY_DOVUI, 'fromdate' => 0, 'todate' => 0), self::getweek(1, 1, 0, 0, 0, 0, 0, 0));
     $arrAward2 = $objNews->getListAwardByWeek(array('isGearman' => false, 'object_type' => OBJECT_TYPE_DOVUI, 'award' => AWARD_DAY_DOVUI, 'fromdate' => 0, 'todate' => 0), self::getweek(2, 1, 0, 0, 0, 0, 0, 0));
     $arrAward3 = $objNews->getListAwardByWeek(array('isGearman' => false, 'object_type' => OBJECT_TYPE_DOVUI, 'award' => AWARD_DAY_DOVUI, 'fromdate' => 0, 'todate' => 0), self::getweek(3, 1, 0, 0, 0, 0, 0, 0));
     $arrAward4 = $objNews->getListAwardByWeek(array('isGearman' => false, 'object_type' => OBJECT_TYPE_DOVUI, 'award' => AWARD_DAY_DOVUI, 'fromdate' => 0, 'todate' => 0), self::getweek(4, 1, 0, 0, 0, 0, 0, 0));
     $arrAward5 = $objNews->getListAwardByWeek(array('isGearman' => false, 'object_type' => OBJECT_TYPE_DOVUI, 'award' => AWARD_DAY_DOVUI, 'fromdate' => 0, 'todate' => 0), self::getweek(5, 1, 0, 0, 0, 0, 0, 0));
     $arrAward6 = $objNews->getListAwardByWeek(array('isGearman' => false, 'object_type' => OBJECT_TYPE_DOVUI, 'award' => AWARD_DAY_DOVUI, 'fromdate' => 0, 'todate' => 0), self::getweek(6, 1, 0, 0, 0, 0, 0, 0));
     $arrAwardBlock = $objNews->getListAwardByWeek(array('isGearman' => false, 'object_type' => OBJECT_TYPE_DOVUI, 'award' => AWARD_DAY_DOVUI, 'fromdate' => 0, 'todate' => 0), self::getweek(1, 0, 0, 0, 0, 0, 0, 0));
     $week = self::getweek(1, 0, $arrAward1, $arrAward2, $arrAward3, $arrAward4, $arrAward5, $arrAward6);
     $this->view->assign(array('strCateCode' => $strCateCode, 'currentDate' => $currentDate, 'arrAward' => $arrAward, 'arrData1' => $arrAward1, 'arrData2' => $arrAward2, 'arrData3' => $arrAward3, 'arrData4' => $arrAward4, 'arrData5' => $arrAward5, 'arrData6' => $arrAward6, 'arrAwardBlock' => $arrAwardBlock, 'dateAward' => $dateAward, 'week' => $week));
     $titleMeta = 'Ðố vui World Cup 2014 - VnExpress';
     $keywords = 'World cup 2014, tin tuc , bong da';
     $description = '';
     //Set param
     $this->_request->setParam('block_cate', WORLD_CUP);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', WORLD_CUP);
     //Add script
     $this->view->headTitle($titleMeta);
     $this->view->headMeta()->setName('description', $description);
     $this->view->headMeta()->setName('keywords', $keywords);
 }
Ejemplo n.º 12
0
$Autoloader->setDefaultAutoloader(array(new Fpt_Autoloader(), 'loadClass'));
//regis name space for thethao
$Autoloader->registerNamespace('Thethao_')->registerNamespace('Fpt_')->registerNamespace('Job_');
//get application conf
$arrConfig = Thethao_Global::getConfig('job');
//new application conf
$application = new Application($arrConfig);
//set to bootstrap params
Zend_Controller_Front::getInstance()->setParam('bootstrap', $application);
//unset applicaion
unset($application);
//Try execute
$result = array();
try {
    //get model news
    $modelNews = Thethao_Model_News::getInstance();
    //get model category
    $modelCategory = Thethao_Model_Category::getInstance();
    //get full array cate
    $arrCate = $modelCategory->getFullCategoryByParentId();
    //only get id
    $arrCate = array_keys($arrCate);
    //add site_id
    $arrCate[] = SITE_ID;
    //clear cache
    $result['interaction'] = $modelNews->clearCacheTop('all', $arrCate);
    //get top view 24h all Site
    $result['top_view_all_site'] = $modelNews->getTopView24hAllSite();
    //Closed all resource
    Thethao_Global::closeResource();
    Fpt_Data_Model::_destruct();
Ejemplo n.º 13
0
 /**
  * function get soccer of footballmatch
  *
  */
 public function soccerAction()
 {
     header('Expires: 60000');
     // cache expires 60s
     //Disable layout
     $this->_helper->layout->disableLayout(true);
     //get id of match
     $matchId = (int) $this->_request->getParam('id');
     //init response
     $respose = array();
     if ($matchId > 0) {
         //get common info of match
         $this->_getInfoMatch();
         switch ($this->_matchDetail['status']) {
             case 1:
                 //tran dau ket thuc
                 $respose['match']['time'] = 'Trước trận đấu';
                 break;
             case 2:
                 //tran dau ket thuc
                 $respose['match']['time'] = 'Kết thúc';
                 break;
             case 4:
                 $respose['match']['time'] = 'Hết hiệp 1';
                 break;
             case 6:
                 $respose['match']['time'] = 'Hết hiệp 2';
                 break;
             case 8:
                 $respose['match']['time'] = 'Hết hiệp phụ thứ nhất';
                 break;
             case 10:
                 $respose['match']['time'] = 'Hết hiệp phụ thứ hai';
                 break;
             case 11:
                 $respose['match']['time'] = 'Penalty';
                 break;
             default:
                 //tran dau dang dien ra
                 $respose['match']['time'] = $this->_matchDetail['matchTime'] . "'";
                 break;
         }
         $score = $this->_matchDetail['goal1'] . ' - ' . $this->_matchDetail['goal2'];
         if ($this->_matchDetail['penalty1'] > 0 || $this->_matchDetail['penalty2'] > 0) {
             $score .= '<p class="txt_11">penalty</p>';
             $score .= '<p style="color:red" class="txt_11">(' . $this->_matchDetail['penalty1'] . ' - ' . $this->_matchDetail['penalty2'] . ')</p>';
         }
         //init match score
         $respose['match']['score'] = $score;
         //init score card
         $respose['match']['card'] = $this->view->render('match/soccer.phtml');
     } else {
         $respose['error'] = array('errorKey' => 'content-not-found');
     }
     $jsonData = Zend_Json::encode($respose);
     # JSON if no callback
     if (!isset($_GET['callback'])) {
         echo $jsonData;
         exit;
     }
     //init model new
     $modelNew = Thethao_Model_News::getInstance();
     # JSONP if valid callback
     if ($modelNew->isValidCallback($_GET['callback'])) {
         echo "{$_GET['callback']}({$jsonData})";
         exit;
     }
 }
Ejemplo n.º 14
0
 /**
  * Page Rss Yahoo
  */
 public function yahooAction()
 {
     $this->_helper->layout->disableLayout();
     $modelNews = Thethao_Model_News::getInstance();
     // Get list article with rule 3
     $arrPamram = array('category_id' => SITE_ID, 'site_id' => SITE_ID, 'offset' => 0, 'limit' => 25);
     $arrTopArticleID = $modelNews->getListArticleIdsByRule3($arrPamram);
     $this->view->assign(array('arrArticle' => $arrTopArticleID['data']));
 }
Ejemplo n.º 15
0
 /**
  * @author      : VinhNT
  * @name        : photoAction
  * @copyright   : FPT Online
  * @todo        : photo Action
  */
 public function photoAction()
 {
     // set cache
     $this->_request->setParam('cache_file', 1);
     // get article id
     $id = (int) $this->_request->getParam('id', 0);
     // get view app
     $viewApp = $this->_request->getParam('view', '');
     // get article instance
     $artInstance = $this->view->objArticle;
     // get full detail article
     $arrData = $artInstance->getArticleFull($id);
     // check $arraData
     if (empty($arrData)) {
         $this->_redirect('/');
     }
     // check publish time security
     // bai hen gio
     if (intval($arrData['publish_time']) > time()) {
         $sig = md5($id . $arrData['creation_name']);
         if ($sig != $this->_request->getParam('sig')) {
             $this->_redirect($this->view->configView['linkerror'][DEVICE_ENV], array('code' => 301));
         }
     }
     //init category of article detail
     $intCategoryId = $arrData['category_id'];
     $arrCateOther = array(SEA_GAMES, CATE_SEA_GAMES_BONGDA, CATE_SEA_GAMES_ANH, CATE_SEA_GAMES_VIDEO, CATE_SEA_GAMES_CACMONKHAC, CATE_SEA_GAMES_BINHLUAN, CATE_SEA_GAMES_BENLE, CATE_SEA_GAMES_THONGTIN);
     //check cate in array other
     if (!in_array($intCategoryId, $arrCateOther)) {
         $this->_redirect($arrData['share_url'] . ($viewApp == 'app' ? '?view=app' : ''), array('code' => 301));
     }
     // link string
     $strLink = $this->_request->getPathInfo();
     if (APPLICATION_ENV != 'development' && strpos($arrData['share_url'], $strLink) === false) {
         $this->_redirect($this->view->ShareurlSeagame($arrData['share_url'] . ($viewApp == 'app' ? '?view=app' : '')), array('code' => 301));
     }
     //Set params
     $arrParams = array('article_id' => $arrData['article_id'], 'limit' => LIMIT_PHOTO_DETAIL, 'offset' => 0);
     // Get list object reference
     $arrReference = $artInstance->getObjectReferenceByArticleId($arrParams);
     //chia se anh
     $refer = $this->_request->getParam('refer', 0);
     $selected = 0;
     $thumbImage = '';
     if ($refer > 0) {
         $i = 1;
         foreach ($arrReference['data'] as $dt) {
             if ($refer == $dt['reference_id']) {
                 $selected = $i;
                 /// xac dinh vi tri can share
                 $thumbImage = $this->view->Imageurl($dt['url'], 'size2');
                 break;
             }
             //end if
             $i++;
         }
         //end foreach
     }
     //end if
     //check view app
     if (!empty($viewApp) && $viewApp == 'app') {
         //Disable layout
         $this->_helper->layout->disableLayout(true);
         //Trim data
         $arrData['title'] = trim($arrData['title']);
         $arrData['title_format'] = trim($arrData['title_format']);
         $arrData['lead'] = trim($arrData['lead']);
         // Assign to view
         $this->view->assign(array('arrArticleDetail' => $arrData, 'arrPhoto' => $arrReference['data'], 'intCategoryId' => $intCategoryId, 'intArticleId' => $id));
         // SEO
         $arrKeyword = array();
         $arrData['title'] = html_entity_decode($arrData['title'], ENT_QUOTES, 'UTF-8');
         $this->view->headTitle($arrData['title'] . ' - VnExpress SEA Games');
         $this->view->headMeta()->setName('description', trim(strip_tags(html_entity_decode($arrData['lead'], ENT_COMPAT, 'UTF-8'))))->setName('keywords', join(',', $arrKeyword));
         echo $this->view->render('detail/app-photo.phtml');
         exit;
     }
     // GET OTHER NEWS
     // get news model
     $newsModel = Thethao_Model_News::getInstance();
     // array param for other news
     $arrOtherNewsParams = array('category_id' => $arrData['category_id'], 'offset' => 0, 'limit' => LIMIT_OTHER_NEWS + 1, 'article_type' => NULL);
     //  get other news
     $arrOtherNews = $newsModel->getListArticleIdsByRule2($arrOtherNewsParams);
     // check data empty
     $intKeyExists = false;
     if (is_array($arrOtherNews) && !empty($arrOtherNews['data'])) {
         // find id in array other news data
         $intKeyExists = array_search($id, $arrOtherNews['data']);
         // if id exist in other news
         if ($intKeyExists !== false) {
             unset($arrOtherNews['data'][$intKeyExists]);
         }
         $arrOtherNews['data'] = array_slice($arrOtherNews['data'], 0, LIMIT_OTHER_NEWS);
     }
     // set id to article instance
     if (!empty($arrOtherNews['data'])) {
         $artInstance->setIdBasic($arrOtherNews['data']);
     }
     //Trim data
     $arrData['title'] = trim($arrData['title']);
     $arrData['title_format'] = trim($arrData['title_format']);
     $arrData['lead'] = trim($arrData['lead']);
     ///////////////get audio ///////////////////////
     $songName = $urlSongMp3 = $artistName = '';
     if (!empty($arrData['list_object_type']) && !empty($arrData['list_object_type'][OBJECT_TYPE_SONG])) {
         $fwSong = $this->view->objObject->getSong();
         $songId = $arrData['list_object_type'][OBJECT_TYPE_SONG][0];
         //OBJECT_SONG=1
         $songDetail = $fwSong->setId($songId)->getDetailObjectBasic($songId);
         if (!empty($songDetail)) {
             $urlSongMp3 = $songDetail['link_url'] . '/' . $songDetail['location'];
             $songName = $songDetail['name_format'];
             //artist
             if (!empty($songDetail['artist_id'])) {
                 $fwArtist = $this->view->objObject->getArtist();
                 $artistDetail = $fwArtist->setId($songDetail['artist_id'][0])->getDetailObjectBasic($songDetail['artist_id'][0]);
                 if (!empty($artistDetail)) {
                     $artistName = $artistDetail['name_format'];
                 }
                 //end if
             }
             //end if
         }
         //end if
     }
     //end if
     $strMetaImage = !empty($arrData['thumbnail_url']) ? $this->view->ImageurlArticle($arrData, 'size2') : 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg';
     //set cate active
     $this->_request->setParam('cateActiveId', $intCategoryId);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', SEA_GAMES);
     // set category id into block_cate param
     $this->_request->setParam('block_cate', CATE_SEA_GAMES_ANH);
     // assign params to view
     $this->view->assign(array('arrArticleDetail' => $arrData, 'arrPhoto' => $arrReference['data'], 'arrOrtherArticle' => $arrOtherNews['data'], 'flagExc' => $intKeyExists !== false ? 1 : 0, 'intPage' => 1, 'intCategoryId' => $arrData['category_id'], 'intOtherCate' => $arrData['category_id'], 'intArticleId' => $id, 'isArticleHotVnE' => $arrData['privacy'] & 512, 'isArticlePhoto' => true, 'ogType' => 'website', 'ogTitle' => $arrData['title_format'] . ' - VnExpress SEA Games', 'ogUrl' => $this->view->ShareurlSeagame($arrData['share_url']), 'ogImage' => !empty($thumbImage) ? $thumbImage : $strMetaImage, 'ogDescription' => trim(strip_tags(html_entity_decode($arrData['lead'], ENT_COMPAT, 'UTF-8'))), 'breakCumbOther' => array(), 'imageShare' => $selected, 'songName' => $songName, 'artistName' => $artistName, 'urlSongMp3' => $urlSongMp3, 'intCateIdPolyAds' => $arrData['category_id'], 'articleTrackingId' => $arrData['article_id']));
     if (DEVICE_ENV != 1) {
         $this->view->headScript()->appendFile($this->view->configView['vnecdn']['js'] . '/utils/slideshow/ImgFullscreen.js');
     }
     //end if
     // Prepend title
     $this->view->headTitle()->prepend(html_entity_decode($arrData['title'], ENT_COMPAT, 'UTF-8') . ' - VnExpress SEA Games');
     $this->view->headMeta()->setName('description', trim(strip_tags(html_entity_decode($arrData['lead'], ENT_COMPAT, 'UTF-8'))) . ' - VnExpress SEA Games')->setName('keywords', $arrData['title_format'] . ' - VnExpress SEA Games');
 }
Ejemplo n.º 16
0
 /**
  * @author   : AnPCD
  * otherphotoAction
  */
 public function otherphotoAction()
 {
     //get limit & offset
     $offset = (int) $this->_request->getParam('offset');
     $limit = (int) $this->_request->getParam('limit');
     //Get album
     $newsModel = Thethao_Model_News::getInstance();
     //format param
     $arrParam = array('category_id' => CATE_ID_PHOTO, 'limit' => $limit, 'offset' => $offset);
     //get all article by rule 2
     $arrAlbum = $newsModel->getListArticleIdsByRule2($arrParam);
     // Assign to view
     $this->view->assign(array('arrData' => $arrAlbum['data']));
     $response = array('error' => 0, 'offset' => $offset + LIMIT_PHOTO_MORE, 'total' => count($arrAlbum['data']), 'html' => '');
     if (!empty($arrAlbum['data'])) {
         //set id
         $this->view->objArticle->setIdBasic($arrAlbum['data']);
         //Render view
         $response['html'] = $this->view->render('mobile/otherphoto.phtml');
     } else {
         $response['error'] = 1;
         $response['msg'] = 'Dữ liệu đã được tải hết';
     }
     //Return Json
     echo Zend_Json::encode($response);
 }
Ejemplo n.º 17
0
 /**
  * Photo Action
  */
 public function photoAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     //Get article id
     $id = (int) $this->_request->getParam('id', 0);
     if (!is_numeric($id) || $id <= 0) {
         $this->_redirect($this->view->configView['linkerror'][DEVICE_ENV]);
     }
     //end if
     //Get full detail article
     $arrData = $this->view->objArticle->getArticleFull($id);
     //valid data
     if (empty($arrData)) {
         $this->_redirect($this->view->configView['linkerror'][DEVICE_ENV]);
     }
     //end if
     //check publish
     if (intval($arrData['publish_time']) > time()) {
         $sig = md5($id . $arrData['creation_time']);
         //gen sig
         if ($sig != $this->_request->getParam('sig')) {
             $this->_redirect($this->view->configView['linkerror'][DEVICE_ENV]);
         }
         //end if
     }
     //end if
     //str link
     $strLink = $this->view->configView['url'] . $this->_request->getPathInfo();
     //replace share_url
     $arrData['share_url'] = $this->view->ShareurlM240($arrData['share_url']);
     //check link
     if ($strLink != $arrData['share_url']) {
         $this->_redirect($arrData['share_url']);
     }
     //end if
     //Set category id for block_cate user in block
     $this->_request->setParam('cateid', $arrData['category_id']);
     //Set params
     $arrParams = array('article_id' => $arrData['article_id'], 'limit' => LIMIT_SLIDESHOW_PHOTO, 'offset' => 0);
     //Get list object reference
     $arrReference = $this->view->objArticle->getObjectReferenceByArticleId($arrParams);
     //********************* Initialize Model Object *************************//
     //News object
     $modelNews = Thethao_Model_News::getInstance();
     //********************* Process Tin khác *************************//
     //Init array params other news
     $arrOtherNewsParams = array('category_id' => $arrData['category_id'], 'limit' => LIMIT_OTHER_NEWS + 1, 'offset' => 0, 'article_type' => TYPE_ALL);
     //Get news by rule 2: folder và liston lên folder của tin đang xem)
     $arrOtherNews = $modelNews->getListArticleIdsByRule2($arrOtherNewsParams);
     //check data empty
     if (is_array($arrOtherNews) && !empty($arrOtherNews['data'])) {
         $intKeyExists = array_search($id, $arrOtherNews['data']);
         if ($intKeyExists !== FALSE) {
             unset($arrOtherNews['data'][$intKeyExists]);
         } elseif (isset($arrOtherNews['data'][LIMIT_OTHER_NEWS])) {
             unset($arrOtherNews['data'][LIMIT_OTHER_NEWS]);
         }
         //end if
     }
     //end if
     //Check empty
     if (!empty($arrOtherNews['data'])) {
         //set obj get Article
         $this->view->objArticle->setIdBasic($arrOtherNews['data']);
     }
     //end if
     //Trim data
     $arrData['title'] = trim($arrData['title']);
     $arrData['title_format'] = trim($arrData['title_format']);
     $arrData['lead'] = trim($this->view->ShareurlM240($arrData['lead']));
     $arrData['content'] = $this->view->ShareurlM240($arrData['content']);
     //********************* Process Meta: title + description + keywords Facebook*************************//
     $strMetaTitle = strip_tags(html_entity_decode($arrData['title'], ENT_COMPAT, 'UTF-8')) . ' - VnExpress Giải Trí';
     $strMetaDescript = strip_tags(html_entity_decode($arrData['lead'], ENT_COMPAT, 'UTF-8')) . ' - VnExpress Giải Trí';
     //Assign to views
     $this->view->assign(array('arrArticleDetail' => $arrData, 'arrPhoto' => $arrReference['data'], 'intCategoryId' => $arrData['category_id'], 'intArticleId' => $arrData['article_id'], 'arrOtherNews' => $arrOtherNews));
     // Prepend title
     $this->view->headTitle()->prepend($strMetaTitle);
     $this->view->headMeta()->setName('description', $strMetaDescript)->setName('keywords', $strMetaTitle);
 }
Ejemplo n.º 18
0
 /**
  * Get table worldcup
  */
 public function tableapiAction()
 {
     //set header
     header('Access-Control-Allow-Origin: *');
     header('Access-Control-Allow-Methods: GET');
     //set cache
     $this->_request->setParam('cache_file', 1);
     //Disable layout
     $this->_helper->layout->disableLayout(true);
     //Set no render view
     $this->_helper->viewRenderer->setNoRender(true);
     //init response
     $respose = array('data' => '', 'error' => 1);
     $modelObject = Fpt_Data_Materials_Object::getInstance();
     // Get models instance
     $modelFootball = Thethao_Model_Football::getInstance();
     //get table with seasonId and leagueId
     $tableRanking = $modelFootball->getListTableRanking(153, 18);
     if (!empty($tableRanking)) {
         //set id object
         $modelObject->getTeam()->setId(array_keys($tableRanking));
         $respose['error'] = 0;
     }
     $respose['data'] = $tableRanking;
     $jsonData = Zend_Json::encode($respose);
     # JSON if no callback
     if (!isset($_GET['callback'])) {
         echo $jsonData;
         exit;
     }
     //init model new
     $modelNew = Thethao_Model_News::getInstance();
     # JSONP if valid callback
     if ($modelNew->isValidCallback($_GET['callback'])) {
         echo "{$_GET['callback']}({$jsonData})";
         exit;
     }
 }
Ejemplo n.º 19
0
 /**
  * cate folder page
  * @author HungNT1
  */
 public function indexAction()
 {
     //set cache
     $this->_request->setParam('cache_file', 1);
     $strCateCode = $this->_request->getParam('cate_code');
     //get instance Cate
     $objCate = Thethao_Model_Category::getInstance();
     //get cate id by cate code
     $intCateId = $objCate->getIdByCode($strCateCode, WORLD_CUP);
     //get page of cate
     $intPage = $this->_request->getParam('page', 1);
     //check cate id is not exists
     if ($intCateId < 1) {
         $this->_redirect("/");
     }
     // Get Category detail
     $cateDetail = $objCate->getDetailByCateId($intCateId);
     //str link
     $strLink = $this->_request->getPathInfo();
     if (strpos(rtrim($strLink, '/'), $cateDetail['link']) === FALSE) {
         //$this->_redirect($this->view->configView['url'] . $cateDetail['link'], array('code' => 301));
     }
     //init param to get list data with rule 2
     $arrParamNews = array('category_id' => $intCateId, 'article_type' => NULL, 'limit' => LIMIT_LIST_CATE, 'offset' => ($intPage - 1) * LIMIT_LIST_CATE);
     //init model news
     $objNews = Thethao_Model_News::getInstance();
     //get list article with rule 2 list on Thethao
     $arrListData = $objNews->getListArticleIdsByRule2($arrParamNews);
     // set id from $arrListPaging to get article
     $this->view->objArticle->setIdBasic($arrListData['data']);
     $arrArticleExclude = array();
     $arrHotNews = $arrListExclude = array();
     if (1 == $intPage && !empty($arrListData['data'])) {
         $arrArticleExclude = $arrListData['data'];
         //get Instance Block
         $objBlock = Thethao_Plugin_Block::getInstance();
         // set exclude article id from arrData
         $objBlock->setExclude($arrArticleExclude);
         $arrHotNews = array_slice($arrListData['data'], 0, LIMIT_TOP);
         $arrListData['data'] = array_diff($arrListData['data'], $arrHotNews);
         //get Exclude
         $arrListExclude = $objBlock->getExclude();
     }
     //get video
     $arrParamVideo = array('category_id' => CATE_ID_VIDEO, 'limit' => LIMIT_VIDEO + LIMIT_LIST_CATE, 'offset' => 0, 'article_type' => TYPE_VIDEO);
     //get list article with rule 2 list on Thethao
     $arrListVideo = $objNews->getListArticleIdsByRule1($arrParamVideo);
     if (1 == $intPage && !empty($arrListVideo['data'])) {
         $arrListVideo['data'] = array_diff($arrListVideo['data'], $arrListExclude);
     }
     if (count($arrListVideo['data']) > LIMIT_VIDEO) {
         $arrListVideo['data'] = array_slice($arrListVideo['data'], 0, LIMIT_VIDEO);
     }
     // set id from $arrListPaging to get article
     $this->view->objArticle->setIdBasic($arrListVideo['data']);
     //get video
     $arrParamPhoto = array('category_id' => CATE_ID_PHOTO, 'limit' => LIMIT_PHOTO + LIMIT_LIST_CATE, 'offset' => 0, 'article_type' => TYPE_PHOTO);
     //get list article with rule 2 list on Thethao
     $arrListPhoto = $objNews->getListArticleIdsByRule1($arrParamPhoto);
     if (1 == $intPage && !empty($arrListPhoto['data'])) {
         $arrListPhoto['data'] = array_diff($arrListPhoto['data'], $arrListExclude);
     }
     if (count($arrListPhoto['data']) > LIMIT_PHOTO) {
         $arrListPhoto['data'] = array_slice($arrListPhoto['data'], 0, LIMIT_PHOTO);
     }
     // set id from $arrListPaging to get article
     $this->view->objArticle->setIdBasic($arrListPhoto['data']);
     //check if page > max page then return to max page
     if ($arrListData['total'] > 0) {
         $maxPage = ceil($arrListData['total'] / LIMIT_LIST_CATE);
         if ($intPage > $maxPage) {
             //$this->_redirect($this->configView['url'] . $cateDetail['link'] . '/page/' . $maxPage . '.html');
         }
     }
     //InitParam Paging
     $arrParamPaging = array('total' => $arrListData['total'], 'page' => $intPage, 'url' => $this->view->configView['url'] . $cateDetail['link'] . '/page', 'perpage' => LIMIT_LIST_CATE, 'classPagination' => 'pagination_news', 'extEnd' => '.html', 'separate' => '/');
     //Set param
     $this->_request->setParam('block_cate', $intCateId);
     //gan meta data
     $titleMeta = $cateDetail['catename'] . ' World Cup 2014 - VnExpress';
     $keywords = 'World cup 2014, tin tuc , bong da';
     $description = 'Fifa World Cup 2014 - tin nhanh , hình ảnh , video clip bóng đá, lịch thi đấu WC 2014 tại Brazil, tường thuật bình luận bóng đá World Cup 2014';
     //Assign to view
     $this->view->assign(array('intCategoryId' => $intCateId, 'arrHotNews' => $arrHotNews, 'arrParamPaging' => $arrParamPaging, 'arrData' => $arrListData['data'], 'arrListVideo' => $arrListVideo['data'], 'arrListPhoto' => $arrListPhoto['data'], 'arrArticleExclude' => $arrArticleExclude, 'arrListExclude' => $arrListExclude, 'ogType' => 'website', 'ogTitle' => $titleMenta, 'ogUrl' => $this->view->configView['url'] . $cateDetail['link'], 'ogImage' => 'http://m.f9.img.vnexpress.net/2014/01/10/fa68f81afe10b727852361b1894ccc74.jpg', 'ogDescription' => $description));
     if (DEVICE_ENV != 1) {
         //ad js
         $this->view->headScript()->appendFile($this->view->configView['vnecdn']['js'] . '/utils/calendar/calendar.js');
     } else {
         //Set no render view
         $this->_helper->viewRenderer->setNoRender(true);
         echo $this->view->render('mobile/category.phtml');
     }
     //init cate for set menu
     //set cate active
     $this->_request->setParam('cateActiveId', $intCateId);
     //set cateid to show active in menu
     $this->_request->setParam('cateid', WORLD_CUP);
     // Set metadata tags
     $this->view->headTitle()->prepend($titleMeta);
     $this->view->headMeta()->setName('description', $description)->setName('keywords', $keywords);
 }
Ejemplo n.º 20
0
 function othernewsAction()
 {
     //Disable layout
     $this->_helper->layout->disableLayout(true);
     // Set not render view
     $this->_helper->viewRenderer->setNoRender(true);
     //New object
     $modelNews = Thethao_Model_News::getInstance();
     $intCategoryId = (int) $this->_request->getParam('category_id', 0);
     $intLimit = (int) $this->_request->getParam('limit');
     $intOffset = (int) $this->_request->getParam('offset');
     $arrExclude = $this->_request->getParam('exclude');
     if (empty($exclude)) {
         $arrExclude = array();
         $totalExclude = 0;
     } else {
         $arrExclude = explode(',', $exclude);
         $totalExclude = count($arrExclude);
     }
     $intOffset = $intOffset - $totalExclude;
     //Init array params other news
     $arrOtherNewsParams = array('category_id' => $intCategoryId, 'article_type' => NULL, 'limit' => $intLimit + $totalExclude, 'offset' => $intOffset);
     //Get other news (Get news by rule 2: folder và liston lên folder của tin đang xem)
     $arrOtherNews = $modelNews->getListArticleIdsByRule2($arrOtherNewsParams);
     //var_dump('<pre>', $arrExclude, $arrOtherNews);die;
     //check data empty
     if (!empty($arrOtherNews['data'])) {
         $arrOtherNews['data'] = array_slice(array_diff($arrOtherNews['data'], $arrExclude), 0, LIMIT_MORE_NEWS);
     }
     //end if
     $this->view->assign(array('arrOtherNews' => $arrOtherNews['data']));
     $arrResult = array('error' => 0, 'offset' => $intOffset + LIMIT_MORE_NEWS, 'total' => count($arrOtherNews['data']), 'exclude' => $arrExclude, 'html' => '');
     if (empty($arrOtherNews['data'])) {
         $arrResult['error'] = 1;
         $arrResult['message'] = 'Dữ liệu đã được tải hết';
     } else {
         //set obj get Article
         $this->view->objArticle->setIdBasic($arrOtherNews['data']);
         $arrResult['html'] = $this->view->render('category/othernews.phtml');
     }
     echo Zend_Json::encode($arrResult);
 }
Ejemplo n.º 21
0
 /**
  * Get block interview in the verticle The Thao
  * @param type $arrParam
  * @return type
  */
 public function getBlockInterView($arrParam)
 {
     $arrReturn = array();
     $objCategory = Thethao_Model_Category::getInstance();
     //get Info Cate
     $arrCate = $objCategory->getInfoCateByBlock($arrParam);
     //Init model
     $modelMews = Thethao_Model_News::getInstance();
     //Get
     $arrReturn = $modelMews->getListArticleIdsByRule2($arrParam);
     if (!empty($arrReturn['data'])) {
         $this->_article->setIdBasic($arrReturn['data']);
         //Init Obj Interview
         $objInterview = Fpt_Data_News_Interview::getInstance();
         //Get Image, Time interview
         $arrParam = array('article_id' => $arrReturn['data'][0]);
         $arrReturn['info']['interview'] = $objInterview->getInterviewInfo($arrParam);
         $arrReturn['info']['cate'] = $arrCate['cate'];
     }
     return $arrReturn;
 }