PageRenderTime 40ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/public_html/includes/preturi_online/malta.php

https://bitbucket.org/ocaziituristice/ocaziituristice.ro
PHP | 160 lines | 141 code | 16 blank | 3 comment | 19 complexity | 8ee4239893cf1c2d85dcde77b5d1a734 MD5 | raw file
  1. <?php
  2. $arivdata = date('Y-m-d', strtotime($plecdata.' + '.$pleczile.' days'));
  3. $trip_Room_Chd_Age = '';
  4. for($i=0; $i<$copii; $i++) {
  5. $trip_Room_Chd_Age .= '<Age>'.$copil_age[$i].'</Age>';
  6. }
  7. if($detalii['moneda']=='EURO') $trip_currency = 'EUR';
  8. else $trip_currency = $detalii['moneda'];
  9. $sel_plecare = "SELECT
  10. localitati.denumire AS loc_plecare,
  11. localitati.id_localitate AS idloc_plecare
  12. FROM oferte_transport_avion
  13. LEFT JOIN aeroport ON oferte_transport_avion.aeroport_plecare = aeroport.id_aeroport
  14. LEFT JOIN localitati ON aeroport.id_localitate = localitati.id_localitate
  15. WHERE oferte_transport_avion.id_oferta = '".$id_oferta."'
  16. AND oferte_transport_avion.tip = 'dus'
  17. ORDER BY oferte_transport_avion.ordonare
  18. LIMIT 0,1 ";
  19. $que_plecare = mysql_query($sel_plecare) or die(mysql_error());
  20. $row_plecare = mysql_fetch_array($que_plecare);
  21. $sel_request = "SELECT
  22. import_hoteluri.nume_hotel,
  23. import_hoteluri.stele_hotel,
  24. preturi_malta.hotel_destCode
  25. FROM import_hoteluri
  26. Inner Join preturi_malta ON preturi_malta.hotel_code = import_hoteluri.id_hotel
  27. WHERE import_hoteluri.id_hotel_corespondent = '".$id_hotel."'
  28. AND import_hoteluri.id_furnizor = '".$id_furnizor."'
  29. AND preturi_malta.period = '".$pleczile."'
  30. AND preturi_malta.`date` = '".$plecdata."'
  31. AND preturi_malta.price_currency = '".$trip_currency."'
  32. AND preturi_malta.trans_code <> ''
  33. LIMIT 0,1 ";
  34. $que_request = mysql_query($sel_request) or die(mysql_error());
  35. $row_request = mysql_fetch_array($que_request);
  36. $trip_CountryCode = $detalii_hotel['country_code'];
  37. $trip_CityCode = $row_request['hotel_destCode'];
  38. $trip_DepCityCode = $depCityCode[$id_furnizor][$row_plecare['idloc_plecare']];
  39. if($detalii['transport']=='Avion') $trip_Transport = 'plane';
  40. $trip_ProductName = $row_request['nume_hotel'];
  41. $trip_ProductCategory = $row_request['stele_hotel'];
  42. $trip_CurrencyCode = $trip_currency;
  43. $sXml = '<?xml version="1.0" encoding="UTF-8"?>
  44. <Request RequestType="getPackageNVPriceRequest">
  45. <AuditInfo>
  46. <RequestId>'.date("dmYHis").'</RequestId>
  47. <RequestUser>xml_ocazii</RequestUser>
  48. <RequestPass>451388X</RequestPass>
  49. <RequestTime>'.date("Y-m-d").'T'.date("H-i-s").'</RequestTime>
  50. <RequestLang>EN</RequestLang>
  51. </AuditInfo>
  52. <RequestDetails>
  53. <getPackageNVPriceRequest>
  54. <CountryCode>'.$trip_CountryCode.'</CountryCode>
  55. <CityCode>'.$trip_CityCode.'</CityCode>
  56. <DepCountryCode>RO</DepCountryCode>
  57. <DepCityCode>'.$trip_DepCityCode.'</DepCityCode>
  58. <Transport>'.$trip_Transport.'</Transport>
  59. <TourOpCode>MLT</TourOpCode>
  60. <ProductName>'.$trip_ProductName.'</ProductName>
  61. <ProductCategory>'.$trip_ProductCategory.'</ProductCategory>
  62. <CurrencyCode>'.$trip_CurrencyCode.'</CurrencyCode>
  63. <Language>RO</Language>
  64. <OfferType>TOATE</OfferType>
  65. <PeriodOfStay>
  66. <CheckIn>'.$plecdata.'</CheckIn>
  67. <CheckOut>'.$arivdata.'</CheckOut>
  68. </PeriodOfStay>
  69. <Days>1</Days>
  70. <Rooms>
  71. <Room Code="DB" NoAdults="'.$adulti.'" NoChildren="'.$copii.'">
  72. <Children>
  73. '.$trip_Room_Chd_Age.'
  74. </Children>
  75. </Room>
  76. </Rooms>
  77. </getPackageNVPriceRequest>
  78. </RequestDetails>
  79. </Request>';
  80. $sUrl = 'http://www.rezervari.malta.ro/server_xml/server.php';
  81. $ch = curl_init($sUrl);
  82. curl_setopt($ch, CURLOPT_POST, 1);
  83. curl_setopt($ch, CURLOPT_POSTFIELDS, $sXml);
  84. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  85. curl_setopt($ch, CURLOPT_HEADER, 0);
  86. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  87. $sResponse = curl_exec($ch);
  88. //echo $sResponse;
  89. $prices = new SimpleXMLElement($sResponse);
  90. //if(!$err_logare_admin) echo $prices;
  91. if($prices->ResponseDetails->getPackageNVPriceResponse != '') {
  92. if(count($rezcam)>0) $J = count($rezcam)+1; else $J=0;
  93. foreach($prices->ResponseDetails->getPackageNVPriceResponse->Hotel->Offers->Offer as $key => $value) {
  94. $den_camera[$key] = (string) $value->BookingRoomTypes->Room;
  95. $sel_roomtype = "SELECT tip_camera_corespondent.id_camera_corespondent, tip_camera.denumire
  96. FROM tip_camera_corespondent
  97. INNER JOIN tip_camera ON tip_camera.id_camera = tip_camera_corespondent.id_camera_corespondent
  98. WHERE tip_camera_corespondent.den_camera = '".$den_camera[$key]."' ";
  99. $que_roomtype = mysql_query($sel_roomtype) or die(mysql_error());
  100. $row_roomtype = mysql_fetch_array($que_roomtype);
  101. $rezcam[$J]['id_pret'] = 0;
  102. $rezcam[$J]['plecare'] = '1';
  103. $rezcam[$J]['id_camera'] = $row_roomtype['id_camera_corespondent'];
  104. if($row_roomtype['denumire']) $rezcam[$J]['denumire_camera'] = $row_roomtype['denumire']; else $rezcam[$J]['denumire_camera'] = schimba_caractere($den_camera[$key]);
  105. $rezcam[$J]['pret'] = (string) $value->Gross;
  106. $rezcam[$J]['comision'] = (string) $value->CommissionCed;
  107. $rezcam[$J]['moneda'] = $detalii['moneda'];
  108. $rezcam[$J]['nr_adulti'] = $adulti;
  109. $rezcam[$J]['nr_copii'] = $copii;
  110. $rezcam[$J]['copil1'] = $copil_age[0];
  111. $rezcam[$J]['copil2'] = $copil_age[1];
  112. $rezcam[$J]['copil3'] = $copil_age[2];
  113. if(isset($value->OfferDescription) and ((string) $value->Gross != (string) $value->PriceNoRedd)) {
  114. $rezcam[$J]['oferta'] = schimba_caractere((string) $value->OfferDescription);
  115. $rezcam[$J]['oferta_pret'] = (string) $value->PriceNoRedd;
  116. } else {
  117. $rezcam[$J]['oferta'] = '';
  118. $rezcam[$J]['oferta_pret'] = '';
  119. }
  120. $rezcam[$J]['masa'] = '';
  121. if(sizeof($value->Meals->Meal)>0) {
  122. foreach($value->Meals->Meal as $k_meal => $v_meal) {
  123. $rezcam[$J]['masa'] .= schimba_caractere(change_meal((string) $v_meal)).', ';
  124. }
  125. $rezcam[$J]['masa'] = substr($rezcam[$J]['masa'],0,-2);
  126. } else {
  127. $rezcam[$J]['masa'] .= 'Fără masă';
  128. }
  129. //if(((string) $value->Meals->Meal)=='') $rezcam[$J]['masa'] = 'Fara masa'; else $rezcam[$J]['masa'] = (string) $value->Meals->Meal;
  130. $rezcam[$J]['series_name'] = '';
  131. $rezcam[$J]['period'] = date("d.m",strtotime((string) $value->PeriodOfStay->CheckIn)).' - '.date("d.m.Y",strtotime((string) $value->PeriodOfStay->CheckOut));
  132. $rezcam[$J]['data_start'] = date("Y-m-d",strtotime((string) $value->PeriodOfStay->CheckIn));
  133. if((string) $value->Availability['Code'] == 'IM') $rezcam[$J]['disponibilitate'] = 'disponibil';
  134. elseif((string) $value->Availability['Code'] == 'OR') $rezcam[$J]['disponibilitate'] = 'request';
  135. elseif((string) $value->Availability['Code'] == 'ST') $rezcam[$J]['disponibilitate'] = 'stopsales';
  136. $rezcam[$J]['nr_nights'] = dateDiff((string) $value->PeriodOfStay->CheckOut, (string) $value->PeriodOfStay->CheckIn)-1;
  137. $rezcam[$J]['id_furnizor'] = $id_furnizor;
  138. $rezcam[$J]['furnizor_comision_procent'] = $furnizor['comision_procent'];
  139. $rezcam[$J]['id_oferta'] = $id_oferta;
  140. $J++;
  141. }
  142. }
  143. $one_time_only = 'da';
  144. ?>