Ejemplo n.º 1
0
 /**
  * CODE: passenger_create
  */
 public function executeSave(sfWebRequest $request)
 {
     $passenger_session = $this->getUser()->getAttribute('passangers');
     $camp_id = $passenger_session['camp_id'];
     //    if (!$passenger_session)
     //    {
     //      return $this->forward('passanger', 'step3');
     //    }
     //save
     if ($passenger_session['sub_title'] === "Edit passenger") {
         //echo $passenger_session['sub_title'];die();
         $passenger = $passenger_session['passenger'];
         $success = 'Passenger information has been successfully edited!';
     } else {
         $passenger = new Passenger();
         $success = 'Passenger information has been successfully created!';
     }
     $passenger->setPersonId($passenger_session['person_id']);
     if ($passenger_session['passenger_type_id'] == 0) {
         $passenger->setPassengerTypeId(null);
     } else {
         $passenger->setPassengerTypeId($passenger_session['passenger_type_id']);
     }
     $passenger->setParent($passenger_session['parent']);
     $passenger->setDateOfBirth($passenger_session['date_of_birth']);
     $passenger->setWeight($passenger_session['weight']);
     $passenger->setIllness($passenger_session['illness']);
     if ($passenger_session['passenger_illness_category_id'] == 0) {
         $passenger->setPassengerIllnessCategoryId(null);
     } else {
         $passenger->setPassengerIllnessCategoryId($passenger_session['passenger_illness_category_id']);
     }
     $passenger->setLanguageSpoken($passenger_session['language_spoken']);
     $passenger->setBestContactMethod($passenger_session['best_contact_method']);
     $passenger->setFinancial($passenger_session['financial']);
     $passenger->setPublicConsiderations($passenger_session['public_considerations']);
     $passenger->setPrivateConsiderations($passenger_session['private_considerations']);
     $passenger->setGroundTransportationComment($passenger_session['ground_transportation_comment']);
     $passenger->setTravelHistoryNotes($passenger_session['travel_history_notes']);
     $passenger->setReleasingPhysician($passenger_session['releasing_physician']);
     $passenger->setReleasingPhone($passenger_session['releasing_phone']);
     $passenger->setReleasingFax1($passenger_session['releasing_fax1']);
     $passenger->setReleasingFax1Comment($passenger_session['releasing_fax1_comment']);
     $passenger->setReleasingEmail($passenger_session['releasing_email']);
     $passenger->setNeedMedicalRelease($passenger_session['need_medical_release']);
     $passenger->setMedicalReleaseRequested($passenger_session['medical_release_requested']);
     $passenger->setMedicalReleaseReceived($passenger_session['medical_release_received']);
     $passenger->setTreatingPhysician($passenger_session['treating_physician']);
     $passenger->setTreatingPhone($passenger_session['treating_phone']);
     //echo $passenger_session['treating_phone']; die();
     $passenger->setTreatingFax1($passenger_session['treating_fax1']);
     $passenger->setTreatingFax1Comment($passenger_session['treating_fax1_comment']);
     $passenger->setTreatingEmail($passenger_session['treating_email']);
     $passenger->setLanguageSpoken($passenger_session['language_spoken']);
     $passenger->setLodgingName($passenger_session['lodging_name']);
     $passenger->setLodgingPhone($passenger_session['lodging_phone']);
     $passenger->setLodgingPhoneComment($passenger_session['lodging_phone_comment']);
     $passenger->setFacilityName($passenger_session['facility_name']);
     $passenger->setFacilityCity($passenger_session['facility_city']);
     $passenger->setFacilityState($passenger_session['facility_state']);
     $passenger->setFacilityPhone($passenger_session['facility_phone']);
     $passenger->setFacilityPhoneComment($passenger_session['facility_phone_comment']);
     if ($passenger_session['requester_id'] == 0) {
         $passenger->setRequesterId(null);
     } else {
         $passenger->setRequesterId($passenger_session['requester_id']);
     }
     $passenger->setEmergencyContactName($passenger_session['emergency_contact_name']);
     $passenger->setEmergencyContactPrimaryPhone($passenger_session['emergency_contact_primary_phone']);
     $passenger->setEmergencyContactPrimaryComment($passenger_session['emergency_contact_primary_comment']);
     $passenger->setEmergencyContactSecondaryPhone($passenger_session['emergency_contact_secondary_phone']);
     $passenger->setEmergencyContactSecondaryComment($passenger_session['emergency_contact_secondary_comment']);
     $newPass = false;
     if ($passenger->isNew()) {
         $person = PersonPeer::retrieveByPK($passenger_session['person_id']);
         $content = $this->getUser()->getName() . ' added new Passenger: ' . $person->getFirstName();
         ActivityPeer::log($content);
         $newPass = true;
     }
     $passenger->save();
     //die("farazi");
     if ($newPass) {
         $passengerDest = new PassengerDest();
         $passengerDest->setPassengerId($passenger->getId());
         $passengerDest->setLodging($passenger_session['lodging_name']);
         $passengerDest->setFacility($passenger_session['facility_name']);
         $passengerDest->setFacilityCity($passenger_session['facility_city']);
         $passengerDest->setFacilityState($passenger_session['facility_state']);
         $passengerDest->setLodPhone($passenger_session['lodging_phone']);
         $passengerDest->setLodPhoneComment($passenger_session['lodging_phone_comment']);
         $passengerDest->setFacPhone($passenger_session['facility_phone']);
         $passengerDest->setFacilityPhoneComment($passenger_session['facility_phone_comment']);
         $passengerDest->save();
     }
     $return_path = $this->getUser()->getAttribute('return_path');
     if ($return_path) {
         $this->getUser()->setAttribute('return_path', null);
         $success = "Passenger information has been successfully created: Passenger lastname - " . $person->getLastName();
     }
     $this->getUser()->setFlash('success', $success);
     if ($this->getUser()->getAttribute('passangers')) {
         $pass = $this->getUser()->getAttribute('passangers');
         $back = $pass['back'];
         $last = $pass['referer'];
     }
     $back_url = 'passenger';
     //    if($last || $back){
     //      if(strstr($back,'@passenger_view')){
     //        if($passenger_session['person_id']){
     //          $back_url = '@passenger_view?id='.$passenger->getId();
     //        }
     //      }elseif(strstr($back,'@person_view')){
     //        $back_url = $back;
     //      }elseif(strstr($last,'/mission/view/')){
     //        $back_url = $last;
     //      }
     //    }
     if ($last) {
         $back_url = $last;
     }
     if ($back) {
         $back_url = $back;
     }
     if ($camp_id) {
         $campPassenger = new CampPassenger();
         $campPassenger->setCampId($camp_id);
         $campPassenger->setPassengerId($passenger->getId());
         $campPassenger->save();
         $this->redirect('/camp/view/id/' . $camp_id);
     }
     // redirecting blah
     if ($return_path) {
         $this->redirect($return_path);
     }
     //    echo var_dump($back_url);die();
     //removing used session like passenger data
     unset($passenger_session[$key]);
     $this->getUser()->setAttribute('passangers', $passenger_session);
     if (strstr($back_url, '/mission/view/')) {
         $this->redirect($back_url);
     }
     //echo $passenger->getId();
     //die("farazi");
     //$personId=$passenger_session['person_id'];
     //$urlGet="/person/view/".$personId;
     $passId = $passenger->getId();
     $urlGet = "/passenger/view/" . $passId;
     //die($urlGet);
     $this->redirect($urlGet);
 }
Ejemplo n.º 2
0
 /**
  * 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      PassengerDest $value A PassengerDest object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(PassengerDest $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }