Ejemplo n.º 1
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());
 }
Ejemplo n.º 2
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);
 }