/** * Show the form for editing the specified resource. * * @param int $id * * @return Response */ public function edit($id) { $newsletters_offer = NewslettersOffer::findOrFail($id); $hoteluri = Hoteluri::join('geo_orase', 'geo_orase.AidaID', '=', 'hoteluri.City')->select('hoteluri.id', DB::raw("CONCAT(hoteluri.Name,'-',hoteluri.Stars,'-',geo_orase.Name) AS Nume"))->lists('Nume', 'id')->all(); $newsletters_offer = NewslettersOffer::findOrFail($id); return view('backend.newsletters_offers.edit', compact('newsletters_offer'))->with('hoteluri', $hoteluri); }
public function ListareDetaliiPachet($slugPachet) { $pachet = Pachete::findBySlug($slugPachet); $infoPachet = PacheteCamere::where('PackID', $pachet->PackID)->first(); $hotel = Hoteluri::where('AidaID', $infoPachet->UnitID)->first(); $oras = $infoPachet->CityID; // dd($pachet); $pacheteSimilare = Pachete::select('PackID', 'Name', 'Description', 'Currency', 'slug')->groupBy('PackID')->take(3)->get(); return view('frontend.detalii-pachet')->with('pachet', $pachet)->with('pachetesimilare', $pacheteSimilare)->with('hotel', $hotel); }
function getImaginePrincipalaHotel($AidaID) { $hotel = Hoteluri::where('AidaID', $AidaID)->first(); $imagine = PozeHoteluri::where('AidaID', $AidaID)->where('MainPicture', 1)->first(); if (!$imagine) { $url = URL::asset('frontend/images/template/nopic.jpg'); } else { $url = URL::to('Hoteluri', [$hotel->Operator, $AidaID, @$imagine->PictureName]); } return $url; }
public function cronWeather() { Weather::truncate(); $hoteluri = Hoteluri::all(); foreach ($hoteluri as $hotel) { $file = "http://api.yr.no/weatherapi/locationforecast/1.9/?lat={$hotel->Latitude};lon={$hotel->Longitude};msl=70"; $xml = new SimpleXMLElement($file, null, TRUE); $temp = $xml->product->time; foreach ($temp as $xml_time) { foreach ($xml_time->location as $xml_loc) { if ($xml_loc->minTemperature && $xml_loc->maxTemperature && $xml_loc->symbol) { $mintemp = $xml_loc->minTemperature->attributes()->value; $maxtemp = $xml_loc->maxTemperature->attributes()->value; $array_min = array_filter(preg_split("(T|Z)", $xml_time->attributes()->from)) + ['2' => (string) $mintemp]; $array_max = array_filter(preg_split("(T|Z)", $xml_time->attributes()->to)) + ['2' => (string) $maxtemp]; $icon = "http://api.yr.no/weatherapi/weathericon/1.1/?symbol=" . $xml_loc->symbol->attributes()->number . ";is_night=1;content_type=image/png"; $array = ['HotelID' => $hotel->id, 'FromDate' => $array_min[0], 'FromHour' => $array_min[1], 'MinDegrees' => $array_min[2], 'ToDate' => $array_max[0], 'ToHour' => $array_max[1], 'MaxDegrees' => $array_max[2], 'Logo' => $xml_loc->symbol->attributes()->number]; Weather::create($array); } } } } }
public function ajaxVerificareHoteluri(Request $request) { $array = []; foreach ($request->formData as $value) { $array[$value['name']] = $value['value']; } $hotel = Hoteluri::where('AidaID', $array['HotelID'])->first(); $DateRange = ['DateStart' => parse_date_time($array['DataStart'], 'Y-m-d'), 'DateEnd' => parse_date_time($array['DataEnd'], 'Y-m-d')]; $Config_Camere = []; $nrCamere = $array['Camere']; for ($i = 1; $i <= $nrCamere; $i++) { $Ocupare = []; if ($array['Copii_Cam' . $i] >= 1) { for ($j = 1; $j <= $array['Copii_Cam' . $i]; $j++) { array_push($Ocupare, ['AgeQualifyingCode' => 'c', 'Count' => 1, 'Age' => $array['varstaCopil' . $j . '_Cam' . $i]]); } array_unshift($Ocupare, ['AgeQualifyingCode' => 'a', 'Count' => $array['Adulti_Cam' . $i]]); } else { if ($array['Copii_Cam' . $i] == 0) { array_push($Ocupare, ['AgeQualifyingCode' => 'a', 'Count' => $array['Adulti_Cam' . $i]]); } } array_push($Config_Camere, ['IndexNumber' => $i, 'GuestsCount' => ['GuestCount' => $Ocupare]]); } $raspuns = Soap::AccSearchV2($hotel->Operator, $DateRange, $Config_Camere, $hotel->Name, $hotel->Stars, $hotel->City); $services = $raspuns->AccUnits->AccUnit->AccServices->AccService; //dd($services); return (string) view('frontend.ajax.raspuns-hoteluri-oferte')->with('services', $services)->with('data_sejur', $DateRange)->with('config_camere', $Config_Camere); }
public function GetAllHotels($operator) { // $xml = new SimpleXMLElement('hoteluri.xml', null, TRUE); // dd(json_decode(json_encode($xml->AccUnit),TRUE)); $AidaHoteluri = Soap::AidaSoap($operator, 'AccUnits', ['AIDA_AccUnitsRQ' => ['Filters' => []]])->AccUnits->AccUnit; foreach ($AidaHoteluri as $hotel) { $array = ['AidaID' => $hotel->ID, 'Type' => $hotel->Type->_, 'Name' => $hotel->Name, 'Themes' => $hotel->ThemesIDS, 'Stars' => $hotel->Stars, 'Category' => @$hotel->Category->_, 'Country' => $hotel->Destination->Country->ID, 'City' => $hotel->Destination->City->ID, 'Region' => @$hotel->Destination->Region->ID, 'Address' => @$hotel->Destination->Address, 'Telephone' => @$hotel->Contact->Telephone, 'Email' => '*****@*****.**', 'FacilitiesDescription' => @$hotel->Descriptions->FacilitiesDescription, 'ShortDescription' => @$hotel->Descriptions->ShortDescription, 'FullDescription' => @$hotel->Descriptions->FullDescription, 'RoomsDescription' => @$hotel->Descriptions->RoomsDescription, 'DrivingDirections' => @$hotel->Descriptions->DrivingDirections, 'TouristicAttractions' => @$hotel->Descriptions->TouristicAttractions, 'Latitude' => @$hotel->Latitude, 'Longitude' => @$hotel->Longitude, 'Operator' => $operator]; $imagini = @$hotel->Gallery->GalleryImage; $hoteluri = Hoteluri::where('AidaID', $hotel->ID)->first(); //-------------verific daca exista hotel---------------------// if (isset($hoteluri)) { //---------verific daca este setat ca updatabil------------// if ($hoteluri->Updatabil == 1) { //--------------fac update de continut---------------// $hoteluri->update($array); //-------------sterg pozele aferente----------------// PozeHoteluri::where('AidaID', $hotel->ID)->delete(); File::delete("Hoteluri/{$operator}/{$hotel->ID}"); //-----------preiau pozele noi daca exista--------------------// if (isset($imagini)) { foreach ($imagini as $imagine) { if (@$imagine->URL != null) { $numefisier = parseurl($imagine->URL, 'url'); Image::make(file_get_contents($imagine->URL))->save("Hoteluri/{$operator}/{$hotel->ID}/{$numefisier}"); $mainpicture = @$imagine->MainPicture != null ? 1 : 0; $array_poze = ['AidaID' => $hotel->ID, 'PictureName' => $numefisier, 'MainPicture' => $mainpicture]; PozeHoteluri::create($array_poze); } } } //---------setez updatabil 0---------- Hoteluri::findOrFail($hoteluri->id)->update(['Updatabil' => 0]); } //---------------------daca nu exista preiau datele si pozele------------------- } else { $hid = Hoteluri::create($array); File::makeDirectory("Hoteluri/{$operator}/{$hotel->ID}", 0777); if (isset($imagini)) { foreach ($imagini as $imagine) { if (@$imagine->URL != null) { $numefisier = parseurl($imagine->URL, 'url'); Image::make(file_get_contents($imagine->URL))->save("Hoteluri/{$operator}/{$hotel->ID}/{$numefisier}"); $mainpicture = @$imagine->MainPicture != null ? 1 : 0; $array_poze = ['AidaID' => $hotel->ID, 'PictureName' => $numefisier, 'MainPicture' => $mainpicture]; PozeHoteluri::create($array_poze); } } } //---------setez updatabil 0---------- Hoteluri::findOrFail($hid->id)->update(['Updatabil' => 0]); } } }