Beispiel #1
0
 public function executeSaveCopy()
 {
     $accal_tujuan = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('accal1'));
     $accal_asal = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('accal2'));
     $params = array();
     foreach (explode('&', $this->getRequestParameter('ekskul_list_ser')) as $p) {
         $p = explode('=', $p);
         $params[rawurldecode($p[0])][] = rawurldecode($p[1]);
     }
     if (array_key_exists('ekskuls', $params)) {
         foreach ($params['ekskuls'] as $ekskul_id) {
             $sc = SchedulePeer::retrieveByPK($ekskul_id);
             $cw = new Criteria();
             $cw->add(ScheduleDetailPeer::SCHEDULE_ID, $sc->getId());
             $sc_details = ScheduleDetailPeer::doSelect($cw);
             $cd = new Criteria();
             $cd->add(ScheduleTutorPeer::SCHEDULE_ID, $sc->getId());
             $sc_tutors = ScheduleTutorPeer::doSelect($cd);
             $schedule = new Schedule();
             $schedule->setGradeComponentId($sc->getGradeComponentId());
             $schedule->setAcademicCalendarId($accal_tujuan->getId());
             $schedule->setType(2);
             $schedule->setEmployeeId($sc->getEmployeeId());
             $schedule->save();
             foreach ($sc_details as $sc_detail) {
                 $schedule_detail = new ScheduleDetail();
                 $schedule_detail->setSchedule($schedule);
                 $schedule_detail->setLocationId($sc_detail->getLocationId());
                 $schedule_detail->setClassSessionId($sc_detail->getClassSessionId());
                 $schedule_detail->setDay($sc_detail->getDay());
                 $schedule_detail->save();
                 $cb = new Criteria();
                 $cb->add(StudentRaportPeer::GRADE_COMPONENT_ID, $sc->getGradeComponentId());
                 $cb->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $sc->getAcademicCalendarId());
                 $cb->add(StudentRaportPeer::SCHEDULE_DETAIL_ID, $sc_detail->getId());
                 $cb->add(StudentRaportPeer::SCHEDULE_ID, $sc->getId());
                 $stu_raports = StudentRaportPeer::doSelect($cb);
                 foreach ($stu_raports as $stu_raport) {
                     $sr = new StudentRaport();
                     $sr->setStudentId($stu_raport->getStudentId());
                     $sr->setAcademicCalendarId($accal_tujuan->getId());
                     $sr->setGradeComponentId($sc->getGradeComponentId());
                     $sr->setClassGroupId($sc->getClassGroupId());
                     $sr->setSchedule($schedule);
                     $sr->setScheduleDetail($schedule_detail);
                     $sr->save();
                 }
             }
             foreach ($sc_tutors as $sc_tutor) {
                 $schedule_tutor = new ScheduleTutor();
                 $schedule_tutor->setSchedule($schedule);
                 $schedule_tutor->setEmployeeId($sc_tutor->getEmployeeId());
                 $schedule_tutor->save();
             }
         }
     }
     return $this->redirect('extracurricular/list');
 }
Beispiel #2
0
 public function executeSaveRanks()
 {
     $counseling = CounselingPeer::retrieveByPK($this->getRequestParameter('counseling_id'));
     $this->forward404Unless($counseling);
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($this->getRequestParameter('accal_id'));
     $this->forward404Unless($academic_calendar);
     $ranks = $this->getRequestParameter('rank');
     foreach ($ranks as $student_id => $rank) {
         $c = new Criteria();
         $c->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
         $c->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
         $c->add(StudentAccalPeer::STUDENT_ID, $student_id);
         $sa = StudentAccalPeer::doSelectOne($c);
         if ($sa == null) {
             $sa = new StudentAccal();
         }
         $sa->setStudentId($student_id);
         $sa->setAcademicCalendarId($academic_calendar->getId());
         $sa->setClassGroupId($counseling->getClassGroupId());
         $sa->setClassRank($rank);
         $sa->save();
     }
     $totalScores = $this->getRequestParameter('totalScore');
     foreach ($totalScores as $student_id => $totalScore) {
         $c = new Criteria();
         $c->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
         $c->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
         $c->add(StudentAccalPeer::STUDENT_ID, $student_id);
         $sa = StudentAccalPeer::doSelectOne($c);
         if ($sa == null) {
             $sa = new StudentAccal();
         }
         $sa->setStudentId($student_id);
         $sa->setAcademicCalendarId($academic_calendar->getId());
         $sa->setClassGroupId($counseling->getClassGroupId());
         $sa->setTotalScore($totalScore);
         $sa->save();
     }
     $avgScores = $this->getRequestParameter('avgScore');
     foreach ($avgScores as $student_id => $avgScore) {
         $c = new Criteria();
         $c->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
         $c->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
         $c->add(StudentAccalPeer::STUDENT_ID, $student_id);
         $sa = StudentAccalPeer::doSelectOne($c);
         if ($sa == null) {
             $sa = new StudentAccal();
         }
         $sa->setStudentId($student_id);
         $sa->setAcademicCalendarId($academic_calendar->getId());
         $sa->setClassGroupId($counseling->getClassGroupId());
         $sa->setAvgScore($avgScore);
         $sa->save();
     }
     $statues = $this->getRequestParameter('status');
     foreach ($statues as $student_id => $status) {
         $cr = new Criteria();
         $cr->add(StudentRaportPeer::STUDENT_ID, $student_id);
         $cr->add(StudentRaportPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
         $cr->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
         $cr->add(StudentRaportPeer::GRADE_SPEC_ID, 57);
         $sr = StudentRaportPeer::doSelectOne($cr);
         if ($sr == null) {
             $sr = new StudentRaport();
         }
         $sr->setStudentId($student_id);
         $sr->setAcademicCalendarId($academic_calendar->getId());
         $sr->setClassGroupId($counseling->getClassGroupId());
         $sr->setGradeSpecId(57);
         $sr->setRemark($status);
         $sr->save();
     }
     $scores = $this->getRequestParameter('score');
     foreach ($scores as $k => $score) {
         if ($score != null) {
             if ($score != '-') {
                 $ids = split('_', $k);
                 $cb = new Criteria();
                 $cb->add(StudentHabitPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
                 $cb->add(StudentHabitPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
                 $cb->add(StudentHabitPeer::STUDENT_ID, $ids[0]);
                 $cb->add(StudentHabitPeer::GRADE_COMPONENT_ID, $ids[1]);
                 $sh = StudentHabitPeer::doSelectOne($cb);
                 if ($sh == null) {
                     $sh = new StudentHabit();
                 }
                 $sh->setStudentId($ids[0]);
                 $sh->setGradeComponentId($ids[1]);
                 $sh->setAcademicCalendarId($academic_calendar->getId());
                 $sh->setClassGroupId($counseling->getClassGroupId());
                 $sh->setGrade($score);
                 $sh->save();
             } else {
                 $ids = split('_', $k);
                 $cb = new Criteria();
                 $cb->add(StudentHabitPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
                 $cb->add(StudentHabitPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
                 $cb->add(StudentHabitPeer::STUDENT_ID, $ids[0]);
                 $cb->add(StudentHabitPeer::GRADE_COMPONENT_ID, $ids[1]);
                 $sh = StudentHabitPeer::doSelectOne($cb);
                 if ($sh == null) {
                     $sh->delete();
                 }
             }
         }
     }
     return $this->redirect('counseling_hist/listLedger?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId());
 }
Beispiel #3
0
 public function executeUpdate()
 {
     $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 $su_id) {
             $sc = new StudentRaport();
             $sc->setStudentId($su_id);
             $sc->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
             $sc->setGradeComponentId($this->getRequestParameter('grade_component_id'));
             $sc->setClassGroupId($this->getRequestParameter('class_group_id'));
             $sc->setScheduleId($this->getRequestParameter('schedule_id'));
             $sc->setScheduleDetailId($this->getRequestParameter('schedule_detail_id'));
             $sc->save();
         }
     }
     return $this->redirect('course_ekskul/list?id=' . $this->getRequestParameter('schedule_id') . '&detail_id=' . $this->getRequestParameter('schedule_detail_id'));
 }
Beispiel #4
0
 public function executeSaveUploadKnowledge()
 {
     $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();
                 $cw = new Criteria();
                 $cw->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                 $cw->add(CourseRegulationPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                 $cw->add(CourseRegulationPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                 $c_regulation = CourseRegulationPeer::doSelectOne($cw);
                 $cd = new Criteria();
                 $cd->add(StudentAccalPeer::STUDENT_ID, $ids[0]);
                 $cd->add(StudentAccalPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                 $cd->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                 $stu_accal = StudentAccalPeer::doSelectOne($cd);
                 if ($ids[2] == 92) {
                     $cm = new Criteria();
                     $cm->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                     $cm->add(CourseRegulationPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                     $cm->add(CourseRegulationPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                     $c_regulation = CourseRegulationPeer::doSelectOne($cm);
                     $c = new Criteria();
                     $c->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                     $c->add(StudentRaportPeer::GRADE_SPEC_ID, $ids[2]);
                     $c->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                     $c->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                     $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                     $g = StudentRaportPeer::doSelectOne($c);
                     if ($g == null) {
                         $g = new StudentRaport();
                     }
                     $g->setStudentId($ids[0]);
                     $g->setGradeSpecId($ids[2]);
                     $g->setGrade($score);
                     $g->setSubjectCurrId($course_schedule->getSubjectCurrId());
                     $g->setClassGroupId($course_schedule->getClassGroupId());
                     $g->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                     $g->setCitationId($stu_accal->getId());
                     $g->save();
                     if ($c_regulation) {
                         $cg = new Criteria();
                         $cg->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                         $cg->add(StudentRaportPeer::GRADE_SPEC_ID, $ids[2]);
                         $cg->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                         $cg->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                         $cg->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                         $nr = StudentRaportPeer::doSelectOne($cg);
                         $f = new Criteria();
                         $f->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                         $f->add(StudentRaportPeer::GRADE_SPEC_ID, 14);
                         $f->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                         $f->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                         $f->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                         $uh = StudentRaportPeer::doSelectOne($f);
                         if ($nr->getGrade() >= $c_regulation->getKkm()) {
                             if ($uh == null) {
                                 $uh = new StudentRaport();
                             }
                             $uh->setStudentId($ids[0]);
                             $uh->setGradeSpecId(14);
                             $uh->setGrade($c_regulation->getKkm());
                             $uh->setSubjectCurrId($course_schedule->getSubjectCurrId());
                             $uh->setClassGroupId($course_schedule->getClassGroupId());
                             $uh->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                             $uh->setCitationId($stu_accal->getId());
                             $uh->save();
                         } elseif ($nr->getGrade() < $c_regulation->getKkm()) {
                             if ($uh == null) {
                                 $uh = new StudentRaport();
                                 $uh->setStudentId($ids[0]);
                                 $uh->setGradeSpecId(14);
                                 $uh->setGrade($nr->getGrade());
                                 $uh->setSubjectCurrId($course_schedule->getSubjectCurrId());
                                 $uh->setClassGroupId($course_schedule->getClassGroupId());
                                 $uh->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                                 $uh->setCitationId($stu_accal->getId());
                                 $uh->save();
                             } else {
                                 if ($nr->getGrade() > $uh->getGrade()) {
                                     $uh->setStudentId($ids[0]);
                                     $uh->setGradeSpecId(14);
                                     $uh->setGrade($nr->getGrade());
                                     $uh->setSubjectCurrId($course_schedule->getSubjectCurrId());
                                     $uh->setClassGroupId($course_schedule->getClassGroupId());
                                     $uh->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                                     $uh->setCitationId($stu_accal->getId());
                                     $uh->save();
                                 }
                             }
                         }
                     }
                 } else {
                     $c = new Criteria();
                     $c->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                     $c->add(StudentRaportPeer::GRADE_SPEC_ID, $ids[2]);
                     $c->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                     $c->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                     $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                     $g = StudentRaportPeer::doSelectOne($c);
                     if ($g == null) {
                         $g = new StudentRaport();
                     }
                     $g->setStudentId($ids[0]);
                     $g->setGradeSpecId($ids[2]);
                     $g->setGrade($score);
                     $g->setSubjectCurrId($course_schedule->getSubjectCurrId());
                     $g->setClassGroupId($course_schedule->getClassGroupId());
                     $g->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                     $g->setCitationId($stu_accal->getId());
                     $g->save();
                     $cg = new Criteria();
                     $cg->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                     $cg->add(StudentRaportPeer::GRADE_SPEC_ID, 22);
                     $cg->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                     $cg->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                     $cg->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                     $cg->add(StudentRaportPeer::CITATION_ID, $stu_accal->getId());
                     $praktek_uts = StudentRaportPeer::doSelectOne($cg);
                     $cf = new Criteria();
                     $cf->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                     $cf->add(StudentRaportPeer::GRADE_SPEC_ID, 23);
                     $cf->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                     $cf->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                     $cf->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                     $cf->add(StudentRaportPeer::CITATION_ID, $stu_accal->getId());
                     $teori_uts = StudentRaportPeer::doSelectOne($cf);
                     if ($praktek_uts != null && $teori_uts != null) {
                         $score_uts = round(($praktek_uts->getGrade() + $teori_uts->getGrade()) / 2);
                         $f = new Criteria();
                         $f->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                         $f->add(StudentRaportPeer::GRADE_SPEC_ID, 14);
                         $f->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                         $f->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                         $f->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                         $f->add(StudentRaportPeer::CITATION_ID, $stu_accal->getId());
                         $uts = StudentRaportPeer::doSelectOne($f);
                         if ($uts == null) {
                             $uts = new StudentRaport();
                         }
                         $uts->setStudentId($ids[0]);
                         $uts->setGradeSpecId(14);
                         $uts->setGrade($score_uts);
                         $uts->setSubjectCurrId($course_schedule->getSubjectCurrId());
                         $uts->setClassGroupId($course_schedule->getClassGroupId());
                         $uts->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                         $uts->setCitationId($stu_accal->getId());
                         $uts->save();
                     } elseif ($praktek_uts != null && $teori_uts == null) {
                         $score_uts = $praktek_uts->getGrade();
                         $f = new Criteria();
                         $f->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                         $f->add(StudentRaportPeer::GRADE_SPEC_ID, 14);
                         $f->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                         $f->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                         $f->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                         $f->add(StudentRaportPeer::CITATION_ID, $stu_accal->getId());
                         $uts = StudentRaportPeer::doSelectOne($f);
                         if ($uts == null) {
                             $uts = new StudentRaport();
                         }
                         $uts->setStudentId($ids[0]);
                         $uts->setGradeSpecId(14);
                         $uts->setGrade($score_uts);
                         $uts->setSubjectCurrId($course_schedule->getSubjectCurrId());
                         $uts->setClassGroupId($course_schedule->getClassGroupId());
                         $uts->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                         $uts->setCitationId($stu_accal->getId());
                         $uts->save();
                     } elseif ($praktek_uts == null && $teori_uts != null) {
                         $score_uts = $teori_uts->getGrade();
                         $f = new Criteria();
                         $f->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                         $f->add(StudentRaportPeer::GRADE_SPEC_ID, 14);
                         $f->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                         $f->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                         $f->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                         $f->add(StudentRaportPeer::CITATION_ID, $stu_accal->getId());
                         $uts = StudentRaportPeer::doSelectOne($f);
                         if ($uts == null) {
                             $uts = new StudentRaport();
                         }
                         $uts->setStudentId($ids[0]);
                         $uts->setGradeSpecId(14);
                         $uts->setGrade($score_uts);
                         $uts->setSubjectCurrId($course_schedule->getSubjectCurrId());
                         $uts->setClassGroupId($course_schedule->getClassGroupId());
                         $uts->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                         $uts->setCitationId($stu_accal->getId());
                         $uts->save();
                     }
                     # Praktek UAS dan Teori UAS
                     $ct = new Criteria();
                     $ct->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                     $ct->add(StudentRaportPeer::GRADE_SPEC_ID, 27);
                     $ct->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                     $ct->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                     $ct->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                     $praktek_uas = StudentRaportPeer::doSelectOne($ct);
                     $ch = new Criteria();
                     $ch->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                     $ch->add(StudentRaportPeer::GRADE_SPEC_ID, 28);
                     $ch->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                     $ch->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                     $ch->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                     $teori_uas = StudentRaportPeer::doSelectOne($ch);
                     if ($praktek_uas != null && $teori_uas != null) {
                         $score_uas = round(($praktek_uas->getGrade() + $teori_uas->getGrade()) / 2);
                         $fg = new Criteria();
                         $fg->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                         $fg->add(StudentRaportPeer::GRADE_SPEC_ID, 15);
                         $fg->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                         $fg->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                         $fg->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                         $fg->add(StudentRaportPeer::CITATION_ID, $stu_accal->getId());
                         $uas = StudentRaportPeer::doSelectOne($fg);
                         if ($uas == null) {
                             $uas = new StudentRaport();
                         }
                         $uas->setStudentId($ids[0]);
                         $uas->setGradeSpecId(15);
                         $uas->setGrade($score_uas);
                         $uas->setSubjectCurrId($course_schedule->getSubjectCurrId());
                         $uas->setClassGroupId($course_schedule->getClassGroupId());
                         $uas->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                         $uas->setCitationId($stu_accal->getId());
                         $uas->save();
                     } elseif ($praktek_uas != null && $teori_uas == null) {
                         $score_uas = $praktek_uas->getGrade();
                         $fg = new Criteria();
                         $fg->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                         $fg->add(StudentRaportPeer::GRADE_SPEC_ID, 15);
                         $fg->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                         $fg->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                         $fg->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                         $fg->add(StudentRaportPeer::CITATION_ID, $stu_accal->getId());
                         $uas = StudentRaportPeer::doSelectOne($fg);
                         if ($uas == null) {
                             $uas = new StudentRaport();
                         }
                         $uas->setStudentId($ids[0]);
                         $uas->setGradeSpecId(15);
                         $uas->setGrade($score_uas);
                         $uas->setSubjectCurrId($course_schedule->getSubjectCurrId());
                         $uas->setClassGroupId($course_schedule->getClassGroupId());
                         $uas->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                         $uas->setCitationId($stu_accal->getId());
                         $uas->save();
                     } elseif ($praktek_uas == null && $teori_uas != null) {
                         $score_uas = $teori_uas->getGrade();
                         $fg = new Criteria();
                         $fg->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                         $fg->add(StudentRaportPeer::GRADE_SPEC_ID, 15);
                         $fg->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                         $fg->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                         $fg->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                         $fg->add(StudentRaportPeer::CITATION_ID, $stu_accal->getId());
                         $uas = StudentRaportPeer::doSelectOne($fg);
                         if ($uas == null) {
                             $uas = new StudentRaport();
                         }
                         $uas->setStudentId($ids[0]);
                         $uas->setGradeSpecId(15);
                         $uas->setGrade($score_uas);
                         $uas->setSubjectCurrId($course_schedule->getSubjectCurrId());
                         $uas->setClassGroupId($course_schedule->getClassGroupId());
                         $uas->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                         $uas->setCitationId($stu_accal->getId());
                         $uas->save();
                     }
                 }
             } else {
                 $ids = split('_', $k);
                 $c = new Criteria();
                 $c->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                 $c->add(StudentRaportPeer::GRADE_SPEC_ID, $ids[1]);
                 $c->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                 $c->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                 $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                 $g = StudentRaportPeer::doSelectOne($c);
                 if ($g != null) {
                     $g->delete();
                 }
             }
         }
     }
     return $this->redirect('course_score_new/uploadKnowledgeFinish?course_id=' . $id_course);
 }
Beispiel #5
0
 public function executeSaveUpload()
 {
     $scores = $this->getRequestParameter('score');
     $id_course = 0;
     $id_student = 0;
     foreach ($scores as $k => $score) {
         if ($score != null) {
             if ($score != '-') {
                 $ids = split('_', $k);
                 $course_schedule = CourseSchedulePeer::retrieveByPK($ids[1]);
                 $id_course = $course_schedule->getId();
                 $student = StudentPeer::retrieveByPK($ids[0]);
                 $id_student = $student->getId();
                 $cd = new Criteria();
                 $cd->add(StudentAccalPeer::STUDENT_ID, $ids[0]);
                 $cd->add(StudentAccalPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                 $cd->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                 $stu_accal = StudentAccalPeer::doSelectOne($cd);
                 $c = new Criteria();
                 $c->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                 $c->add(StudentRaportPeer::GRADE_SPEC_ID, $ids[2]);
                 $c->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                 $c->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                 $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                 $g = StudentRaportPeer::doSelectOne($c);
                 if ($g == null) {
                     $g = new StudentRaport();
                 }
                 $g->setStudentId($ids[0]);
                 $g->setGradeSpecId($ids[2]);
                 $g->setGrade($score);
                 $g->setSubjectCurrId($course_schedule->getSubjectCurrId());
                 $g->setClassGroupId($course_schedule->getClassGroupId());
                 $g->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                 $g->setCitationId($stu_accal->getId());
                 $g->save();
             } else {
                 $ids = split('_', $k);
                 $course_schedule = CourseSchedulePeer::retrieveByPK($ids[1]);
                 $c = new Criteria();
                 $c->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                 $c->add(StudentRaportPeer::GRADE_SPEC_ID, $ids[2]);
                 $c->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                 $c->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                 $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                 $g = StudentRaportPeer::doSelectOne($c);
                 if ($g != null) {
                     $g->delete();
                 }
             }
         }
     }
     $hiddenscores = $this->getRequestParameter('hiddenscore');
     foreach ($hiddenscores as $j => $hiddenscore) {
         $ids = split('_', $j);
         $course_schedule = CourseSchedulePeer::retrieveByPK($ids[1]);
         $student = StudentPeer::retrieveByPK($ids[0]);
         $cd = new Criteria();
         $cd->add(StudentAccalPeer::STUDENT_ID, $ids[0]);
         $cd->add(StudentAccalPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
         $cd->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
         $stu_accal = StudentAccalPeer::doSelectOne($cd);
         $cw = new Criteria();
         $cw->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
         $cw->add(CourseRegulationPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
         $cw->add(CourseRegulationPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
         $c_regulation = CourseRegulationPeer::doSelectOne($cw);
         if ($c_regulation) {
             $cr = new Criteria();
             $cr->add(GradeSpecPeer::PARENT, 1);
             $cr->addAscendingOrderByColumn(GradeSpecPeer::ID);
             $grade1 = GradeSpecPeer::doSelect($cr);
             $count1 = GradeSpecPeer::doCount($cr);
             $ct = new Criteria();
             $ct->add(GradeSpecPeer::PARENT, 7);
             $ct->addAscendingOrderByColumn(GradeSpecPeer::ID);
             $grade2 = GradeSpecPeer::doSelect($ct);
             $count2 = GradeSpecPeer::doCount($ct);
             $student_grades = array();
             $student_total_grades = 0;
             $student_grade_count = 0;
             $student_grades2 = array();
             $student_total_grades2 = 0;
             $student_grade_count2 = 0;
             $connection = Propel::getConnection();
             $statement = $connection->createStatement();
             $sql = "SELECT grade_spec_id, sum(grade) grade FROM grade_spec g left outer join student_raport s on grade_spec_id = g.id WHERE PARENT=" . $grade1[0]->getParent() . " and student_id = " . $student->getId() . " and subject_curr_id = " . $course_schedule->getSubjectCurrId() . " and class_group_id = " . $course_schedule->getClassGroupId() . " and academic_calendar_id = " . $course_schedule->getAcademicCalendarId() . " group by student_id, subject_curr_id, class_group_id, academic_calendar_id, grade_spec_id";
             $result = $statement->executeQuery($sql, ResultSet::FETCHMODE_NUM);
             while ($result->next()) {
                 $ra = $result->getRow();
                 $student_grades[$ra[0]] = $ra[1];
                 $student_total_grades += $ra[1];
                 $student_grade_count += 1;
             }
             $sql2 = "SELECT grade_spec_id, sum(grade) grade FROM grade_spec g left outer join student_raport s on grade_spec_id = g.id WHERE PARENT=" . $grade2[0]->getParent() . " and student_id = " . $student->getId() . " and subject_curr_id = " . $course_schedule->getSubjectCurrId() . " and class_group_id = " . $course_schedule->getClassGroupId() . " and academic_calendar_id = " . $course_schedule->getAcademicCalendarId() . " group by student_id, subject_curr_id, class_group_id, academic_calendar_id, grade_spec_id";
             $result2 = $statement->executeQuery($sql2, ResultSet::FETCHMODE_NUM);
             while ($result2->next()) {
                 $ra2 = $result2->getRow();
                 $student_grades2[$ra2[0]] = $ra2[1];
                 $student_total_grades2 += $ra2[1];
                 $student_grade_count2 += 1;
             }
             foreach ($grade1 as $g1) {
                 if (array_key_exists($g1->getId(), $student_grades)) {
                     $student_grades[$g1->getId()];
                 }
             }
             $avg1 = 0;
             if ($student_grade_count > 0) {
                 $avg1 = round($student_total_grades / $student_grade_count);
             }
             foreach ($grade2 as $g2) {
                 if (array_key_exists($g2->getId(), $student_grades2)) {
                     $student_grades2[$g2->getId()];
                 }
             }
             $avg2 = 0;
             if ($student_grade_count2 > 0) {
                 $avg2 = round($student_total_grades2 / $student_grade_count2);
             }
             $cm = new Criteria();
             $cm->add(StudentRaportPeer::STUDENT_ID, $student->getId());
             $cm->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
             $cm->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
             $cm->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
             $stu_scores = StudentRaportPeer::doSelect($cm);
             $student_score = array();
             foreach ($stu_scores as $stu_score) {
                 $student_score[$stu_score->getGradeSpecId()] = $stu_score->getGrade();
             }
             ## Format 2 (RUH+UTS+UAS)/3
             if ($c_regulation->getFormulaId() == 2) {
                 $scoreBLP = round(($avg1 + $student_score[14] + $student_score[15]) / 3);
                 # Format 3 (3RUH+UTS+UAS)/5
             } elseif ($c_regulation->getFormulaId() == 3) {
                 $scoreBLP = round((3 * $avg1 + $student_score[14] + $student_score[15]) / 5);
                 ## Format 4 (2RUH+RTGS+UTS+UAS)/5
             } elseif ($c_regulation->getFormulaId() == 4) {
                 $scoreBLP = round((2 * $avg1 + $avg2 + $student_score[14] + $student_score[15]) / 5);
                 ## Format 5 (2RUH+RTGS+UAS)/4
             } elseif ($c_regulation->getFormulaId() == 5) {
                 $scoreBLP = round((2 * $avg1 + $avg2 + $student_score[15]) / 4);
                 ## Format 6 (2RUH+UAS)/3
             } elseif ($c_regulation->getFormulaId() == 6) {
                 $scoreBLP = round((2 * $avg1 + $student_score[15]) / 3);
                 ## Format 7 (50%RUH+10%RTGS+20%UTS+20%UAS)
             } elseif ($c_regulation->getFormulaId() == 7) {
                 $scoreBLP = round(0.5 * $avg1 + 0.1 * $avg2 + 0.2 * $student_score[14] + 0.2 * $student_score[15]);
                 ## Format 8  (2NH+UTS+UAS)/4
             } elseif ($c_regulation->getFormulaId() == 8) {
                 #$nh = round((7 * $avg1 + 3 * $avg2) / 10);
                 $nh = round((3 * $ids[1] + $ids[2]) / 4);
                 $scoreBLP = round(($nh + $student_score[14] + $student_score[15]) / 4);
                 ## Format 9  (3NH+NUTS+NUKK)/5
             } elseif ($c_regulation->getFormulaId() == 9) {
                 #$nh = round((3*$avg1+$avg2)/5);
                 $nh = round(0.6 * $ids[1] + 0.4 * $ids[2]);
                 $scoreBLP = round((3 * $nh + $student_score[14] + $student_score[15]) / 5);
                 ## Format 10 (70%*NH+30%*(UTS+UAS))
             } elseif ($c_regulation->getFormulaId() == 10) {
                 #$nh = round($ids[1] + 2 * $ids[2]);
                 #$nh = round((0.6 * $ids [1]) + (0.4 * $ids [2]));
                 #$scoreBLP = round(0.6 * $nh + 0.4 * ($ids[3] + $ids[4]));
                 #$nh = round($avg1 + 2 * $avg2);
                 $nh = round(0.6 * $avg1 + 0.4 * $avg2);
                 $scoreBLP = round(0.6 * $nh + 0.4 * ($student_score[14] + $student_score[15]));
                 ## Format 1 atau Lainnya (RTGS+RUH+UTS+UAS)/4
             } else {
                 $scoreBLP = round(($avg1 + $avg2 + $student_score[14] + $student_score[15]) / 4);
             }
             $cn = new Criteria();
             $cn->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
             $cn->add(StudentRaportPeer::GRADE_SPEC_ID, 16);
             $cn->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
             $cn->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
             $cn->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
             $graport = StudentRaportPeer::doSelectOne($cn);
             if ($graport == null) {
                 $graport = new StudentRaport();
             }
             $graport->setStudentId($ids[0]);
             $graport->setGradeSpecId(16);
             $graport->setGrade($scoreBLP);
             $graport->setSubjectCurrId($course_schedule->getSubjectCurrId());
             $graport->setClassGroupId($course_schedule->getClassGroupId());
             $graport->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
             $graport->setCitationId($stu_accal->getId());
             $graport->save();
             ## Menyimpan Nilai Raport Murni
             $ii = new Criteria();
             $ii->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
             $ii->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
             $ii->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
             $ii->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
             $ii->add(StudentRaportPeer::GRADE_SPEC_ID, 88);
             $gi = StudentRaportPeer::doSelectOne($ii);
             if ($gi == null) {
                 $gi = new StudentRaport();
             }
             $gi->setStudentId($ids[0]);
             $gi->setGradeSpecId(88);
             $gi->setGrade($scoreBLP);
             $gi->setSubjectCurrId($course_schedule->getSubjectCurrId());
             $gi->setClassGroupId($course_schedule->getClassGroupId());
             $gi->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
             $gi->setCitationId($stu_accal->getId());
             $gi->save();
         }
     }
     return $this->redirect('course_score/uploadFinish?course_id=' . $id_course);
 }
Beispiel #6
0
 public function executeSaveEksSmp()
 {
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($this->getRequestParameter('accal_id'));
     $this->forward404Unless($academic_calendar);
     $schedule = SchedulePeer::retrieveByPk($this->getRequestParameter('schedule_id'));
     $this->forward404Unless($schedule);
     $schedule_detail = ScheduleDetailPeer::retrieveByPk($this->getRequestParameter('detail_id'));
     $this->forward404Unless($schedule_detail);
     $class_group = ClassGroupPeer::retrieveByPK($this->getRequestParameter('class_id'));
     $this->forward404Unless($class_group);
     $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(StudentRaportPeer::GRADE_COMPONENT_ID, $schedule->getGradeComponentId());
             $cr->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $schedule->getAcademicCalendarId());
             $cr->add(StudentRaportPeer::SCHEDULE_DETAIL_ID, $schedule_detail->getId());
             $cr->add(StudentRaportPeer::SCHEDULE_ID, $schedule->getId());
             $cr->add(StudentRaportPeer::CLASS_GROUP_ID, $class_group->getId());
             $cr->add(StudentRaportPeer::STUDENT_ID, $student_id);
             $sc = StudentRaportPeer::doSelectOne($cr);
             if ($sc == null) {
                 $sc = new StudentRaport();
             }
             $sc->setStudentId($student_id);
             $sc->setAcademicCalendarId($schedule->getAcademicCalendarId());
             $sc->setGradeComponentId($schedule->getGradeComponentId());
             $sc->setClassGroupId($class_group->getId());
             $sc->setScheduleId($schedule->getId());
             $sc->setScheduleDetailId($schedule_detail->getId());
             $sc->save();
         }
     }
     $this->schedule = $schedule;
     $this->schedule_detail = $schedule_detail;
     $this->academic_calendar = $academic_calendar;
     #return $this->redirect('counseling_sd/listEksStu?id='.$schedule->getId().'&detail_id='.$schedule_detail->getId().'&accal_id='.$academic_calendar->getId().'&counseling_id='.$counseling->getId());
     $this->getRequest()->setParameter('accal_id', $academic_calendar->getId());
     $this->getRequest()->setParameter('id', $schedule->getId());
     $this->getRequest()->setParameter('detail_id', $schedule_detail->getId());
     $this->forward($this->getModuleName(), 'listEksStu');
 }
Beispiel #7
0
 public function executeSaveRaportHistory()
 {
     $course_id = $this->getRequestParameter('course_id');
     $course_schedule = CourseSchedulePeer::retrieveByPK($course_id);
     $this->forward404Unless($course_schedule);
     $cw = new Criteria();
     $cw->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
     $cw->add(CourseRegulationPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
     $cw->add(CourseRegulationPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
     $c_regulation = CourseRegulationPeer::doSelectOne($cw);
     if ($c_regulation) {
         $scores = $this->getRequestParameter('score');
         foreach ($scores as $k => $score) {
             if ($score != null) {
                 if ($score != '-') {
                     $ids = split('_', $k);
                     $cd = new Criteria();
                     $cd->add(StudentAccalPeer::STUDENT_ID, $ids[0]);
                     $cd->add(StudentAccalPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                     $cd->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                     $stu_accal = StudentAccalPeer::doSelectOne($cd);
                     $c = new Criteria();
                     $c->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                     $c->add(StudentRaportPeer::GRADE_SPEC_ID, $ids[1]);
                     $c->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                     $c->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                     $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                     $g = StudentRaportPeer::doSelectOne($c);
                     if ($g == null) {
                         $g = new StudentRaport();
                     }
                     $g->setStudentId($ids[0]);
                     $g->setGradeSpecId($ids[1]);
                     $g->setGrade($score);
                     $g->setSubjectCurrId($course_schedule->getSubjectCurrId());
                     $g->setClassGroupId($course_schedule->getClassGroupId());
                     $g->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                     $g->setCitationId($stu_accal->getId());
                     $g->save();
                 } else {
                     $ids = split('_', $k);
                     $c = new Criteria();
                     $c->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                     $c->add(StudentRaportPeer::GRADE_SPEC_ID, $ids[1]);
                     $c->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                     $c->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                     $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                     $g = StudentRaportPeer::doSelectOne($c);
                     if ($g != null) {
                         $g->delete();
                     }
                 }
             }
         }
         #Nilai Utama dan Remed
         $exams = $this->getRequestParameter('exam');
         foreach ($exams as $k => $exam) {
             if ($exam != null) {
                 if ($exam != '-') {
                     $ids = split('_', $k);
                     $cd = new Criteria();
                     $cd->add(StudentAccalPeer::STUDENT_ID, $ids[0]);
                     $cd->add(StudentAccalPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                     $cd->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                     $stu_accal = StudentAccalPeer::doSelectOne($cd);
                     $c = new Criteria();
                     $c->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                     $c->add(StudentRaportPeer::GRADE_SPEC_ID, $ids[1]);
                     $c->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                     $c->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                     $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                     $g = StudentRaportPeer::doSelectOne($c);
                     if ($g == null) {
                         $g = new StudentRaport();
                     }
                     $g->setStudentId($ids[0]);
                     $g->setGradeSpecId($ids[1]);
                     $g->setGrade($exam);
                     $g->setSubjectCurrId($course_schedule->getSubjectCurrId());
                     $g->setClassGroupId($course_schedule->getClassGroupId());
                     $g->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                     $g->setCitationId($stu_accal->getId());
                     $g->save();
                     $grade_spec = GradeSpecPeer::retrieveByPK($ids[1]);
                     #Nilai Utama
                     if ($grade_spec->getCode() == 'NU') {
                         $cg = new Criteria();
                         $cg->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                         $cg->add(StudentRaportPeer::GRADE_SPEC_ID, $grade_spec->getId());
                         $cg->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                         $cg->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                         $cg->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                         $nu = StudentRaportPeer::doSelectOne($cg);
                         $f = new Criteria();
                         $f->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                         $f->add(StudentRaportPeer::GRADE_SPEC_ID, $grade_spec->getParent());
                         $f->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                         $f->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                         $f->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                         $uh = StudentRaportPeer::doSelectOne($f);
                         if ($uh == null) {
                             $uh = new StudentRaport();
                         }
                         $uh->setStudentId($ids[0]);
                         $uh->setGradeSpecId($grade_spec->getParent());
                         $uh->setGrade($nu->getGrade());
                         $uh->setSubjectCurrId($course_schedule->getSubjectCurrId());
                         $uh->setClassGroupId($course_schedule->getClassGroupId());
                         $uh->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                         $uh->setCitationId($stu_accal->getId());
                         $uh->save();
                         #Nilai Remedial
                     } elseif ($grade_spec->getCode() == 'NR') {
                         $cg = new Criteria();
                         $cg->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                         $cg->add(StudentRaportPeer::GRADE_SPEC_ID, $grade_spec->getId());
                         $cg->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                         $cg->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                         $cg->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                         $nr = StudentRaportPeer::doSelectOne($cg);
                         $f = new Criteria();
                         $f->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                         $f->add(StudentRaportPeer::GRADE_SPEC_ID, $grade_spec->getParent());
                         $f->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                         $f->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                         $f->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                         $uh = StudentRaportPeer::doSelectOne($f);
                         if ($nr->getGrade() >= $c_regulation->getKkm()) {
                             $score_atas = $nr->getGrade() - $c_regulation->getKkm();
                             $score_bawah = round(0.1 * (100 - $c_regulation->getKkm()));
                             $score = round($c_regulation->getKkm() + $score_atas / $score_bawah);
                             if ($uh == null) {
                                 $uh = new StudentRaport();
                             }
                             $uh->setStudentId($ids[0]);
                             $uh->setGradeSpecId($grade_spec->getParent());
                             $uh->setGrade($score);
                             $uh->setSubjectCurrId($course_schedule->getSubjectCurrId());
                             $uh->setClassGroupId($course_schedule->getClassGroupId());
                             $uh->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                             $uh->setCitationId($stu_accal->getId());
                             $uh->save();
                         }
                         #Nilai Pengayaan
                     } elseif ($grade_spec->getCode() == 'NP') {
                         $cg = new Criteria();
                         $cg->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                         $cg->add(StudentRaportPeer::GRADE_SPEC_ID, $grade_spec->getId());
                         $cg->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                         $cg->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                         $cg->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                         $nr = StudentRaportPeer::doSelectOne($cg);
                         $f = new Criteria();
                         $f->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                         $f->add(StudentRaportPeer::GRADE_SPEC_ID, $grade_spec->getParent());
                         $f->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                         $f->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                         $f->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                         $uh = StudentRaportPeer::doSelectOne($f);
                         if ($nr->getGrade() >= $uh->getGrade()) {
                             $score_atas = $nr->getGrade() - $uh->getGrade();
                             $score_bawah = round(0.1 * (100 - $uh->getGrade()));
                             $score = round($uh->getGrade() + $score_atas / $score_bawah);
                             if ($uh == null) {
                                 $uh = new StudentRaport();
                             }
                             $uh->setStudentId($ids[0]);
                             $uh->setGradeSpecId($grade_spec->getParent());
                             $uh->setGrade($score);
                             $uh->setSubjectCurrId($course_schedule->getSubjectCurrId());
                             $uh->setClassGroupId($course_schedule->getClassGroupId());
                             $uh->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                             $uh->setCitationId($stu_accal->getId());
                             $uh->save();
                         }
                     }
                 } else {
                     $ids = split('_', $k);
                     $c = new Criteria();
                     $c->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                     $c->add(StudentRaportPeer::GRADE_SPEC_ID, $ids[1]);
                     $c->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                     $c->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                     $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                     $g = StudentRaportPeer::doSelectOne($c);
                     if ($g != null) {
                         $g->delete();
                     }
                 }
             }
         }
     }
     return $this->redirect('course_score/listHistory');
 }
Beispiel #8
0
 public function executeUpdateScore()
 {
     $subject_id = $this->getRequestParameter('subject_id');
     $class_id = $this->getRequestParameter('class_id');
     $accal_id = $this->getRequestParameter('accal_id');
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id);
     $scores = $this->getRequestParameter('score');
     foreach ($scores as $k => $score) {
         if ($score != null) {
             if ($score != '-') {
                 $ids = split('_', $k);
                 $c = new Criteria();
                 $c->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                 $c->add(StudentRaportPeer::GRADE_SPEC_ID, $ids[1]);
                 $c->add(StudentRaportPeer::SUBJECT_CURR_ID, $subject_id);
                 $c->add(StudentRaportPeer::CLASS_GROUP_ID, $class_id);
                 $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal_id);
                 $g = StudentRaportPeer::doSelectOne($c);
                 if ($g == null) {
                     $g = new StudentRaport();
                 }
                 $g->setStudentId($ids[0]);
                 $g->setGradeSpecId($ids[1]);
                 $g->setGrade($score);
                 $g->setSubjectCurrId($subject_id);
                 $g->setClassGroupId($class_id);
                 $g->setAcademicCalendarId($accal_id);
                 $g->save();
             } else {
                 $ids = split('_', $k);
                 $c = new Criteria();
                 $c->add(StudentRaportPeer::STUDENT_ID, $ids[0]);
                 $c->add(StudentRaportPeer::GRADE_SPEC_ID, $ids[1]);
                 $c->add(StudentRaportPeer::SUBJECT_CURR_ID, $subject_id);
                 $c->add(StudentRaportPeer::CLASS_GROUP_ID, $class_id);
                 $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal_id);
                 $g = StudentRaportPeer::doSelectOne($c);
                 if ($g != null) {
                     $g->delete();
                 }
             }
         }
     }
     if ($academic_calendar->getCourseModel() == 'A') {
         return $this->redirect('course/listScore?employee_id=' . $this->getRequestParameter('employee_id'));
     } else {
         return $this->redirect('course/listScore2?employee_id=' . $this->getRequestParameter('employee_id'));
     }
 }