コード例 #1
0
 public function saveCampPassengerList($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (!isset($this->widgetSchema['camp_passenger_list'])) {
         // somebody has unset this widget
         return;
     }
     if (is_null($con)) {
         $con = $this->getConnection();
     }
     $c = new Criteria();
     $c->add(CampPassengerPeer::PASSENGER_ID, $this->object->getPrimaryKey());
     CampPassengerPeer::doDelete($c, $con);
     $values = $this->getValue('camp_passenger_list');
     if (is_array($values)) {
         foreach ($values as $value) {
             $obj = new CampPassenger();
             $obj->setPassengerId($this->object->getPrimaryKey());
             $obj->setCampId($value);
             $obj->save();
         }
     }
 }
コード例 #2
0
ファイル: actions.class.php プロジェクト: yasirgit/afids
 /**
  * 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);
 }
コード例 #3
0
ファイル: actions.class.php プロジェクト: yasirgit/afids
 public function executeAutoAddMissionsOnCamp(sfWebRequest $request)
 {
     // see if there is airport exist with this name
     $airport_name = $request->getParameter('airportname');
     $airport = AirportPeer::getBySpecificAirportName($airport_name);
     // If there is no airport then insert it into airport table
     if (!$airport) {
         // @TODO Set default airport fields values
         $airport = new Airport();
         $airport->setName($airport_name);
         $airport->save();
     }
     $pass_id = $request->getParameter('passenger');
     $camp_id = $request->getParameter('camp_id');
     $camp_passenger = new CampPassenger();
     $camp_passenger->setCampId($camp_id);
     $camp_passenger->setPassengerId($pass_id);
     if (CampPassengerPeer::doCount($camp_passenger->buildCriteria())) {
         $passenger = PassengerPeer::retrieveByPK($pass_id);
         $this->getUser()->setFlash('warning', 'Passenger "' . $passenger->getPerson()->getName() . '" has already been added!');
         return $this->redirect('camp/view?id=' . $request->getParameter('camp_id'));
     }
     $camp = CampPeer::retrieveByPK($camp_id);
     $this->forward404Unless($camp);
     $note = $request->getParameter('note');
     //$camp_passenger->setAirportId($camp->getAirportId ()); // Camp Location Id
     $camp_passenger->setNote($note);
     //if ($camp_passenger->save()){
     //return $this->renderText($airport->getId());
     //}
     $mission_type = MissionTypePeer::getByName('normal');
     if (!$mission_type instanceof MissionType) {
         $mission_type = MissionTypePeer::doSelectOne(new Criteria());
         $this->forward404Unless($mission_type);
     }
     $airport = AirportPeer::getBySpecificAirportName($airport_name);
     $camp_location = $camp->getAirport();
     $itinerary = new Itinerary();
     $itinerary->setCampId($camp->getId());
     $itinerary->setPassengerId($pass_id);
     $itinerary->setDateRequested(time());
     $itinerary->setApointTime('unspecified');
     $itinerary->setMissionTypeId($mission_type->getId());
     $itinerary->setAgencyId($camp->getAgencyId());
     $itinerary->setCancelItinerary(1);
     $itinerary->save();
     // Mission 1
     $mission1 = new Mission();
     $mission1->setItineraryId($itinerary->getId());
     $mission1->setCampId($camp->getId());
     $mission1->setCancelMission(1);
     $mission1->setPassengerId($pass_id);
     $mission1->setMissionCount(1);
     $mission1->setDateRequested(time());
     $mission1->setExternalId($this->getLatestExternalId());
     $mission1->setMissionTypeId($mission_type->getId());
     $mission1->save();
     $camp_passenger->setReturnAirportId(NULL);
     // this indicates that return airport id would be camp airport id
     $camp_passenger->setAirportId($airport->getId());
     $camp_passenger->setMissionId($mission1->getId());
     $camp_passenger->save();
     $mission1_leg1 = new MissionLeg();
     $mission1_leg1->setFromAirportId($airport->getId());
     $mission1_leg1->setLegNumber(1);
     $mission1_leg1->setMissionId($mission1->getId());
     if ($camp_location) {
         $mission1_leg1->setToAirportId($camp_location->getId());
     } else {
         $mission1_leg1->setToAirportId(NULL);
     }
     $mission1_leg1->setCancelMissionLeg(1);
     $mission1_leg1->save();
     // Mission 2
     $mission2 = new Mission();
     $mission2->setItineraryId($itinerary->getId());
     $mission2->setCampId($camp->getId());
     $mission2->setCancelMission(1);
     $mission2->setPassengerId($pass_id);
     $mission2->setMissionCount(2);
     // From treatment to hme
     $mission2->setDateRequested(time());
     $mission2->setExternalId($this->getLatestExternalId());
     $mission2->setMissionTypeId($mission_type->getId());
     $mission2->save();
     $camp_passenger2 = new CampPassenger();
     $camp_passenger2->setCampId($camp_id);
     $camp_passenger2->setPassengerId($pass_id);
     $camp_passenger2->setMissionId($mission2->getId());
     $camp_passenger2->setAirportId(NULL);
     // this indicates that return airport id would be camp airport id
     $camp_passenger2->setReturnAirportId($airport->getId());
     $camp_passenger2->setNote($note);
     $camp_passenger2->save();
     $mission2_leg2 = new MissionLeg();
     if ($camp_location) {
         $mission2_leg2->setFromAirportId($camp_location->getId());
     } else {
         $mission2_leg2->setFromAirportId(NULL);
     }
     $mission2_leg2->setLegNumber(1);
     $mission2_leg2->setMissionId($mission2->getId());
     $mission2_leg2->setToAirportId($airport->getId());
     $mission2_leg2->setCancelMissionLeg(1);
     $mission2_leg2->save();
     return $this->redirect('camp/view?id=' . $camp->getId());
 }