public function changePassword(Request $request) { if ($request->input('user') == 'passenger') { $user = new Passenger(); return $user->changePassword($request->input('contactNo'), $request->input('password')); } elseif ($request->input('user') == 'driver') { $user = new Driver(); return $user->changePassword($request->input('contactNo'), $request->input('password')); } }
/** * Passenger update ajax5(pop up) * CODE: passenger_create */ public function executeUpdate5Ajax(sfWebRequest $request) { $this->setLayout(false); if (!$this->getUser()->getAttribute('pop_pass')) { return $this->forward('passenger', 'update1Ajax'); } else { $pass_pop_session = unserialize($this->getUser()->getAttribute('pop_pass')); } if (isset($pass_pop_session)) { $passenger = $pass_pop_session; } else { $passenger = new Passenger(); } //echo "<pre>";(print_r($pass_pop_session)); $this->requester_p = trim($this->getRequestParameter('requester_p', '*')) == '' ? '*' : trim($this->getRequestParameter('requester_p', '*')); $this->form5 = new PassengerPopUpForm5($passenger); //$this->form5 = new PassengerPopUpForm5(); $this->sub_title = 'Add New Passenger'; if ($request->isMethod('post')) { $this->referer = $request->getReferer(); $this->form5->bind($request->getParameter('pass_popup5')); if ($this->form5->isValid()) { $passenger->setRequesterId($request->getParameter('person_id')); $passenger->setEmergencyContactName($request->getParameter('pass_popup5[emergency_contact_name]')); $passenger->setEmergencyContactPrimaryPhone($request->getParameter('pass_popup5[emergency_contact_primary_phone]')); $passenger->setEmergencyContactSecondaryPhone($request->getParameter('pass_popup5[emergency_contact_secondary_phone]')); $passenger->setEmergencyContactPrimaryComment($request->getParameter('pass_popup5[emergency_contact_primary_comment]')); $passenger->setEmergencyContactSecondaryComment($request->getParameter('pass_popup5[emergency_contact_secondary_comment]')); $this->getUser()->setAttribute('pop_pass', serialize($passenger)); return $this->redirect('passenger/ajaxSave'); } } else { # Set referer URL $this->referer = $request->getReferer() ? $request->getReferer() : '@passenger/update4Ajax'; } }
/** * Declares an association between this object and a Passenger object. * * @param Passenger $v * @return Companion The current object (for fluent API support) * @throws PropelException */ public function setPassenger(Passenger $v = null) { if ($v === null) { $this->setPassengerId(NULL); } else { $this->setPassengerId($v->getId()); } $this->aPassenger = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Passenger object, it will not be re-added. if ($v !== null) { $v->addCompanion($this); } return $this; }
public function removePassanger(Passenger $passenger) { unset($this->passangers[$passenger->getId()]); }
public function executeAjaxAddPersonAndPassenger(sfWebRequest $request) { #Security if (!$this->getUser()->hasCredential(array('Administrator', 'Staff'), false)) { $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer()); $this->redirect('dashboard/index'); } //$this->setLayout(false); if ($request->getParameter('add_pass') == 'yes') { $this->person = new Person(); $this->person_title = 'Step 1 : Add person'; if ($request->getParameter('camp_id')) { $this->camp_id = $request->getParameter('camp_id'); } $this->stepped = 1; } if ($request->getParameter('add_pass_iti') == 'yes') { $this->person = new Person(); $this->person_title = 'Step 1 : Add person'; $this->person_itine = 1; } if ($request->getParameter('add_cont') == 'yes') { $this->person = new Person(); $this->person_title = 'Step 1 : Add person'; $this->contact = 1; } if ($request->getParameter('id')) { $this->person = PersonPeer::retrieveByPK($request->getParameter('id')); $this->person_title = 'Edit person'; } else { $this->person = new Person(); $this->person_title = 'Add person'; } # Person Form $this->person_form = new PersonForm($this->person); $this->back = $request->getReferer(); //session $this->key = $request->getParameter('key'); if (!$this->key) { $this->key = rand(1000, 9999); } if (strstr($request->getReferer(), 'person/view')) { if ($this->person) { //session $referer_session = $this->getUser()->getAttribute('ref'); if (!$referer_session) { $referer_session = array($this->key => array()); $this->getUser()->setAttribute('ref', $referer_session); } elseif (!isset($referer_session[$this->key])) { $a = '@person_view?id=' . $this->person->getId(); $referer_session[$this->key] = array('referer' => $a); $this->getUser()->setAttribute('ref', $referer_session[$this->key]); } } } $this->person_referer = $request->getParameter('referer'); if ($request->isMethod('post')) { if ($request->hasParameter('action_from_passenger_or_requester')) { $this->action_from = $request->getParameter('action_from_passenger_or_requester'); } $this->person_referer = $request->getParameter('referer'); $this->person_form->bind($request->getParameter('per')); if ($this->person_form->isValid() && $request->getParameter('per[first_name]') != "" && $request->getParameter('per[last_name]') != "") { $this->person->setTitle($this->person_form->getValue('title')); $this->person->setFirstName($this->person_form->getValue('first_name')); $this->person->setLastName($this->person_form->getValue('last_name')); $this->person->setAddress1($this->person_form->getValue('address1')); $this->person->setAddress2($this->person_form->getValue('address2')); $this->person->setCity($this->person_form->getValue('city')); $this->person->setCounty($this->person_form->getValue('county')); $this->person->setState($this->person_form->getValue('state')); $this->person->setCountry($this->person_form->getValue('country')); $this->person->setZipcode($this->person_form->getValue('zipcode')); $this->person->setDayPhone($this->person_form->getValue('day_phone')); $this->person->setDayComment($this->person_form->getValue('day_comment')); $this->person->setEveningPhone($this->person_form->getValue('evening_phone')); $this->person->setEveningComment($this->person_form->getValue('evening_comment')); $this->person->setMobilePhone($this->person_form->getValue('mobile_phone')); $this->person->setMobileComment($this->person_form->getValue('mobile_comment')); $this->person->setPagerPhone($this->person_form->getValue('paper_phone')); $this->person->setPagerComment($this->person_form->getValue('paper_comment')); $this->person->setOtherPhone($this->person_form->getValue('other_phone')); $this->person->setOtherComment($this->person_form->getValue('other_comment')); $this->person->setFaxPhone1($this->person_form->getValue('fax_phone1')); $this->person->setFaxComment1($this->person_form->getValue('fax_comment1')); $this->person->setAutoFax($this->person_form->getValue('auto_fax')); $this->person->setFaxPhone2($this->person_form->getValue('fax_phone2')); $this->person->setFaxComment2($this->person_form->getValue('fax_comment2')); $this->person->setEmail($this->person_form->getValue('email')); $this->person->setEmailTextOnly($this->person_form->getValue('email_text_only')); $this->person->setEmailBlocked($this->person_form->getValue('email_blocked')); $this->person->setComment($this->person_form->getValue('comment')); //$this->person->setBlockMailings($this->person_form->getValue('block_mailings')==0?null:$this->person_form->getValue('block_mailings')); $this->person->setBlockMailings($this->person_form->getValue('block_mailings')); $this->person->setNewsletter($this->person_form->getValue('newsletter')); $this->person->setGender($this->person_form->getValue('gender')); $this->person->setDeceased($this->person_form->getValue('deceased')); $this->person->setDeceasedComment($this->person_form->getValue('deceased_comment')); $this->person->setSecondaryEmail($this->person_form->getValue('secondary_email')); $this->person->setDeceasedDate($this->person_form->getValue('deceased_date')); $this->person->setMiddleName($this->person_form->getValue('middle_name')); $this->person->setSuffix($this->person_form->getValue('suffix')); $this->person->setNickname($this->person_form->getValue('nickname')); $this->person->setVeteran($this->person_form->getValue('veteran')); if ($this->person->isNew()) { $content = $this->getUser()->getName() . ' added new Person: ' . $this->person->getFirstName(); ActivityPeer::log($content); } $this->person->save(); //////////////////////////////////////#bglobal omar if ($this->person->getId()) { $passenger = new Passenger($this->person->getId()); $passenger->setPersonId($this->person->getId()); $passenger->save(); $c = new Criteria(); $c->add(RoleNotificationPeer::MID, 5); $c->add(RoleNotificationPeer::NOTIFICATION, 1); $c->addOr(RoleNotificationPeer::NOTIFICATION, 3); $c->addJoin(RoleNotificationPeer::ROLE_ID, PersonRolePeer::ROLE_ID); $c->addJoin(PersonRolePeer::PERSON_ID, PersonPeer::ID); $personemail = PersonPeer::doSelect($c); $allemail = array(); $pindex = 0; foreach ($personemail as $getEmail) { if (strlen($getEmail->getEmail()) > 0) { $allemail[$pindex++] = $getEmail->getEmail(); } else { if (strlen($getEmail->getSecondaryEmail()) > 0) { $allemail[$pindex++] = $getEmail->getSecondaryEmail(); } } } //$allemail[$pindex]="*****@*****.**"; /* $email['subject']="New Person added"; $link=$request->getHost()."/person/view/".$this->person->getId(); $body="A new person added in ".$request->getHost()."\r\n" .$this->person->getFirstName()." ".$this->person->getLastName()."\r\n Profile Link: ".$link; $email['body']=$body; $email['sender_email']="*****@*****.**"; $this->getComponent('mail', 'sendBulk', array( 'subject' => $email['subject'], 'recievers' => $allemail, 'sender' => $email['sender_email'], 'body' => $email['body'], ));*/ } ///////////////////////////////////// if ($request->hasParameter('has')) { $data = ''; if ($request->getParameter('camp_id')) { $data = '&camp_id=' . $request->getParameter('camp_id'); } $this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add passenger!'); $this->redirect('@passenger_create?add_pass='******'has') . '&p_id=' . $this->person->getId() . $data); } if ($request->hasParameter('iti')) { $this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add passenger!'); $this->redirect('@passenger_create?add_pass_iti=' . $request->getParameter('iti') . '&p_id=' . $this->person->getId()); } if ($request->hasParameter('contact')) { $this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add contact!'); $this->redirect('@contact_create?person_id=' . $this->person->getId()); } $this->getUser()->setFlash('success', 'Person information has been successfully saved!'); $last = $request->getParameter('back'); $referer_session = $this->getUser()->getAttribute('ref'); //$back_url = '@person_view?id='.$this->person->getId(); //$this->redirect($back_url); //$this->person_a = $this->person_form->getValue('first_name').' '. $this->person_form->getValue('last_name'); //return $this->renderText('Person information has been successfully saved!'); //return $this->renderText($this->person_form->getValue('first_name').' '. $this->person_form->getValue('last_name')); $this->personpass_id = $this->person->getId(); $this->_passenger = PassengerPeer::getByPersonId($this->personpass_id); $this->personpass_last_name = $this->person->getLastName(); //echo $this->person->getId(); //$this->person_a = $this->person_form->getValue('first_name').' '. $this->person_form->getValue('last_name'); } else { if ($request->getParameter("per[title]") == "") { $this->titleError = "true"; } if ($request->getParameter("per[first_name]") == "") { $this->first_name_error = "true"; } if ($request->getParameter("per[last_name]") == "") { $this->last_name_error = "true"; } } $this->person_form__ = $request->getRequestParameters(); $this->setTemplate("ajaxAddPersonAndPassenger"); } else { # Set referer URL $this->person_referer = $request->getReferer() ? $request->getReferer() : '@person'; } }
/** * missionRequests save all data into corresponding tables * CODE:mission_request_create */ public function executeSave(sfWebRequest $request) { # security if (!$this->getUser()->hasCredential(array('Administrator', 'Staff', 'Coordinator'), false)) { $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getReferer()); $this->redirect('dashboard/index'); } $miss_req_session = $this->getUser()->getAttribute('miss_req'); if (!$miss_req_session) { return $this->forward('passenger', 'step3'); } //set Requester Person $req_person = new Person(); $req_person->setFirstName($miss_req_session->getReqFirstname()); $req_person->setLastName($miss_req_session->getReqLastname()); $req_person->setAddress1($miss_req_session->getReqAddress1()); $req_person->setAddress2($miss_req_session->getReqAddress2()); $req_person->setCity($miss_req_session->getReqCity()); $req_person->setCounty($miss_req_session->getReqCounty()); $req_person->setState($miss_req_session->getReqState()); $req_person->setCountry($miss_req_session->getReqCountry()); $req_person->setZipcode($miss_req_session->getReqZipcode()); $req_person->setEmail($miss_req_session->getReqEmail()); $req_person->setSecondaryEmail($miss_req_session->getReqSecondaryEmail()); $req_person->setPagerEmail($miss_req_session->getReqPagerEmail()); $req_person->setDayPhone($miss_req_session->getReqDayPhone()); $req_person->setDayComment($miss_req_session->getReqDayComment()); $req_person->setEveningPhone($miss_req_session->getReqEvePhone()); $req_person->setEveningComment($miss_req_session->getReqEveComment()); $req_person->setMobilePhone($miss_req_session->getReqMobilePhone()); $req_person->setMobileComment($miss_req_session->getReqMobileComment()); $req_person->setPagerPhone($miss_req_session->getReqPagerPhone()); $req_person->setPagerComment($miss_req_session->getReqPagerComment()); $req_person->setOtherPhone($miss_req_session->getReqOtherPhone()); $req_person->setOtherComment($miss_req_session->getReqOtherComment()); $req_person->save(); //end of Requester Person // set Requester Agency $agency = AgencyPeer::getByNamePhone(trim($miss_req_session->getAgencyName())); if ($agency) { # nothing } else { $agency = new Agency(); $agency->setName(trim($miss_req_session->getAgencyName())); $agency->save(); } //set Requester $requester = new Requester(); $requester->setPersonId($req_person->getId()); $requester->setAgencyId($agency->getId()); //$requester->setDischarge($miss_req_session->getReqDischarge()); $requester->save(); if (isset($miss_req_session->passenger_id)) { $passenger = PassengerPeer::retrieveByPK($miss_req_session->passenger_id); if (!$passenger instanceof Passenger) { $passenger = new Passenger(); } } else { $passenger = new Passenger(); } if ($passenger->isNew()) { $person = new Person(); } else { $person = $passenger->getPerson(); } //set Person to Passenger $person->setTitle($miss_req_session->getPassTitle()); $person->setFirstName($miss_req_session->getPassFirstName()); $person->setLastName($miss_req_session->getPassLastName()); $person->setGender($miss_req_session->getPassGender()); $person->setAddress1($miss_req_session->getPassAddress1()); $person->setAddress2($miss_req_session->getPassAddress2()); $person->setCity($miss_req_session->getPassCity()); $person->setState($miss_req_session->getPassState()); $person->setZipcode($miss_req_session->getPassZipcode()); $person->setCountry($miss_req_session->getPassCountry()); $person->setEmail($miss_req_session->getPassEmail()); $person->setDayPhone($miss_req_session->getPassDayPhone()); $person->setDayComment($miss_req_session->getPassDayComment()); $person->setEveningPhone($miss_req_session->getPassEvePhone()); $person->setEveningComment($miss_req_session->getPassEveComment()); $person->setMobilePhone($miss_req_session->getPassMobilePhone()); $person->setMobileComment($miss_req_session->getPassMobileComment()); $person->setPagerPhone($miss_req_session->getPassPagerPhone()); $person->setPagerComment($miss_req_session->getPassPagerComment()); $person->setOtherPhone($miss_req_session->getPassOtherPhone()); $person->setOtherComment($miss_req_session->getPassOtherComment()); $person->save(); //set Passenger $passenger->setPersonId($person->getId()); $passenger->setPassengerTypeId($miss_req_session->getPassType()); $passenger->setDateOfBirth($miss_req_session->getPassDateOfBirth()); $passenger->setIllness($miss_req_session->getIllness()); $passenger->setFinancial($miss_req_session->getFinancial()); $passenger->setPublicConsiderations($miss_req_session->getPassPublicCons()); $passenger->setPrivateConsiderations($miss_req_session->getPassPrivateCons()); $passenger->setReleasingPhysician($miss_req_session->getReleasingPhysician()); $passenger->setReleasingPhone($miss_req_session->getReleasePhone()); $passenger->setReleasingFax1($miss_req_session->getReleaseFax()); $passenger->setReleasingFax1Comment($miss_req_session->getReleaseFaxComment()); $passenger->setLodgingName($miss_req_session->getLodgingName()); $passenger->setLodgingPhone($miss_req_session->getLodgingPhone()); $passenger->setLodgingPhoneComment($miss_req_session->getLodgingPhoneComment()); $passenger->setFacilityName($miss_req_session->getFacilityName()); $passenger->setFacilityPhone($miss_req_session->getFacilityPhone()); $passenger->setFacilityPhoneComment($miss_req_session->getFacilityPhoneComment()); $passenger->setReleasingEmail($miss_req_session->getReleaseEmail()); $passenger->setTreatingPhysician($miss_req_session->getTreatingPhysician()); $passenger->setTreatingPhone($miss_req_session->getTreatingPhone()); $passenger->setTreatingFax1($miss_req_session->getTreatingFax()); $passenger->setTreatingFax1Comment($miss_req_session->getTreatingFaxComment()); $passenger->setTreatingEmail($miss_req_session->getTreatingEmail()); $passenger->setLanguageSpoken($miss_req_session->getPassLanguage()); $passenger->setBestContactMethod($miss_req_session->getBestContact()); $passenger->setEmergencyContactName($miss_req_session->getEmergencyName()); $passenger->setEmergencyContactPrimaryPhone($miss_req_session->getEmergencyPhone1()); $passenger->setEmergencyContactPrimaryComment($miss_req_session->getEmergencyPhone1Comment()); $passenger->setEmergencyContactSecondaryPhone($miss_req_session->getEmergencyPhone2()); $passenger->setEmergencyContactSecondaryComment($miss_req_session->getEmergencyPhone2Comment()); $passenger->setNeedMedicalRelease($miss_req_session->getPassMedical()); $passenger->save(); //set Companions if ($passenger && $miss_req_session->getCom1Name()) { $person = new Person(); $names[] = split(" ", $miss_req_session->getCom1Name()); //echo var_dump($names); die(); $person->setFirstName($names[0][0]); $person->setLastName($names[0][1]); $person->setDayPhone($miss_req_session->getCom1Phone()); $person->setDayComment($miss_req_session->getCom1Comment()); $person->save(); $companion = new Companion(); $companion->setPassengerId($passenger->getId()); $companion->setName($miss_req_session->getCom1Name()); $companion->setRelationship($miss_req_session->getCom1Relationship()); $companion->setDateOfBirth($miss_req_session->getCom1DateOfBirth()); $companion->setWeight($miss_req_session->getCom1Weigth()); $companion->setCompanionPhone($miss_req_session->getCom1Phone()); $companion->setCompanionPhoneComment($miss_req_session->getCom1Comment()); $companion->setPersonId($person->getId()); $companion->save(); } if ($passenger && $miss_req_session->getCom2Name()) { $person = new Person(); $names[] = split(" ", $miss_req_session->getCom2Name()); //echo var_dump($names); die(); $person->setFirstName($names[0][0]); $person->setLastName($names[0][1]); $person->setDayPhone($miss_req_session->getCom2Phone()); $person->setDayComment($miss_req_session->getCom2Comment()); $person->save(); $companion = new Companion(); $companion->setPassengerId($passenger->getId()); $companion->setName($miss_req_session->getCom2Name()); $companion->setRelationship($miss_req_session->getCom2Relationship()); $companion->setDateOfBirth($miss_req_session->getCom2DateOfBirth()); $companion->setWeight($miss_req_session->getCom2Weigth()); $companion->setCompanionPhone($miss_req_session->getCom2Phone()); $companion->setCompanionPhoneComment($miss_req_session->getCom2Comment()); $companion->setPersonId($person->getId()); $companion->save(); } if ($passenger && $miss_req_session->getCom3Name()) { $person = new Person(); $names[] = split(" ", $miss_req_session->getCom3Name()); //echo var_dump($names); die(); $person->setFirstName($names[0][0]); $person->setLastName($names[0][1]); $person->setDayPhone($miss_req_session->getCom3Phone()); $person->setDayComment($miss_req_session->getCom3Comment()); $person->save(); $companion = new Companion(); $companion->setPassengerId($passenger->getId()); $companion->setName($miss_req_session->getCom3Name()); $companion->setRelationship($miss_req_session->getCom3Relationship()); $companion->setDateOfBirth($miss_req_session->getCom3DateOfBirth()); $companion->setWeight($miss_req_session->getCom3Weigth()); $companion->setCompanionPhone($miss_req_session->getCom3Phone()); $companion->setCompanionPhoneComment($miss_req_session->getCom3Comment()); $companion->setPersonId($person->getId()); $companion->save(); } if ($passenger && $miss_req_session->getCom4Name()) { $person = new Person(); $names[] = split(" ", $miss_req_session->getCom4Name()); //echo var_dump($names); die(); $person->setFirstName($names[0][0]); $person->setLastName($names[0][1]); $person->setDayPhone($miss_req_session->getCom4Phone()); $person->setDayComment($miss_req_session->getCom4Comment()); $person->save(); $companion = new Companion(); $companion->setPassengerId($passenger->getId()); $companion->setName($miss_req_session->getCom4Name()); $companion->setRelationship($miss_req_session->getCom4Relationship()); $companion->setDateOfBirth($miss_req_session->getCom4DateOfBirth()); $companion->setWeight($miss_req_session->getCom4Weigth()); $companion->setCompanionPhone($miss_req_session->getCom4Phone()); $companion->setCompanionPhoneComment($miss_req_session->getCom4Comment()); $companion->setPersonId($person->getId()); $companion->save(); } if ($passenger && $miss_req_session->getCom5Name()) { $person = new Person(); $names[] = split(" ", $miss_req_session->getCom5Name()); //echo var_dump($names); die(); $person->setFirstName($names[0][0]); $person->setLastName($names[0][1]); $person->setDayPhone($miss_req_session->getCom5Phone()); $person->setDayComment($miss_req_session->getCom5Comment()); $person->save(); $companion = new Companion(); $companion->setPassengerId($passenger->getId()); $companion->setName($miss_req_session->getCom5Name()); $companion->setRelationship($miss_req_session->getCom5Relationship()); $companion->setDateOfBirth($miss_req_session->getCom5DateOfBirth()); $companion->setWeight($miss_req_session->getCom5Weigth()); $companion->setCompanionPhone($miss_req_session->getCom5Phone()); $companion->setCompanionPhoneComment($miss_req_session->getCom5Comment()); $companion->setPersonId($person->getId()); $companion->save(); } //set Itinerary $itinerary = ItineraryPeer::getByMissReqId($miss_req_session->getId()); if (!$itinerary) { $new_itinerary = new Itinerary(); $new_itinerary->setDateRequested(date('m/d/Y')); $new_itinerary->setMissionRequestId($miss_req_session->getId()); $new_itinerary->setMissionTypeId($miss_req_session->getMissionRequestTypeId()); $new_itinerary->setApointTime($miss_req_session->getApptDate()); $new_itinerary->setPassengerId($passenger->getId()); $new_itinerary->setRequesterId($requester->getId()); $new_itinerary->setFacility($miss_req_session->getFacilityName()); $new_itinerary->setLodging($miss_req_session->getLodgingName()); $new_itinerary->setOrginCity($miss_req_session->getOrginCity()); $new_itinerary->setOrginState($miss_req_session->getOrginState()); $new_itinerary->setDestCity($miss_req_session->getDestCity()); $new_itinerary->setDestState($miss_req_session->getDestState()); $new_itinerary->setWaiverNeed(0); $new_itinerary->setNeedMedicalRelease($miss_req_session->getPassMedical()); $new_itinerary->setComment($miss_req_session->getComment()); $new_itinerary->setAgencyId($agency->getId()); $new_itinerary->save(); } //set default Mission to Mission table //get Passenger //$passenger = PassengerPeer::getByPersonId($person->getId()); $misson = new Mission(); $misson->setRequestId($miss_req_session->getId()); $misson->setItineraryId($new_itinerary->getId()); $misson->setMissionTypeId($miss_req_session->getMissionRequestTypeId()); $misson->setDateRequested($miss_req_session->getRequesterDate()); if ($passenger) { $misson->setPassengerId($passenger->getId()); } if ($requester) { $misson->setRequesterId($requester->getId()); } if ($agency) { $misson->setAgencyId($agency->getId()); } // Farazi Mission 1 externa ID $c = new Criteria(); $c->add(MissionPeer::EXTERNAL_ID, NULL, Criteria::ISNOTNULL); $c->addDescendingOrderByColumn(MissionPeer::ID); $external_mission = MissionPeer::doSelectOne($c); $external_id = $external_mission->getExternalId(); $currentExternalId = $external_id + 1; $misson->setExternalId($currentExternalId); $misson->setApptDate($miss_req_session->getApptDate()); $misson->setFlightTime($miss_req_session->getFlightTime()); $misson->setMissionDate($miss_req_session->getMissionDate()); $misson->setMissionCount(1); $misson->save(); $missLeg = new MissionLeg(); $missLeg->setMissionId($misson->getId()); $missLeg->setLegNumber(1); if ($miss_req_session->getOrginState() && $miss_req_session->getOrginZipcode()) { //echo $miss_req_session->getOrginState().'-'.$miss_req_session->getOrginZipcode();die(); $fromairport = AirportPeer::getAirportByStateAndZipcode($miss_req_session->getOrginState(), $miss_req_session->getOrginZipcode()); if ($fromairport) { $missLeg->setFromAirportId($fromairport->getId()); } } if ($miss_req_session->getDestState() && $miss_req_session->getDestZipcode()) { //echo $miss_req_session->getDestState().'--'.$miss_req_session->getDestZipcode();die(); $toairport = AirportPeer::getAirportByStateAndZipcode($miss_req_session->getDestState(), $miss_req_session->getDestZipcode()); if ($toairport) { $missLeg->setToAirportId($toairport->getId()); } } //echo "oder";die(); $missLeg->setPassOnBoard(0); $missLeg->setWebCoordinated(0); $missLeg->setTransportation('air_mission'); $missLeg->save(); //end set Mission $this->getUser()->setFlash('success', 'New mission has successfully created!'); $miss_req_session->setProcessedDate(time()); $miss_req_session->save(); $this->getUser()->setAttribute('miss_req', null); //$this->redirect('miss_req'); //$this->getUser()->setFlash('success',$success); //$request->getParameter('back') $this->redirect('/itinerary/detail/' . $new_itinerary->getId()); }
public function AddPassenger($formno, $title, $firstname, $lastname, $btnpress = null) { $passenger = new Passenger(); $passenger->formid = $formno; $passenger->title = $title; $passenger->firstname = $firstname; $passenger->lastname = $lastname; $passenger->analyser(); $passenger_list = Session::get("Passengers"); if ($passenger_list == NULL) { $passenger_list = []; } if ($passenger->validated()) { } else { Session::set("passage-form", $formno); ContextManager::ValidationFor("warning", $passenger->getError()); } $passenger_list[$formno] = $passenger; Session::set("Passengers", $passenger_list); Session::set("Passager-Valid", $this->countValidPessenger()); $this->ViewBag("Controller", "Booking"); $this->ViewBag("Page", "PassenderForms"); return $this->View($this->viewModel->flightDbModel, "Booking", "Index"); }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Passenger $value A Passenger object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(Passenger $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
header("Location: ../controller/Controller.php"); } if (isset($_POST['Purchase'])) { $validator = new FormValidator(); $validator->addValidation("firstName", "alpha", "Please fill only aplphabets for first name"); $validator->addValidation("firstName", "req", "Please fill in first name"); $validator->addValidation("lastName", "req", "Please fill in last name"); $validator->addValidation("lastName", "alpha", "Please fill only alphabets for last name"); $validator->addValidation("age", "req", "Please fill in phone number"); $validator->addValidation("age", "numeric", "Please fill only numeric values for phone number"); if ($validator->ValidateForm()) { $_SESSION['action'] = "purchaseTicket"; $var = $_SESSION['userMiles'] + $flightDetails->getFlightMiles(); $_SESSION['userMiles'] = $var; $_SESSION['modeOfPayment'] = $_REQUEST['modeOfPayment']; $passenger = new Passenger(); $passenger->setage($_REQUEST['age']); $passenger->setfname($_REQUEST['firstName']); $passenger->setlname($_REQUEST['lastName']); $_SESSION['passengerDetails'] = serialize($passenger); header("Location: ../controller/Controller.php"); } else { echo "<B>Validation Errors:</B>"; $error_hash = $validator->GetErrors(); foreach ($error_hash as $inpname => $inp_err) { echo "<p>{$inpname} : {$inp_err}</p>\n"; } } } $disp_firstName = isset($_POST['firstName']) ? $_POST['firstName'] : ''; $disp_lastName = isset($_POST['lastName']) ? $_POST['lastName'] : '';