public function executeSave() { $i18n = new sfI18N(); $i18n->initialize($this->getContext()); $i18n->setCulture($this->getUser()->getCulture()); $action_i18n = $i18n->globalMessageFormat->format('save as new'); $action_type = $this->getRequestParameter('action_type'); $c = new Criteria(); $c->add(NgRegTestPeriodPeer::NG_REG_PERIOD_ID, $this->getRequestParameter('ng_reg_period')); $c->add(NgRegTestPeriodPeer::REG_TYPE, NgRegTestPeriod::TEST); $ng_reg_test_period = NgRegTestPeriodPeer::doSelectOne($c); if ($action_type == $action_i18n || !$this->getRequestParameter('id')) { $ng_test_applicant = new NgTestApplicant(); } else { $ng_test_applicant = NgTestApplicantPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($ng_test_applicant); } $ng_test_applicant->setId($this->getRequestParameter('id')); $ng_test_applicant->setCode($this->getRequestParameter('code')); $ng_test_applicant->setNgStatusApplicantId($this->getRequestParameter('ng_status_applicant_id')); $ng_test_applicant->setApplicantType($this->getRequestParameter('applicant_type')); $ng_test_applicant->setNgRegInfoId($this->getRequestParameter('ng_reg_info_id')); $ng_test_applicant->setName($this->getRequestParameter('name')); $ng_test_applicant->setPob($this->getRequestParameter('pob')); if ($this->getRequestParameter('dob')) { $ng_test_applicant->setDob($this->getRequestParameter('dob')); } $ng_test_applicant->setHeregStatus(NgTestApplicant::NOT_DONE); if ($ng_reg_test_period) { $ng_test_applicant->setNgRegTestPeriodId($ng_reg_test_period->getId()); } $ng_test_applicant->setYear($this->getRequestParameter('year')); $ng_test_applicant->setSchoolOfOrigin($this->getRequestParameter('school_of_origin')); $ng_test_applicant->setSchoolOfOriginAddress($this->getRequestParameter('school_of_origin_address')); $ng_test_applicant->setDepartmentId($this->getRequestParameter('department_id')); $ng_test_applicant->setClassLevelId($this->getRequestParameter('class_level_id')); $ng_test_applicant->setEnquirer($this->getRequestParameter('enquirer')); $ng_test_applicant->setEnquiryRelation($this->getRequestParameter('enquiry_relation')); $ng_test_applicant->setAddress($this->getRequestParameter('address')); $ng_test_applicant->setEmail($this->getRequestParameter('email')); $ng_test_applicant->setCellphone($this->getRequestParameter('cellphone')); $ng_test_applicant->setPhone($this->getRequestParameter('phone')); $ng_test_applicant->save(); if ($ng_test_applicant->getNgStatusApplicant()->getTypeStatus() == NgStatusApplicant::ONLINE) { return $this->redirect('ng_test_applicant/list'); } else { return $this->redirect('ng_test_applicant/education?id=' . $ng_test_applicant->getId()); } }