public function ajaxtennisAction() { // Disable render layout $this->_helper->layout->disableLayout(true); $this->_helper->viewRenderer->setNoRender(true); //get params $gender = $this->_request->getParam('gender', 0); $year = $this->_request->getParam('year', date('Y')); //get instance $tennisModel = Thethao_Model_Tennis::getInstance(); //get list tennis ranking $arrTennisRanking = $tennisModel->getTableTennis($gender, $year); $objTennis = $this->view->objObject->getTennis(); if (!empty($arrTennisRanking)) { //get player tennis id $arrPlayerTennis = array_keys($arrTennisRanking); $objTennis->setId($arrPlayerTennis); } // Assign to view $this->view->assign(array('arrTennisRanking' => $arrTennisRanking, 'gender' => $gender, 'year' => $year, 'objTennis' => $objTennis)); $result = array('error' => 0, 'msg' => 'Success', 'body' => $this->view->render('bang-xep-hang/ajaxtennis.phtml')); echo Zend_Json::encode($result); exit; }
public function tayVotAction() { //Set param $this->_request->setParam('block_cate', SITE_ID); //get params $params = $this->_request->getParams(); $player_id = $params['id'] ? $params['id'] : NULL; $player_name = $params[3] ? $params[3] : NULL; $gender = $this->_request->getParam('gender', 1); $year = $this->_request->getParam('year', date("Y")); //get Tennis's instance $tennisModel = Thethao_Model_Tennis::getInstance(); //init player detail full $arrPlayer = array(); $objTennis = $this->view->objObject->getTennis(); $objTennis->setId($player_id); //get detail player tennis $arrPlayer['info'] = $objTennis->getDetailObjectBasic($player_id); //get static player tennist $statistic = $tennisModel->getTennisPlayerDetail(array($player_id)); $arrPlayer['statistic'] = $statistic[$player_id]; $seoName = Fpt_Filter::setSeoLink($arrPlayer['info']['name']); if ($player_name != $seoName) { $this->_redirect($arrPlayer['info']['share_url']); } //get News's instance $modelNews = $this->view->objArticle; //init param get news of playser $arrParam = array('object_id' => $player_id, 'object_type' => OBJECT_TYPE_TENNIS, 'limit' => 4, 'offset' => 0); $moreID = $modelNews->getObjectNews($arrParam); $modelNews->setIdBasic($moreID['data']); $articleIdPlayer = $moreID['data']; $matchesPlayerAttend = $tennisModel->getMatchesPlayerAttend($player_id, strtotime('-4 months'), time()); $arrMatchesSingle = array(); $arrMatchesDouble = array(); foreach ($matchesPlayerAttend as $key => $value) { //single if ($value['match_type'] == 1) { $objTennis->setId(array($value['player1a'], $value['player2a'])); $value['player1a_info'] = $objTennis->getDetailObjectBasic($value['player1a']); $value['player2a_info'] = $objTennis->getDetailObjectBasic($value['player2a']); array_push($arrMatchesSingle, $value); } //double if ($value['match_type'] == 2) { $objTennis->setId(array($value['player1a'], $value['player2a'], $value['player1b'], $value['player2b'])); $value['player1a_info'] = $objTennis->getDetailObjectBasic($value['player1a']); $value['player1b_info'] = $objTennis->getDetailObjectBasic($value['player1b']); $value['player2a_info'] = $objTennis->getDetailObjectBasic($value['player2a']); $value['player2b_info'] = $objTennis->getDetailObjectBasic($value['player2b']); if ($player_id == $value['player1a']) { $arrMatchesDouble[$value['player1b_info']['name']][$key] = $value; } if ($player_id == $value['player1b']) { $arrMatchesDouble[$value['player1a_info']['name']][$key] = $value; } if ($player_id == $value['player2a']) { $arrMatchesDouble[$value['player2b_info']['name']][$key] = $value; } if ($player_id == $value['player2b']) { $arrMatchesDouble[$value['player2a_info']['name']][$key] = $value; } } } //set breakcumb $breakCumbOther = array('link' => $arrPlayer['info']['share_url'], 'name' => 'Tay vợt'); // Assign to view $this->view->assign(array('arrPlayer' => $arrPlayer, 'totalNews' => $moreID['total'], 'newsPlayer' => $articleIdPlayer, 'gender' => $gender, 'year' => $year, 'seoName' => $seoName, 'categoryID' => CATE_ID_TENNIS, 'player_id' => $player_id, 'arrMatchesSingle' => $arrMatchesSingle, 'arrMatchesDouble' => $arrMatchesDouble, 'breakCumbOther' => $breakCumbOther, 'intCategoryId' => CATE_ID_TENNIS)); // Init menu $this->_request->setParam('cateid', CATE_ID_TENNIS); $this->view->headMeta()->setName('object_id', $player_id); //Head title $this->view->headTitle('Thông tin tay vợt ' . $arrPlayer['info']['name'] . ' - Vnexpress'); //Set image_src headLink $image_src = array('rel' => 'image_src', 'href' => !empty($arrPlayer['info']['thumbnail']) ? $this->view->Imageurl($arrPlayer['info']['thumbnail'], 'size1') : ''); $this->view->headLink($image_src); }
public function chitietAction() { // Disable render layout $this->_helper->layout->disableLayout(true); $this->_helper->viewRenderer->setNoRender(true); $response = array('error' => 0, 'msg' => 'Success', 'html' => NULL); $date = $this->_request->getParam('ngay', NULL); $leagueId = intval($this->_request->getParam('lid', 0)); $group = $this->_request->getParam('g', NULL); $gmt = 7; //1 - mobile , 0 - web, tablet $device = DEVICE_ENV & 1; // Determine group if ($group != 'quoc-te' && $group != 'trong-nuoc') { $group = NULL; } if (!$leagueId) { $leagueId = NULL; } // Determine date to get fixture if (empty($date)) { $unixTime = strtotime(date('Y/m/d')); } else { $unixTime = strtotime($date); } // Get models' instance $footballModel = Thethao_Model_Football::getInstance(); $matchModel = Thethao_Model_Match::getInstance(); $tennisModel = Thethao_Model_Tennis::getInstance(); $objMatch = $this->view->objObject->getMatch(); // Get list league // Quoc te $arrListLeagueQT = $arrListLeagueTN = NULL; if ($group == NULL || $group == 'quoc-te') { $arrListLeagueQT = $footballModel->getListLeagueByGroup(GROUP_FOOTBAL_QT); } if ($group == NULL || $group == 'trong-nuoc') { $arrListLeagueTN = $footballModel->getListLeagueByGroup(GROUP_FOOTBAL_VN); } // Get list matches' id by happen time $arrMatchIDs = $matchModel->getMatchIDsHappenTime($unixTime, $leagueId, $gmt); // Set list matches' id $objMatch->setId($arrMatchIDs); $fixture = array(); foreach ($arrMatchIDs as $id) { $match = $objMatch->getDetailObjectBasic($id); if (!isset($fixture[$match['group']])) { $fixture[$match['group']] = array($match['league_id'] => array('name' => $match['league_name'], 'season_name' => $match['name_season'], 'league_id' => $match['league_id'], 'season_id' => $match['season_id'], 'arrMatches' => array($match))); } else { if (isset($fixture[$match['group']][$match['league_id']])) { array_push($fixture[$match['group']][$match['league_id']]['arrMatches'], $match); } else { $fixture[$match['group']][$match['league_id']] = array('name' => $match['league_name'], 'season_name' => $match['name_season'], 'league_id' => $match['league_id'], 'season_id' => $match['season_id'], 'arrMatches' => array($match)); } } } $tennisFixture = array(); if (!$device) { // Get tennis matches' id by time $arrTennisMatches = $tennisModel->getTennisSchedule($unixTime, $unixTime); // Format fixture for tennis $arrPlayerTennis = array(); if (!empty($arrTennisMatches)) { foreach ($arrTennisMatches as $key => $value) { $tennisFixture[$value['league_name']][$key] = $value; array_push($arrPlayerTennis, $value['player1a'], $value['player1b'], $value['player2a'], $value['player2b']); } $this->view->objObject->getTennis()->setId($arrPlayerTennis); } } // Assign to view $this->view->assign(array('group' => $group, 'currTime' => time() - 25200, 'leagueId' => intval($leagueId), 'prevUnixTime' => $unixTime - 86400, 'currUnixTime' => $unixTime, 'nextUnixTime' => $unixTime + 86400, 'fixture' => $fixture, 'arrListLeagueQT' => $arrListLeagueQT, 'arrListLeagueTN' => $arrListLeagueTN, 'gmt' => $gmt, 'tennisFixture' => $tennisFixture)); $response['html'] = $this->view->render('lich-thi-dau/chitiet_' . $device . '.phtml'); echo Zend_Json::encode($response); exit; }
/** * Get block table tennis player * @param array $arrParam * @return array() * @author HungNT1 */ public function getTableTennis($arrParams) { //init data return $arrReturn = array('data' => array()); $year = date('Y'); $limit = $arrParams['limit']; $tennisModel = Thethao_Model_Tennis::getInstance(); $modelObject = Fpt_Data_Materials_Object::getInstance(); $modelTennis = $modelObject->getTennis(); //get ranking ATP $arrTennisRankingATP = $tennisModel->getTableTennis(1, $year); $arrTennisRankingATP = array_slice($arrTennisRankingATP, 0, $limit, true); //get ranking wtp $arrTennisRankingWTP = $tennisModel->getTableTennis(0, $year); $arrTennisRankingWTP = array_slice($arrTennisRankingWTP, 0, $limit, true); //array_merge $arrIds = array_merge(array_keys($arrTennisRankingATP), array_keys($arrTennisRankingWTP)); if (!empty($arrIds)) { //get and set id $modelTennis->setId($arrIds); } $arrReturn['data'] = array('1' => $arrTennisRankingATP, '2' => $arrTennisRankingWTP); return $arrReturn; }