Пример #1
0
 public function saveParkingLeadAction()
 {
     $request = $this->getRequest();
     $directory = $request->server->get('DOCUMENT_ROOT') . '/secured/uploads/parking/';
     $files = $request->files->get('documents');
     $salutation = $request->request->get('salutation');
     $fname = $request->request->get('fname');
     $lname = $request->request->get('lname');
     $gender = $request->request->get('gender');
     $tmpbdate = $request->request->get('bdate');
     $bdate = new \DateTime($tmpbdate);
     $age = $request->request->get('age');
     $email = $request->request->get('email');
     $mobile = $request->request->get('mobile');
     $property = $request->request->get('property');
     $unit = $request->request->get('unit');
     $slots = $request->request->get('slots');
     $firstHeard = $request->request->get('firstHeard');
     $terms = $request->request->get('terms');
     $paymentType = $request->request->get('paymentType');
     $date = new \DateTime('now');
     $lead = new LeasingParkingLeads();
     $lead->setSalutation($salutation);
     $lead->setFname($fname);
     $lead->setLname($lname);
     $lead->setGender($gender);
     $lead->setAge($age);
     $lead->setBirthday($bdate->format('Y-m-d'));
     $lead->setEmail($email);
     $lead->setMobile($mobile);
     $lead->setProperty($property);
     $lead->setUnit($unit);
     $lead->setSlots($slots);
     $lead->setFirstHeard($firstHeard);
     $lead->setPaymentTerms($terms);
     $lead->setPaymentType($paymentType);
     $lead->setDateAdded($date->format(C::DATETIMEFORMAT));
     $lead->setStatus(C::PENDING);
     $lead->save();
     $code = 'PA' . U::generateCode(5, $lead->getId());
     $lead->setApplicationNumber($code);
     $lead->save();
     foreach ($files as $file) {
         $tmp = $file->getPathName();
         $fileName = $lead->getId() . '_' . $lead->getLname() . '_' . $lead->getApplicationNumber() . '_' . $file->getClientOriginalName();
         $target = $directory . $fileName;
         if (move_uploaded_file($tmp, $target)) {
             $doc = new LeasingDocument();
             $doc->setDocument($fileName);
             $doc->save();
             $ld = new LeasingLeadDocument();
             $ld->setLeadId($lead->getId());
             $ld->setDocumentId($doc->getId());
             $ld->setLeadTypeId(C::PARKING);
             $ld->save();
         } else {
             echo -2;
             exit;
         }
     }
     $tl1 = new LeasingTimelineActivity();
     $tl1->setLeadTypeId(C::PARKING);
     $tl1->setLeadId($lead->getId());
     $tl1->setUser('Lead');
     $tl1->setActivity('Applied for Parking Space');
     $tl1->setTimestamp($date->format(C::DATETIMEFORMAT));
     $tl1->setStatus('Pending');
     $tl1->setStatusId(C::PENDING);
     $tl1->save();
     $this->get('session')->set('thank-you', 1);
     $client = new GlobeClient();
     $msg = "Thank you, " . $lead->getFname() . " " . $lead->getLname() . "! Your application reference number (ARN) is " . $lead->getApplicationNumber() . ". We will update you once we've reviewed your application. You can check your status in this page, http://bit.ly/as12f. Log in with your Application Reference Number. This msg is FREE.";
     $sms = $client->sms($this->globeShortCode);
     $response = $sms->sendMessage($lead->getMobile(), $msg, $this->appId, $this->appSecret);
     if ($response && !isset($response['error'])) {
         $badge = new LeasingLeadBadges();
         $badge->setBadgeId(11);
         $badge->setLeadTypeId(C::PARKING);
         $badge->setLeadId($lead->getId());
         $badge->setStatus(1);
         $badge->save();
         $tl2 = new LeasingTimelineActivity();
         $tl2->setLeadTypeId(C::PARKING);
         $tl2->setLeadId($lead->getId());
         $tl2->setUser('System');
         $tl2->setActivity('Verified mobile number');
         $tl2->setTimestamp($date->format(C::DATETIMEFORMAT));
         $tl2->setStatus('Mobile Verified');
         $tl2->setStatusId(C::MOBILE_VERIFIED);
         $tl2->save();
     }
     $ve = VerifyEmail::verifyThisEmail($lead->getEmail());
     if ($ve = 'valid') {
         $badge = new LeasingLeadBadges();
         $badge->setBadgeId(12);
         $badge->setLeadTypeId(C::PARKING);
         $badge->setLeadId($lead->getId());
         $badge->setStatus(1);
         $badge->save();
         $tl3 = new LeasingTimelineActivity();
         $tl3->setLeadTypeId(C::PARKING);
         $tl3->setLeadId($lead->getId());
         $tl3->setUser('System');
         $tl3->setActivity('Verified email address');
         $tl3->setTimestamp($date->format(C::DATETIMEFORMAT));
         $tl3->setStatus('Email Verified');
         $tl3->setStatusId(C::EMAIL_VERIFIED);
         $tl3->save();
     }
     echo 1;
     exit;
 }
Пример #2
0
 public function saveEventBookingAction()
 {
     $request = $this->getRequest();
     $directory = $request->server->get('DOCUMENT_ROOT') . '/secured/uploads/events/';
     $files = $request->files->get('documents');
     $salutation = $request->request->get('salutation');
     $fname = $request->request->get('fname');
     $lname = $request->request->get('lname');
     $gender = $request->request->get('gender');
     $age = $request->request->get('age');
     $email = $request->request->get('email');
     $mobile = $request->request->get('mobile');
     $tmpbdate = $request->request->get('bdate');
     $bdate = new \DateTime($tmpbdate);
     $tmpEventDate = $request->request->get('eventDate');
     $eventDate = new \DateTime($tmpEventDate);
     $eventTimeFrom = $request->request->get('eventTimeFrom');
     $eventTimeTo = $request->request->get('eventTimeTo');
     $eventPostId = $request->request->get('postId');
     $eventSpecific = $request->request->get('eventSpecific');
     $firstHeard = $request->request->get('firstHeard');
     $date = new \DateTime('now');
     $eventPlace = LeasingEventPlacePeer::getEventPlaceByPostId($eventPostId);
     $eventLead = new LeasingEventLeads();
     $eventLead->setFname($fname);
     $eventLead->setLname($lname);
     $eventLead->setBirthdate($bdate->format('Y-m-d'));
     $eventLead->setAge($age);
     $eventLead->setGender($gender);
     $eventLead->setMobile($mobile);
     $eventLead->setEmail($email);
     $eventLead->setEventLeadType(1);
     $eventLead->save();
     $eventBooking = new LeasingEventBookings();
     $eventBooking->setEventPlaceId($eventPlace->getId());
     $eventBooking->setEventPlaceSpecific($eventSpecific);
     $eventBooking->setEventLeadsId($eventLead->getId());
     $eventBooking->setEventDate($eventDate->format('Y-m-d'));
     $eventBooking->setEventStartTime($eventTimeFrom);
     $eventBooking->setEventEndTime($eventTimeTo);
     $eventBooking->setDateAdded($date->format(C::DATETIMEFORMAT));
     $eventBooking->setFirstHeard($firstHeard);
     $eventBooking->setStatus(C::PENDING);
     $eventBooking->setPrevStatus(C::PENDING);
     $eventBooking->save();
     $code = 'EV' . U::generateCode(5, $eventBooking->getId());
     $eventBooking->setApplicationNumber($code);
     $eventBooking->save();
     $tl1 = new LeasingTimelineActivity();
     $tl1->setLeadTypeId(C::EVENT);
     $tl1->setLeadId($eventBooking->getId());
     $tl1->setUser('Lead');
     $tl1->setActivity('Requested for Event Space Rental');
     $tl1->setTimestamp($date->format(C::DATETIMEFORMAT));
     $tl1->setStatus('Pending');
     $tl1->setStatusId(C::PENDING);
     $tl1->save();
     foreach ($files as $file) {
         $tmp = $file->getPathName();
         $fileName = $eventBooking->getId() . '_' . $eventLead->getLname() . '_' . $eventBooking->getApplicationNumber() . '_' . $file->getClientOriginalName();
         $target = $directory . $fileName;
         if (move_uploaded_file($tmp, $target)) {
             $doc = new LeasingDocument();
             $doc->setDocument($fileName);
             $doc->save();
             $ld = new LeasingLeadDocument();
             $ld->setLeadId($eventBooking->getId());
             $ld->setDocumentId($doc->getId());
             $ld->setLeadTypeId(C::EVENT);
             $ld->save();
         } else {
             echo -2;
             exit;
         }
     }
     $this->get('session')->set('thank-you', 1);
     $client = new GlobeClient();
     $msg = "Thank you, " . $eventLead->getFname() . " " . $eventLead->getLname() . "! Your application reference number (ARN) is " . $eventBooking->getApplicationNumber() . ". We will update you ASAP once we've reviewed your application. You can check your status in this page, http://bit.ly/as12f. Log in with your last name and ARN. This msg is FREE.";
     $sms = $client->sms($this->globeShortCode);
     $response = $sms->sendMessage($eventLead->getMobile(), $msg, $this->appId, $this->appSecret);
     if ($response && !isset($response['error'])) {
         $badge = new LeasingLeadBadges();
         $badge->setBadgeId(11);
         $badge->setLeadTypeId(C::EVENT);
         $badge->setLeadId($eventBooking->getId());
         $badge->setStatus(1);
         $badge->save();
         $tl2 = new LeasingTimelineActivity();
         $tl2->setLeadTypeId(C::EVENT);
         $tl2->setLeadId($eventBooking->getId());
         $tl2->setUser('System');
         $tl2->setActivity('Verified mobile number');
         $tl2->setTimestamp($date->format(C::DATETIMEFORMAT));
         $tl2->setStatus('Mobile Verified');
         $tl2->setStatusId(C::MOBILE_VERIFIED);
         $tl2->save();
     }
     $ve = VerifyEmail::verifyThisEmail($eventLead->getEmail());
     if ($ve = 'valid') {
         $badge = new LeasingLeadBadges();
         $badge->setBadgeId(12);
         $badge->setLeadTypeId(C::EVENT);
         $badge->setLeadId($eventBooking->getId());
         $badge->setStatus(1);
         $badge->save();
         $tl3 = new LeasingTimelineActivity();
         $tl3->setLeadTypeId(C::EVENT);
         $tl3->setLeadId($eventBooking->getId());
         $tl3->setUser('System');
         $tl3->setActivity('Verified email address');
         $tl3->setTimestamp($date->format(C::DATETIMEFORMAT));
         $tl3->setStatus('Email Verified');
         $tl3->setStatusId(C::EMAIL_VERIFIED);
         $tl3->save();
     }
     echo 1;
     exit;
 }
Пример #3
0
 public function saveAppointmentRequestAction()
 {
     $request = $this->getRequest();
     $postid = $request->request->get('unitid');
     $date = $request->request->get('date');
     $time = $request->request->get('time');
     $leasePeriod = $request->request->get('leasePeriod');
     $targetMoveIn = $request->request->get('targetMoveIn');
     $fname = $request->request->get('fname');
     $lname = $request->request->get('lname');
     $contact = $request->request->get('contact');
     $email = $request->request->get('email');
     $country = LeasingCountryPeer::getIdByCountryName($request->request->get('country'));
     $nationality = LeasingNationalityPeer::getIdByNationalityName($request->request->get('nationality'));
     $notes = $request->request->get('notes');
     $clientIp = $request->request->get('clientIp');
     $firstHeard = $request->request->get('firstHeard');
     //UNIT DETAILS
     $unit = LeasingUnitPeer::getUnitByPostId($postid);
     $lead = new LeasingAppointmentLeads();
     $lead->setFname($fname);
     $lead->setLname($lname);
     $lead->setEmail($email);
     $lead->setMobile($contact);
     $lead->setCountryId($country->getId());
     $lead->setNationalityId($nationality->getId());
     $lead->setClientIp($clientIp);
     $lead->save();
     $now = new \DateTime('now');
     $app = new LeasingAppointments();
     $app->setAppointmentLeadsId($lead->getId());
     $app->setUnitId($unit->getId());
     $app->setPreferredDate($date);
     $app->setPreferredTime($time);
     $app->setLeasePeriod($leasePeriod);
     $app->setTargetMoveIn($targetMoveIn);
     $app->setFirstHeard($firstHeard);
     $app->setNotes($notes);
     $app->setDateAdded($now->format(C::DATETIMEFORMAT));
     $app->setStatus(C::PENDING);
     $app->setPrevStatus(C::PENDING);
     $app->save();
     $tl1 = new LeasingTimelineActivity();
     $tl1->setLeadTypeId(C::APPOINTMENT);
     $tl1->setLeadId($lead->getId());
     $tl1->setUser('Lead');
     $tl1->setActivity('Requested Unit Viewing');
     $tl1->setTimestamp($now->format(C::DATETIMEFORMAT));
     $tl1->setStatus('Pending');
     $tl1->setStatusId(C::PENDING);
     $tl1->save();
     $this->get('session')->set('thank-you', 1);
     $client = new GlobeClient();
     $msg = "Thank you, " . $lead->getFname() . " " . $lead->getLname() . "! Your request to view " . $app->getLeasingUnit()->getName() . " is now being processed. We will update you ASAP once an agent is assigned to assist you. This msg is FREE.";
     $sms = $client->sms($this->globeShortCode);
     $response = $sms->sendMessage($lead->getMobile(), $msg, $this->appId, $this->appSecret);
     if ($response && !isset($response['error'])) {
         $badge = new LeasingLeadBadges();
         $badge->setBadgeId(11);
         $badge->setLeadTypeId(C::APPOINTMENT);
         $badge->setLeadId($lead->getId());
         $badge->setStatus(1);
         $badge->save();
         $tl2 = new LeasingTimelineActivity();
         $tl2->setLeadTypeId(C::APPOINTMENT);
         $tl2->setLeadId($lead->getId());
         $tl2->setUser('System');
         $tl2->setActivity('Verified mobile number');
         $tl2->setTimestamp($now->format(C::DATETIMEFORMAT));
         $tl2->setStatus('Mobile Verified');
         $tl2->setStatusId(C::MOBILE_VERIFIED);
         $tl2->save();
     }
     $ve = VerifyEmail::verifyThisEmail($lead->getEmail());
     if ($ve = 'valid') {
         $badge = new LeasingLeadBadges();
         $badge->setBadgeId(12);
         $badge->setLeadTypeId(C::PARKING);
         $badge->setLeadId($lead->getId());
         $badge->setStatus(1);
         $badge->save();
         $tl3 = new LeasingTimelineActivity();
         $tl3->setLeadTypeId(C::PARKING);
         $tl3->setLeadId($lead->getId());
         $tl3->setUser('System');
         $tl3->setActivity('Verified email address');
         $tl3->setTimestamp($now->format(C::DATETIMEFORMAT));
         $tl3->setStatus('Email Verified');
         $tl3->setStatusId(C::EMAIL_VERIFIED);
         $tl3->save();
     }
     echo 1;
     exit;
     return new Response();
 }