Пример #1
0
 /**
  * missionRequests step2
  * CODE: mission_request_create
  */
 public function executeStep2(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');
     }
     $this->setTemplate('step1');
     if (!$this->getUser()->getAttribute('miss_req')) {
         return $this->forward('missionRequest', 'step1');
     } else {
         $miss_req_session = $this->getUser()->getAttribute('miss_req');
     }
     if (isset($miss_req_session)) {
         $miss_req = $miss_req_session;
     } else {
         $miss_req = new MissionRequest();
     }
     //find Passenger
     $this->pass_firstname = $miss_req->getPassFirstName();
     $this->pass_lastname = $miss_req->getPassLastName();
     $this->form2 = new MissionRequestForm6($miss_req);
     $this->title = 'Mission Request Process';
     $this->sub_title = 'Find Matching Passenger';
     //passengers
     $this->pass_illness_cats = PassengerIllnessCategoryPeer::getForSelectParent();
     $this->pass_types = PassengerTypePeer::getForSelectParent();
     $this->old_passengers = PassengerPeer::getFLName($this->pass_firstname, $this->pass_lastname);
     if ($request->isMethod('post')) {
         $this->referer = $request->getReferer();
         $this->form2->bind($request->getParameter('miss_req_temp6'));
         if ($this->form2->isValid() && $request->getParameter('miss_req_temp6[pass_type]') != 0) {
             $miss_req->passenger_id = $request->getParameter('passenger_id');
             //set datas to MissionRequest
             $miss_req->setPassTitle($request->getParameter('miss_req_temp6[pass_title]'));
             $miss_req->setPassGender($request->getParameter('miss_req_temp6[pass_gender]'));
             $miss_req->setPassType($request->getParameter('miss_req_temp6[pass_type]'));
             $miss_req->setPassAddress1($request->getParameter('miss_req_temp6[pass_address1]'));
             $miss_req->setPassAddress2($request->getParameter('miss_req_temp6[pass_address2]'));
             $miss_req->setPassCity($request->getParameter('miss_req_temp6[pass_city]'));
             $miss_req->setPassState($request->getParameter('miss_req_temp6[pass_state]'));
             $miss_req->setPassZipcode($request->getParameter('miss_req_temp6[pass_zipcode]'));
             $miss_req->setPassCountry($request->getParameter('miss_req_temp6[pass_country]'));
             $miss_req->setPassEmail($request->getParameter('miss_req_temp6[pass_email]'));
             $miss_req->setPassDayPhone($request->getParameter('miss_req_temp6[pass_day_phone]'));
             $miss_req->setPassDayComment($request->getParameter('miss_req_temp6[pass_day_comment]'));
             $miss_req->setPassEvePhone($request->getParameter('miss_req_temp6[pass_eve_phone]'));
             $miss_req->setPassEveComment($request->getParameter('miss_req_temp6[pass_eve_comment]'));
             $miss_req->setPassMobilePhone($request->getParameter('miss_req_temp6[pass_mobile_phone]'));
             $miss_req->setPassMobileComment($request->getParameter('miss_req_temp6[pass_mobile_comment]'));
             $miss_req->setPassPagerPhone($request->getParameter('miss_req_temp6[pass_pager_phone]'));
             $miss_req->setPassPagerComment($request->getParameter('miss_req_temp6[pass_pager_comment]'));
             $miss_req->setPassOtherPhone($request->getParameter('miss_req_temp6[pass_other_phone]'));
             $miss_req->setPassOtherComment($request->getParameter('miss_req_temp6[pass_other_comment]'));
             $miss_req->setBestContact($request->getParameter('miss_req_temp6[best_contact]'));
             $miss_req->setIllness($request->getParameter('miss_req_temp6[illness]'));
             $miss_req->setFinancial($request->getParameter('miss_req_temp6[financial]'));
             $miss_req->setPassPrivateCons($request->getParameter('miss_req_temp6[pass_private_cons]'));
             $miss_req->setPassPublicCons($request->getParameter('miss_req_temp6[pass_public_cons]'));
             $miss_req->setPassWeight($request->getParameter('miss_req_temp6[pass_weight]'));
             $miss_req->setPassHeight($request->getParameter('miss_req_temp6[pass_height]'));
             $miss_req->setPassMedical($request->getParameter('miss_req_temp6[pass_medical]'));
             $miss_req->setPassLanguage($request->getParameter('miss_req_temp6[pass_language]'));
             $miss_req->setPassDateOfBirth($request->getParameter('miss_req_temp6[pass_date_of_birth]'));
             $miss_req->setReleasingPhysician($request->getParameter('miss_req_temp6[releasing_physician]'));
             $miss_req->setReleasePhone($request->getParameter('miss_req_temp6[release_phone]'));
             $miss_req->setReleasePhoneComment($request->getParameter('miss_req_temp6[release_phone_comment]'));
             $miss_req->setReleaseFax($request->getParameter('miss_req_temp6[release_fax]'));
             $miss_req->setReleaseFaxComment($request->getParameter('miss_req_temp6[release_fax_comment]'));
             $miss_req->setReleaseEmail($request->getParameter('miss_req_temp6[release_email]'));
             $miss_req->setTreatingPhysician($request->getParameter('miss_req_temp6[treating_physician]'));
             $miss_req->setTreatingPhone($request->getParameter('miss_req_temp6[treating_phone]'));
             $miss_req->setTreatingPhoneComment($request->getParameter('miss_req_temp6[treating_phone_comment]'));
             $miss_req->setTreatingFax($request->getParameter('miss_req_temp6[treating_fax]'));
             $miss_req->setTreatingFaxComment($request->getParameter('miss_req_temp6[treating_fax_comment]'));
             $miss_req->setTreatingEmail($request->getParameter('miss_req_temp6[treating_email]'));
             $miss_req->setFacilityName($request->getParameter('miss_req_temp6[facility_name]'));
             $miss_req->setFacilityPhone($request->getParameter('miss_req_temp6[facility_phone]'));
             $miss_req->setFacilityPhoneComment($request->getParameter('miss_req_temp6[facility_phone_comment]'));
             $miss_req->setLodgingName($request->getParameter('miss_req_temp6[lodging_name]'));
             $miss_req->setLodgingPhone($request->getParameter('miss_req_temp6[lodging_phone]'));
             $miss_req->setLodgingPhoneComment($request->getParameter('miss_req_temp6[lodging_phone_comment]'));
             $miss_req->setEmergencyName($request->getParameter('miss_req_temp6[emergency_name]'));
             $miss_req->setEmergencyPhone1($request->getParameter('miss_req_temp6[emergency_phone1]'));
             $miss_req->setEmergencyPhone1Comment($request->getParameter('miss_req_temp6[emergency_phone1_comment]'));
             $miss_req->setEmergencyPhone2($request->getParameter('miss_req_temp6[emergency_phone2]'));
             $miss_req->setEmergencyPhone2Comment($request->getParameter('miss_req_temp6[emergency_phone2_comment]'));
             $this->getUser()->setAttribute('miss_req', $miss_req);
             return $this->redirect('missionRequest/step3');
         } else {
             if ($request->getParameter('miss_req_temp6[pass_type]') == 0) {
                 $this->type_error = 1;
             }
         }
     } else {
         $this->referer = $request->getReferer() ? $request->getReferer() : '@missionRequest/step2';
     }
     $this->form1 = new MissionRequestForm3($miss_req);
     $this->form3 = new MissionRequestForm7();
     $this->miss_req = $miss_req;
 }