Example #1
0
 public function executeSaveUploadAfective()
 {
     $scores = $this->getRequestParameter('score');
     $id_course = 0;
     foreach ($scores as $k => $score) {
         if ($score != null) {
             if ($score != '-') {
                 $ids = split('_', $k);
                 #$ids [0] == Id Student
                 #$ids [1] == Id Course Schedule
                 #$ids [2] == Id Grade Spec
                 $course_schedule = CourseSchedulePeer::retrieveByPK($ids[1]);
                 $id_course = $course_schedule->getId();
                 $c = new Criteria();
                 $c->add(StudentGradeRaportPeer::STUDENT_ACCAL_ID, $ids[0]);
                 $c->add(StudentGradeRaportPeer::GRADE_SPEC_ID, $ids[2]);
                 $c->add(StudentGradeRaportPeer::COURSE_SCHEDULE_ID, $id_course);
                 $g = StudentGradeRaportPeer::doSelectOne($c);
                 if ($g == null) {
                     $g = new StudentGradeRaport();
                 }
                 $g->setGradeSpecId($ids[2]);
                 $g->setGrade($score);
                 $g->setCourseScheduleId($id_course);
                 $g->setGradeValue($score);
                 $g->setStudentAccalId($ids[0]);
                 $g->setSubjectCurrId($course_schedule->getSubjectCurrId());
                 $g->save();
             } else {
                 $ids = split('_', $k);
                 #$ids [0] == Id Student
                 #$ids [1] == Id Course Schedule
                 #$ids [2] == Id Grade Spec
                 $course_schedule = CourseSchedulePeer::retrieveByPK($ids[1]);
                 $id_course = $course_schedule->getId();
                 $c = new Criteria();
                 $c->add(StudentGradeRaportPeer::STUDENT_ACCAL_ID, $ids[0]);
                 $c->add(StudentGradeRaportPeer::GRADE_SPEC_ID, $ids[2]);
                 $c->add(StudentGradeRaportPeer::COURSE_SCHEDULE_ID, $id_course);
                 $g = StudentGradeRaportPeer::doSelectOne($c);
                 if ($g != null) {
                     $g->delete();
                 }
             }
         }
     }
     return $this->redirect('course_score_new/uploadAfektifFinish?course_id=' . $id_course);
 }
Example #2
0
 public function executeSaveAll()
 {
     $course_id = $this->getRequestParameter('course_id');
     $course_schedule = CourseSchedulePeer::retrieveByPK($course_id);
     $this->forward404Unless($course_schedule);
     $spec_id = 132;
     ## Penilaian Umum
     $scores = $this->getRequestParameter('score');
     foreach ($scores as $k => $score) {
         if ($score != null) {
             if ($score != '-') {
                 $ids = split('_', $k);
                 $c = new Criteria();
                 $c->add(StudentGradeRaportPeer::STUDENT_ACCAL_ID, $ids[0]);
                 $c->add(StudentGradeRaportPeer::GRADE_SPEC_ID, $spec_id);
                 $c->add(StudentGradeRaportPeer::COURSE_SCHEDULE_ID, $course_id);
                 $g = StudentGradeRaportPeer::doSelectOne($c);
                 if ($g == null) {
                     $g = new StudentGradeRaport();
                 }
                 ## Simpan Nilai Angka
                 if ($ids[1] == 1) {
                     $g->setGradeSpecId($spec_id);
                     $g->setTotalValue($score);
                     $g->setCourseScheduleId($course_id);
                     $g->setGradeValue($score);
                     $g->setStudentAccalId($ids[0]);
                     $g->setSubjectCurrId($course_schedule->getSubjectCurrId());
                     $g->save();
                     ## Simpan Nilai Skala
                 } elseif ($ids[1] == 2) {
                     $g->setGradeSpecId($spec_id);
                     $g->setGrade($score);
                     $g->setCourseScheduleId($course_id);
                     $g->setStudentAccalId($ids[0]);
                     $g->setSubjectCurrId($course_schedule->getSubjectCurrId());
                     $g->save();
                     ## Simpan Nilai Bobot
                 } elseif ($ids[1] == 3) {
                     $g->setGradeSpecId($spec_id);
                     $g->setRemark($score);
                     $g->setCourseScheduleId($course_id);
                     $g->setStudentAccalId($ids[0]);
                     $g->setSubjectCurrId($course_schedule->getSubjectCurrId());
                     $g->save();
                 }
             } else {
                 $ids = split('_', $k);
                 $c = new Criteria();
                 $c->add(StudentGradeRaportPeer::STUDENT_ACCAL_ID, $ids[0]);
                 $c->add(StudentGradeRaportPeer::GRADE_SPEC_ID, $spec_id);
                 $c->add(StudentGradeRaportPeer::COURSE_SCHEDULE_ID, $course_id);
                 $g = StudentGradeRaportPeer::doSelectOne($c);
                 if ($g != null) {
                     $g->delete();
                 }
             }
         }
     }
     return $this->redirect('course_afective/listAllScore?course_id=' . $course_schedule->getId());
 }
Example #3
0
 public function executeSaveAfektif()
 {
     $counseling_id = $this->getRequestParameter('counseling_id');
     $counseling = CounselingPeer::retrieveByPK($counseling_id);
     $this->forward404Unless($counseling);
     $accal_id = $this->getRequestParameter('accal_id');
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id);
     $this->forward404Unless($academic_calendar);
     ## Grade Spec ID untuk Penilaian Antar Mata Pelajaran 133
     $spec_id = 133;
     ## Penilaian Umum
     $scores = $this->getRequestParameter('score');
     foreach ($scores as $k => $score) {
         if ($score != null) {
             if ($score != '-') {
                 $ids = split('_', $k);
                 $c = new Criteria();
                 $c->add(StudentGradeRaportPeer::STUDENT_ACCAL_ID, $ids[0]);
                 $c->add(StudentGradeRaportPeer::GRADE_SPEC_ID, $spec_id);
                 $c->add(StudentGradeRaportPeer::COURSE_SCHEDULE_ID, $counseling_id);
                 $c->add(StudentGradeRaportPeer::SUBJECT_CURR_ID, $accal_id);
                 $g = StudentGradeRaportPeer::doSelectOne($c);
                 if ($g == null) {
                     $g = new StudentGradeRaport();
                 }
                 ## Simpan Nilai Angka (Total)
                 if ($ids[1] == 1) {
                     $g->setGradeSpecId($spec_id);
                     $g->setTotalValue($score);
                     $g->setCourseScheduleId($counseling_id);
                     $g->setGradeValue($score);
                     $g->setStudentAccalId($ids[0]);
                     $g->setSubjectCurrId($accal_id);
                     $g->save();
                     ## Simpan Nilai Rata-rata
                 } elseif ($ids[1] == 2) {
                     $g->setGradeSpecId($spec_id);
                     $g->setAvgValue($score);
                     $g->setCourseScheduleId($counseling_id);
                     $g->setStudentAccalId($ids[0]);
                     $g->setSubjectCurrId($accal_id);
                     $g->save();
                     ## Simpan Nilai Bobot
                 } elseif ($ids[1] == 3) {
                     $g->setGradeSpecId($spec_id);
                     $g->setRemark($score);
                     $g->setCourseScheduleId($counseling_id);
                     $g->setStudentAccalId($ids[0]);
                     $g->setSubjectCurrId($accal_id);
                     $g->save();
                 }
             } else {
                 $ids = split('_', $k);
                 $c = new Criteria();
                 $c->add(StudentGradeRaportPeer::STUDENT_ACCAL_ID, $ids[0]);
                 $c->add(StudentGradeRaportPeer::GRADE_SPEC_ID, $spec_id);
                 $c->add(StudentGradeRaportPeer::COURSE_SCHEDULE_ID, $counseling_id);
                 $c->add(StudentGradeRaportPeer::SUBJECT_CURR_ID, $accal_id);
                 $g = StudentGradeRaportPeer::doSelectOne($c);
                 if ($g != null) {
                     $g->delete();
                 }
             }
         }
     }
     return $this->redirect('counseling_new/listAfektifEdit?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId());
 }