</tr> <tr> <?php $j = 0; foreach ($cur13_term_specs as $cur13_term_spec) { $j++; if ($cur13_term->getCur13KiId() == ScoreRule::THREE) { $cm = new Criteria(); $cm->add(GradeAliasPeer::TYPE, ScoreRule::THREE); $cm->add(GradeAliasPeer::GRADE_SPEC_ID, $cur13_term_spec->getGradeSpecId()); } else { $cm = new Criteria(); $cm->add(GradeAliasPeer::TYPE, ScoreRule::FOUR); $cm->add(GradeAliasPeer::GRADE_SPEC_ID, $cur13_term_spec->getGradeSpecId()); } $ga = GradeAliasPeer::doSelectOne($cm); ?> <th width="5%" style="text-align: center;"><?php echo $ga->getCode(); ?> </th> <?php } ?> </tr> </thead> <tbody> <?php if ($pager->getNbResults() < 1) { ?> <tr class="list"><td colspan="100"><div class="no_record"><?php
public function executeSaveKi4() { $cur13Lib = new cur13Lib(); $course_schedule_id = $this->getRequestParameter('course_id'); $course_schedule = CourseSchedulePeer::retrieveByPK($course_schedule_id); $this->forward404Unless($course_schedule); $this->course_schedule = $course_schedule; $accal_id = $this->getRequestParameter('accal_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($academic_calendar); $this->academic_calendar = $academic_calendar; $cur13_term_id = $this->getRequestParameter('cur13_term_id'); $cur13_term = Cur13TermPeer::retrieveByPK($cur13_term_id); $this->forward404Unless($cur13_term); $this->cur13_term = $cur13_term; $department = $academic_calendar->getDepartment(); $this->ki = new ki4($department); $this->ki->setDepartment($department->getId()); $this->ki->setCourseSchedule($course_schedule->getId()); $this->ki->setTerm($cur13_term->getId()); $this->ki->prepareTermSpecs(); $this->ki->prepareStudents(); $this->ki->prepareConversion(); $bobot = array(); $jumlahBobot = 0; foreach ($this->ki->getTermSpecs() as $cur13_term_spec) { $c = new Criteria(); $c->add(GradeAliasPeer::GRADE_SPEC_ID, $cur13_term_spec->getGradeSpecId()); $gradeAlias = GradeAliasPeer::doSelectOne($c); if ($gradeAlias) { $bobot[$cur13_term_spec->getId()] = $cur13_term_spec->getBobot(); $jumlahBobot += $cur13_term_spec->getBobot(); } } $department = $academic_calendar->getDepartment(); $this->ki = new ki3($department); $this->ki->setDepartment($department->getId()); $this->ki->prepareConversion(); $scores = $this->getRequestParameter('score'); foreach ($scores as $studentAccalId => $terms) { $nilai = 0; foreach ($terms as $termSpecId => $score) { if ($score != null && $score != '-') { $thisNilai = $bobot[$termSpecId] * $score; if ($thisNilai > 0) { $cr = new Criteria(); $cr->add(Cur13GradePeer::STUDENT_ACCAL_ID, $studentAccalId); $cr->add(Cur13GradePeer::CUR13_TERM_SPEC_ID, $termSpecId); $g = Cur13GradePeer::doSelectOne($cr); if ($g == null) { $g = new Cur13Grade(); } $g->setStudentAccalId($studentAccalId); $g->setCur13TermSpecId($termSpecId); $g->setGrade($score); $g->save(); $nilai += $thisNilai; } ## Delete } else { $cr = new Criteria(); $cr->add(Cur13GradePeer::STUDENT_ACCAL_ID, $studentAccalId); $cr->add(Cur13GradePeer::CUR13_TERM_SPEC_ID, $termSpecId); $g = Cur13GradePeer::doSelectOne($cr); if ($g != null) { $g->delete(); } } } if ($nilai > 0) { $avg = $nilai / $jumlahBobot; $roundAvg = round($avg); $scale = round($avg * 4 / 100, 2); $remark = ''; foreach ($this->ki->getGradeConversions() as $gc) { if ($roundAvg >= $gc->getMinValue() && $roundAvg <= $gc->getMaxValue()) { $remark = $gc->getName(); } } $cri = new Criteria(); $cri->add(Cur13GradeTermPeer::STUDENT_ACCAL_ID, $studentAccalId); $cri->add(Cur13GradeTermPeer::CUR13_TERM_ID, $cur13_term->getId()); $gi = Cur13GradeTermPeer::doSelectOne($cri); if ($gi == null) { $gi = new Cur13GradeTerm(); } $gi->setStudentAccalId($studentAccalId); $gi->setCur13TermId($cur13_term->getId()); $gi->setGrade($avg); $gi->setGradeScale($scale); $gi->setRemark($remark); $gi->save(); } else { $cri = new Criteria(); $cri->add(Cur13GradeTermPeer::STUDENT_ACCAL_ID, $studentAccalId); $cri->add(Cur13GradeTermPeer::CUR13_TERM_ID, $cur13_term->getId()); $gi = Cur13GradeTermPeer::doSelectOne($cri); if ($gi) { $gi->delete(); } } } return $this->redirect('course_sd/listScoreKi4?accal_id=' . $academic_calendar->getId() . '&course_id=' . $course_schedule->getId() . '&cur13_term_id=' . $cur13_term->getId()); }