public function executeSaveLector() { $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 = CounselingPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($counseling); #$counseling->setId($this->getRequestParameter('id')); $counseling->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id')); $counseling->setClassGroupId($this->getRequestParameter('class_group_id')); $counseling->save(); $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) { $cr = new Criteria(); $cr->add(CounselingTutorPeer::COUNSELING_ID, $counseling->getId()); $cr->add(CounselingTutorPeer::EMPLOYEE_ID, $student_id); $counseling_tutor = CounselingTutorPeer::doSelectOne($cr); if ($counseling_tutor == null) { $counseling_tutor = new CounselingTutor(); } $counseling_tutor->setEmployeeId($student_id); $counseling_tutor->setCounselingId($this->getRequestParameter('id')); $counseling_tutor->save(); } } return $this->redirect('counselor_new/student?id=' . $counseling->getId()); }