Exemple #1
0
 /**
  * Passenger update ajax5(pop up)
  * CODE: passenger_create
  */
 public function executeUpdate5Ajax(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'));
     }
     if (isset($pass_pop_session)) {
         $passenger = $pass_pop_session;
     } else {
         $passenger = new Passenger();
     }
     //echo "<pre>";(print_r($pass_pop_session));
     $this->requester_p = trim($this->getRequestParameter('requester_p', '*')) == '' ? '*' : trim($this->getRequestParameter('requester_p', '*'));
     $this->form5 = new PassengerPopUpForm5($passenger);
     //$this->form5 = new PassengerPopUpForm5();
     $this->sub_title = 'Add New Passenger';
     if ($request->isMethod('post')) {
         $this->referer = $request->getReferer();
         $this->form5->bind($request->getParameter('pass_popup5'));
         if ($this->form5->isValid()) {
             $passenger->setRequesterId($request->getParameter('person_id'));
             $passenger->setEmergencyContactName($request->getParameter('pass_popup5[emergency_contact_name]'));
             $passenger->setEmergencyContactPrimaryPhone($request->getParameter('pass_popup5[emergency_contact_primary_phone]'));
             $passenger->setEmergencyContactSecondaryPhone($request->getParameter('pass_popup5[emergency_contact_secondary_phone]'));
             $passenger->setEmergencyContactPrimaryComment($request->getParameter('pass_popup5[emergency_contact_primary_comment]'));
             $passenger->setEmergencyContactSecondaryComment($request->getParameter('pass_popup5[emergency_contact_secondary_comment]'));
             $this->getUser()->setAttribute('pop_pass', serialize($passenger));
             return $this->redirect('passenger/ajaxSave');
         }
     } else {
         # Set referer URL
         $this->referer = $request->getReferer() ? $request->getReferer() : '@passenger/update4Ajax';
     }
 }