Exemplo n.º 1
0
 /**
  * Passenger update ajax4(pop up)
  * CODE: passenger_create
  */
 public function executeUpdate4Ajax(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'));
     }
     // (print_r($pass_pop_session));
     if (isset($pass_pop_session)) {
         $passenger = $pass_pop_session;
         // echo 'yes4';
     } else {
         $passenger = new Passenger();
     }
     $this->form4 = new PassengerPopUpForm4($passenger);
     //$this->form4 = new PassengerPopUpForm4();
     $this->sub_title = 'Add New Passenger';
     if ($request->isMethod('post')) {
         $this->referer = $request->getReferer();
         $this->form4->bind($request->getParameter('pass_popup4'));
         if ($this->form4->isValid()) {
             $passenger->setLodgingName($request->getParameter('pass_popup4[lodging_name]'));
             $passenger->setLodgingPhone($request->getParameter('pass_popup4[lodging_phone]'));
             $passenger->setLodgingPhoneComment($request->getParameter('pass_popup4[lodging_phone_comment]'));
             $passenger->setFacilityName($request->getParameter('pass_popup4[facility_name]'));
             $passenger->setFacilityPhone($request->getParameter('pass_popup4[facility_phone]'));
             $passenger->setFacilityPhoneComment($request->getParameter('pass_popup4[facility_phone_comment]'));
             $passenger->setFacilityCity($request->getParameter('pass_popup4[facility_city]'));
             $passenger->setFacilityState($request->getParameter('pass_popup4[facility_state]'));
             //$this->getUser()->setAttribute('pop_pass', $passenger);
             $this->getUser()->setAttribute('pop_pass', serialize($passenger));
             return $this->redirect('passenger/update5Ajax');
         }
     } else {
         # Set referer URL
         $this->referer = $request->getReferer() ? $request->getReferer() : '@passenger/update3Ajax';
     }
 }