Exemplo n.º 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());
 }