Пример #1
0
 public function executeSaveNote()
 {
     $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);
     $descs = $this->getRequestParameter('desc');
     foreach ($descs as $m => $desc) {
         if ($desc != null) {
             if ($desc != '-') {
                 $ced = new Criteria();
                 $ced->add(StudentNotePeer::STUDENT_ID, $m);
                 $ced->add(StudentNotePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
                 $ced->add(StudentNotePeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
                 $ced->add(StudentNotePeer::COUNSELING_ID, $counseling->getId());
                 $note = StudentNotePeer::doSelectOne($ced);
                 if ($note == null) {
                     $note = new StudentNote();
                 }
                 $note->setStudentId($m);
                 $note->setAcademicCalendarId($academic_calendar->getId());
                 $note->setClassGroupId($counseling->getClassGroupId());
                 $note->setCounselingId($counseling->getId());
                 $note->setNote($desc);
                 $note->save();
             } else {
                 $ced = new Criteria();
                 $ced->add(StudentNotePeer::STUDENT_ID, $m);
                 $ced->add(StudentNotePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
                 $ced->add(StudentNotePeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
                 $ced->add(StudentNotePeer::COUNSELING_ID, $counseling->getId());
                 $note = StudentNotePeer::doSelectOne($ced);
                 if ($note != null) {
                     $note->delete();
                 }
             }
         }
     }
     return $this->redirect('counseling_sd/listNote?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId());
 }
Пример #2
0
 public function executeUpdate()
 {
     $counseling = CounselingPeer::retrieveByPk($this->getRequestParameter('counseling_id'));
     $this->forward404Unless($counseling);
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($this->getRequestParameter('accal_id'));
     $this->forward404Unless($academic_calendar);
     $status = $this->getRequestParameter('status');
     $tanggal = $this->getRequestParameter('thn') . '-' . $this->getRequestParameter('bln') . '-' . $this->getRequestParameter('tgl');
     $tanggal2 = $this->getRequestParameter('thn') . '-0' . $this->getRequestParameter('bln') . '-' . $this->getRequestParameter('tgl');
     $tgl_cetak = $this->getRequestParameter('tgl');
     $catatan = $this->getRequestParameter('note');
     $cw = new Criteria();
     $cw->add(TempTablePeer::COUNSELING_ID, $counseling->getId());
     TempTablePeer::doDelete($cw);
     $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(TempTablePeer::COUNSELING_ID, $counseling->getId());
             $cr->add(TempTablePeer::TIME, $tanggal);
             $cr->add(TempTablePeer::STUDENT_ID, $student_id);
             $temp_table = TempTablePeer::doSelectOne($cr);
             if ($temp_table == null) {
                 $temp_table = new TempTable();
             }
             $temp_table->setStudentId($student_id);
             $temp_table->setCounselingId($this->getRequestParameter('counseling_id'));
             $temp_table->setTime($tanggal);
             $temp_table->save();
             if ($catatan != null || $catatan != '') {
                 $cb = new Criteria();
                 $cb->add(StudentNotePeer::STUDENT_ID, $student_id);
                 $cb->add(StudentNotePeer::COUNSELING_ID, $counseling->getId());
                 $cb->add(StudentNotePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
                 $note = StudentNotePeer::doSelectOne($cb);
                 if ($note == null) {
                     $note = new StudentNote();
                 }
                 $note->setStudentId($student_id);
                 $note->setCounselingId($counseling->getId());
                 $note->setClassGroupId($counseling->getClassGroupId());
                 $note->setAcademicCalendarId($academic_calendar->getId());
                 $note->setNote($catatan);
                 $note->save();
             }
         }
     }
     $this->counseling = $counseling;
     $this->tanggal = $tanggal;
     $this->tgl_cetak = $tgl_cetak;
     $this->status = $status;
     $this->catatan = $catatan;
     return $this->redirect('counseling_hist/preview?counseling_id=' . $counseling->getId() . '&accal_id=' . $academic_calendar->getId() . '&time=' . $tanggal . '&time2=' . $tanggal2 . '&tgl_cetak=' . $tgl_cetak . '&note=' . $catatan);
 }
Пример #3
0
 public function addStudentNote(StudentNote $l)
 {
     $this->collStudentNotes[] = $l;
     $l->setCounseling($this);
 }
Пример #4
0
 public function executeSaveNotes()
 {
     $course_id = $this->getRequestParameter('course_id');
     $course_schedule = CourseSchedulePeer::retrieveByPK($course_id);
     $this->forward404Unless($course_schedule);
     $descs = $this->getRequestParameter('desc');
     foreach ($descs as $m => $desc) {
         if ($desc != null) {
             if ($desc != '-') {
                 $ced = new Criteria();
                 $ced->add(StudentNotePeer::STUDENT_ID, $m);
                 $ced->add(StudentNotePeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                 $ced->add(StudentNotePeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                 $ced->add(StudentNotePeer::RANKING, 5);
                 $note = StudentNotePeer::doSelectOne($ced);
                 if ($note == null) {
                     $note = new StudentNote();
                 }
                 $note->setStudentId($m);
                 $note->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                 $note->setClassGroupId($course_schedule->getClassGroupId());
                 $note->setNote($desc);
                 $note->setRanking(5);
                 $note->save();
             } else {
                 $ced = new Criteria();
                 $ced->add(StudentNotePeer::STUDENT_ID, $m);
                 $ced->add(StudentNotePeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                 $ced->add(StudentNotePeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                 $ced->add(StudentNotePeer::RANKING, 5);
                 $note = StudentNotePeer::doSelectOne($ced);
                 if ($note != null) {
                     $note->delete();
                 }
             }
         }
     }
     return $this->redirect('course_score/listPersonality?course_id=' . $course_schedule->getId());
 }