Beispiel #1
0
 public function executePrintMiddle()
 {
     $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);
     ## 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, 5);
     $score_rule = ScoreRulePeer::doSelectOne($cd);
     $this->score_rule = $score_rule;
     $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 = ScoreRuleObjectPeer::doSelect($ct);
     $this->count1 = ScoreRuleObjectPeer::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 = ScoreRuleObjectPeer::doSelect($cte);
     $this->count2 = ScoreRuleObjectPeer::doCount($cte);
     $ctm = new Criteria();
     $ctm->add(GradeSpecPeer::PARENT, 90, Criteria::IN);
     $ctm->addJoin(GradeSpecPeer::ID, ScoreRuleObjectPeer::GRADE_SPEC_ID);
     $ctm->add(ScoreRuleObjectPeer::PUBLISHED, 1, Criteria::IN);
     $ctm->add(ScoreRuleObjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN);
     $ctm->addAscendingOrderByColumn(ScoreRuleObjectPeer::SEQUENCE);
     $this->grade3 = ScoreRuleObjectPeer::doSelect($ctm);
     $this->count3 = ScoreRuleObjectPeer::doCount($ctm);
     $ce = new Criteria();
     $ce->add(DepartmentDetailPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId());
     $this->department_detail = DepartmentDetailPeer::doSelectOne($ce);
     ## 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 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;
     $this->students = $students;
     $this->subtitle = '';
     $this->counseling = $counseling;
     $this->tanggal = $time;
     $this->tgl_cetak = $tgl;
     $this->time2 = $time2;
     $this->academic_calendar = $academic_calendar;
     $this->term = $term;
     if ($academic_calendar->getDepartment()->getCourseModel() == Department::CM_TK) {
         $term = $this->getRequestParameter('term');
         $this->orientation = 'landscape';
         $this->setTemplate('printMiddle');
         $this->papersize = 'a4';
     } elseif ($academic_calendar->getDepartment()->getCourseModel() == Department::CM_SMA) {
         $this->orientation = 'landscape';
         $this->setTemplate('printMiddleSMA');
         $this->papersize = 'legal';
     } else {
         ## Khusus SMPIA 6 (Dipisahin ngedadak soalnya)
         if ($academic_calendar->getDepartmentId() == 7) {
             $this->setTemplate('printMiddleSMP6');
             $this->orientation = 'portrait';
             $this->papersize = 'a4';
         } else {
             $this->setTemplate('printMiddle');
             $this->orientation = 'portrait';
             $this->papersize = 'a4';
         }
     }
     $this->setViewClass('sfDomPDF');
 }
Beispiel #2
0
 public function executePrintMiddle()
 {
     $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);
     ## 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, 5);
     $score_rule = ScoreRulePeer::doSelectOne($cd);
     /*
     var_dump($score_rule->toArray());
     die();
     */
     $this->score_rule = $score_rule;
     $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 = ScoreRuleObjectPeer::doSelect($ct);
     $this->count1 = ScoreRuleObjectPeer::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 = ScoreRuleObjectPeer::doSelect($cte);
     $this->count2 = ScoreRuleObjectPeer::doCount($cte);
     $ctm = new Criteria();
     $ctm->add(GradeSpecPeer::PARENT, 90, Criteria::IN);
     $ctm->addJoin(GradeSpecPeer::ID, ScoreRuleObjectPeer::GRADE_SPEC_ID);
     $ctm->add(ScoreRuleObjectPeer::PUBLISHED, 1, Criteria::IN);
     $ctm->add(ScoreRuleObjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN);
     $ctm->addAscendingOrderByColumn(ScoreRuleObjectPeer::SEQUENCE);
     $this->grade3 = ScoreRuleObjectPeer::doSelect($ctm);
     $this->count3 = ScoreRuleObjectPeer::doCount($ctm);
     $ce = new Criteria();
     $ce->add(DepartmentDetailPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId());
     $this->department_detail = DepartmentDetailPeer::doSelectOne($ce);
     ## 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 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);
     $stu_accal = array();
     foreach ($stu_accs as $stu_acc) {
         $stu_accal[$stu_acc->getStudentId()] = $stu_acc->getId();
     }
     $this->stu_accal = $stu_accal;
     $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;
     $this->students = $students;
     $this->subtitle = '';
     $this->counseling = $counseling;
     $this->tanggal = $time;
     $this->tgl_cetak = $tgl;
     $this->time2 = $time2;
     $this->academic_calendar = $academic_calendar;
     $this->term = $term;
     if ($academic_calendar->getDepartment()->getCourseModel() == Department::CM_TK) {
         $term = $this->getRequestParameter('term');
         $this->orientation = 'landscape';
         $this->setTemplate('printMiddle');
         $this->papersize = 'a4';
     } elseif ($academic_calendar->getDepartment()->getCourseModel() == Department::CM_SMA) {
         $this->orientation = 'landscape';
         $this->setTemplate('printMiddleSMA');
         $this->papersize = 'legal';
     } else {
         ## Khusus SMPIA 6 (Dipisahin ngedadak soalnya)
         if ($academic_calendar->getDepartmentId() == 7) {
             $this->setTemplate('printMiddleSMP6');
             $cde = new Criteria();
             $cde->add(ScoreRulePeer::KKM_SPEC, $academic_calendar->getDepartmentId());
             $cde->add(ScoreRulePeer::TYPE, ScoreRule::TYPE_ONE);
             $cde->add(ScoreRulePeer::CLASS_TYPE_ID, $counseling->getClassTypeId());
             $s_rule = ScoreRulePeer::doSelectOne($cde);
             $this->s_rule = $s_rule;
             ## Memunculkan semua mata pelajaran yang ada di aturan penilaian
             ## Mengelompokannya untuk kelompok A
             $cm = new Criteria();
             $cm->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $s_rule->getId(), Criteria::IN);
             $cm->add(ScoreRuleSubjectPeer::PUBLISHED, ScoreRule::ONE, Criteria::IN);
             #$cm->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN);
             $cton1 = $cm->getNewCriterion(ScoreRuleSubjectPeer::SUBJECT_TYPE, ScoreRuleSubject::SUBJECT_ONE, Criteria::IN);
             $cton2 = $cm->getNewCriterion(ScoreRuleSubjectPeer::SUBJECT_TYPE, ScoreRuleSubject::SUBJECT_THREE, Criteria::IN);
             $cton1->addOr($cton2);
             $cm->add($cton1);
             $cm->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE);
             $list_subs = ScoreRuleSubjectPeer::doSelect($cm);
             $subject_count = ScoreRuleSubjectPeer::doCount($cm);
             $this->list_subs = $list_subs;
             $this->subject_count = $subject_count;
             ## Memunculkan semua mata pelajaran yang ada di aturan penilaian
             ## Mengelompokannya untuk kelompok B
             $cmt = new Criteria();
             $cmt->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $s_rule->getId(), Criteria::IN);
             $cmt->add(ScoreRuleSubjectPeer::PUBLISHED, ScoreRule::ONE, Criteria::IN);
             $cmt->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, ScoreRuleSubject::SUBJECT_TWO, Criteria::IN);
             $cmt->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE);
             $list_subject = ScoreRuleSubjectPeer::doSelect($cmt);
             $subj_count = ScoreRuleSubjectPeer::doCount($cmt);
             $this->list_subject = $list_subject;
             $this->subj_count = $subj_count;
             ## Memunculkan semua mata pelajaran yang ada di aturan penilaian
             ## Mengelompokannya untuk kelompok C
             $cmp = new Criteria();
             $cmp->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $s_rule->getId(), Criteria::IN);
             $cmp->add(ScoreRuleSubjectPeer::PUBLISHED, ScoreRule::ONE, Criteria::IN);
             $cmp->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, ScoreRuleSubject::SUBJECT_SIX, Criteria::IN);
             $cmp->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE);
             $list_subjs = ScoreRuleSubjectPeer::doSelect($cmp);
             $s_count = ScoreRuleSubjectPeer::doCount($cmp);
             $this->list_subjs = $list_subjs;
             $this->s_count = $s_count;
             ## Khusus SMPIA 8
         } elseif ($academic_calendar->getDepartmentId() == 10) {
             ## Menentukan Aturan Penilaian (Tengah Semester)
             $cdi = new Criteria();
             $cdi->add(ScoreRulePeer::KKM_SPEC, $counseling->getAcademicCalendar()->getDepartmentId());
             $cdi->add(ScoreRulePeer::TYPE, ScoreRule::TYPE_ONE);
             $cdi->add(ScoreRulePeer::CLASS_TYPE_ID, $counseling->getClassTypeId());
             $sc_rule = ScoreRulePeer::doSelectOne($cdi);
             $this->sc_rule = $sc_rule;
             $cti = new Criteria();
             $cti->add(GradeSpecPeer::PARENT, 1, Criteria::IN);
             $cti->addJoin(GradeSpecPeer::ID, ScoreRuleObjectPeer::GRADE_SPEC_ID);
             $cti->add(ScoreRuleObjectPeer::PUBLISHED, 1, Criteria::IN);
             $cti->add(ScoreRuleObjectPeer::SCORE_RULE_ID, $sc_rule->getId(), Criteria::IN);
             $cti->addAscendingOrderByColumn(ScoreRuleObjectPeer::SEQUENCE);
             $this->grade4 = ScoreRuleObjectPeer::doSelect($cti);
             $this->count4 = ScoreRuleObjectPeer::doCount($cti);
             $ctf = new Criteria();
             $ctf->add(GradeSpecPeer::PARENT, 7, Criteria::IN);
             $ctf->addJoin(GradeSpecPeer::ID, ScoreRuleObjectPeer::GRADE_SPEC_ID);
             $ctf->add(ScoreRuleObjectPeer::PUBLISHED, 1, Criteria::IN);
             $ctf->add(ScoreRuleObjectPeer::SCORE_RULE_ID, $sc_rule->getId(), Criteria::IN);
             $ctf->addAscendingOrderByColumn(ScoreRuleObjectPeer::SEQUENCE);
             $this->grade5 = ScoreRuleObjectPeer::doSelect($ctf);
             $this->count5 = ScoreRuleObjectPeer::doCount($ctf);
             $ctg = new Criteria();
             $ctg->add(ScoreRuleObjectPeer::PUBLISHED, 1, Criteria::IN);
             $ctg->add(ScoreRuleObjectPeer::SCORE_RULE_ID, $sc_rule->getId(), Criteria::IN);
             $ctg->add(ScoreRuleObjectPeer::SEQUENCE, TestApplicant::REG_INFO_EXB, Criteria::IN);
             $ctg->addAscendingOrderByColumn(ScoreRuleObjectPeer::ID);
             $this->grade6 = ScoreRuleObjectPeer::doSelect($ctg);
             $this->count6 = ScoreRuleObjectPeer::doCount($ctg);
             $cth = new Criteria();
             $cth->add(ScoreRuleObjectPeer::PUBLISHED, 1, Criteria::IN);
             $cth->add(ScoreRuleObjectPeer::SCORE_RULE_ID, $sc_rule->getId(), Criteria::IN);
             $cth->add(ScoreRuleObjectPeer::SEQUENCE, TestApplicant::REG_INFO_MISC, Criteria::IN);
             $cth->addAscendingOrderByColumn(ScoreRuleObjectPeer::ID);
             $this->grade7 = ScoreRuleObjectPeer::doSelect($cth);
             $this->count7 = ScoreRuleObjectPeer::doCount($cth);
             $ctj = new Criteria();
             $ctj->add(ScoreRuleObjectPeer::PUBLISHED, 1, Criteria::IN);
             $ctj->add(ScoreRuleObjectPeer::SCORE_RULE_ID, $sc_rule->getId(), Criteria::IN);
             $ctj->add(ScoreRuleObjectPeer::SEQUENCE, 7, Criteria::IN);
             $ctj->addAscendingOrderByColumn(ScoreRuleObjectPeer::ID);
             $this->grade8 = ScoreRuleObjectPeer::doSelect($ctj);
             $this->count8 = ScoreRuleObjectPeer::doCount($ctj);
             ## Mengelompokkan Penilaian Anak berdasarkan Tahun Ajaran dan Kelas
             $cre = new Criteria();
             $sgrades = StudentGradeRaportPeer::doSelect($cre);
             $this->sgrades = $sgrades;
             $nilai = array();
             foreach ($sgrades as $sgrade) {
                 $nilai[$sgrade->getStudentAccalId() . '#' . $sgrade->getGradeSpecId() . '#' . $sgrade->getCourseScheduleId()] = $sgrade->getGrade();
             }
             $this->nilai = $nilai;
             $crf = new Criteria();
             $crf->add(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
             $crf->add(CourseSchedulePeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
             $courses = CourseSchedulePeer::doSelect($crf);
             $course_id = array();
             foreach ($courses as $course) {
                 $course_id[$course->getSubjectCurrId()] = $course->getId();
             }
             $this->course_id = $course_id;
             $this->setTemplate('printMiddleSMP8');
         } else {
             $this->setTemplate('printMiddleSMP9');
             $cde = new Criteria();
             $cde->add(ScoreRulePeer::KKM_SPEC, $academic_calendar->getDepartmentId());
             $cde->add(ScoreRulePeer::TYPE, ScoreRule::TYPE_ONE);
             $cde->add(ScoreRulePeer::CLASS_TYPE_ID, $counseling->getClassTypeId());
             $s_rule = ScoreRulePeer::doSelectOne($cde);
             $this->s_rule = $s_rule;
             ## Memunculkan semua mata pelajaran yang ada di aturan penilaian
             ## Mengelompokannya untuk kelompok A
             $cm = new Criteria();
             $cm->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $s_rule->getId(), Criteria::IN);
             $cm->add(ScoreRuleSubjectPeer::PUBLISHED, ScoreRule::ONE, Criteria::IN);
             #$cm->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN);
             $cton1 = $cm->getNewCriterion(ScoreRuleSubjectPeer::SUBJECT_TYPE, ScoreRuleSubject::SUBJECT_ONE, Criteria::IN);
             $cton2 = $cm->getNewCriterion(ScoreRuleSubjectPeer::SUBJECT_TYPE, ScoreRuleSubject::SUBJECT_THREE, Criteria::IN);
             $cton1->addOr($cton2);
             $cm->add($cton1);
             $cm->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE);
             $list_subs = ScoreRuleSubjectPeer::doSelect($cm);
             $subject_count = ScoreRuleSubjectPeer::doCount($cm);
             $this->list_subs = $list_subs;
             $this->subject_count = $subject_count;
             ## Memunculkan semua mata pelajaran yang ada di aturan penilaian
             ## Mengelompokannya untuk kelompok B
             $cmt = new Criteria();
             $cmt->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $s_rule->getId(), Criteria::IN);
             $cmt->add(ScoreRuleSubjectPeer::PUBLISHED, ScoreRule::ONE, Criteria::IN);
             $cmt->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, ScoreRuleSubject::SUBJECT_TWO, Criteria::IN);
             $cmt->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE);
             $list_subject = ScoreRuleSubjectPeer::doSelect($cmt);
             $subj_count = ScoreRuleSubjectPeer::doCount($cmt);
             $this->list_subject = $list_subject;
             $this->subj_count = $subj_count;
             ## Memunculkan semua mata pelajaran yang ada di aturan penilaian
             ## Mengelompokannya untuk kelompok C
             $cmp = new Criteria();
             $cmp->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $s_rule->getId(), Criteria::IN);
             $cmp->add(ScoreRuleSubjectPeer::PUBLISHED, ScoreRule::ONE, Criteria::IN);
             $cmp->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, ScoreRuleSubject::SUBJECT_SIX, Criteria::IN);
             $cmp->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE);
             $list_subjs = ScoreRuleSubjectPeer::doSelect($cmp);
             $s_count = ScoreRuleSubjectPeer::doCount($cmp);
             $this->list_subjs = $list_subjs;
             $this->s_count = $s_count;
             $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, $s_rule->getId(), Criteria::IN);
             $ct->addAscendingOrderByColumn(ScoreRuleObjectPeer::SEQUENCE);
             $this->grade1 = ScoreRuleObjectPeer::doSelect($ct);
             $this->count1 = ScoreRuleObjectPeer::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, $s_rule->getId(), Criteria::IN);
             $cte->addAscendingOrderByColumn(ScoreRuleObjectPeer::SEQUENCE);
             $this->grade2 = ScoreRuleObjectPeer::doSelect($cte);
             $this->count2 = ScoreRuleObjectPeer::doCount($cte);
         }
         if ($academic_calendar->getDepartmentId() == 10) {
             $this->setLayout = false;
             $this->orientation = 'landscape';
         } else {
             $this->orientation = 'potrait';
         }
         $this->papersize = 'a4';
     }
     if (SF_ENVIRONMENT != 'dev') {
         $this->setViewClass('sfDomPDF');
     }
 }