public function executeSavePreviewCopy() { $class_group1 = $this->getRequestParameter('class1'); $academic1 = $this->getRequestParameter('accal1'); $class_group2 = $this->getRequestParameter('class2'); $academic2 = $this->getRequestParameter('accal2'); $c = new Criteria(); $c->add(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, $academic1); $c->add(CourseSchedulePeer::CLASS_GROUP_ID, $class_group1); $c_schedules = CourseSchedulePeer::doSelect($c); foreach ($c_schedules as $c_schedule) { $course_schedule = new CourseSchedule(); $course_schedule->setSubjectCurrId($c_schedule->getSubjectCurrId()); $course_schedule->setKkm($c_schedule->getKkm()); $course_schedule->setClassGroupId($class_group2); $course_schedule->setAcademicCalendarId($academic2); $course_schedule->setEmployeeId($c_schedule->getEmployeeId()); $course_schedule->setName($c_schedule->getName()); $course_schedule->save(); $cw = new Criteria(); $cw->add(CourseScheduleDetailPeer::COURSE_SCHEDULE_ID, $c_schedule->getId()); $c_details = CourseScheduleDetailPeer::doSelect($cw); foreach ($c_details as $c_detail) { $course_detail = new CourseScheduleDetail(); $course_detail->setCourseSchedule($course_schedule); $course_detail->setLocationId($c_detail->getLocationId()); $course_detail->setClassSessionId($c_detail->getClassSessionId()); $course_detail->setDay($c_detail->getDay()); $course_detail->save(); } $cr = new Criteria(); $cr->add(CourseScheduleTutorPeer::COURSE_SCHEDULE_ID, $c_schedule->getId()); $c_tutors = CourseScheduleTutorPeer::doSelect($cr); foreach ($c_tutors as $c_tutor) { $course_tutor = new CourseScheduleTutor(); $course_tutor->setCourseSchedule($course_schedule); $course_tutor->setEmployeeId($c_tutor->getEmployeeId()); $course_tutor->save(); } } return $this->redirect('course_sched/preview?class_group_id=' . $class_group2 . '&accal_id=' . $academic2); }