예제 #1
0
 public function executeUpdateParent()
 {
     $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');
     $counseling_id = $this->getRequestParameter('counseling_id');
     $counseling = CounselingPeer::retrieveByPK($counseling_id);
     $this->forward404Unless($counseling);
     $accal_id = $this->getRequestParameter('academic_calendar_id');
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id);
     $this->forward404Unless($academic_calendar);
     $student_detail = StudentDetailPeer::retrieveByPk($this->getRequestParameter('student_detail_id'));
     $this->forward404Unless($student_detail);
     $student_detail->setFather($this->getRequestParameter('father'));
     $student_detail->setMother($this->getRequestParameter('mother'));
     $student_detail->save();
     $student = StudentPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($student);
     $father = StudentParentsPeer::retrieveByPK($this->getRequestParameter('father_id'));
     if ($father == null) {
         $father = new StudentParents();
     }
     $father->setId($this->getRequestParameter('father_id'));
     $father->setStudent($student);
     $father->setRelation(StudentParents::RELATION_FATHER);
     $father->setName($this->getRequestParameter('father'));
     $father->setPob($this->getRequestParameter('father_pob'));
     if ($this->getRequestParameter('father_dob')) {
         $father->setDob($this->getRequestParameter('father_dob'));
     }
     $father->setReligionId($this->getRequestParameter('religion_father'));
     $father->setCountryId($this->getRequestParameter('father_country'));
     $father->setDegreeId($this->getRequestParameter('degree_father'));
     $father->setJob($this->getRequestParameter('father_job'));
     $father->setNoteDetail($this->getRequestParameter('father_notedetail'));
     $father->setMonthlyRevenue($this->getRequestParameter('father_revenue'));
     $father->setOfficePhone($this->getRequestParameter('father_officephone'));
     $father->setEmail($this->getRequestParameter('father_email'));
     $father->setAddress($this->getRequestParameter('father_address'));
     $father->setCellphone($this->getRequestParameter('father_cellphone'));
     $father->save();
     $mother = StudentParentsPeer::retrieveByPK($this->getRequestParameter('mother_id'));
     if ($mother == null) {
         $mother = new StudentParents();
     }
     $mother->setId($this->getRequestParameter('mother_id'));
     $mother->setStudent($student);
     $mother->setRelation(StudentParents::RELATION_MOTHER);
     $mother->setName($this->getRequestParameter('mother'));
     $mother->setPob($this->getRequestParameter('mother_pob'));
     if ($this->getRequestParameter('mother_dob')) {
         $mother->setDob($this->getRequestParameter('mother_dob'));
     }
     $mother->setReligionId($this->getRequestParameter('religion_mother'));
     $mother->setCountryId($this->getRequestParameter('mother_country'));
     $mother->setDegreeId($this->getRequestParameter('degree_mother'));
     $mother->setJob($this->getRequestParameter('mother_job'));
     $mother->setNoteDetail($this->getRequestParameter('mother_notedetail'));
     $mother->setMonthlyRevenue($this->getRequestParameter('mother_revenue'));
     $mother->setOfficePhone($this->getRequestParameter('mother_officephone'));
     $mother->setEmail($this->getRequestParameter('mother_email'));
     $mother->setAddress($this->getRequestParameter('mother_address'));
     $mother->setCellphone($this->getRequestParameter('mother_cellphone'));
     $mother->save();
     return $this->redirect('counseling_sd/listStudent?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId());
 }
예제 #2
0
 public function executeUpdateParent()
 {
     $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');
     $student = StudentPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($student);
     $student_detail = StudentDetailPeer::retrieveByPk($this->getRequestParameter('student_detail_id'));
     $this->forward404Unless($student_detail);
     $c = new Criteria();
     $c->add(StudentParentsPeer::STUDENT_ID, $student->getId());
     $c->add(StudentParentsPeer::RELATION, StudentParents::RELATION_FATHER);
     $father = StudentParentsPeer::doSelectOne($c);
     if ($father == null) {
         $father = new StudentParents();
     }
     $father->setRelation(StudentParents::RELATION_FATHER);
     $father->setStudentId($student->getId());
     $father->setName($this->getRequestParameter('father_name'));
     $father->setPob($this->getRequestParameter('father_pob'));
     if ($this->getRequestParameter('father_dob')) {
         $father->setDob($this->getRequestParameter('father_dob'));
     }
     $father->setJob($this->getRequestParameter('father_job_note'));
     $father->setDegreeId($this->getRequestParameter('father_degree'));
     $father->setMonthlyRevenue($this->getRequestParameter('father_revenue'));
     $father->setAddress($this->getRequestParameter('father_address'));
     $father->setPostCode($this->getRequestParameter('father_postcode'));
     $father->setHomePhone($this->getRequestParameter('father_homephone'));
     $father->save();
     $ct = new Criteria();
     $ct->add(StudentParentsPeer::STUDENT_ID, $student->getId());
     $ct->add(StudentParentsPeer::RELATION, StudentParents::RELATION_MOTHER);
     $mother = StudentParentsPeer::doSelectOne($ct);
     if ($mother == null) {
         $mother = new StudentParents();
     }
     $mother->setRelation(StudentParents::RELATION_MOTHER);
     $mother->setStudentId($student->getId());
     $mother->setName($this->getRequestParameter('mother_name'));
     $mother->setPob($this->getRequestParameter('mother_pob'));
     if ($this->getRequestParameter('mother_dob')) {
         $mother->setDob($this->getRequestParameter('mother_dob'));
     }
     $mother->setJob($this->getRequestParameter('mother_job_note'));
     $mother->setDegreeId($this->getRequestParameter('mother_degree'));
     $mother->setMonthlyRevenue($this->getRequestParameter('mother_revenue'));
     $mother->setAddress($this->getRequestParameter('mother_address'));
     $mother->setPostCode($this->getRequestParameter('mother_postcode'));
     $mother->setHomePhone($this->getRequestParameter('mother_homephone'));
     $mother->save();
     $cr = new Criteria();
     $cr->add(StudentParentsPeer::STUDENT_ID, $student->getId());
     $cr->add(StudentParentsPeer::RELATION, StudentParents::RELATION_GUARDIAN);
     $guardian = StudentParentsPeer::doSelectOne($cr);
     if ($guardian == null) {
         $guardian = new StudentParents();
     }
     $guardian->setRelation(StudentParents::RELATION_GUARDIAN);
     $guardian->setStudentId($student->getId());
     $guardian->setName($this->getRequestParameter('guardian_name'));
     $guardian->setPob($this->getRequestParameter('guardian_pob'));
     if ($this->getRequestParameter('guardian_dob')) {
         $guardian->setDob($this->getRequestParameter('guardian_dob'));
     }
     $guardian->setJob($this->getRequestParameter('guardian_job_note'));
     $guardian->setDegreeId($this->getRequestParameter('guardian_degree'));
     $guardian->setMonthlyRevenue($this->getRequestParameter('guardian_revenue'));
     $guardian->setAddress($this->getRequestParameter('guardian_address'));
     $guardian->setPostCode($this->getRequestParameter('guardian_postcode'));
     $guardian->setHomePhone($this->getRequestParameter('guardian_homephone'));
     $guardian->save();
     $student_detail->setFather($father->getName());
     $student_detail->setMother($mother->getName());
     $student_detail->setFatherJob($this->getRequestParameter('father_job'));
     $student_detail->setMotherJob($this->getRequestParameter('mother_job'));
     $student_detail->setDetailFatherJob($this->getRequestParameter('detail_father_job'));
     $student_detail->setDetailMotherJob($this->getRequestParameter('detail_mother_job'));
     $student_detail->save();
     return $this->redirect('scholar/listPhysical?id=' . $student->getId());
 }