public function executeSave() { $counseling_id = $this->getRequestParameter('counseling_id'); $counseling = CounselingPeer::retrieveByPK($counseling_id); $this->forward404Unless($counseling); $term = $this->getRequestParameter('term'); $accal_id = $this->getRequestParameter('academic_calendar_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($academic_calendar); $employee_id = $this->getRequestParameter('employee_id'); $employee = EmployeePeer::retrieveByPK($employee_id); $this->forward404Unless($employee); $descs = $this->getRequestParameter('desc'); foreach ($descs as $m => $desc) { if ($desc != null) { if ($desc != '-') { $ced = new Criteria(); $ced->add(StudentDescPeer::STUDENT_ACCAL_ID, $m); $ced->add(StudentDescPeer::TERM, $term); $spec = StudentDescPeer::doSelectOne($ced); if ($spec == null) { $spec = new StudentDesc(); } $spec->setStudentAccalId($m); $spec->setTerm($term); $spec->setNote($desc); $spec->save(); } else { $ced = new Criteria(); $ced->add(StudentDescPeer::STUDENT_ACCAL_ID, $m); $ced->add(StudentDescPeer::TERM, $term); $spec = StudentDescPeer::doSelectOne($ced); if ($spec != null) { $spec->delete(); } } } } return $this->redirect('course_tk/listScore?accal_id=' . $academic_calendar->getId() . '&term=' . $term . '&counseling_id=' . $counseling->getId() . '&employee_id=' . $employee_id); }
public function executeSaveDescript() { $course_schedule = CourseSchedulePeer::retrieveByPk($this->getRequestParameter('course_id')); $this->forward404Unless($course_schedule); $grade_spec = GradeSpecPeer::retrieveByPK($this->getRequestParameter('grade_spec_id')); $this->forward404Unless($grade_spec); $desc = $this->getRequestParameter('desc'); $student_list_ser = $this->getRequestParameter('student_list_ser'); $params = array(); foreach (explode('&', $this->getRequestParameter('student_list_ser')) as $p) { $p = explode('=', $p); $params[rawurldecode($p[0])][] = rawurldecode($p[1]); } if (array_key_exists('students', $params)) { foreach ($params['students'] as $student_id) { if ($desc != null || $desc != '') { $cb = new Criteria(); $cb->add(StudentDescPeer::STUDENT_ACCAL_ID, $student_id); $cb->add(StudentDescPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId()); $cb->add(StudentDescPeer::TERM, $grade_spec->getId()); $note = StudentDescPeer::doSelectOne($cb); if ($note == null) { $note = new StudentDesc(); } $note->setStudentAccalId($student_id); $note->setSubjectCurrId($course_schedule->getSubjectCurrId()); $note->setNote($desc); $note->setTerm($grade_spec->getId()); $note->save(); } } } return $this->redirect('course_score/listDescript?course_id=' . $course_schedule->getId()); }