echo $student->getName() ? $student->getName() : '-'; ?> </td> <?php $c = new Criteria(); $c->add(StudentAbsencePeer::STUDENT_ID, $student->getId()); $c->add(StudentAbsencePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cton1 = $c->getNewCriterion(StudentAbsencePeer::START, $tahun . '-' . $title->getId() . '-1', Criteria::GREATER_EQUAL); $cton2 = $c->getNewCriterion(StudentAbsencePeer::START, $tahun . '-' . ($title->getId() + 1) . '-1', Criteria::LESS_THAN); $cton1->addAnd($cton2); $c->add($cton1); $c->addGroupByColumn(StudentAbsencePeer::START); $c->addGroupByColumn(StudentAbsencePeer::STUDENT_ID); $c->addGroupByColumn(StudentAbsencePeer::ACADEMIC_CALENDAR_ID); $c->addGroupByColumn(StudentAbsencePeer::CLASS_GROUP_ID); $sas = StudentabsencePeer::doSelect($c); $absence = array(); if (count($sas)) { foreach ($sas as $sa) { $absence[$sa->getStart()] = $sa->getStatus(); $absence[$sa->getStatus()] = (array_key_exists($sa->getStatus(), $absence) ? $absence[$sa->getStatus()] : 0) + 1; } } ?> <?php $tgl = 0; while ($tgl < $jumHari) { $tgl++; ?> <td width="2%" style="text-align: center; vertical-align:middle; font-weight: bold;" <?php if ($tgl % 2 == 0) {
public function executeListStudent() { $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $employee = EmployeePeer::retrieveByPK($employee_id); $this->forward404Unless($employee); $course_schedule = CourseSchedulePeer::retrieveByPk($this->getRequestParameter('course_id')); $this->forward404Unless($course_schedule); $attendance_class = AttendanceClassPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($attendance_class); $tanggal = $this->getRequestParameter('time'); $status = $this->getRequestParameter('status'); if ($status == AbsenceCourse::STATUS_PRESENT) { $cb = new Criteria(); $cb->add(StudentAbsencePeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId()); $cb->add(StudentAbsencePeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId()); $cb->add(StudentAbsencePeer::START, $tanggal); $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); $student_ids = array(); foreach ($sas as $sa) { $student_ids[] = $sa->getStudentId(); } $c = new Criteria(); $c->add(VStudentActivePeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendar()->getParent(), Criteria::IN); $c->add(VStudentActivePeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId(), Criteria::IN); $c->add(VStudentActivePeer::ID, $student_ids, Criteria::NOT_IN); $c->addAscendingOrderByColumn(VStudentActivePeer::CLASS_NAME); $students = VStudentActivePeer::doSelect($c); } elseif ($status == 9) { $c = new Criteria(); $c->add(VStudentActivePeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendar()->getParent(), Criteria::IN); $c->add(VStudentActivePeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId(), Criteria::IN); $c->addAscendingOrderByColumn(VStudentActivePeer::CLASS_NAME); $students = VStudentActivePeer::doSelect($c); } else { $cb = new Criteria(); $cb->add(StudentAbsencePeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId()); $cb->add(StudentAbsencePeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId()); $cb->add(StudentAbsencePeer::START, $tanggal); $cb->add(StudentAbsencePeer::STATUS, $status); $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); $student_ids = array(); foreach ($sas as $sa) { $student_ids[] = $sa->getStudentId(); } $c = new Criteria(); $c->add(VStudentActivePeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendar()->getParent(), Criteria::IN); $c->add(VStudentActivePeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId(), Criteria::IN); $c->add(VStudentActivePeer::ID, $student_ids, Criteria::IN); $c->addAscendingOrderByColumn(VStudentActivePeer::CLASS_NAME); $students = VStudentActivePeer::doSelect($c); } $rpp = $this->getRequestParameter('max_per_page', 999); $pager = new sfPropelPager('VStudentActive', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'student_active')); $this->getUser()->setAttribute('page', $page, 'student_active'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions = array(array('name' => 'Kembali', 'url' => 'course_absence/listShow?course_id=' . $course_schedule->getId(), 'color' => 'black')); array_unshift($actions, array('name' => 'Print Excel', 'url' => "course_absence/listStudentAsCSV?id=" . $attendance_class->getId() . "&course_id=" . $course_schedule->getId() . "&time=" . $tanggal . "&status=" . $status, 'color' => 'black', 'type' => 'direct')); array_unshift($actions, array('name' => 'Print PDF', 'url' => "course_absence/listStudentAsPDF?id=" . $attendance_class->getId() . "&course_id=" . $course_schedule->getId() . "&time=" . $tanggal . "&status=" . $status, 'color' => 'black', 'type' => 'direct')); $this->actions = $actions; $actions2 = array(array('name' => '<span>Agenda Kelas</span>', 'url' => 'course_agenda/list?course_id=' . $course_schedule->getId(), 'color' => 'sun')); if ($course_schedule->getAcademicCalendar()->getCourseModel() == 'A') { array_unshift($actions2, array('name' => '<span>' . $course_schedule->getAcademicCalendar()->getName() . '</span>', 'url' => 'course/listScore', 'color' => 'sun')); } else { array_unshift($actions2, array('name' => '<span>' . $course_schedule->getAcademicCalendar()->getName() . '</span>', 'url' => 'course/listScore2', 'color' => 'sun')); } array_push($actions2, array('name' => '<span>Absensi Kelas</span>', 'url' => 'course_absence/listShow?course_id=' . $course_schedule->getId(), 'color' => 'sun', 'type' => 'direct')); array_push($actions2, array('name' => '<span>Jadwal Tugas / Ulangan / PR</span>', 'url' => 'course_test/list?course_id=' . $course_schedule->getId(), 'color' => 'sun')); array_push($actions2, array('name' => '<span>Bimbingan Konseling</span>', 'url' => 'course_counseling/list?course_id=' . $course_schedule->getId(), 'color' => 'sun')); $this->actions2 = $actions2; $this->subtitle = $course_schedule->getSubjectCurr()->getSubject()->getName() . ' - ' . $course_schedule->getClassGroup()->toString(); $this->course_schedule = $course_schedule; $this->course_schedule_id = $course_schedule->getId(); $this->attendance_class = $attendance_class; $this->employee = $employee; $this->tanggal = $tanggal; $this->status = $status; }
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'); }
$stu_attendance[$sa->getStudentId()] = (array_key_exists($sa->getStudentId(), $stu_attendance) ? $stu_attendance[$sa->getStudentId()] : 0) + 1; } } $cd = new Criteria(); $cd->add(AttendanceClassPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId()); $cd->add(AttendanceClassPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId()); $cd->add(AttendanceClassPeer::DATETIME, $tanggal); $confirms = AttendanceClassPeer::doSelect($cd); $cm = new Criteria(); $cm->add(StudentAbsencePeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId()); $cm->add(StudentAbsencePeer::START, $tanggal); $cm->addGroupByColumn(StudentAbsencePeer::START); $cm->addGroupByColumn(StudentAbsencePeer::STUDENT_ID); $cm->addGroupByColumn(StudentAbsencePeer::ACADEMIC_CALENDAR_ID); $cm->addGroupByColumn(StudentAbsencePeer::CLASS_GROUP_ID); $stas = StudentabsencePeer::doSelect($cm); $absence = array(); if (count($stas)) { foreach ($stas as $sta) { $absence[$sta->getStudentId()] = $sta->getStatus(); } } ?> <table border="0" width="100%" style="margin-top: -10px;"> <tr><td width="34%" valign="top"> <table class="form"> <tr><td class="form" width="100%"> <table class="form_content" width="100%"> <tbody>
public static function getStudentAttendance($studentAccal) { $cb = new Criteria(); $cb->add(StudentAbsencePeer::STUDENT_ID, $studentAccal->getStudentId()); $cb->add(StudentAbsencePeer::ACADEMIC_CALENDAR_ID, $studentAccal->getAcademicCalendarId()); $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()] = (array_key_exists($sa->getStatus(), $absence) ? $absence[$sa->getStatus()] : 0) + 1; } } return $absence; }