Esempio n. 1
0
 /**
  * Get list league and season by team attend
  * @param int $teamID
  * @return array|boolean
  * @author QuangTM
  */
 public function getListLeagueAndSeasonTeamAttend($teamID)
 {
     // Default result
     $result = array();
     try {
         // Get DB Obj
         $dbObj = Thethao_Global::getDB('sport', 'slave');
         // Prepare SQL
         $stmt = $dbObj->prepare('CALL sp_sport_getLeagueSeasonByTeam(:p_teamid);');
         // Bind param
         $stmt->bindParam('p_teamid', $teamID, PDO::PARAM_INT);
         // Execute
         $stmt->execute();
         while ($row = $stmt->fetch()) {
             if (!isset($result[$row['league_id']])) {
                 $result[$row['league_id']] = array();
             }
             array_push($result[$row['league_id']], $row['season_id']);
         }
         // Close cursor
         $stmt->closeCursor();
         // Release
         unset($stmt);
     } catch (Exception $ex) {
         Thethao_Global::sendlog($ex, 1);
     }
     // Return result
     return $result;
 }
Esempio n. 2
0
 /**
  * get data from table keybox with key id
  * @param int $intKeyId
  * @return array
  */
 public function getKeyBox($arrKey = NULL)
 {
     $arrReturn = array();
     try {
         //get db slave
         $sport_m = Thethao_Global::getDB('sport', 'slave');
         // Get user activeation key
         $objStmt = $sport_m->prepare('CALL sp_getKeyBox(:p_keyid)');
         // Bind param
         $objStmt->bindParam('p_keyid', $arrKey, PDO::PARAM_STR);
         // Fetch result
         $objStmt->execute();
         //fetch result
         while ($row = $objStmt->fetch()) {
             $arrReturn[$row['key_id']] = $row['values'];
         }
         // Close cursor
         $objStmt->closeCursor();
         // Release
         unset($objStmt);
     } catch (Zend_Db_Exception $ex) {
         Thethao_Global::sendLog($ex);
     }
     return $arrReturn;
 }
Esempio n. 3
0
 /**
  * insert post article
  * @param array $arrParams
  * @return int
  * @author Phongtx
  */
 public function insertPostArticle($arrParams)
 {
     $intResult = false;
     try {
         // Get DB Object
         $db = Thethao_Global::getDB('sport', 'master');
         // Prepare SQL
         $stmt = $db->prepare('CALL sp_ent_insertShareMusic(:p_userid, :p_fullname, :p_email, :p_title, :p_lead, :p_content, :p_status, :p_sharetype, :p_categoryid, @p_id);');
         // Bind params
         $stmt->bindParam('p_userid', $arrParams['intUserId'], PDO::PARAM_INT);
         $stmt->bindParam('p_fullname', $arrParams['txtName'], PDO::PARAM_STR);
         $stmt->bindParam('p_email', $arrParams['txtEmail'], PDO::PARAM_STR);
         $stmt->bindParam('p_title', $arrParams['txtTitle'], PDO::PARAM_STR);
         $stmt->bindParam('p_lead', $arrParams['txtLead'], PDO::PARAM_STR);
         $stmt->bindParam('p_content', $arrParams['txtContent'], PDO::PARAM_STR);
         $stmt->bindParam('p_status', $arrParams['intStatus'], PDO::PARAM_INT);
         $stmt->bindParam('p_sharetype', $arrParams['type'], PDO::PARAM_INT);
         $stmt->bindParam('p_categoryid', $arrParams['cateid'], PDO::PARAM_INT);
         // Execute
         $stmt->execute();
         // Close cursor
         $stmt->closeCursor();
         $stmt = $db->query("SELECT @p_id");
         //Fetch Result
         $intResult = $stmt->fetchColumn();
         // Release
         unset($stmt);
     } catch (Exception $ex) {
         //log error
         Thethao_Global::sendLog($ex);
     }
     // Return result
     return $intResult;
 }
Esempio n. 4
0
 /**
  * get all category detail
  * @param int $intCategoryID
  * @return array
  * @author PhuongTN
  */
 public function getFullCategoryByParentId($intCategoryID)
 {
     $arrArticleInfo = array();
     try {
         $sport_m = Thethao_Global::getDB('sport', 'slave');
         // Get user activeation key
         $objStmt = $sport_m->prepare('CALL sp_getCategoryFullByParentID(:p_parentid)');
         // Bind param
         $objStmt->bindParam('p_parentid', $intCategoryID, PDO::PARAM_INT);
         // Fetch result
         $objStmt->execute();
         while ($row = $objStmt->fetch()) {
             $arrArticleInfo[$row['category_id']] = $row;
         }
         // Close cursor
         $objStmt->closeCursor();
         // Release
         unset($objStmt);
     } catch (Zend_Db_Exception $ex) {
         Thethao_Global::sendLog($ex);
     }
     return $arrArticleInfo;
 }
Esempio n. 5
0
 /**
  * Get full information about tennis match.<br />
  * Consist of tennis sets in matches, league, and season
  * @param array $arrMatchIDs list id of matches
  * @return array|boolean
  * @author QuangTM
  */
 public function getTennisMatches($arrMatchIDs)
 {
     // Get result
     $result = array();
     try {
         // Validate input paramter
         if (!is_array($arrMatchIDs) || !count($arrMatchIDs)) {
             return FALSE;
         }
         // Convert array match id into string
         $strMatchID = implode(',', $arrMatchIDs);
         // Get DB Obj
         $dbObj = Thethao_Global::getDB('sport', 'slave');
         // Prepare SQL to get tennis matches detail
         $stmt = $dbObj->prepare('CALL sp_tennis_getDetailTennisMatch(:p_matchid);');
         // Bind param
         $stmt->bindParam('p_matchid', $strMatchID, PDO::PARAM_STR);
         // Execute
         $stmt->execute();
         $arrLeagues = array();
         $arrSeasons = array();
         while ($row = $stmt->fetch()) {
             // Get match detail
             $result[$row['match_id']] = $row;
             // Default set in match
             $result[$row['match_id']]['set'] = array();
             // Default league and season name for this match
             $result[$row['match_id']]['league_name'] = NULL;
             $result[$row['match_id']]['season_name'] = NULL;
             // Push array league and season
             array_push($arrSeasons, $row['season_id']);
             array_push($arrLeagues, $row['league_id']);
         }
         // Unique league and season and convert them into string
         $strSeasons = implode(',', array_unique($arrSeasons));
         $strLeagues = implode(',', array_unique($arrLeagues));
         // Close
         $stmt->closeCursor();
         // Prepare SQL to get tennis sets by match
         $stmt = $dbObj->prepare('CALL sp_tennis_getTennisSet(:p_matchid);');
         // Bind param
         $stmt->bindParam('p_matchid', $strMatchID, PDO::PARAM_STR);
         // Execute
         $stmt->execute();
         while ($row = $stmt->fetch()) {
             $result[$row['match_id']]['set'][$row['set_id']] = $row;
         }
         // Close
         $stmt->closeCursor();
         $strLeagues = !empty($strLeagues) ? $strLeagues : null;
         // Prepare SQL to get tennis leagues
         $stmt = $dbObj->prepare('CALL sp_tennis_getTennisLeague(:p_leagueid);');
         // Bind param
         $stmt->bindParam('p_leagueid', $strLeagues, PDO::PARAM_STR);
         // Execute
         $stmt->execute();
         // Default result league has got
         $arrLeagues = array();
         while ($row = $stmt->fetch()) {
             $arrLeagues[$row['league_id']] = $row['league_name'];
         }
         // Close
         $stmt->closeCursor();
         // Prepare SQL to get tennis leagues
         $stmt = $dbObj->prepare('CALL sp_tennis_getTennisLeague(:p_leagueid);');
         // Bind param
         $stmt->bindParam('p_leagueid', $strLeagues, PDO::PARAM_STR);
         // Execute
         $stmt->execute();
         // Default result league has got
         $arrLeagues = array();
         while ($row = $stmt->fetch()) {
             $arrLeagues[$row['league_id']] = $row['league_name'];
         }
         // Close
         $stmt->closeCursor();
         // Default result league has got
         $arrSeasons = array();
         if (!empty($strSeasons)) {
             // Prepare SQL to get tennis leagues
             $stmt = $dbObj->prepare('CALL sp_tennis_getTennisSeasonByID(:p_seasonid);');
             // Bind param
             $stmt->bindParam('p_seasonid', $strSeasons, PDO::PARAM_STR);
             // Execute
             $stmt->execute();
             while ($row = $stmt->fetch()) {
                 $arrSeasons[$row['season_id']] = $row['name_season'];
             }
         }
         // Close
         $stmt->closeCursor();
         // Release variables
         unset($stmt);
         // By league name into match info
         foreach ($result as $matchId => $matchInfo) {
             $result[$matchId]['league_name'] = $arrLeagues[$result[$matchId]['league_id']];
             $result[$matchId]['season_name'] = $arrSeasons[$result[$matchId]['season_id']];
         }
     } catch (Exception $ex) {
         Thethao_Global::sendLog($ex, 1);
     }
     return $result;
 }
Esempio n. 6
0
 /**
  * Get list players by team
  * @param int $teamId
  * @return array
  * @author ThuyNT
  */
 public function getListPlayersByTeam($teamId)
 {
     try {
         // Get DB Obj
         $dbObj = Thethao_Global::getDB('sport', 'slave');
         // Prepare SQL
         $stmt = $dbObj->prepare('CALL sp_getListPlayersByTeam(:p_teamid);');
         // Bind param
         $stmt->bindParam('p_teamid', $teamId, PDO::PARAM_INT);
         // Execute
         $stmt->execute();
         // Get result
         $result = array();
         while ($row = $stmt->fetch()) {
             $result[] = $row['player_id'];
         }
         // Close
         $stmt->closeCursor();
         // Release variables
         unset($stmt);
         return $result;
     } catch (Exception $ex) {
         Thethao_Global::sendlog($ex, 1);
     }
 }
Esempio n. 7
0
 public function getListAward($arrParams)
 {
     //default return
     $arrResult = array();
     try {
         //get db slave
         $db_s = Thethao_Global::getDB('interaction', 'slave');
         // Call sp get detail book
         $stmt = $db_s->prepare('CALL sp_getListAwardResult(:p_object_type, :p_award , :p_fromdate , :p_todate)');
         // Bind param
         $stmt->bindParam('p_object_type', $arrParams['object_type'], PDO::PARAM_INT);
         $stmt->bindParam('p_award', $arrParams['award'], PDO::PARAM_INT);
         $stmt->bindParam('p_fromdate', $arrParams['fromdate'], PDO::PARAM_INT);
         $stmt->bindParam('p_todate', $arrParams['todate'], PDO::PARAM_INT);
         // Execute sp
         $stmt->execute();
         //fetch result
         $arrResult = $stmt->fetchAll();
         // Close cursor
         $stmt->closeCursor();
         // Release
         unset($stmt);
     } catch (Zend_Db_Exception $ex) {
         //log error
         Thethao_Global::sendLog($ex);
     }
     return $arrResult;
 }
Esempio n. 8
0
 /**
  * Get list league by group
  * @param int $group
  * @return array|boolean
  * @author QuangTM
  */
 public function getListLeagueByGroup($group)
 {
     // Get result
     $result = array();
     try {
         // Get DB Obj
         $dbObj = Thethao_Global::getDB('sport', 'slave');
         // Prepare SQL
         $stmt = $dbObj->prepare('CALL sp_fe_sport_getLeagueByGroup(:p_group);');
         // Bind param
         $stmt->bindParam('p_group', $group, PDO::PARAM_INT);
         // Execute
         $stmt->execute();
         while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
             $result[$row['league_id']] = $row['name'];
         }
         // Close
         $stmt->closeCursor();
         // Release variables
         unset($stmt);
     } catch (Exception $ex) {
         Thethao_Global::sendlog($ex, 1);
     }
     return $result;
 }
Esempio n. 9
0
 /**
  * Get extend of match detail
  * @param type $arrMatchId
  * @return boolean|array
  */
 public function getMatchExtendByIDs($arrMatchId)
 {
     $result = array();
     try {
         if (!is_array($arrMatchId) || !count($arrMatchId)) {
             return FALSE;
         }
         $strMatchId = implode(',', $arrMatchId);
         // Get DB Obj
         $dbObj = Thethao_Global::getDB('sport', 'slave');
         // Prepare SQL
         $stmt = $dbObj->prepare('CALL sp_fesport_getDetailMatchByIDs(:p_matchids);');
         // Bind param
         $stmt->bindParam('p_matchids', $strMatchId, PDO::PARAM_STR);
         // Execute
         $stmt->execute();
         while ($row = $stmt->fetch()) {
             if (!isset($result[$row['match_id']])) {
                 $result[$row['match_id']] = array();
             }
             $result[$row['match_id']] = Zend_Json::decode($row['event']);
         }
         // Close
         $stmt->closeCursor();
         // Release variables
         unset($stmt);
     } catch (Exception $ex) {
         Fpt_Data_Model::sendLog($ex);
         return FALSE;
     }
     return $result;
 }