Ejemplo n.º 1
0
 /**
  * Passenger update ajax1(pop up)
  * CODE: passenger_create
  */
 public function executeUpdate1Ajax(sfWebRequest $request)
 {
     $this->setLayout(false);
     $passenger = new Passenger();
     $this->form1 = new PassengerPopUpForm1($passenger);
     $this->back = $request->getReferer();
     $this->key = $request->getParameter('key');
     if (!$this->key) {
         $this->key = rand(1000, 9999);
     }
     $this->person_a = trim($this->getRequestParameter('person_a', '*')) == '' ? '*' : trim($this->getRequestParameter('person_a', '*'));
     if ($request->isMethod('post')) {
         $this->referer = $request->getReferer();
         $this->form1->bind($request->getParameter('pass_popup1'));
         if ($this->form1->isValid() && $request->getParameter('personpass_id')) {
             //set form datas into session
             $p_type_id = $request->getParameter('pass_popup1[passenger_type_id]') ? $request->getParameter('pass_popup1[passenger_type_id]') : null;
             $p_illness_cat = $request->getParameter('pass_popup1[passenger_illness_category_id]') ? $request->getParameter('pass_popup1[passenger_illness_category_id]') : null;
             $passenger->setPersonId($request->getParameter('personpass_id'));
             $passenger->setPassengerTypeId($p_type_id);
             $passenger->setParent($request->getParameter('pass_popup1[parent]'));
             $passenger->setDateOfBirth($request->getParameter('pass_popup1[date_of_birth]'));
             $passenger->setIllness($request->getParameter('pass_popup1[illness]'));
             $passenger->setFinancial($request->getParameter('pass_popup1[financial]'));
             $passenger->setPassengerIllnessCategoryId($p_illness_cat);
             $passenger->setLanguageSpoken($request->getParameter('pass_popup1[language_spoken]'));
             $passenger->setBestContactMethod($request->getParameter('pass_popup1[best_contact_method]'));
             //$this->getUser()->setAttribute('pop_pass', $passenger);
             $this->getUser()->setAttribute('pop_pass', serialize($passenger));
             return $this->redirect('passenger/update2Ajax');
         } else {
             $this->person_need = 1;
         }
     } else {
         # Set referer URL
         $this->referer = $request->getReferer() ? $request->getReferer() : '@passenger/update1Ajax';
     }
 }