public function displayDisciplineClassesToEnroll($courseId, $disciplineId) { $disciplineData = $this->getDisciplineByCode($disciplineId); $semester = new Semester(); $currentSemester = $semester->getCurrentSemester(); $offer = new Offer(); $classes = $offer->getApprovedOfferListDisciplineClasses($courseId, $currentSemester['id_semester'], $disciplineId); $data = array('courseId' => $courseId, 'disciplineClasses' => $classes, 'disciplineData' => $disciplineData); loadTemplateSafelyByGroup('estudante', 'discipline/discipline_classes_enroll', $data); }
/** * Generates results based on input. */ public function generate() { $validation = $this->validate(); if ($validation === true) { $offers = Offer::whereHas('leadstat', function ($query) { $query->where('date', '>=', Input::get('date_start'))->where('date', '<=', Input::get('date_end')); }); $country = Input::get('country'); if (!empty($country)) { $offers->whereHas('countries', function ($query) use($country) { $query->where('country', '=', $country); }); } $offerIds = Input::get('offer_ids'); // 0 denotes all offers. if (!in_array('0', $offerIds)) { $offers->whereRaw('id IN (' . implode(',', $offerIds) . ')'); } $this->generated = true; return $this->showResults($offers->get()->sortBy('name')); } else { $this->setAlertDanger($validation); return $this->showResults(); } }
public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Offer::create([]); } }
public function getAllOffers() { $filterString = 'Active = true'; $catID = $this->getRequest()->getVar('catid'); if ($catID) { if (strlen($filterString) > 0) { $filterString .= ' AND '; } $filterString .= 'CategoryID = ' . intval($catID); } $offers = Offer::get('Offer', $filterString); $search = $this->getRequest()->getVar('search'); if ($search) { $offers = $offers->filterAny(array('Name:PartialMatch' => $search, 'Description:PartialMatch' => $search)); //('SearchFields:fulltext', $search); } $sort = Convert::raw2sql($this->getRequest()->getVar('sort')); if ($sort) { if (strlen($sort) > 2) { $dir = substr($sort, 0, 1); $field = substr($sort, 1); if ($field == 'Name' || $field == 'LastEdited') { if ($dir == 'a') { $offers = $offers->sort(Convert::raw2sql($field) . " ASC"); } else { $offers = $offers->sort(Convert::raw2sql($field) . " DESC"); } } else { die("Undefined field for sorting"); } } } return new PaginatedList($offers, $this->request); }
public function show($id) { $rooms = Rooms::where('ID_RoomType', '=', $id)->firstOrFail(); $listRooms = Rooms::where('Status', '=', 'Active')->get(); $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all(); $data['about'] = About::get()->all(); return View::make('Rooms.show', compact('rooms', 'listRooms'))->with('room_active', 'active')->with('listRoom', $listRooms)->with('data', $data); }
public function index() { $testimonial = Testimonial::orderby('date', 'DESC')->where('Status', '=', 'Confirm')->paginate(10, ['Name', 'Email', 'Subject', 'Message', 'Date'], 'ID_Feedback'); $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all(); $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all(); $data['about'] = About::get()->all(); return View::make('Testimonials.index', compact('testimonial'))->with('data', $data); }
public function show($id) { $dinas = Dinasevents::orderby('Event_Date', 'Desc')->where('Event_ID', '=', $id)->firstOrFail(); $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all(); $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all(); $data['about'] = About::get()->all(); return View::make('dinasevents.show', compact('dinas'))->with('data', $data); }
public function show($id) { $events = Events::findOrFail($id); $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all(); $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all(); $data['about'] = About::get()->all(); return View::make('Events.show', compact('events'))->with('event_active', 'active')->with('data', $data); }
public function index() { $faqs = Faq::where('Status', '=', 'Active')->get(); $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all(); $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all(); $data['about'] = About::get()->all(); return View::make('faqs.index', compact('faqs'))->with('data', $data); }
public function show($id) { $facility = Facilities::where('ID_Facility', '=', $id)->firstOrFail(); $faciList = Facilities::where('Status', '=', 'Active')->get(); $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all(); $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all(); $data['about'] = About::get()->all(); return View::make('Facilities.show', compact('facility', 'listFaci'))->with('faci_active', 'active')->with('faciList', $faciList)->with('data', $data); }
public function show($id) { $destination = Destination::where('ID_Destination', '=', $id)->firstOrFail(); $listDest = Destination::where('Status', '=', 'Active')->get(); $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all(); $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all(); $data['about'] = About::get()->all(); return View::make('Destinations.show', compact('destination', 'listDest'))->with('data', $data); }
public function show($id) { $travel = Travel::where('ID_Travel', '=', $id)->firstOrFail(); $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all(); $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all(); $data['about'] = About::get()->all(); $package = TravelPackage::where('ID_Travel', '=', $id)->get(); return View::make('travels.show', compact('travel'))->with('package', $package)->with('data', $data); }
public function searchOffers($mro) { try { //echo 'LMwebSoapClient search offer'; $result = $this->sc->searchOffers(array('mro' => $mro->getParamsAsArray()))->return; } catch (Exception $ex) { echo $ex->getMessage(); return null; } if ($result->offers->info == "NOHIT") { Template::errorTemplate("Keine Treffer gefunden"); return null; } if ($result->offers->offers != 0) { $cities = array(); if (is_array($result->offers->cityList)) { foreach ($result->offers->cityList as $value) { $city = new City($value->id, $value->minPrice, $value->name); $cities[$city->getId()] = $city; } } else { $city = new City($result->offers->cityList->id, $result->offers->cityList->minPrice, $result->offers->cityList->name); $cities[$city->getId()] = $city; } $offers = array(); if (is_array($result->offers->offersList)) { foreach ($result->offers->offersList as $value) { $offer = new Offer(); $offer->setParamsByArray($value); $offer->setCity($cities[$offer->getCity()]); array_push($offers, $offer); } } else { $offer = new Offer(); $offer->setParamsByArray($result->offers->offersList); $offer->setCity($cities[$offer->getCity()]); array_push($offers, $offer); } } else { Template::errorTemplate("Keine Treffer gefunden"); return null; } return $offers; }
public function create() { $uid = Input::get('uid'); $offer = new Offer(); $offer->body = Input::get('body'); $offer->recipient_id = $uid; $offer->rate = Input::get('rate') / 100; $offer->daily_rate = $offer->rate / 100 / Config::get('rate.days'); $offer->offer_ends = Input::get('end_date'); $offer->save(); $recipient = DB::table('users')->where('id', '=', $uid)->first(); $username = $recipient->email; $data = ['username' => $username, 'body' => Input::get('body')]; Mail::send('emails.adminmessage', $data, function ($message) { $recipient = DB::table('users')->where('id', '=', Input::get('uid'))->first(); $message->to($recipient->email, 'test')->subject('Offer'); }); return Redirect::to('/user/admin/nextstepusers'); }
public function show($id) { $room = Rooms::select('roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(15)->get(); $countRoom = Rooms::where('Status', '=', 'Active')->count(); $offer = Offer::findOrFail($id); $offerDetail = Offer::join('detail_offer', 'detail_offer.ID_Offer', '=', 'offer.ID_Offer')->join('roomtype_pic', 'roomtype_pic.ID_RoomType', '=', 'detail_offer.ID_RoomType')->join('roomtype', 'roomtype.ID_RoomType', '=', 'detail_offer.ID_RoomType')->where('offer.Status', '=', 'Active')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('offer.ID_Offer', '=', $id)->get(); $offerCount = Offer::join('detail_offer', 'detail_offer.ID_Offer', '=', 'offer.ID_Offer')->join('roomtype_pic', 'roomtype_pic.ID_RoomType', '=', 'detail_offer.ID_RoomType')->join('roomtype', 'roomtype.ID_RoomType', '=', 'detail_offer.ID_RoomType')->where('offer.Status', '=', 'Active')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('offer.ID_Offer', '=', $id)->count(); $data['about'] = About::get()->all(); return View::make('offers.show')->with('offer', $offer)->with('offerDetail', $offerDetail)->with('room', $room)->with('countRoom', $countRoom)->with('offerCount', $offerCount)->with('data', $data); }
public function index() { $room = Rooms::select('roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(15)->get(); $data['about'] = About::get()->all(); $countRoom = Rooms::where('Status', '=', 'Active')->count(); $offer = Offer::where('Status', '=', 'Active')->take(15)->get(); $countOffer = Offer::where('Status', '=', 'Active')->count(); $about = About::all(); return View::make('Books.View.index')->with('data', $data)->with('room', $room)->with('countRoom', $countRoom)->with('offer', $offer)->with('countOffer', $countOffer)->with('about', $about); }
public function action_new_post() { if (Auth::guest()) { $page = Input::get('offer_type') == 1 ? 'offers/new_freight' : 'offers/new_trans'; Cookie::put('rid', $page); return Redirect::to('login')->with_input(); } $input = array('user_id' => Input::get('user_id'), 'offer_type' => Input::get('offer_type'), 'from_date' => $this->mysql_date(Input::get('from_date')), 'to_date' => $this->mysql_date(Input::get('to_date')), 'from_country' => Input::get('from_country'), 'from_state' => Input::get('from_state'), 'from_town' => Input::get('from_town'), 'to_country' => Input::get('to_country'), 'to_state' => Input::get('to_state'), 'to_town' => Input::get('to_town'), 'auto_type' => Input::get('auto_type'), 'auto_load_type' => Input::get('auto_load_type'), 'auto_capacity' => Input::get('auto_capacity'), 'auto_volume' => Input::get('auto_volume'), 'auto_price' => Input::get('auto_price'), 'auto_count' => Input::get('auto_count'), 'auto_license' => Input::get('auto_license'), 'comments' => Input::get('comments')); $rules = array('offer_type' => 'required', 'from_date' => 'required', 'to_date' => 'required', 'from_country' => 'required', 'from_town' => 'required', 'to_country' => 'required', 'to_town' => 'required', 'auto_type' => 'required', 'auto_capacity' => 'numeric|required', 'auto_count' => 'integer', 'auto_price' => 'numeric'); $v = Validator::make($input, $rules); if ($v->fails()) { $page = $input['offer_type'] == 1 ? 'offers/new_freight' : 'offers/new_trans'; return Redirect::to($page)->with_errors($v)->with_input(); } else { $offer = new Offer($input); $offer->save(); return View::make('sapoc.pages.result')->with('message', __('offers-new.save-success')); } }
public function BookOffer($idOff, $idRoom) { $offer = Offer::join('detail_offer', 'detail_offer.ID_Offer', '=', 'offer.ID_Offer')->join('roomtype_pic', 'roomtype_pic.ID_RoomType', '=', 'detail_offer.ID_RoomType')->join('roomtype', 'roomtype.ID_RoomType', '=', 'detail_offer.ID_RoomType')->where('offer.Status', '=', 'Active')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('offer.ID_Offer', '=', $idOff)->where('roomtype.ID_RoomType', '=', $idRoom)->get(); $rooms = Rooms::where('ID_RoomType', '=', $idRoom)->where('Status', '=', 'Active')->get(); $tax = Tax::where('Status', '=', 'Active')->get(); $additional = Additional::where('Status', '=', 'Active')->get(); $countAdd = Additional::where('Status', '=', 'Active')->count(); $data['about'] = About::get()->all(); return View::make('Books.Offer.show')->with('data', $data)->with('offer', $offer)->with('rooms', $rooms)->with('tax', $tax)->with('additional', $additional)->with('countAdd', $countAdd); }
/** * Display the specified resource. * GET /orders/{id} * * @param int $id * @return Response */ public function show($company, $order) { if (is_numeric($order)) { $orders = Company::findOrFail($company)->orders->find($order); $offers = Offer::where('order_id', '=', $order)->where('provider_id', '=', Auth::user()->provider_id)->get(); $company = Company::find($company); $interval = calculate_time_interval($orders->start_date, $orders->end_date); $dates = extract_dates($orders->start_date, $interval); $offer_dates = array_pluck($offers, 'date'); } return View::make('orders.show', compact('offer_dates', 'offers', 'orders', 'company', 'interval', 'dates', 'start_at')); }
public function isDuplicate($key_word, $id = 0) { $duplicateOffer = Offer::where('key_word', $key_word)->first(); if (empty($duplicateOffer)) { return false; } if ($id != 0) { if ($duplicateOffer->id == $id) { return false; } } return true; }
private function sendNewOffersNewsletter() { $sevenDaysAgo = strtotime("-7 day"); $offers = Offer::get('Offer', 'Active = 1', 'Created DESC')->filter(array('Created:GreaterThan' => date('Y-m-d', $sevenDaysAgo) . ' 00:00:00'))->limit(10); $members = Member::get(); foreach ($members as $member) { if ($member->inGroup("Helfer")) { $mail = new NewOffersNewsletterEmail($this, $member, $offers); $mail->send(); } } die('Success'); }
public function loadOffer($id) { $squeeb = Offer::where('id', '=', $id)->first(); View::share('squeeb', $squeeb); view::share('model', 'Offer'); //detect device $detect = new Mobile_Detect(); $deviceType = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'phone' : 'computer'; View::share('deviceType', $deviceType); //update the squeeb table $this->sqFactor($squeeb); if (Auth::user()) { return View::make('member.squeeb'); } return View::make('guest.squeeb'); }
<?php $oOffer = new Offer(); $oOfferImage = new OfferImage(); $offerAll = $oOffer->findAllFrom("Offer", "1=1 order by sequence"); //1st Room //8th Room $idx = 1; if ($oOffer->countFrom('Offer', "1=1") > 0) { foreach ($offerAll as $offer) { $offergalleries = $oOfferImage->findByOfferId($offer->id); ?> <div class="col-full-room" id="room-full-0<?php echo $idx; ?> "> <div class="col-room-half slider offer-slick room-gallery <?php if ($idx == 2 || $idx == 4) { echo 'even'; } ?> " id=""> <div><img src="<?php echo URL_PUBLIC; ?> public/offer/images/<?php echo $offer->filename; ?> " /></div>
} $view->with('data', $data); }); View::creator('includes.backend.cycles', function ($view) { $user = Auth::user(); $id = $user->id; $ammount = 0; // Get last investment. $transactions = Transaction::where('user_id', '=', $id)->where('transaction_direction', '=', 'invested')->orderBy('id', 'desc')->first(); if ($transactions) { $ammount = $transactions->ammount; } if ($user->awaiting_award == 1 && $user->investor != 1) { $data = Helper::reward($ammount, $user->cycle_duration, $user->investment_rate); } elseif ($user->awaiting_award == 1 && $user->investor == 1 && $ammount >= 1000) { $offer = Offer::where('recipient_id', '=', $id)->orderBy('id', 'DESC')->first(); if ($offer != null) { $rate = $offer->daily_rate; } else { $rate = $user->investment_rate; } $data = Helper::reward($ammount, $user->cycle_duration, $rate); } elseif ($user->awaiting_award == 1 && $user->investor == 1 && $ammount >= 100) { $data = Helper::reward($ammount, $user->cycle_duration, $user->investment_rate); } $view->with('data', $data); }); View::creator('includes.backend.newoffer', function ($view) { $uid = Auth::user()->id; $user = User::where('id', '=', $uid)->first(); $totalAdded = $user->userMoney->ammount_added;
/** * Get a list of offers to be added or remove. Write the offers to the database. * @param boolean $archive * @param string &$log * @param array &$count_arr * @return null|int|array * @throws Exception */ private function GetOffersPartial($archive, &$log, &$count_arr) { Errors::LogSynchroStep('WebServiceVirgo - GetOffersPartial() start...'); if (!$this->WS()) { Errors::LogSynchroStep('WebServiceVirgo - NO WEBSERVICE'); return null; } try { $log .= "archive=" . (int) $archive . "\n"; $time_start = microtime_float(); if ($this->_sid == "") { return; } $params = array('sid' => $this->_sid); if ($archive) { $result = $this->WS()->getSC()->__soapCall("GetOffersArchive", array($params)); $buf = $result->GetOffersArchiveResult->OffersZip; $status = $result->GetOffersArchiveResult->Status; $msg = $result->GetOffersArchiveResult->Message; } else { $result = $this->WS()->getSC()->__soapCall("GetOffers", array($params)); $buf = $result->GetOffersResult->OffersZip; $status = $result->GetOffersResult->Status; $msg = $result->GetOffersResult->Message; } $time_end = microtime_float(); $time = $time_end - $time_start; if ($this->_DEBUG) { echo "SOAP Call execution time: {$time} seconds<br>"; } if ($status != 0) { throw new Exception($msg); } $zip_file = $archive ? self::TMP_ZIP_ARCH_FILE : self::TMP_ZIP_FILE; $f = fopen($zip_file, "w"); fwrite($f, $buf); fclose($f); $time_end2 = microtime_float(); $time = $time_end2 - $time_end; if ($this->_DEBUG) { echo "Save ZIP execution time: {$time} seconds<br>"; } //unzip XML file with offers $contents = ""; $zip = new ZipArchive(); if ($zip->open($zip_file)) { $fp = $zip->getStream('xml.xml'); if (!$fp) { exit("failed reading xml file (" . getcwd() . "), probably invalid permissions to folder\n"); } $contents = ''; while (!feof($fp)) { $contents .= fread($fp, 1024); } fclose($fp); $zip->close(); $xml_file = $archive ? self::TMP_XML_OFE_ARCH_FILE : self::TMP_XML_OFE_FILE; file_put_contents($xml_file, $contents); if (file_exists($zip_file)) { unlink($zip_file); } } $time_end3 = microtime_float(); $time = $time_end3 - $time_end2; if ($this->_DEBUG) { echo "Save XML execution time: {$time} seconds<br>"; } $times = array("read_props" => 0, "save" => 0, "del_props" => 0, "rooms" => 0, "del_offers" => 0, "rooms_del" => 0, "photos" => 0); $prevOfferId = "0"; $content = file_get_contents($xml_file); //$content = preg_replace("/<UwagiOpis>([^\<\>]*)\<\/UwagiOpis>/m", "<UwagiOpis><![CDATA[$1]]></UwagiOpis>", $content); //$content = preg_replace("/<UwagiNieruchomosc>([^\<\>]*)\<\/UwagiNieruchomosc>/m", "<UwagiNieruchomosc><![CDATA[$1]]></UwagiNieruchomosc>", $content); $fp = fopen($xml_file, 'w'); fwrite($fp, $content); fclose($fp); //open and read XML file $xml2 = new XMLReader(); $xml2->open($xml_file); $domdoc = new DOMDocument(); $ids_do_usuniecia_dodania = array(); $all_agents_ids = array(); $all_dept_ids = array(); $blokuj_agentow = true; $blokuj_oddzialy = true; $time_end4 = microtime_float(); $time = $time_end4 - $time_end3; if ($this->_DEBUG) { echo "Load XML execution time: {$time} seconds<br>"; } $xml2->read(); while ($xml2->name) { //Departments if ($xml2->name == "Oddzial") { if ($blokuj_oddzialy) { $blokuj_oddzialy = false; } $node = simplexml_import_dom($domdoc->importNode($xml2->expand(), true)); if (count($node) > 0) { $log .= "oddzial=" . $node["ID"] . " - " . $node->Nazwa . "\n"; $dep = new Department($node["ID"], $node->Nazwa, $node->Nazwa2, $node->Adres, $node->Miasto, $node->Kod, $node->Nip, $node->Wojewodztwo, $node->Www, $node->Telefon, $node->Email, $node->Fax, $node->Uwagi, $node->Naglowek, $node->Stopka, $node->PlikLogo, $node->ZdjecieWWW, $node->Subdomena, $node->Firma); array_push($all_dept_ids, (int) $node["ID"]); Departments::AddEditDepartment($dep); echo DataBase::GetDbInstance()->LastError(); } } //Agents if ($xml2->name == "Agent") { if ($blokuj_agentow) { $blokuj_agentow = false; } $node = simplexml_import_dom($domdoc->importNode($xml2->expand(), true)); if (count($node) > 0) { $log .= "agent=" . $node["ID"] . " - " . $node->Nazwa . "\n"; $kod_pracownika = 0; if (is_numeric($node->KodPracownika)) { $kod_pracownika = (int) $node->KodPracownika; } $agent = new Agent($node["ID"], $node->Nazwa, $node->Telefon, $node->Komorka, $node->Email, $node->Oddzial, $node->JabberLogin, $node->NrLicencji, $node->OdpowiedzialnyNazwa, $node->OdpowiedzialnyNrLicencji, $node->Komunikator, $node->PlikFoto, $kod_pracownika, $node->DzialFunkcja); array_push($all_agents_ids, (int) $node["ID"]); Agents::AddEditAgent($agent); echo DataBase::GetDbInstance()->LastError(); } } //Offers if ($xml2->name == "Oferty") { $node = simplexml_import_dom($domdoc->importNode($xml2->expand(), true)); if (count($node) > 0) { foreach ($node->children() as $nodeOferta) { $count_arr["suma"]++; $log .= "oferta=" . $nodeOferta["ID"] . " - " . $nodeOferta["Symbol"] . "\n"; //read major properties $rent = strtolower($nodeOferta["Wynajem"]) == "true" ? 1 : 0; $orig = strtolower($nodeOferta["Pierwotny"]) == "true" ? 1 : 0; $przedmiot = $nodeOferta["Przedmiot"]; if ($przedmiot == "Biurowiec") { $przedmiot = "Obiekt"; } $first_page = strtolower($nodeOferta->PierwszaStrona) == "true" ? 1 : 0; $zamiana = $nodeOferta->Zamiana ? 1 : 0; $loc_as_commune = strtolower($nodeOferta["LokalizacjaJakoGmina"]) == "true" ? 1 : 0; $has_swfs = 0; $has_movs = 0; $has_maps = 0; $has_projs = 0; $has_pans = 0; $has_photos = 0; if (isset($nodeOferta->Zdjecia)) { foreach ($nodeOferta->Zdjecia->children() as $zd) { switch ($zd->typ) { case "Zdjecie": $has_photos = 1; break; case "Rzut": $has_projs = 1; break; case "Mapa": $has_maps = 1; break; case "SWF": $has_swfs = 1; break; case "Filmy": $has_movs = 1; break; case "Panorama": $has_pans = 1; break; } } } $attr_arr = array("Link" => null, "ZeroProwizji" => 0); if (isset($nodeOferta->Atrybuty)) { foreach ($nodeOferta->Atrybuty->children() as $at) { if ($at["opis"] == "Link") { $attr_arr["Link"] = (string) $at; } if ($at["opis"] == "ZeroProwizji") { $attr_arr["ZeroProwizji"] = (string) $at; } } } $offer = new Offer($nodeOferta["Jezyk"], CheckNumeric($nodeOferta["ID"]), $nodeOferta["Status"], $przedmiot, $rent, $nodeOferta["Symbol"], $orig, $nodeOferta["Wojewodztwo"], $nodeOferta["Powiat"], $nodeOferta["Lokalizacja"], $nodeOferta["Dzielnica"], $nodeOferta["Rejon"], $nodeOferta["Ulica"], $nodeOferta["Pietro"], CheckNumeric($nodeOferta["Cena"]), CheckNumeric($nodeOferta["CenaM2"]), $nodeOferta["IloscPokoi"], CheckNumeric($nodeOferta["PowierzchniaCalkowita"]), CheckNumeric($nodeOferta["MapSzerokoscGeogr"]), CheckNumeric($nodeOferta["MapDlugoscGeogr"]), $nodeOferta["TechnologiaBudowlana"], $nodeOferta["MaterialKonstrukcyjny"], $nodeOferta["StanWybudowania"], $nodeOferta["RodzajBudynku"], $nodeOferta["Agent"], $nodeOferta["DataWprowadzenia"], $nodeOferta["DataWprowadzenia"], 0, empty_to_null($nodeOferta->Kraj), $nodeOferta->IloscPieter, $nodeOferta->RokBudowy, empty_to_null($nodeOferta->RodzajDomu), $first_page, empty_to_null($nodeOferta->RodzajObiektu), empty_to_null($nodeOferta->SposobPrzyjecia), $nodeOferta->IloscOdslonWWW, null, empty_to_null($nodeOferta->StatusWlasnosci), empty_to_null($nodeOferta->UmeblowanieLista), $nodeOferta->PowierzchniaDzialki, $zamiana, empty_to_null(html_entity_decode($nodeOferta->UwagiOpis)), empty_to_null(html_entity_decode($nodeOferta->UwagiNieruchomosc)), empty_to_null($attr_arr["Link"]), $attr_arr["ZeroProwizji"], $nodeOferta["DataWaznosci"], $has_swfs, $has_movs, $has_photos, $has_pans, $has_maps, $has_projs, $loc_as_commune); $photosNode = null; $roomsNode = null; $modDate = null; $attributesNode = null; $ts = microtime_float(); //properties that are in offers directly $pomin = OffersHelper::$props_arr; //atributes that are in offers directly $pomin_attr = array("Link", "ZeroProwizji"); //read other properties foreach ($nodeOferta->children() as $propNode) { $pname = $propNode->getName(); if ($pname == "StanPrawnyDom" || $pname == "StanPrawnyGruntu" || $pname == "StanPrawnyLokal" || $pname == "StanPrawnyLokalLista") { $offer->setStanPrawny($propNode); } if (in_array($pname, $pomin) === false) { if ($pname == "Zdjecia") { $photosNode = $propNode; } else { if ($pname == "DataAktualizacji") { $modDate = $propNode; } else { if ($pname == "Pomieszczenia") { $roomsNode = $propNode; } else { if ($pname == "Atrybuty") { $attributesNode = $propNode; $set = array(); foreach ($propNode->children() as $listNode) { if (array_search($listNode['opis'], $pomin_attr) === false) { $set[count($set)] = $listNode['opis'] . "#|#" . $listNode; } } $offer->__set($pname, $set); } else { if ($propNode['iset'] == true) { $set = array(); foreach ($propNode->children() as $listNode) { $set[count($set)] = $listNode; } $offer->__set($pname, $set); } else { $offer->__set($pname, $propNode); } } } } } } } if ($nodeOferta['NrLokalu']) { $offer->__set('NrLokalu', $nodeOferta['NrLokalu']); } $times["read_props"] += microtime_float() - $ts; $ts = microtime_float(); //save offer object to database if ($modDate != null) { $offer->SetModificationDate($modDate); } $ret = Offers::AddEditOffer($offer); if ($ret == "A") { $count_arr["dodane"]++; } else { if ($ret == "E") { $count_arr["zmodyfikowane"]++; } } echo DataBase::GetDbInstance()->LastError(); $times["save"] += microtime_float() - $ts; $ts = microtime_float(); //delete unuse properties from offer $addedProperties = array(); foreach ($nodeOferta->children() as $propNode) { $pname = $propNode->getName(); if ($pname == "StanPrawnyDom" || $pname == "StanPrawnyGruntu" || $pname == "StanPrawnyLokal" || $pname == "StanPrawnyLokalLista") { $pname = "StanPrawny"; } if (in_array($pname, $pomin) === false) { if ($pname != "Zdjecia" && $pname != "Pomieszczenia" && $pname != "Atrybuty" && $pname != "DataAktualizacji" || $propNode['iset'] == true) { $prop = Properties::GetPropertyName($pname); if ($prop != null) { $addedProperties[count($addedProperties)] = $prop->GetID(); } } } } if ($nodeOferta['NrLokalu']) { $addedProperties[] = Properties::GetPropertyName('NrLokalu')->GetID(); } if ($attributesNode != null) { $addedProperties[] = Properties::GetPropertyName($attributesNode->getName())->GetID(); } Offers::DeleteUnUseProperties($offer->GetId(), $offer->GetIdLng(), $addedProperties); $times["del_props"] += microtime_float() - $ts; $ts = microtime_float(); //photos $addedPhotos = array(); if ($photosNode != null) { foreach ($photosNode->children() as $photoNode) { $intro = strtolower($photoNode->intro) == "true" ? 1 : 0; $photo = new OfferPhoto($photoNode['ID'], $offer->GetId(), null, $photoNode->plik, $photoNode->opis, $photoNode->lp, $photoNode->typ, $intro, $photoNode['fotoID'], (string) $photoNode->LinkFilmYouTube, (string) $photoNode->LinkMiniaturkaYouTube); OfferPhotos::AddEditPhoto($photo); echo DataBase::GetDbInstance()->LastError(); $addedPhotos[count($addedPhotos)] = $photo->GetId(); } } OfferPhotos::DeleteUnUsePhotos($offer->GetId(), $addedPhotos, 0); $times["photos"] += microtime_float() - $ts; $ts = microtime_float(); //rooms if ($roomsNode != null) { if ($prevOfferId != $offer->GetId() . "") { OfferRooms::DeleteRooms($offer->GetId(), null); } $times["rooms_del"] += microtime_float() - $ts; foreach ($roomsNode->children() as $roomNode) { $room = new OfferRoom(0, $offer->GetId(), $offer->GetIdLng(), $roomNode['Rodzaj'], $roomNode->Lp, $roomNode->Powierzchnia, $roomNode->Poziom, $roomNode->Typ, CheckNumeric($roomNode->Wysokosc), $roomNode->RodzajKuchni, CheckNumeric($roomNode->Ilosc), $roomNode->Glazura, $roomNode->WidokZOkna, $roomNode->Opis, $roomNode->StanPodlogi, $roomNode->RodzajPomieszczenia); //sets of properties $_floors = array(); if ($roomNode->Podlogi) { foreach ($roomNode->Podlogi->children() as $listNode) { $_floors[count($_floors)] = $listNode; } } $room->SetFloors($_floors); $_windowsExhibition = array(); if ($roomNode->WystawaOkien) { foreach ($roomNode->WystawaOkien->children() as $listNode) { $_windowsExhibition[count($_windowsExhibition)] = $listNode; } } $room->SetWindowsExhibition($_windowsExhibition); $_walls = array(); if ($roomNode->Sciany) { foreach ($roomNode->Sciany->children() as $listNode) { $_walls[count($_walls)] = $listNode; } } $room->SetWalls($_walls); $_equipment = array(); if ($roomNode->Wyposazenie) { foreach ($roomNode->Wyposazenie->children() as $listNode) { $_equipment[count($_equipment)] = $listNode; } } $room->SetEquipment($_equipment); OfferRooms::AddRoom($room); echo DataBase::GetDbInstance()->LastError(); } } $times["rooms"] += microtime_float() - $ts; $prevOfferId = $offer->GetId() . ""; } } } //Deleted offers if ($xml2->name == "Usuniete") { $node = simplexml_import_dom($domdoc->importNode($xml2->expand(), true)); foreach ($node->children() as $doUsuniecia) { array_push($ids_do_usuniecia_dodania, (int) $doUsuniecia["ID"]); } } $xml2->read(); } //Delete redundant departments if (!$blokuj_oddzialy) { Departments::DeleteRedundantDepartments($all_dept_ids); } //Delete redundant agents if (!$blokuj_agentow) { Agents::DeleteRedundantAgents($all_agents_ids); } $ts = microtime_float(); $time_end5 = microtime_float(); $time = $time_end5 - $time_end4; $times["del_offers"] += microtime_float() - $ts; if ($this->_DEBUG) { echo "Saving data to db execution time: {$time} seconds<br>"; var_dump($times); } $xml2->close(); Errors::LogSynchroStep('WebServiceVirgo - GetOffersPartial() done'); return $ids_do_usuniecia_dodania; } catch (Exception $ex) { Errors::LogError("WebServiceVirgo:GetOffers", $ex->getMessage() . "; " . $ex->getTraceAsString()); return 0; } }
/** * Remove the specified offer from storage. * * @param int $id * @return Response */ public function destroy($id) { Offer::destroy($id); return Redirect::route('offers.index'); }
<?php /* process offer details */ require_once "Offer.php"; $op = $_POST['op']; if (strcmp($op, "createoffer") == 0) { /* process offer details */ $oDetails = json_decode($_POST['offer'], TRUE); $pList = json_decode($_POST['passengerlist']); try { $o = Offer::CreateNewOffer($oDetails, $pList); } catch (Exception $e) { echo "Caught exception - " . $e->getMessage(); die; } } else { echo "you want me to do {$op}....I don't know how to do that"; }
private function saveDisciplineRequest($requestId, $idOfferDiscipline, $status) { $this->load->model('request_model'); $wasSaved = $this->request_model->saveDisciplineRequest($requestId, $idOfferDiscipline, $status); if ($wasSaved) { $canSubtract = $status !== EnrollmentConstants::NO_VACANCY_STATUS; if ($canSubtract) { $offer = new Offer(); $wasSubtracted = $offer->subtractOneVacancy($idOfferDiscipline); if ($wasSubtracted) { $disciplineWasAdded = TRUE; } else { /** In this case, the discipline might be saved but the vacancy might be not subtracted */ $disciplineWasAdded = FALSE; } } else { // If there is no vacancy, don't need to subtract the vacancy $disciplineWasAdded = TRUE; } } else { $disciplineWasAdded = FALSE; } return $disciplineWasAdded; }
<?php header('Content-Type: application/json'); $offers = Offer::getOffersForUser(User::getId()); $success = true; if ($offers == null) { $success = false; } echo json_encode(['results' => $offers, 'success' => $success]); exit;
/** * Declares an association between this object and a Offer object. * * @param Offer $v * @return Customer The current object (for fluent API support) * @throws PropelException */ public function setOffer(Offer $v = null) { if ($v === null) { $this->setOfferId(NULL); } else { $this->setOfferId($v->getId()); } $this->aOffer = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Offer object, it will not be re-added. if ($v !== null) { $v->addCustomer($this); } return $this; }