| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/gtxapi.hellogtx.com/application/models/ |
Upload File : |
<?php
class GTX_Model_Flightmodel extends Zend_Db_Table_Abstract
{
private $db = NULL;
function init()
{
$this->db = Zend_Db_Table::getDefaultAdapter();
}
public function GUID()
{
if (function_exists('com_create_guid') === true) {
return trim(com_create_guid(), '{}');
}
return sprintf('%04X%04X%04X%04X%04X%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
}
public function updateTable($table, $editData, $where)
{
$dbtable = new Zend_Db_Table("$table");
return $dbtable->update($editData, $where);
}
public function insertTable($table, $data)
{
$dbtable = new Zend_Db_Table("$table");
return $dbtable->insert($data);
}
public function GetSearchQuery($TraceId, $iSsearch = 0)
{
$select = $this->db->select()->from("tbl_temp_data", "*");
$select->where('TraceId = ?', $TraceId);
$select->where('iSsearch = ?', $iSsearch);
$result = $this->db->fetchRow($select);
return $result;
}
public function deleteFlightTempData($TraceId, $iSsearch = 0)
{
$where = array('TraceId = ? ' => $TraceId, 'iSsearch = ? ' => $iSsearch);
$this->db->delete('tbl_temp_data', $where);
}
public function getSerialNumberLastRow($table, $AgencySysId)
{
$select = $this->db->select()->from("$table", "*");
$select->where('AgencySysId = ?', $AgencySysId);
$select->where('iSsearch = ?', 1);
$select->order("id DESC");
$select->limit(1);
$result = $this->db->fetchRow($select);
return $result;
}
public function CheckFlightToken($tablename, $AgencySysId, $apiType = null, $PlanType = null)
{
$date1 = date('Y-m-d') . " 00:00:00";
$select = $this->db->select()->from("$tablename", "*");
if ($apiType == 'AKASA' || $apiType == 'FLY24HRS') {
$select->where('created_at >= DATE_SUB(NOW(), INTERVAL 15 MINUTE)');
} else {
$date2 = date('Y-m-d') . " 23:59:00";
$select->where('created_at >= ?', $date1);
$select->where('created_at <= ?', $date2);
}
if ($apiType) {
$select->where('apiType = ?', $apiType);
} else {
$select->where('apiType = ?', 'TBO');
}
if ($PlanType) {
$select->where('PlanType = ?', $PlanType);
}
$select->where('AgencySysId = ?', $AgencySysId);
$result = $this->db->fetchRow($select);
return $result;
}
public function DeleteToken($AgencySysId = NULL, $apiType = NULL, $PlanType = NULL)
{
$where = array('AgencySysId = ? ' => $AgencySysId, 'apiType = ? ' => $apiType, 'PlanType = ?' => $PlanType);
$result = $this->db->delete("tbl_token", $where);
return $result;
}
public function airportdata($AirportCode = NULL)
{
$select = $this->db->select()->from("airportdata", ["AirportCode", "CityID", "ContSysId", "ICAO", "CountryCode", "DO", "cn", "ContName", "label", "labelWithSynonyms"]);
if ($AirportCode) {
$select->where('AirportCode = ?', $AirportCode);
}
$result = $this->db->fetchAll($select);
return $result;
}
public function updatetbl($data, $ModificationId,$tbl)
{
// $where = $this->db->quoteInto('BookingId = ?', $ModificationId);
$where = array('BookingId = ? ' => $ModificationId);
return $this->db->update($tbl, $data, $where);
}
public function getpendingbooking($MasterAgencySysId,$AgencySysId)
{
$select = $this->db->select();
$select->from(array('TP' => "tbl_booking_log"));
$select->where("TP.BookingDetail = ?", 2);
$select->Where("TP.MasterAgencySysId = ?", $MasterAgencySysId);
$select->Where("TP.AgencySysId = ?", $AgencySysId);
$select->orWhere("TP.ProposalStatus = ?", 3);
$select->orWhere("TP.QueryStatus = ?", 3);
$result = $this->db->fetchAll($select);
return $result;
}
}