public function executeDelete() { $subject_curr_id = $this->getRequestParameter('subject_curr_id'); $subject_curr = SubjectCurrPeer::retrieveByPK($subject_curr_id); $this->forward404Unless($subject_curr); $this->subject_curr = $subject_curr; $subject_grading = SubjectGradingPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($subject_grading); $ref_error = 0; foreach ($subject_grading->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $subject_grading->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('subject_grading/delete/' . sfInflector::camelize($ref['table']), $count); } } $c = new Criteria(); $c->add(StudentCoursePeer::SUBJECT_CURR_ID, $subject_grading->getSubjectCurrId()); $c->add(StudentCoursePeer::GRADE_COMPONENT_ID, $subject_grading->getGradeComponentId()); $c->addJoin(StudentRaportPeer::STUDENT_COURSE_ID, StudentCoursePeer::ID); $score_count = StudentRaportPeer::doCount($c); if ($ref_error > 0) { $this->getRequest()->setError('subject_grading/delete', '_ERR_DELETE_ (' . $subject_grading->toString() . ' - id:' . $subject_grading->getId() . ')'); } elseif ($score_count > 0) { $this->getRequest()->setError('subject_grading/delete/StudentScore', $score_count); $this->getRequest()->setError('subject_grading/delete', '_ERR_DELETE_ (' . $subject_grading->toString() . ' - id:' . $subject_grading->getId() . ')'); } else { $subject_grading->delete(); } $this->getRequest()->setParameter('subject_curr_id', $subject_curr_id); return $this->forward('subject_grading', 'list'); }
$cr = new Criteria(); $cr->add(StudentRaportPeer::STUDENT_COURSE_ID, $student_course->getId()); $cr->add(StudentRaportPeer::GRADE_SPEC_ID, 15); $sr4 = StudentRaportPeer::doSelectOne($cr); ?> <td align="center" style="text-align:center" class="first"> <?php echo $sr4 != null ? $sr4->getGrade() : '-'; ?> </td> <?php $cr = new Criteria(); $cr->add(StudentRaportPeer::STUDENT_COURSE_ID, $student_course->getId()); $cr->add(StudentRaportPeer::GRADE_SPEC_ID, 16); $sr5 = StudentRaportPeer::doSelectOne($cr); ?> <td align="center" style="text-align:center" class="first"> <?php echo $sr5 != null ? $sr5->getGrade() : '-'; ?> </td> </tr> <?php } ?> <?php } ?> </tbody> </table>
public function executeGetScore() { $academic_calendar_id = $this->getRequestParameter('academic_calendar_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id); $this->forward404Unless($academic_calendar); $counseling_id = $this->getRequestParameter('counseling_id'); $counseling = CounselingPeer::retrieveByPK($counseling_id); $this->forward404Unless($counseling); $student_id = $this->getRequestParameter('student_id'); $student = StudentPeer::retrieveByPK($student_id); $this->forward404Unless($student); ## Daftar Mata Pelajaran di Jadwal Pelajaran $cw = new Criteria(); $cw->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cw->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $subjects = VCoursePeer::doSelect($cw); $subject_ids = array(); foreach ($subjects as $subject) { $subject_ids[] = $subject->getSubjectCurrId(); } $this->subjects = $subjects; ## Mengelompokkan Penilaian Anak berdasarkan Tahun Ajaran dan Kelas $cr = new Criteria(); $cr->add(StudentRaportPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cr->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $stugrades = StudentRaportPeer::doSelect($cr); $this->stugrades = $stugrades; ## Menentukan Aturan Penilaian $cd = new Criteria(); $cd->add(ClassGroupPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId()); $cd->addJoin(ScoreRulePeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $cd->add(ScoreRulePeer::TYPE, 6); $score_rule = ScoreRulePeer::doSelectOne($cd); $this->score_rule = $score_rule; ## Menentukan Aturan Penilaian Yang digunakan $cm = new Criteria(); $cm->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cm->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cm->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cm->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $list_subs = ScoreRuleSubjectPeer::doSelect($cm); $subject_count = ScoreRuleSubjectPeer::doCount($cm); $this->list_subs = $list_subs; $this->subject_count = $subject_count; ## Kelompokkan Mata Pelajaran Muatan Nasional $cmi = new Criteria(); $cmi->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cmi->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cmi->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 1, Criteria::IN); $cmi->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cmi->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $subs1 = ScoreRuleSubjectPeer::doSelect($cmi); $subs1_count = ScoreRuleSubjectPeer::doCount($cmi); $this->subs1 = $subs1; $this->subs1_count = $subs1_count; ## Kelompokkan Mata Pelajaran Muatan Lokal $ciw = new Criteria(); $ciw->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $ciw->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $ciw->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 2, Criteria::IN); $ciw->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $ciw->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $subs2 = ScoreRuleSubjectPeer::doSelect($ciw); $subs2_count = ScoreRuleSubjectPeer::doCount($ciw); $this->subs2 = $subs2; $this->subs2_count = $subs2_count; ## Kelompokkan Mata Pelajaran IPA $ci = new Criteria(); $ci->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $ci->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $ci->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 3, Criteria::IN); $ci->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $ci->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $ipas = ScoreRuleSubjectPeer::doSelect($ci); $ipas_count = ScoreRuleSubjectPeer::doCount($ci); $this->ipas = $ipas; $this->ipas_count = $ipas_count; ## Kelompokkan Mata Pelajaran IPS $cit = new Criteria(); $cit->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cit->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cit->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 4, Criteria::IN); $cit->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cit->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $ips = ScoreRuleSubjectPeer::doSelect($cit); $ips_count = ScoreRuleSubjectPeer::doCount($cit); $this->ips = $ips; $this->ips_count = $ips_count; ## Kelompokkan Mata Pelajaran Setelah IPS $cet = new Criteria(); $cet->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cet->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cet->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 5, Criteria::IN); $cet->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cet->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $subs3 = ScoreRuleSubjectPeer::doSelect($cet); $subs3_count = ScoreRuleSubjectPeer::doCount($cet); $this->subs3 = $subs3; $this->subs3_count = $subs3_count; ## Kelompokkan Mata Pelajaran Pilihan $cetr = new Criteria(); $cetr->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cetr->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cetr->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 6, Criteria::IN); $cetr->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $subs4 = ScoreRuleSubjectPeer::doSelect($cetr); $subs4_count = ScoreRuleSubjectPeer::doCount($cetr); $this->subs4 = $subs4; $this->subs4_count = $subs4_count; ## Mengelompokkan Penilaian Anak berdasarkan Tahun Ajaran dan Kelas $cem = new Criteria(); $cem->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cem->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cem->add(StudentAccalPeer::STATUS, 1); $stu_accs = StudentAccalPeer::doSelect($cem); $this->stu_accs = $stu_accs; $cw = new Criteria(); $cw->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cw->add(CourseRegulationPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $c_regulations = CourseRegulationPeer::doSelect($cw); $this->c_regulations = $c_regulations; $crd = new Criteria(); $crd->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $crd->add(StudentRaportPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $stud_raports = StudentRaportPeer::doSelect($crd); $sub_grade_spec = array(); foreach ($stud_raports as $stu_raport) { $sub_grade_spec[$stu_raport->getGradeSpecId() . '#' . $stu_raport->getStudentId()] = $stu_raport; } $this->sub_grade_spec = $sub_grade_spec; $grades = array(); $grade_avg = array(); foreach ($stugrades as $stugrade) { $grades[$stugrade->getSubjectCurrId() . '#' . $stugrade->getStudentId() . '#' . $stugrade->getGradeSpecId()] = $stugrade->getGrade(); $grade_avg[$stugrade->getSubjectCurrId() . '#' . $stugrade->getGradeSpecId()] = (array_key_exists($stugrade->getsubjectCurrId() . '#' . $stugrade->getGradeSpecId(), $grade_avg) ? $grade_avg[$stugrade->getSubjectCurrId() . '#' . $stugrade->getGradeSpecId()] : 0) + $stugrade->getGrade(); } $this->grades = $grades; $this->grade_avg = $grade_avg; $course_reg = array(); foreach ($c_regulations as $cr) { $course_reg[$cr->getSubjectCurrId()] = $cr->getKkm(); } $this->course_reg = $course_reg; $ce = new Criteria(); $ce->add(DepartmentDetailPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId()); $this->department_detail = DepartmentDetailPeer::doSelectOne($ce); $cmot = new Criteria(); $cmot->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cmot->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cmot->addJoin(StudentPeer::ID, StudentAccalPeer::STUDENT_ID); $this->student_count = StudentPeer::doCount($cmot); $actions = array(); $this->actions = $actions; $this->academic_calendar = $academic_calendar; $this->counseling = $counseling; $this->student = $student; }
<?php use_helper('Object', 'Validation', 'myHelper'); echo include_partial('global/tab', array('actions2' => $actions2)); echo include_partial('global/title4', array('type' => 'list', 'title' => __('Rekap Nilai UAS'), 'actions' => $actions, 'subtitle' => $subtitle . ($sf_request->hasErrors() ? '<div class=form_error>* ' . __('_FORM_HAS_ERROR_') . '</div>' : ''))); echo form_remote_tag(array('url' => 'counseling_menu/listUas?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'update' => 'content', 'script' => 'true', 'before' => "this.blur();showIndicator('content', 'snakebig_black');", 'complete' => "hideIndicator()"), 'name=edit_form'); echo input_hidden_tag('sort'); $cr = new Criteria(); $cr->add(StudentRaportPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cr->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $stugrades = StudentRaportPeer::doSelect($cr); $grades = array(); $grade_avg = array(); foreach ($stugrades as $stugrade) { $grades[$stugrade->getSubjectCurrId() . '#' . $stugrade->getStudentId() . '#' . $stugrade->getGradeSpecId()] = $stugrade->getGrade(); $grade_avg[$stugrade->getSubjectCurrId() . '#' . $stugrade->getGradeSpecId()] = (array_key_exists($stugrade->getsubjectCurrId() . '#' . $stugrade->getGradeSpecId(), $grade_avg) ? $grade_avg[$stugrade->getSubjectCurrId() . '#' . $stugrade->getGradeSpecId()] : 0) + $stugrade->getGrade(); } $column = $subject_count7 + $subject_count8; $column_smp = $subject_count1 + $subject_count2 + $ipa_count + $ips_count; ?> <table border="0" width="100%" style="margin-top: -10px;"> <tr> <td valign="top"> <table class="list"> <tr> <td class="list" valign="top"> <table class="list_content" width="100%"> <thead> <!-- Tingkat SD --> <?php
?> </td> <td style="text-align:left; vertical-align: middle; padding-left: 5px;" width="10%"><?php echo $student->getStudent() ? $student->getStudent()->getName() : '-'; ?> </td> <?php $cm = new Criteria(); $cm->add(GradeComponentPeer::GRADE_SPEC_ID, 21); $cm->add(GradeComponentPeer::PUBLISHED, 1); $cm->addJoin(StudentRaportPeer::GRADE_COMPONENT_ID, GradeComponentPeer::ID); $cm->add(StudentRaportPeer::STUDENT_ID, $student->getStudentId()); $cm->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $ekskuls = StudentRaportPeer::doSelect($cm); $count_ekskul = StudentRaportPeer::doCount($cm); ?> <?php if ($ekskuls) { ?> <?php $m = 0; foreach ($ekskuls as $ekskul) { ?> <td style="text-align:left; vertical-align: middle; font-size: 8px;"> <?php if ($counseling->getEmployeeId() == 222) { echo $ekskul ? $ekskul->getGradeComponent() ? $ekskul->getGradeComponent()->getCode() : '-' : '-'; } else {
if ($course_details < 1) { echo '-'; } else { foreach ($cs_details as $detail) { echo $detail->getClassSession()->getBegin() . ' - ' . $detail->getClassSession()->getEnd() . '<br>'; } } ?> </td> <td style="white-space: nowrap;width: 1%;" align="left"> <?php $c = new Criteria(); $c->add(StudentRaportPeer::STUDENT_ID, $student->getId()); $c->add(StudentRaportPeer::GRADE_COMPONENT_ID, $grade_component->getId()); $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal); $sr = StudentRaportPeer::doSelectOne($c); if ($sr != null) { if ($sr->getGrade() == '80') { echo "<font class='level_green'>" . __('A') . "</font>"; } elseif ($sr->getGrade() == '70') { echo "<font class='level_green'>" . __('B') . "</font>"; } elseif ($sr->getGrade() == '60') { echo "<font class='level_yellow'>" . __('C') . "</font>"; } elseif ($sr->getGrade() == '50') { echo "<font class='level_red'>" . __('D') . "</font>"; } else { echo '-'; } } else { echo '-'; }
public function executeDelete() { $schedule = SchedulePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($schedule); #$ref_error = 0; #foreach ($schedule->getRefCountMethods() as $ref) { # $method = "count".$ref['affix']; # $count = $schedule->$method(); # if ($count > 0) { # ++$ref_error; # $this->getRequest()->setError('extracurricular/delete/'.sfInflector::camelize($ref['table']), $count); # } #} #if ($ref_error > 0) { # $this->getRequest()->setError('extracurricular/delete', '_ERR_DELETE_ ('.$schedule->toString().' - id:'.$schedule->getId().')'); #} else { $c = new Criteria(); $c->add(ScheduleDetailPeer::SCHEDULE_ID, $this->getRequestParameter('id')); $sc_details = ScheduleDetailPeer::doSelect($c); foreach ($sc_details as $sc_detail) { $sc_detail->delete(); } $cb = new Criteria(); $cb->add(ScheduleTutorPeer::SCHEDULE_ID, $this->getRequestParameter('id')); $sc_tutors = ScheduleTutorPeer::doSelect($cb); foreach ($sc_tutors as $sc_tutor) { $sc_tutor->delete(); } $cw = new Criteria(); $cw->add(StudentRaportPeer::SCHEDULE_ID, $this->getRequestParameter('id')); $sc_raports = StudentRaportPeer::doSelect($cw); foreach ($sc_raports as $sc_raport) { $sc_raport->delete(); } $schedule->delete(); #} return $this->forward('extracurricular', 'list'); }
<td><?php echo strlen($student->getCode()) > 0 ? $student->getCode() : 'n/a'; ?> </td> <td><?php echo $student->getName() ? $student->getName() : '-'; ?> </td> <td><?php $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()); $cm->add(StudentRaportPeer::GRADE_SPEC_ID, $grade_spec->getId()); $sr1 = StudentRaportPeer::doSelectOne($cm); echo input_tag('score[' . $student->getId() . '_' . $grade_spec->getId() . ']', $sr1 != null ? $sr1->getGrade() : '', array('size' => 2, 'maxlength' => 5, 'style' => 'font-size: 10px;')); ?> </td> </tr> <?php } ?> <?php } ?> </tbody> </table> <?php if ($pager->getNbResults() > 1) { echo include_partial('global/pager', array('position' => 'bottom', 'pager' => $pager, 'module' => 'student'));
public function executeSaveScoreSmp() { $accal_id = $this->getRequestParameter('accal_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($academic_calendar); $this->academic_calendar = $academic_calendar; $schedule = SchedulePeer::retrieveByPk($this->getRequestParameter('schedule_id')); $this->forward404Unless($schedule); $this->schedule = $schedule; $schedule_detail = ScheduleDetailPeer::retrieveByPk($this->getRequestParameter('detail_id')); $this->forward404Unless($schedule_detail); $this->schedule_detail = $schedule_detail; $class_group = ClassGroupPeer::retrieveByPK($this->getRequestParameter('class_id')); $this->forward404Unless($class_group); $scores = $this->getRequestParameter('score'); foreach ($scores as $k => $score) { if ($score != null) { $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, $k); $sc = StudentRaportPeer::doSelectOne($cr); $sc->setStudentId($k); $sc->setAcademicCalendarId($schedule->getAcademicCalendarId()); $sc->setGradeComponentId($schedule->getGradeComponentId()); $sc->setClassGroupId($class_group->getId()); $sc->setScheduleId($schedule->getId()); $sc->setScheduleDetailId($schedule_detail->getId()); $sc->setGrade($score); $sc->save(); } } return $this->redirect('extracurricular_new/listEksStu?id=' . $schedule->getId() . '&detail_id=' . $schedule_detail->getId() . '&accal_id=' . $academic_calendar->getId()); }
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'); }
public function executeDeleteFinal() { $student_id = $this->getRequestParameter('student_id'); $student = StudentPeer::retrieveByPK($student_id); $this->forward404Unless($student); $this->student = $student; $student_score = StudentRaportPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student_score); $ref_error = 0; foreach ($student_score->getRefCountMethods() as $ref) { $method = "count" . $ref['affix']; $count = $student_score->{$method}(); if ($count > 0) { ++$ref_error; $this->getRequest()->setError('student_score/deleteFinal/' . sfInflector::camelize($ref['table']), $count); } } if ($ref_error > 0) { $this->getRequest()->setError('student_score/deleteFinal', '_ERR_DELETE_ (' . $student_score->toString() . ' - id:' . $student_score->getId() . ')'); } else { $student_score->delete(); } $this->getRequest()->setParameter('student_id', $student_id); return $this->forward('student_score', 'listFinal'); }
if (array_key_exists($student_score->getSubjectCurrId(), $subject_grade_spec)) { $sr = $subject_grade_spec[$student_score->getSubjectCurrId()]; $grade = $sr->getGrade(); } echo strlen($grade) > 0 ? $grade : ''; ?> </td> <!-- Rata-rata Kelas --> <?php $cm = new Criteria(); $cm->add(StudentRaportPeer::SUBJECT_CURR_ID, $student_score->getSubjectCurrId()); $cm->add(StudentRaportPeer::CLASS_GROUP_ID, $student_score->getClassGroupId()); $cm->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cm->add(StudentRaportPeer::GRADE_SPEC_ID, 16); $raports = StudentRaportPeer::doSelect($cm); $total_score = 0; foreach ($raports as $c) { $total_score += $c->getGrade(); } $count = VCounselingPeer::retrieveByPK($counseling->getId()); $student_count = $count->getStudentCount(); $x = $total_score / $student_count; ?> <td align="center" style="text-align:center;" class="first"><?php echo $total_score ? round($x) : '-'; ?> </td> </tr> <?php }
public function executePrintExam() { $counseling_id = $this->getRequestParameter('counseling_id'); $counseling = CounselingPeer::retrieveByPK($counseling_id); $this->forward404Unless($counseling); $academic_calendar = AcademicCalendarPeer::retrieveByPK($this->getRequestParameter('accal_id')); $this->forward404Unless($academic_calendar); $time = $this->getRequestParameter('time'); $time2 = $this->getRequestParameter('time2'); $tgl = $this->getRequestParameter('tgl_cetak'); $test1 = $this->getRequestParameter('test1'); $test2 = $this->getRequestParameter('test2'); $task1 = $this->getRequestParameter('task1'); $task2 = $this->getRequestParameter('task2'); $note = $this->getRequestParameter('note'); $c = new Criteria(); $c->add(TempTablePeer::COUNSELING_ID, $counseling->getId()); $c->add(TempTablePeer::TIME, $time); $c->addJoin(VStudentActivePeer::ID, TempTablePeer::STUDENT_ID); $c->addAscendingOrderByColumn(VStudentActivePeer::CLASS_NAME); $students = VStudentActivePeer::doSelect($c); $this->forward404Unless($students); ## Menentukan Aturan Penilaian (Tengah Semester) $cd = new Criteria(); $cd->add(ScoreRulePeer::ACADEMIC_CALENDAR_ID, $counseling->getAcademicCalendarId()); $cd->add(ClassGroupPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId()); $cd->addJoin(ScoreRulePeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $cd->add(ScoreRulePeer::TYPE, ScoreRule::TYPE_ONE); $score_rule = ScoreRulePeer::doSelectOne($cd); $this->score_rule = $score_rule; ## Daftar Mata Pelajaran di Jadwal Pelajaran $cw = new Criteria(); $cw->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cw->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $subjects = VCoursePeer::doSelect($cw); $subject_ids = array(); foreach ($subjects as $subject) { $subject_ids[] = $subject->getSubjectCurrId(); } $this->subjects = $subjects; ## Menentukan Aturan Penilaian Yang digunakan $cm = new Criteria(); $cm->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cm->add(ScoreRuleSubjectPeer::PUBLISHED, ScoreRule::ONE, Criteria::IN); $cm->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cm->add(ScoreRuleSubjectPeer::PUBLISHED, ScoreRule::ONE, Criteria::IN); $cm->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $list_subs = ScoreRuleSubjectPeer::doSelect($cm); $subject_count = ScoreRuleSubjectPeer::doCount($cm); $this->list_subs = $list_subs; $this->subject_count = $subject_count; $grades_ids = array(); $t1 = $test1 - 1; $t2 = $test2 - 1; while ($t1 <= $t2) { $t1++; $grades_ids[] = $t1; } $cmen = new Criteria(); $cmen->add(GradeAliasPeer::ID, $grades_ids, Criteria::IN); $cmen->addJoin(GradeSpecPeer::ID, GradeAliasPeer::GRADE_SPEC_ID); $cmen->addAscendingOrderByColumn(GradeSpecPeer::ID); $this->grade_pdf1 = GradeSpecPeer::doSelect($cmen); $this->count_pdf1 = GradeSpecPeer::doCount($cmen); $ids = array(); $tsk1 = $task1 - 1; $tsk2 = $task2 - 1; while ($tsk1 <= $tsk2) { $tsk1++; $ids[] = $tsk1; } $cmet = new Criteria(); $cmet->add(GradeAliasPeer::ID, $ids, Criteria::IN); $cmet->addJoin(GradeSpecPeer::ID, GradeAliasPeer::GRADE_SPEC_ID); $cmet->addAscendingOrderByColumn(GradeSpecPeer::ID); $this->grade_pdf2 = GradeSpecPeer::doSelect($cmet); $this->count_pdf2 = GradeSpecPeer::doCount($cmet); $ce = new Criteria(); $ce->add(DepartmentDetailPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId()); $this->department_detail = DepartmentDetailPeer::doSelectOne($ce); $cr = new Criteria(); $cr->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cr->add(StudentRaportPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $student_raports = StudentRaportPeer::doSelect($cr); $subject_grade_spec = array(); foreach ($student_raports as $student_raport) { $subject_grade_spec[$student_raport->getSubjectCurrId() . '#' . $student_raport->getGradeSpecId() . '#' . $student_raport->getStudentId()] = $student_raport; } $this->subject_grade_spec = $subject_grade_spec; $cw = new Criteria(); $cw->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cw->add(CourseRegulationPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $c_regulations = CourseRegulationPeer::doSelect($cw); $course_reg = array(); foreach ($c_regulations as $cr) { $course_reg[$cr->getAcademicCalendarId() . '#' . $cr->getSubjectCurrId() . '#' . $cr->getClassGroupId()] = $cr->getKkm(); } $this->course_reg = $course_reg; $cb = new Criteria(); $cb->add(StudentAbsencePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cb->addGroupByColumn(StudentAbsencePeer::STUDENT_ID); $cb->addGroupByColumn(StudentAbsencePeer::START); $cb->addGroupByColumn(StudentAbsencePeer::ACADEMIC_CALENDAR_ID); $cb->addGroupByColumn(StudentAbsencePeer::CLASS_GROUP_ID); $sas = StudentabsencePeer::doSelect($cb); $absence = array(); if (count($sas)) { foreach ($sas as $sa) { $absence[$sa->getStatus() . '#' . $sa->getStatus()] = (array_key_exists($sa->getStatus() . '#' . $sa->getStatus(), $absence) ? $absence[$sa->getStatus() . '#' . $sa->getStatus()] : 0) + 1; } } $this->absence = $absence; $this->students = $students; $this->subtitle = ''; $this->counseling = $counseling; $this->tanggal = $time; $this->tgl_cetak = $tgl; $this->time2 = $time2; $this->note = $note; $this->test1 = $test1; $this->test2 = $test2; $this->task1 = $task1; $this->task2 = $task2; $this->academic_calendar = $academic_calendar; $this->papersize = 'a4'; $this->orientation = 'portrait'; $this->setViewClass('sfDomPDF'); }
public function executeGetListFinalAll() { $academic_calendar_id = $this->getRequestParameter('academic_calendar_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id); $this->academic_calendar = $academic_calendar; $student_id = $this->getRequestParameter('student_id'); $student = StudentPeer::retrieveByPK($student_id); $this->forward404Unless($student); $this->student = $student; $c = new Criteria(); $c->add(StudentAccalPeer::STUDENT_ID, $student_id, Criteria::IN); $c->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar_id, Criteria::IN); $stu_accal = StudentAccalPeer::doSelectOne($c); $this->stu_accal = $stu_accal; ## Menentukan Aturan Penilaian $cd = new Criteria(); $cd->add(ClassGroupPeer::DEPARTMENT_ID, $academic_calendar->getDepartmentId()); $cd->addJoin(ScoreRulePeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $cd->add(ScoreRulePeer::TYPE, 6); $score_rule = ScoreRulePeer::doSelectOne($cd); $this->score_rule = $score_rule; $cw = new Criteria(); $cw->add(CounselingPeer::CLASS_GROUP_ID, $stu_accal->getClassGroupId()); $cw->add(CounselingPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getParent()); $counseling = CounselingPeer::doSelectOne($cw); $this->counseling = $counseling; $ct = new Criteria(); $ct->add(GradeSpecPeer::PARENT, 1, Criteria::IN); #$ct->addJoin(GradeSpecPeer::ID, ScoreRuleObjectPeer::GRADE_SPEC_ID); #$ct->add(ScoreRuleObjectPeer::PUBLISHED, 1, Criteria::IN); #$ct->add(ScoreRuleObjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); #$ct->addAscendingOrderByColumn(ScoreRuleObjectPeer::SEQUENCE); $this->grade1 = GradeSpecPeer::doSelect($ct); $this->count1 = GradeSpecPeer::doCount($ct); $cte = new Criteria(); $cte->add(GradeSpecPeer::PARENT, 7, Criteria::IN); #$cte->addJoin(GradeSpecPeer::ID, ScoreRuleObjectPeer::GRADE_SPEC_ID); #$cte->add(ScoreRuleObjectPeer::PUBLISHED, 1, Criteria::IN); #$cte->add(ScoreRuleObjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); #$cte->addAscendingOrderByColumn(ScoreRuleObjectPeer::SEQUENCE); $this->grade2 = GradeSpecPeer::doSelect($cte); $this->count2 = GradeSpecPeer::doCount($cte); ## Daftar Mata Pelajaran di Jadwal Pelajaran $cty = new Criteria(); $cty->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cty->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $subjects = VCoursePeer::doSelect($cty); $subject_ids = array(); foreach ($subjects as $subject) { $subject_ids[] = $subject->getSubjectCurrId(); } $this->subjects = $subjects; ## Mengelompokkan Penilaian Anak berdasarkan Tahun Ajaran dan Kelas $cr = new Criteria(); $cr->add(StudentRaportPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cr->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $stugrades = StudentRaportPeer::doSelect($cr); $this->stugrades = $stugrades; ## Menentukan Aturan Penilaian Yang digunakan $cm = new Criteria(); $cm->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cm->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cm->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cm->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $list_subs = ScoreRuleSubjectPeer::doSelect($cm); $subject_count = ScoreRuleSubjectPeer::doCount($cm); $this->list_subs = $list_subs; $this->subject_count = $subject_count; ## Kelompokkan Mata Pelajaran Muatan Nasional $cmi = new Criteria(); $cmi->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cmi->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cmi->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 1, Criteria::IN); $cmi->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cmi->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $subs1 = ScoreRuleSubjectPeer::doSelect($cmi); $subs1_count = ScoreRuleSubjectPeer::doCount($cmi); $this->subs1 = $subs1; $this->subs1_count = $subs1_count; ## Kelompokkan Mata Pelajaran Muatan Lokal $ciw = new Criteria(); $ciw->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $ciw->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $ciw->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 2, Criteria::IN); $ciw->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $ciw->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $subs2 = ScoreRuleSubjectPeer::doSelect($ciw); $subs2_count = ScoreRuleSubjectPeer::doCount($ciw); $this->subs2 = $subs2; $this->subs2_count = $subs2_count; ## Kelompokkan Mata Pelajaran IPA $ci = new Criteria(); $ci->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $ci->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $ci->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 3, Criteria::IN); $ci->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $ci->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $ipas = ScoreRuleSubjectPeer::doSelect($ci); $ipas_count = ScoreRuleSubjectPeer::doCount($ci); $this->ipas = $ipas; $this->ipas_count = $ipas_count; ## Kelompokkan Mata Pelajaran IPS $cit = new Criteria(); $cit->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cit->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cit->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 4, Criteria::IN); $cit->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cit->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $ips = ScoreRuleSubjectPeer::doSelect($cit); $ips_count = ScoreRuleSubjectPeer::doCount($cit); $this->ips = $ips; $this->ips_count = $ips_count; ## Kelompokkan Mata Pelajaran Setelah IPS $cet = new Criteria(); $cet->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cet->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cet->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 5, Criteria::IN); $cet->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cet->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $subs3 = ScoreRuleSubjectPeer::doSelect($cet); $subs3_count = ScoreRuleSubjectPeer::doCount($cet); $this->subs3 = $subs3; $this->subs3_count = $subs3_count; ## Mengelompokkan Penilaian Anak berdasarkan Tahun Ajaran dan Kelas $cem = new Criteria(); $cem->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cem->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cem->add(StudentAccalPeer::STATUS, 1); $stu_accs = StudentAccalPeer::doSelect($cem); $this->stu_accs = $stu_accs; $cw = new Criteria(); $cw->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cw->add(CourseRegulationPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $c_regulations = CourseRegulationPeer::doSelect($cw); $this->c_regulations = $c_regulations; $actions = array(array()); $this->actions = $actions; }
public function executePrintFinal() { $counseling_id = $this->getRequestParameter('counseling_id'); $counseling = CounselingPeer::retrieveByPK($counseling_id); $this->forward404Unless($counseling); $academic_calendar = AcademicCalendarPeer::retrieveByPK($this->getRequestParameter('accal_id')); $this->forward404Unless($academic_calendar); $time = $this->getRequestParameter('time'); $time2 = $this->getRequestParameter('time2'); $tgl = $this->getRequestParameter('tgl_cetak'); $term = $this->getRequestParameter('term'); $c = new Criteria(); $c->add(TempTablePeer::COUNSELING_ID, $counseling->getId()); $c->add(TempTablePeer::TIME, $time); $c->addJoin(VStudentActivePeer::ID, TempTablePeer::STUDENT_ID); $c->addAscendingOrderByColumn(VStudentActivePeer::CLASS_NAME); $students = VStudentActivePeer::doSelect($c); $this->forward404Unless($students); ## Mengelompokkan Penilaian Anak berdasarkan Tahun Ajaran dan Kelas $cri = new Criteria(); $cri->add(StudentNotePeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cri->add(StudentNotePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $stunotes = StudentNotePeer::doSelect($cri); $notes = array(); foreach ($stunotes as $stunote) { $notes[$stunote->getStudentId() . '#' . $stunote->getRanking()] = $stunote->getNote(); } $this->notes = $notes; $this->stunotes = $stunotes; ## Daftar Mata Pelajaran di Jadwal Pelajaran $cw = new Criteria(); $cw->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cw->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $subjects = VCoursePeer::doSelect($cw); $subject_ids = array(); foreach ($subjects as $subject) { $subject_ids[] = $subject->getSubjectCurrId(); } $this->subjects = $subjects; ## Mengelompokkan Penilaian Anak berdasarkan Tahun Ajaran dan Kelas $cr = new Criteria(); $cr->add(StudentRaportPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cr->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $stugrades = StudentRaportPeer::doSelect($cr); $this->stugrades = $stugrades; ## Menentukan Aturan Penilaian $cd = new Criteria(); #$cd->add(ScoreRulePeer::ACADEMIC_CALENDAR_ID, $counseling->getAcademicCalendarId()); $cd->add(ClassGroupPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId()); $cd->addJoin(ScoreRulePeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $cd->add(ScoreRulePeer::TYPE, 6); $score_rule = ScoreRulePeer::doSelectOne($cd); $this->score_rule = $score_rule; ## Menentukan Aturan Penilaian Yang digunakan $cm = new Criteria(); $cm->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cm->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cm->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cm->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $list_subs = ScoreRuleSubjectPeer::doSelect($cm); $subject_count = ScoreRuleSubjectPeer::doCount($cm); $this->list_subs = $list_subs; $this->subject_count = $subject_count; ## Kelompokkan Mata Pelajaran Muatan Nasional $cmi = new Criteria(); $cmi->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cmi->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cmi->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 1, Criteria::IN); $cmi->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cmi->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $subs1 = ScoreRuleSubjectPeer::doSelect($cmi); $subs1_count = ScoreRuleSubjectPeer::doCount($cmi); $this->subs1 = $subs1; $this->subs1_count = $subs1_count; ## Kelompokkan Mata Pelajaran Muatan Lokal $ciw = new Criteria(); $ciw->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $ciw->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $ciw->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 2, Criteria::IN); $ciw->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $ciw->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $subs2 = ScoreRuleSubjectPeer::doSelect($ciw); $subs2_count = ScoreRuleSubjectPeer::doCount($ciw); $this->subs2 = $subs2; $this->subs2_count = $subs2_count; ## Kelompokkan Mata Pelajaran IPA $ci = new Criteria(); $ci->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $ci->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $ci->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 3, Criteria::IN); $ci->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $ci->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $ipas = ScoreRuleSubjectPeer::doSelect($ci); $ipas_count = ScoreRuleSubjectPeer::doCount($ci); $this->ipas = $ipas; $this->ipas_count = $ipas_count; ## Kelompokkan Mata Pelajaran IPS $cit = new Criteria(); $cit->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cit->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cit->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 4, Criteria::IN); $cit->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cit->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $ips = ScoreRuleSubjectPeer::doSelect($cit); $ips_count = ScoreRuleSubjectPeer::doCount($cit); $this->ips = $ips; $this->ips_count = $ips_count; ## Kelompokkan Mata Pelajaran Setelah IPS $cet = new Criteria(); $cet->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cet->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cet->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 5, Criteria::IN); $cet->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cet->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $subs3 = ScoreRuleSubjectPeer::doSelect($cet); $subs3_count = ScoreRuleSubjectPeer::doCount($cet); $this->subs3 = $subs3; $this->subs3_count = $subs3_count; ## Kelompokkan Mata Pelajaran Pilihan $cetr = new Criteria(); $cetr->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cetr->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cetr->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 6, Criteria::IN); #$cet->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cetr->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $subs4 = ScoreRuleSubjectPeer::doSelect($cetr); $subs4_count = ScoreRuleSubjectPeer::doCount($cetr); $this->subs4 = $subs4; $this->subs4_count = $subs4_count; ## Mengelompokkan Penilaian Anak berdasarkan Tahun Ajaran dan Kelas $cem = new Criteria(); $cem->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cem->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cem->add(StudentAccalPeer::STATUS, 1); $stu_accs = StudentAccalPeer::doSelect($cem); $this->stu_accs = $stu_accs; $cw = new Criteria(); $cw->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cw->add(CourseRegulationPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $c_regulations = CourseRegulationPeer::doSelect($cw); $this->c_regulations = $c_regulations; $crd = new Criteria(); $crd->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $crd->add(StudentRaportPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $stud_raports = StudentRaportPeer::doSelect($crd); $sub_grade_spec = array(); foreach ($stud_raports as $stu_raport) { $sub_grade_spec[$stu_raport->getGradeSpecId() . '#' . $stu_raport->getStudentId()] = $stu_raport; } $this->sub_grade_spec = $sub_grade_spec; $specs = array(); foreach ($stu_accs as $stu_acc) { $specs[$stu_acc->getStudentId()] = $stu_acc->getId(); } $this->specs = $specs; $grades = array(); $grade_avg = array(); foreach ($stugrades as $stugrade) { $grades[$stugrade->getSubjectCurrId() . '#' . $stugrade->getStudentId() . '#' . $stugrade->getGradeSpecId()] = $stugrade->getGrade(); $grade_avg[$stugrade->getSubjectCurrId() . '#' . $stugrade->getGradeSpecId()] = (array_key_exists($stugrade->getsubjectCurrId() . '#' . $stugrade->getGradeSpecId(), $grade_avg) ? $grade_avg[$stugrade->getSubjectCurrId() . '#' . $stugrade->getGradeSpecId()] : 0) + $stugrade->getGrade(); } $this->grades = $grades; $this->grade_avg = $grade_avg; $course_reg = array(); foreach ($c_regulations as $cr) { $course_reg[$cr->getSubjectCurrId()] = $cr->getKkm(); } $this->course_reg = $course_reg; $ce = new Criteria(); $ce->add(DepartmentDetailPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId()); $this->department_detail = DepartmentDetailPeer::doSelectOne($ce); $cwe = new Criteria(); $cwe->add(GradeComponentPeer::DEPARTMENT_ID, $academic_calendar->getDepartmentId(), Criteria::IN); $cton1 = $cwe->getNewCriterion(GradeComponentPeer::GRADE_SPEC_ID, 20, Criteria::IN); $cton2 = $cwe->getNewCriterion(GradeComponentPeer::PUBLISHED, 1, Criteria::IN); $cton1->addAnd($cton2); $cwe->add($cton1); $this->grade_components = GradeComponentPeer::doSelect($cwe); $cmot = new Criteria(); $cmot->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cmot->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cmot->addJoin(StudentPeer::ID, StudentAccalPeer::STUDENT_ID); $this->student_count = StudentPeer::doCount($cmot); $this->students = $students; $this->subtitle = ''; $this->counseling = $counseling; $this->tanggal = $time; $this->tgl_cetak = $tgl; $this->time2 = $time2; $this->term = $term; $this->academic_calendar = $academic_calendar; $ctn = new Criteria(); $ctn->add(GradeConversionPeer::DEPARTMENT_ID, $academic_calendar->getDepartmentId()); $grade_conversions = GradeConversionPeer::doSelect($ctn); $name_select = array(); foreach ($grade_conversions as $grade_conversion) { $name_select[$grade_conversion->getTypeConversion() . '#' . $grade_conversion->getGrade()] = $grade_conversion; } $this->name_select = $name_select; ## Spesialisasi Untuk MI if ($academic_calendar->getDepartmentId() == 6) { $this->orientation = 'landscape'; $this->papersize = 'legal'; $this->setTemplate('printFinal'); ## Spesialisasi Untuk SMPIA 9 } elseif ($academic_calendar->getDepartmentId() == 11) { $this->orientation = 'portrait'; $this->papersize = 'a4'; $this->setTemplate('printFinalSMP9'); } else { $this->orientation = 'portrait'; $this->papersize = 'a4'; $this->setTemplate('printFinal'); } $this->setViewClass('sfDomPDF'); }
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); }
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()); }
public function getStudentRaportsJoinCitation($criteria = null, $con = null) { include_once 'lib/model/om/BaseStudentRaportPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collStudentRaports === null) { if ($this->isNew()) { $this->collStudentRaports = array(); } else { $criteria->add(StudentRaportPeer::STUDENT_COURSE_ID, $this->getId()); $this->collStudentRaports = StudentRaportPeer::doSelectJoinCitation($criteria, $con); } } else { $criteria->add(StudentRaportPeer::STUDENT_COURSE_ID, $this->getId()); if (!isset($this->lastStudentRaportCriteria) || !$this->lastStudentRaportCriteria->equals($criteria)) { $this->collStudentRaports = StudentRaportPeer::doSelectJoinCitation($criteria, $con); } } $this->lastStudentRaportCriteria = $criteria; return $this->collStudentRaports; }
public function executeDelete() { $student = StudentPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student); $schedule = SchedulePeer::retrieveByPk($this->getRequestParameter('schedule_id')); $this->forward404Unless($schedule); $schedule_detail = ScheduleDetailPeer::retrieveByPk($this->getRequestParameter('detail_id')); $this->forward404Unless($schedule_detail); $c = new Criteria(); $c->add(StudentRaportPeer::STUDENT_ID, $student->getId()); $c->add(StudentRaportPeer::GRADE_COMPONENT_ID, $schedule->getGradeComponentId()); $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $schedule->getAcademicCalendarId()); $c->add(StudentRaportPeer::SCHEDULE_DETAIL_ID, $schedule_detail->getId()); $c->add(StudentRaportPeer::SCHEDULE_ID, $schedule->getId()); $student_raport = StudentRaportPeer::doSelectOne($c); $student_raport->delete(); return $this->redirect('course_ekskul/list?id=' . $schedule->getId() . '&detail_id=' . $schedule_detail->getId()); }
public function executeListLedgerAll() { $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); ## Daftar Mata Pelajaran di Jadwal Pelajaran $cw = new Criteria(); $cw->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cw->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $subjects = VCoursePeer::doSelect($cw); $subject_ids = array(); foreach ($subjects as $subject) { $subject_ids[] = $subject->getSubjectCurrId(); } $this->subjects = $subjects; ## Mengelompokkan Penilaian Anak berdasarkan Tahun Ajaran dan Kelas $cr = new Criteria(); $cr->add(StudentRaportPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); #$cr->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $stugrades = StudentRaportPeer::doSelect($cr); $this->stugrades = $stugrades; $cblek = new Criteria(); $cblek->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $s_accal = StudentAccalPeer::doSelect($cblek); $this->s_accal = $s_accal; $cmiw = new Criteria(); $cmiw->add(AcademicCalendarPeer::PARENT, $academic_calendar->getParent()); $accals = AcademicCalendarPeer::doSelect($cmiw); $this->accals = $accals; $cq = new Criteria(); $cq->add(AcademicCalendarPeer::COURSE_MODEL, 'A'); $cq->add(AcademicCalendarPeer::PARENT, $academic_calendar->getParent()); $accal1 = AcademicCalendarPeer::doSelectOne($cq); $this->accal1 = $accal1; $cb = new Criteria(); $cb->add(AcademicCalendarPeer::COURSE_MODEL, 'B'); $cb->add(AcademicCalendarPeer::PARENT, $academic_calendar->getParent()); $accal2 = AcademicCalendarPeer::doSelectOne($cb); $this->accal2 = $accal2; $cmi = new Criteria(); $cmi->add(StudentHabitPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cmi->add(StudentHabitPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $student_habits = StudentHabitPeer::doSelect($cmi); $this->student_habits = $student_habits; $cwi = new Criteria(); $cwi->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cwi->add(CourseRegulationPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $c_regulations = CourseRegulationPeer::doSelect($cwi); $this->c_regulations = $c_regulations; ## Menentukan Aturan Penilaian $cd = new Criteria(); #$cd->add(ScoreRulePeer::ACADEMIC_CALENDAR_ID, $counseling->getAcademicCalendarId()); $cd->add(ClassGroupPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId()); $cd->addJoin(ScoreRulePeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $cd->add(ScoreRulePeer::TYPE, 4); $score_rule = ScoreRulePeer::doSelectOne($cd); $this->score_rule = $score_rule; ## Menentukan Aturan Penilaian Yang digunakan $cm = new Criteria(); $cm->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cm->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cm->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cm->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $list_subs = ScoreRuleSubjectPeer::doSelect($cm); $subject_count = ScoreRuleSubjectPeer::doCount($cm); $this->list_subs = $list_subs; $this->subject_count = $subject_count; $cwe = new Criteria(); $cwe->add(GradeComponentPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId(), Criteria::IN); $cton1 = $cwe->getNewCriterion(GradeComponentPeer::GRADE_SPEC_ID, 20, Criteria::IN); $cton2 = $cwe->getNewCriterion(GradeComponentPeer::PUBLISHED, 1, Criteria::IN); $cton1->addAnd($cton2); $cwe->add($cton1); $this->grade_components = GradeComponentPeer::doSelect($cwe); $this->grade_count = GradeComponentPeer::doCount($cwe); $cmot = new Criteria(); $cmot->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cmot->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cmot->addJoin(StudentPeer::ID, StudentAccalPeer::STUDENT_ID); $cmot->add(StudentPeer::STATUS, 2, Criteria::NOT_EQUAL); $cmot->add(StudentPeer::STATUS, 3, Criteria::NOT_EQUAL); $this->student_count = StudentPeer::doCount($cmot); $c = new Criteria(); $c->addJoin(StudentAccalPeer::STUDENT_ID, StudentPeer::ID); $c->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $c->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $this->sortStudentAccal($c); $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'student_accal')); $this->getUser()->setAttribute('max_per_page', $rpp, 'student_accal'); $pager = new sfPropelPager('StudentAccal', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'student_accal')); $this->getUser()->setAttribute('page', $page, 'student_accal'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions = array(); array_unshift($actions, array('name' => 'Print PDF', 'url' => "counseling/listLedgerAllAsPDF?accal_id=" . $academic_calendar->getId() . "&counseling_id=" . $counseling->getId(), 'color' => 'black', 'type' => 'direct')); array_unshift($actions, array('name' => 'Print Excel', 'url' => "counseling/listLedgerAllAsCSV?accal_id=" . $academic_calendar->getId() . "&counseling_id=" . $counseling->getId(), 'color' => 'black', 'type' => 'direct')); $this->actions = $actions; $actions2 = array(array('name' => '<span>' . $academic_calendar->toString() . '</span>', 'url' => 'rpt_counseling/list', 'color' => 'volcadot')); array_push($actions2, array('name' => '<span>Ledger Nilai Raport</span>', 'url' => 'rpt_counseling/listLedger?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sun')); array_push($actions2, array('name' => '<span>Ledger Pembiasaan</span>', 'url' => 'rpt_counseling/listLedgerHabit?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sun')); array_push($actions2, array('name' => '<span>Ledger Gabungan</span>', 'url' => 'rpt_counseling/listLedgerAll?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sky', 'type' => 'direct')); array_push($actions2, array('name' => '<span>Ranking Paralel</span>', 'url' => 'rpt_counseling/listParalel?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sun')); $this->actions2 = $actions2; $this->counseling = $counseling; $this->subtitle = $academic_calendar->getName() . ' # Kelas : ' . $counseling->getClassGroup()->toString(); $this->academic_calendar = $academic_calendar; }
<td style="text-align:center; vertical-align: middle; font-size:10px; <?php ++$k; if ($k % 2 != 0) { echo 'background-color: #ECF6FF;'; } ?> "> <?php $cr = new Criteria(); $cr->add(StudentRaportPeer::CLASS_GROUP_ID, $class_group->getId()); $cr->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cr->add(StudentRaportPeer::GRADE_SPEC_ID, 16); $cr->add(StudentRaportPeer::SUBJECT_CURR_ID, $subject->getSubjectCurrId()); $cr->addDescendingOrderByColumn(StudentRaportPeer::GRADE); $cr->setLimit(1); $stugrade = StudentRaportPeer::doSelectOne($cr); echo $stugrade ? $stugrade->getGrade() : '-'; ?> </td> <td style="text-align:center; vertical-align: middle; font-size:10px; <?php ++$l; if ($l % 2 == 0) { echo 'background-color: #ECF6FF;'; } ?> "> <?php echo array_key_exists($subject->getSubjectCurrId(), $grade_avg) ? round($grade_avg[$subject->getSubjectCurrId()] / $student_count) : '-'; if (array_key_exists($subject->getSubjectCurrId(), $grade_avg)) { $subject_total += round($grade_avg[$subject->getSubjectCurrId()] / $student_count);
public function executePrintTestAsCSV() { $course_schedule = CourseSchedulePeer::retrieveByPk($this->getRequestParameter('course_id')); $this->forward404Unless($course_schedule); $course_schedule_id = $course_schedule->getId(); $cr = new Criteria(); $cr->add(GradeSpecPeer::PARENT, 1); $cr->addAscendingOrderByColumn(GradeSpecPeer::ID); $this->grade = GradeSpecPeer::doSelect($cr); $this->count = GradeSpecPeer::doCount($cr); $c = new Criteria(); $c->addJoin(VStudentAccalPeer::STUDENT_ID, VStudentActivePeer::ID); $c->add(VStudentAccalPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId()); $c->add(VStudentAccalPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId()); $c->addAscendingOrderByColumn(VStudentAccalPeer::CLASS_NAME); $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'student')); $this->getUser()->setAttribute('max_per_page', $rpp, 'student'); $pager = new sfPropelPager('VStudentAccal', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'student')); $this->getUser()->setAttribute('page', $page, 'student'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $this->student_count = VStudentAccalPeer::doCount($c); $this->subtitle = $course_schedule->getSubjectCurr()->getSubject()->getName() . ' - ' . $course_schedule->getClassGroup()->toString(); $this->course_schedule = $course_schedule; $cem = new Criteria(); $cem->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId()); $cem->add(CourseRegulationPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId()); $cem->add(CourseRegulationPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId()); $course_reg = CourseRegulationPeer::doSelectOne($cem); $this->course_reg = $course_reg; ## Mengelompokkan Penilaian Ulangan Harian berdasarkan Tahun Ajaran dan Kelas $crn = new Criteria(); $crn->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId()); $crn->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId()); $crn->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId()); $stuuts = StudentRaportPeer::doSelect($crn); $utscount = StudentRaportPeer::doCount($crn); $this->stuuts = $stuuts; $this->utscount = $utscount; $uts_avg = array(); $uts_total = array(); $uts_grade = array(); foreach ($stuuts as $stuut) { $uts_grade[$stuut->getStudentId() . '#' . $stuut->getGradeSpecId()] = $stuut->getGrade(); $uts_avg[$stuut->getStudentId()] = (array_key_exists($stuut->getStudentId(), $uts_avg) ? $uts_avg[$stuut->getStudentId()] : 0) + $stuut->getGrade(); $uts_total[$stuut->getStudentId()] = (array_key_exists($stuut->getStudentId(), $uts_total) ? $uts_total[$stuut->getStudentId()] : 0) + 1; } $this->uts_grade = $uts_grade; $this->uts_avg = $uts_avg; $this->uts_total = $uts_total; $this->setLayout(false); $this->getResponse()->setHttpHeader('Content-Type', 'application/vnd-ms-excel'); $this->getResponse()->setHttpHeader('Content-Disposition', 'attachment; filename="Ulangan_' . $course_schedule->getSubjectCurr()->getSubject()->getName() . '_' . $course_schedule->getClassGroup()->getName() . '_' . $course_schedule->getAcademicCalendar()->getName() . '.xls"'); }
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = StudentRaportPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setStudentId($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setStudentCourseId($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setGradeComponentId($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setGradeSpecId($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setGrade($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setKkm($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setCitationId($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setRemark($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setSubjectCurrId($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setClassGroupId($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setAcademicCalendarId($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setScheduleId($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { $this->setScheduleDetailId($arr[$keys[13]]); } }
public function executeListAllScore() { $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $employee = EmployeePeer::retrieveByPK($employee_id); $this->forward404Unless($employee); $this->employee_id = $employee_id; $course_schedule = CourseSchedulePeer::retrieveByPk($this->getRequestParameter('course_id')); $this->forward404Unless($course_schedule); $course_schedule_id = $course_schedule->getId(); $c = new Criteria(); $c->addJoin(VStudentAccalPeer::STUDENT_ID, VStudentActivePeer::ID); $c->add(VStudentAccalPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId()); $c->add(VStudentAccalPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId()); $c->addAscendingOrderByColumn(VStudentAccalPeer::CLASS_NAME); $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'student')); $this->getUser()->setAttribute('max_per_page', $rpp, 'student'); $pager = new sfPropelPager('VStudentAccal', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'student')); $this->getUser()->setAttribute('page', $page, 'student'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $this->student_count = VStudentAccalPeer::doCount($c); $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); $this->actions = $actions; $this->subtitle = $course_schedule->getSubjectCurr()->getSubject()->getName() . ' - (' . $course_schedule->getClassGroup()->toString() . ' # ' . $course_schedule->getAcademicCalendar()->getName() . ')'; $this->type = 'edit'; $this->course_schedule = $course_schedule; $cem = new Criteria(); $cem->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId()); $cem->add(CourseRegulationPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId()); $cem->add(CourseRegulationPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId()); $course_reg = CourseRegulationPeer::doSelectOne($cem); $this->course_reg = $course_reg; ## Mengelompokkan Penilaian Keterampilan dan Sikap berdasarkan Tahun Ajaran dan Kelas $cr = new Criteria(); $cr->add(StudentGradeRaportPeer::COURSE_SCHEDULE_ID, $course_schedule->getId()); $stugrades = StudentGradeRaportPeer::doSelect($cr); $this->stugrades = $stugrades; $grades = array(); $grades_value = array(); $remarks = array(); $grade_avg = array(); foreach ($stugrades as $stugrade) { $grades[$stugrade->getStudentAccalId() . '#' . $stugrade->getGradeSpecId()] = $stugrade->getGrade(); $grades_value[$stugrade->getStudentAccalId() . '#' . $stugrade->getGradeSpecId()] = $stugrade->getGradeValue(); $remarks[$stugrade->getStudentAccalId() . '#' . $stugrade->getGradeSpecId()] = $stugrade->getRemark(); $grade_avg[$stugrade->getGradeSpecId()] = (array_key_exists($stugrade->getGradeSpecId(), $grade_avg) ? $grade_avg[$stugrade->getGradeSpecId()] : 0) + $stugrade->getGradeValue(); } $this->grades = $grades; $this->grade_avg = $grade_avg; $this->grades_value = $grades_value; $this->remarks = $remarks; ## Mengelompokkan Penilaian Raport $cri = new Criteria(); $cri->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId()); $cri->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId()); $cri->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId()); $sturaports = StudentRaportPeer::doSelect($cri); $this->sturaports = $sturaports; $raports = array(); $raport_avg = array(); foreach ($sturaports as $sturaport) { $raports[$sturaport->getStudentId() . '#' . $sturaport->getGradeSpecId()] = $sturaport->getGrade(); $raport_avg[$sturaport->getGradeSpecId()] = (array_key_exists($sturaport->getGradeSpecId(), $raport_avg) ? $raport_avg[$sturaport->getGradeSpecId()] : 0) + $sturaport->getGrade(); #$raport_total[$sturaport->getGradeSpecId()] = (array_key_exists($sturaport->getGradeSpecId(), $raport_total) ? $raport_total[$sturaport->getGradeSpecId()] : 0) + 1; } $this->raports = $raports; $this->raport_avg = $raport_avg; #$this->raport_total = $raport_total; ## Mengelompokkan Penilaian Ulangan Harian berdasarkan Tahun Ajaran dan Kelas $crn = new Criteria(); $crn->add(GradeSpecPeer::PARENT, 1); $crn->addJoin(StudentRaportPeer::GRADE_SPEC_ID, GradeSpecPeer::ID); $crn->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId()); $crn->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId()); $crn->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId()); $stuuts = StudentRaportPeer::doSelect($crn); $utscount = StudentRaportPeer::doCount($crn); $this->stuuts = $stuuts; $this->utscount = $utscount; $uts_avg = array(); $uts_total = array(); foreach ($stuuts as $stuut) { $uts_avg[$stuut->getStudentId()] = (array_key_exists($stuut->getStudentId(), $uts_avg) ? $uts_avg[$stuut->getStudentId()] : 0) + $stuut->getGrade(); $uts_total[$stuut->getStudentId()] = (array_key_exists($stuut->getStudentId(), $uts_total) ? $uts_total[$stuut->getStudentId()] : 0) + 1; } $this->uts_avg = $uts_avg; $this->uts_total = $uts_total; ## Mengelompokkan Penilaian Tugas berdasarkan Tahun Ajaran dan Kelas $crm = new Criteria(); $crm->add(GradeSpecPeer::PARENT, 7); $crm->addJoin(StudentRaportPeer::GRADE_SPEC_ID, GradeSpecPeer::ID); $crm->add(StudentRaportPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId()); $crm->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId()); $crm->add(StudentRaportPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId()); $stuuas = StudentRaportPeer::doSelect($crm); $uascount = StudentRaportPeer::doCount($crm); $this->stuuas = $stuuas; $this->uascount = $uascount; $uas_avg = array(); $uas_total = array(); foreach ($stuuas as $stuua) { $uas_avg[$stuua->getStudentId()] = (array_key_exists($stuua->getStudentId(), $uas_avg) ? $uas_avg[$stuua->getStudentId()] : 0) + $stuua->getGrade(); $uas_total[$stuua->getStudentId()] = (array_key_exists($stuua->getStudentId(), $uas_total) ? $uas_total[$stuua->getStudentId()] : 0) + 1; } $this->uas_avg = $uas_avg; $this->uas_total = $uas_total; if ($course_schedule->getAcademicCalendar()->getDepartmentId() == 2) { $cw = new Criteria(); $cw->add(CourseAbsencePeer::COURSE_SCHEDULE_ID, $course_schedule->getId()); $count_absence = CourseAbsencePeer::doCount($cw); $aw = new Criteria(); $aw->add(CourseAbsencePeer::COURSE_SCHEDULE_ID, $course_schedule->getId()); $aw->addJoin(CourseAbsenceStudentPeer::COURSE_ABSENCE_ID, CourseAbsencePeer::ID); $cas = CourseAbsenceStudentPeer::doSelect($aw); $absent = array(); if (count($cas)) { foreach ($cas as $ca) { $absent[$ca->getStatus() . '#' . $ca->getStudentId()] = (array_key_exists($ca->getStatus() . '#' . $ca->getStudentId(), $absent) ? $absent[$ca->getStatus() . '#' . $ca->getStudentId()] : 0) + 1; } } $this->absent = $absent; $this->count_absence = $count_absence; } $cb = new Criteria(); $cb->add(GradeConversionPeer::DEPARTMENT_ID, $course_schedule->getAcademicCalendar()->getDepartmentId()); $cb->add(GradeConversionPeer::TYPE_CONVERSION, GradeConversion::TYPE_KNOWLEDGE); $grade_convs = GradeConversionPeer::doSelect($cb); $this->grade_convs = $grade_convs; $actions2 = array(array('name' => '<span>Rekap Penilaian Akhir</span>', 'url' => 'course_afective/listAllScore?course_id=' . $course_schedule->getId(), 'color' => 'sun', 'type' => 'direct')); array_unshift($actions2, array('name' => '<span>' . $course_schedule->getAcademicCalendar()->getName() . '</span>', 'url' => 'course_score_new/list', 'color' => 'sky')); $this->actions2 = $actions2; }
<?php foreach ($students as $student) { ?> <?php use_helper('Number', 'myHelper'); $cr = new Criteria(); $cr->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cr->add(StudentRaportPeer::STUDENT_ID, $student->getId()); $cr->add(StudentRaportPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $student_raports = StudentRaportPeer::doSelect($cr); $subject_grade_spec = array(); foreach ($student_raports as $student_raport) { $subject_grade_spec[$student_raport->getSubjectCurrId() . '#' . $student_raport->getGradeSpecId()] = $student_raport; } $cw = new Criteria(); $cw->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cw->add(CourseRegulationPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $c_regulations = CourseRegulationPeer::doSelect($cw); $course_reg = array(); foreach ($c_regulations as $cr) { $course_reg[$cr->getAcademicCalendarId() . '#' . $cr->getSubjectCurrId() . '#' . $cr->getClassGroupId()] = $cr->getKkm(); } $cb = new Criteria(); $cb->add(StudentAbsencePeer::STUDENT_ID, $student->getId()); $cb->add(StudentAbsencePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cb->addGroupByColumn(StudentAbsencePeer::STUDENT_ID); $cb->addGroupByColumn(StudentAbsencePeer::START); $cb->addGroupByColumn(StudentAbsencePeer::ACADEMIC_CALENDAR_ID); $cb->addGroupByColumn(StudentAbsencePeer::CLASS_GROUP_ID);
public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(StudentRaportPeer::ID, $pks, Criteria::IN); $objs = StudentRaportPeer::doSelect($criteria, $con); } return $objs; }
public function executeGetStudentScore() { $student_id = $this->getRequestParameter('student_id'); $student = StudentPeer::retrieveByPK($student_id); $this->forward404Unless($student); $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); ## Daftar Mata Pelajaran di Jadwal Pelajaran $cw = new Criteria(); $cw->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cw->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $subjects = VCoursePeer::doSelect($cw); $subject_ids = array(); foreach ($subjects as $subject) { $subject_ids[] = $subject->getSubjectCurrId(); } $this->subjects = $subjects; ## Menentukan Aturan Penilaian $cd = new Criteria(); #$cd->add(ScoreRulePeer::ACADEMIC_CALENDAR_ID, $counseling->getAcademicCalendarId()); $cd->add(ClassGroupPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId()); $cd->addJoin(ScoreRulePeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $cd->add(ScoreRulePeer::TYPE, 2); $score_rule = ScoreRulePeer::doSelectOne($cd); $this->score_rule = $score_rule; ## Menentukan Aturan Penilaian Yang digunakan $cm = new Criteria(); $cm->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN); $cm->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN); $cm->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN); $cm->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $list_subs = ScoreRuleSubjectPeer::doSelect($cm); $subject_count = ScoreRuleSubjectPeer::doCount($cm); $this->list_subs = $list_subs; $this->subject_count = $subject_count; ## Mengelompokkan Penilaian Anak berdasarkan Tahun Ajaran dan Kelas $cr = new Criteria(); $cr->add(StudentRaportPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cr->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cr->add(StudentRaportPeer::STUDENT_ID, $student->getId()); $stugrades = StudentRaportPeer::doSelect($cr); $this->stugrades = $stugrades; $grades = array(); $grade_avg = array(); foreach ($stugrades as $stugrade) { $grades[$stugrade->getSubjectCurrId() . '#' . $stugrade->getGradeSpecId()] = $stugrade->getGrade(); $grade_avg[$stugrade->getSubjectCurrId() . '#' . $stugrade->getGradeSpecId()] = (array_key_exists($stugrade->getsubjectCurrId() . '#' . $stugrade->getGradeSpecId(), $grade_avg) ? $grade_avg[$stugrade->getSubjectCurrId() . '#' . $stugrade->getGradeSpecId()] : 0) + $stugrade->getGrade(); } $this->grades = $grades; $this->grade_avg = $grade_avg; $ct = new Criteria(); $ct->add(GradeSpecPeer::PARENT, 1, Criteria::IN); $ct->addAscendingOrderByColumn(GradeSpecPeer::ID); $this->grade1 = GradeSpecPeer::doSelect($ct); $this->count1 = GradeSpecPeer::doCount($ct); $cte = new Criteria(); $cte->add(GradeSpecPeer::PARENT, 7, Criteria::IN); $cte->addAscendingOrderByColumn(GradeSpecPeer::ID); $this->grade2 = GradeSpecPeer::doSelect($cte); $this->count2 = GradeSpecPeer::doCount($cte); $cw = new Criteria(); $cw->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cw->add(CourseRegulationPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $c_regulations = CourseRegulationPeer::doSelect($cw); $this->c_regulations = $c_regulations; $course_reg = array(); foreach ($c_regulations as $cr) { $course_reg[$cr->getSubjectCurrId()] = $cr->getKkm(); } $this->course_reg = $course_reg; $actions = array(); $this->actions = $actions; $this->counseling = $counseling; $this->subtitle = $academic_calendar->getName() . ' # Kelas : ' . $counseling->getClassGroup()->toString(); $this->academic_calendar = $academic_calendar; $this->student = $student; }
public function executeDeleteScore() { $student_raport = StudentRaportPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student_raport); $student_raport->delete(); return $this->redirect('course_detail/listShowByEmployee?course_id=' . $this->getRequestParameter('course_id')); }