public static function doSelectByAccal() { $student_course_id = sfContext::getInstance()->getRequest()->getParameter('id'); $student_course = StudentCoursePeer::retrieveByPK($student_course_id); if ($student_course) { if (!$student_course->getSubjectAccal()) { return array(); } $accal = $student_course->getSubjectAccal()->getAcademicCalendar(); } else { $accal_id = sfContext::getInstance()->getRequest()->getParameter('accal_id'); $accal = AcademicCalendarPeer::retrieveByPK($accal_id); } if ($accal == null) { return array(); } $c = new Criteria(); $c->addAscendingOrderByColumn(AcademicCalendarPeer::CODE); $c->addAscendingOrderByColumn(SubjectPeer::NAME); $c->addAscendingOrderByColumn(EmployeePeer::NAME); $c->addJoin(AcademicCalendarPeer::ID, SubjectAccalPeer::ACADEMIC_CALENDAR_ID); $c->addJoin(SubjectPeer::ID, SubjectAccalPeer::SUBJECT_ID); $c->addJoin(EmployeePeer::ID, SubjectAccalPeer::EMPLOYEE_ID); $c->add(SubjectAccalPeer::ACADEMIC_CALENDAR_ID, $accal->getId()); $objs = SubjectAccalPeer::doSelect($c); return $objs; }
public function executeList() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $c = new Criteria(); $c->add(JobPeer::CODE, $this->getModuleName()); $job = JobPeer::doSelectOne($c); $acl = AclPeer::retrieveByPK($group_id, $job->getId()); if (!$acl) { $this->forward('default', 'error404'); } $this->can_edit = $acl->getEditPriv() == 1; $this->can_remove = $acl->getRemovePriv() == 1; $accal_id = $this->getRequestParameter('accal_id'); $accal = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($accal); $this->accal = $accal; $c = new Criteria(); $c->add(SubjectAccalPeer::ACADEMIC_CALENDAR_ID, $accal_id); $this->sort($c); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if (is_array($f)) { if (strlen($f['from']) > 0 || strlen($f['to']) > 0) { $defined_filter = true; break; } } else { if ($f != null && $f != '') { $defined_filter = true; break; } } } if ($defined_filter) { $this->filters = $filters; $this->filter($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'subject_accal_s')); $this->getUser()->setAttribute('max_per_page', $rpp, 'subject_accal_s'); $pager = new sfPropelPager('SubjectAccal', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'subject_accal_s')); $this->getUser()->setAttribute('page', $page, 'subject_accal_s'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions = array(array('name' => 'filter', 'color' => 'white')); if ($acl->getAddPriv()) { array_unshift($actions, array('name' => 'add', 'url' => 'subject_accal_s/create?accal_id=' . $accal_id, 'color' => 'green')); } $this->actions = $actions; }
public function getCourseModelRecurs() { if (!$this->getCourseModel()) { if ($this->getParent()) { $p = AcademicCalendarPeer::retrieveByPK($this->getParent()); return $p->getCourseModelRecurs(); } return self::CM_CUSTOM; } return $this->getCourseModel(); }
public function executeGetSubject() { $academic_calendar_id = $this->getRequestParameter('academic_calendar_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id); $this->forward404Unless($academic_calendar); $c = new Criteria(); $c->add(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $c->addAscendingOrderByColumn(CourseSchedulePeer::CLASS_GROUP_ID); $this->sort($c); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if (is_array($f)) { if (strlen($f['from']) > 0 || strlen($f['to']) > 0) { $defined_filter = true; break; } } else { if ($f != null && $f != '') { $defined_filter = true; break; } } } if ($defined_filter) { $this->filters = $filters; $this->filter($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'course')); $this->getUser()->setAttribute('max_per_page', $rpp, 'course'); $pager = new sfPropelPager('CourseSchedule', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'course')); $this->getUser()->setAttribute('page', $page, 'course'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions = array(); $this->actions = $actions; $this->subtitle = ''; $this->academic_calendar = $academic_calendar; }
public function executeDeleteTemp() { $temp_table = TempTablePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($temp_table); $temp_table->delete(); $academic_calendar = AcademicCalendarPeer::retrieveByPK($this->getRequestParameter('accal_id')); $this->forward404Unless($academic_calendar); $counseling = CounselingPeer::retrieveByPk($this->getRequestParameter('counseling_id')); $this->forward404Unless($counseling); $tanggal = $this->getRequestParameter('time'); $time2 = $this->getRequestParameter('time2'); return $this->redirect('rpt_counseling/preview?counseling_id=' . $counseling->getId() . '&accal_id=' . $academic_calendar->getId() . '&time=' . $tanggal . '&time2=' . $time2); }
public function getAcademicCalendar($con = null) { include_once 'lib/model/om/BaseAcademicCalendarPeer.php'; if ($this->aAcademicCalendar === null && $this->academic_calendar_id !== null) { $this->aAcademicCalendar = AcademicCalendarPeer::retrieveByPK($this->academic_calendar_id, $con); } return $this->aAcademicCalendar; }
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; $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; $cr = new Criteria(); $cr->add(GradeSpecPeer::PARENT, 1); $this->grade1 = GradeSpecPeer::doSelect($cr); $this->count1 = GradeSpecPeer::doCount($cr); $crew = new Criteria(); $crew->add(GradeSpecPeer::PARENT, 7); $this->grade2 = GradeSpecPeer::doSelect($crew); $this->count2 = GradeSpecPeer::doCount($crew); #SMP if ($academic_calendar->getDepartmentId() == 2) { $cb = new Criteria(); $cb->add(VCoursePeer::CLASS_GROUP_ID, $stu_accal->getClassGroupId(), Criteria::IN); $cb->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cb->add(VCoursePeer::SUBJECT_CURR_ID, 316, Criteria::NOT_IN); $cb->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects = VCoursePeer::doSelect($cb); $this->subject_count = VCoursePeer::doCount($cb); #SD } elseif ($academic_calendar->getDepartmentId() == 3) { $cb = new Criteria(); $cb->add(VCoursePeer::CLASS_GROUP_ID, $stu_accal->getClassGroupId(), Criteria::IN); $cb->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cb->add(VCoursePeer::SUBJECT_GROUP_ID, 7, Criteria::IN); $cb->add(VCoursePeer::SUBJECT_CURR_ID, 319, Criteria::NOT_IN); $cb->add(VCoursePeer::SUBJECT_CURR_ID, 333, Criteria::NOT_IN); $cb->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects7 = VCoursePeer::doSelect($cb); $subject_count7 = VCoursePeer::doCount($cb); $this->subject_count7 = $subject_count7; $cm = new Criteria(); $cm->add(VCoursePeer::CLASS_GROUP_ID, $stu_accal->getClassGroupId(), Criteria::IN); $cm->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cm->add(VCoursePeer::SUBJECT_GROUP_ID, 8, Criteria::IN); $cm->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects8 = VCoursePeer::doSelect($cm); $subject_count8 = VCoursePeer::doCount($cm); $this->subject_count8 = $subject_count8; } $rpp = $this->getRequestParameter('max_per_page', 999); $pager = new sfPropelPager('VCourse', $rpp); $pager->setCriteria($c); $pager->setPage($this->getRequestParameter('page', 1)); $pager->init(); $this->pager = $pager; $actions = array(array()); $this->actions = $actions; }
public function executeGetListForCourse() { $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $cr = new Criteria(); $academic_calendar_id = $this->getRequestParameter('academic_calendar_id'); $class_group_id = $this->getRequestParameter('class_group_id'); $accal = AcademicCalendarPeer::retrieveByPK($academic_calendar_id); $class = ClassGroupPeer::retrieveByPK($class_group_id); $cr->add(VCourseSchedulePeer::ACADEMIC_CALENDAR_ID, $this->getRequestParameter('academic_calendar_id')); $cr->add(VCourseSchedulePeer::CLASS_GROUP_ID, $this->getRequestParameter('class_group_id')); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if ($f != null && $f != '') { $defined_filter = true; break; } } if ($defined_filter) { $this->filters = $filters; $this->filterSubject($cr, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'course_schedule')); $this->getUser()->setAttribute('max_per_page', $rpp, 'course_schedule'); $pager = new sfPropelPager('VCourseSchedule', $rpp); $pager->setCriteria($cr); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'course_schedule')); $this->getUser()->setAttribute('page', $page, 'course_schedule'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions = array(array('name' => 'filter', 'color' => 'white')); $filter_string = ""; if ($this->filters) { foreach ($this->filters as $key => $val) { $filter_string .= "&filters[{$key}]={$val}"; } $filter_string = preg_replace('/^&/', '', $filter_string); } $this->filter_string = $filter_string; $this->subtitle = ''; $this->actions = $actions; $this->academic_calendar_id = $academic_calendar_id; $this->class_group_id = $class_group_id; }
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'); $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); $co = new Criteria(); $co->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $co->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cton1 = $co->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 319, Criteria::NOT_IN); $cton2 = $co->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 333, Criteria::NOT_IN); $cton1->addAnd($cton2); $co->add($cton1); $co->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects = VCoursePeer::doSelect($co); $subject_count = VCoursePeer::doCount($co); $this->subject_count = $subject_count; $cw = new Criteria(); $cw->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN); $cw->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cton1 = $cw->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 350, Criteria::IN); $cton2 = $cw->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 351, Criteria::IN); $cton3 = $cw->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 346, Criteria::IN); $cton4 = $cw->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 339, Criteria::IN); $cton5 = $cw->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 340, Criteria::IN); $cton6 = $cw->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 337, Criteria::IN); $cton5->addOr($cton6); $cton4->addOr($cton5); $cton3->addOr($cton4); $cton2->addOr($cton3); $cton1->addOr($cton2); $cw->add($cton1); $cw->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects1 = VCoursePeer::doSelect($cw); $subject_count1 = VCoursePeer::doCount($cw); $this->subject_count1 = $subject_count1; $cm = new Criteria(); $cm->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN); $cm->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cton1 = $cm->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 353, Criteria::IN); $cton2 = $cm->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 354, Criteria::IN); $cton1->addOr($cton2); $cm->add($cton1); $cm->addAscendingOrderByColumn(VCoursePeer::CODE); $this->ipas = VCoursePeer::doSelect($cm); $ipa_count = VCoursePeer::doCount($cm); $this->ipa_count = $ipa_count; $cl = new Criteria(); $cl->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN); $cl->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cton1 = $cl->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 343, Criteria::IN); $cton2 = $cl->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 338, Criteria::IN); $cton3 = $cl->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 347, Criteria::IN); $cton2->addOr($cton3); $cton1->addOr($cton2); $cl->add($cton1); $cl->addAscendingOrderByColumn(VCoursePeer::CODE); $this->ips = VCoursePeer::doSelect($cl); $ips_count = VCoursePeer::doCount($cl); $this->ips_count = $ips_count; $cd = new Criteria(); $cd->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN); $cd->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cton1 = $cd->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 352, Criteria::IN); $cton2 = $cd->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 349, Criteria::IN); $cton1->addOr($cton2); $cd->add($cton1); $cd->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects2 = VCoursePeer::doSelect($cd); $subject_count2 = VCoursePeer::doCount($cd); $this->subject_count2 = $subject_count2; $cp = new Criteria(); $cp->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN); $cp->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cp->add(VCoursePeer::SUBJECT_CURR_ID, 348, Criteria::IN); $cp->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects3 = VCoursePeer::doSelect($cp); $subject_count3 = VCoursePeer::doCount($cp); $this->subject_count3 = $subject_count3; $cq = new Criteria(); $cq->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN); $cq->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cq->add(VCoursePeer::SUBJECT_CURR_ID, 341, Criteria::IN); $cq->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subject4 = VCoursePeer::doSelectOne($cq); $subject_count4 = VCoursePeer::doCount($cq); $this->subject_count4 = $subject_count4; $cblek = new Criteria(); $cblek->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN); $cblek->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cblek->add(VCoursePeer::SUBJECT_CURR_ID, 355, Criteria::IN); $cblek->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subject5 = VCoursePeer::doSelectOne($cblek); $subject_count5 = VCoursePeer::doCount($cblek); $this->subject_count5 = $subject_count5; if ($counseling->getClassGroup()->getParent() != 42 || $counseling->getClassGroup()->getParent() != 48 || $counseling->getClassGroup()->getParent() != 123) { if ($counseling->getAcademicCalendarId() == 39) { $cb = new Criteria(); $cb->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN); $cb->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cb->add(VCoursePeer::SUBJECT_GROUP_ID, 7, Criteria::IN); $cb->add(VCoursePeer::SUBJECT_CURR_ID, 319, Criteria::NOT_IN); $cb->add(VCoursePeer::SUBJECT_CURR_ID, 333, Criteria::NOT_IN); $cb->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects7 = VCoursePeer::doSelect($cb); $subject_count7 = VCoursePeer::doCount($cb); $this->subject_count7 = $subject_count7; } else { $cb = new Criteria(); $cb->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN); $cb->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cton1 = $cb->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 325, Criteria::IN); $cton2 = $cb->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 327, Criteria::IN); $cton3 = $cb->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 329, Criteria::IN); $cton4 = $cb->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 317, Criteria::IN); $cton5 = $cb->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 324, Criteria::IN); $cton6 = $cb->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 321, Criteria::IN); $cton7 = $cb->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 322, Criteria::IN); $cton6->addOr($cton7); $cton5->addOr($cton6); $cton4->addOr($cton5); $cton3->addOr($cton4); $cton2->addOr($cton3); $cton1->addOr($cton2); $cb->add($cton1); $cb->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects7 = VCoursePeer::doSelect($cb); $subject_count7 = VCoursePeer::doCount($cb); $this->subject_count7 = $subject_count7; $cbe = new Criteria(); $cbe->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN); $cbe->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cton1 = $cbe->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 328, Criteria::IN); $cton2 = $cbe->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 318, Criteria::IN); $cton3 = $cbe->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 356, Criteria::IN); $cton4 = $cbe->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 357, Criteria::IN); $cton3->addOr($cton4); $cton2->addOr($cton3); $cton1->addOr($cton2); $cbe->add($cton1); $cbe->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects71 = VCoursePeer::doSelect($cbe); $subject_count71 = VCoursePeer::doCount($cbe); $this->subject_count71 = $subject_count71; } } else { $cb = new Criteria(); $cb->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN); $cb->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cb->add(VCoursePeer::SUBJECT_GROUP_ID, 7, Criteria::IN); $cb->add(VCoursePeer::SUBJECT_CURR_ID, 319, Criteria::NOT_IN); $cb->add(VCoursePeer::SUBJECT_CURR_ID, 333, Criteria::NOT_IN); $cb->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects7 = VCoursePeer::doSelect($cb); $subject_count7 = VCoursePeer::doCount($cb); $this->subject_count7 = $subject_count7; } $crit = new Criteria(); $crit->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $crit->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $crit->add(VCoursePeer::SUBJECT_GROUP_ID, 8); $crit->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects8 = VCoursePeer::doSelect($crit); $subject_count8 = VCoursePeer::doCount($crit); $this->subject_count8 = $subject_count8; $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); $rpp = $this->getRequestParameter('max_per_page', 999); $pager = new sfPropelPager('VCourse', $rpp); $pager->setCriteria($co); $pager->setPage($this->getRequestParameter('page', 1)); $pager->init(); $this->pager = $pager; $cmot = new Criteria(); $cmot->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cmot->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cmot->addJoin(VStudentActivePeer::ID, StudentAccalPeer::STUDENT_ID); $cmot->addJoin(StudentPeer::ID, VStudentActivePeer::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->academic_calendar = $academic_calendar; $this->papersize = 'a4'; $this->orientation = 'portrait'; $this->setViewClass('sfDomPDF'); }
public function executeSaveNote() { $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); $descs = $this->getRequestParameter('desc'); foreach ($descs as $m => $desc) { if ($desc != null) { if ($desc != '-') { $ced = new Criteria(); $ced->add(StudentNotePeer::STUDENT_ID, $m); $ced->add(StudentNotePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $ced->add(StudentNotePeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $ced->add(StudentNotePeer::COUNSELING_ID, $counseling->getId()); $note = StudentNotePeer::doSelectOne($ced); if ($note == null) { $note = new StudentNote(); } $note->setStudentId($m); $note->setAcademicCalendarId($academic_calendar->getId()); $note->setClassGroupId($counseling->getClassGroupId()); $note->setCounselingId($counseling->getId()); $note->setNote($desc); $note->save(); } else { $ced = new Criteria(); $ced->add(StudentNotePeer::STUDENT_ID, $m); $ced->add(StudentNotePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $ced->add(StudentNotePeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $ced->add(StudentNotePeer::COUNSELING_ID, $counseling->getId()); $note = StudentNotePeer::doSelectOne($ced); if ($note != null) { $note->delete(); } } } } return $this->redirect('counseling/listNote?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId()); }
?> <table border="0" width="100%" style="page-break-after: always;"> <tr> <td width="100%" align="left"> <table border="0" width="100%"> <tr> <td width="18%" align="center"> <img src='<?php echo image_path('logo_' . $academic_calendar->getDepartment()->getNumCode() . '.jpg', true); ?> ' border=0 > </td> <?php $academicYear = AcademicCalendarPeer::retrieveByPK($academic_calendar->getParent()); ?> <td align="center"> <center class="subtitle" style="font-weight: normal;">LAPORAN NILAI TENGAH SEMESTER</center> <center class="subtitle" style="font-weight: normal;">TAHUN PELAJARAN <?php echo $academicYear->getName(); ?> </center> <center class="subtitle" style="font-weight: normal;">SMP ISLAM AL AZHAR 9 KEMANG PRATAMA</center> <center class="subtitle"></center> <center style="font-weight: 12px;"><?php echo $department_detail ? $department_detail->getAddress() ? $department_detail->getAddress() : '' : ''; #echo $score_rule->getId() ?> <?php #echo $s_rule->getId()
public function executeListRaport() { $accal_id = $this->getRequestParameter('accal_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($academic_calendar); $cw = new Criteria(); $cw->add(ClassGroupPeer::PARENT, 0); $classes = ClassGroupPeer::doSelect($cw); $class_id = array(); foreach ($classes as $classe) { $class_ids[] = $classe->getId(); } $c = new Criteria(); $c->add(ClassGroupPeer::DEPARTMENT_ID, $academic_calendar->getDepartmentId(), Criteria::IN); $cton1 = $c->getNewCriterion(ClassGroupPeer::PARENT, 0, Criteria::NOT_IN); $cton2 = $c->getNewCriterion(ClassGroupPeer::PARENT, $class_ids, Criteria::NOT_IN); $cton1->addAnd($cton2); $c->add($cton1); $this->sortClass($c); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if (is_array($f)) { if (strlen($f['from']) > 0 || strlen($f['to']) > 0) { $defined_filter = true; break; } } else { if ($f != null && $f != '') { $defined_filter = true; break; } } } if ($defined_filter) { $this->filters = $filters; $this->filterClass($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'class_group')); $this->getUser()->setAttribute('max_per_page', $rpp, 'class_group'); $pager = new sfPropelPager('ClassGroup', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'class_group')); $this->getUser()->setAttribute('page', $page, 'class_group'); $pager->setPage($page); $pager->init(); $this->pager = $pager; ## 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, 1); $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->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE); $list_subs = ScoreRuleSubjectPeer::doSelect($cm); $subject_count = ScoreRuleSubjectPeer::doCount($cm); $this->list_subs = $list_subs; $this->subject_count = $subject_count; $actions = array(); array_unshift($actions, array('name' => 'Print PDF', 'url' => "rpt_all_academic/listRaportAsPDF?accal_id=" . $academic_calendar->getId(), 'color' => 'black', 'type' => 'direct')); array_unshift($actions, array('name' => 'Print Excel', 'url' => "rpt_all_academic/listRaportAsCSV?accal_id=" . $academic_calendar->getId(), 'color' => 'black', 'type' => 'direct')); $this->actions = $actions; $actions2 = array(array('name' => '<span>' . $academic_calendar->toString() . '</span>', 'url' => 'rpt_all_academic/list', 'color' => 'volcadot')); array_push($actions2, array('name' => '<span>Analisis Nilai UTS</span>', 'url' => 'rpt_all_academic/listUts?accal_id=' . $academic_calendar->getId(), 'color' => 'sun')); array_push($actions2, array('name' => '<span>Analisis Nilai UAS</span>', 'url' => 'rpt_all_academic/listUas?accal_id=' . $academic_calendar->getId(), 'color' => 'sun')); array_push($actions2, array('name' => '<span>Analisis Nilai Raport</span>', 'url' => 'rpt_all_academic/listRaport?accal_id=' . $academic_calendar->getId(), 'color' => 'sky', 'type' => 'direct')); $this->actions2 = $actions2; $this->subtitle = $academic_calendar->toString(); $this->academic_calendar = $academic_calendar; }
public function executeUpdateScoreAfective() { $subject_id = $this->getRequestParameter('subject_id'); $class_id = $this->getRequestParameter('class_id'); $accal_id = $this->getRequestParameter('accal_id'); $course_id = $this->getRequestParameter('course_id'); $grade_spec_id = $this->getRequestParameter('grade_spec_id'); $course_schedule = CourseSchedulePeer::retrieveByPK($course_id); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $scores = $this->getRequestParameter('score'); foreach ($scores as $k => $score) { if ($score != null) { if ($score != '-') { $ids = split('_', $k); $c = new Criteria(); $c->add(StudentGradeRaportPeer::STUDENT_ACCAL_ID, $ids[0]); $c->add(StudentGradeRaportPeer::GRADE_SPEC_ID, $ids[1]); $c->add(StudentGradeRaportPeer::COURSE_SCHEDULE_ID, $course_id); $g = StudentGradeRaportPeer::doSelectOne($c); if ($g == null) { $g = new StudentGradeRaport(); } $g->setGradeSpecId($ids[1]); $g->setGrade($score); $g->setCourseScheduleId($course_id); $g->setGradeValue($score); $g->setStudentAccalId($ids[0]); $g->setSubjectCurrId($course_schedule->getSubjectCurrId()); $g->save(); } else { $ids = split('_', $k); $c = new Criteria(); $c->add(StudentGradeRaportPeer::STUDENT_ACCAL_ID, $ids[0]); $c->add(StudentGradeRaportPeer::GRADE_SPEC_ID, $ids[1]); $c->add(StudentGradeRaportPeer::COURSE_SCHEDULE_ID, $course_id); $g = StudentGradeRaportPeer::doSelectOne($c); if ($g != null) { $g->delete(); } } } } return $this->redirect('course_afective/finishScore?course_id=' . $course_id . '&grade_spec_id=' . $grade_spec_id); }
public function executeSelectByAccal() { $student_course_id = $this->getRequestParameter('student_course_id'); $student_course = StudentCoursePeer::retrieveByPK($student_course_id); if (!$student_course) { $student_course = new StudentCourse(); } $student_id = $this->getRequestParameter('student_id'); $student = StudentPeer::retrieveByPK($student_id); // $this->forward404Unless($student); $accal_id = $this->getRequestParameter('accal_id'); $accal = AcademicCalendarPeer::retrieveByPK($accal_id); $disabled = array(); if ($student) { $student_courses = $student->getStudentCoursesJoinSubjectAccal(); foreach ($student_courses as $sc) { if ($sc->getSubjectAccal()->getAcademicCalendarId() == $accal->getId() && $student_course->getSubjectAccalId() != $sc->getSubjectAccal()->getId()) { $disabled[] = $sc->getSubjectAccal()->getId(); } } } $content = array(); $objs = SubjectAccalPeer::doSelectByAccal(); if ($student) { foreach ($objs as $o) { $content[$o->getId()] = $o->toString(); $c = new Criteria(); $c->add(SubjectAccalPeer::ID, $o->getId()); $c->add(SubjectCurrPeer::SUBJECT_ID, $o->getSubjectId()); $c->addJoin(AcademicCalendarPeer::ID, SubjectAccalPeer::ACADEMIC_CALENDAR_ID); $c->addJoin(AcademicCalendarPeer::CURRICULUM_ID, SubjectCurrPeer::CURRICULUM_ID); $c->addJoin(SubjectCurrPeer::ID, SubjectPrereqPeer::SUBCURR); $sps = SubjectPrereqPeer::doSelect($c); foreach ($sps as $sp) { $s = $sp->getSubjectCurrRelatedBySubcurrPrereq()->getSubject(); // prereq subject must be in closed state $c = new Criteria(); $c->add(SubjectAccalPeer::SUBJECT_ID, $s->getId()); $c->add(StudentCoursePeer::STUDENT_ID, $student_id); $c->add(StudentCoursePeer::STATUS, StudentCourse::STATUS_CLOSED); $c->addJoin(StudentCoursePeer::SUBJECT_ACCAL_ID, SubjectAccalPeer::ID); $scs = StudentCoursePeer::doSelect($c); $isPassGrade = false; $isPassCredit = true; $isPassIndex = true; foreach ($scs as $sc) { $grade = $sc->getFinalGrade(); $gc = GradeConversionPeer::retrieveByName($grade[0]); // check prereq subject grade if ($gc && $gc->getGrade() >= $sp->getGradeConversion()->getGrade()) { $isPassGrade = true; } else { $isPassGrade = false; } // check credit requirement if ($sp->getTotalCredit() > 0) { if ($sc->getTotalCreditClosed() >= $sp->getTotalCredit()) { $isPassCredit = true; } else { $isPassCredit = false; } } // check index requirement if ($sp->getPerformanceIndex() > 0) { if ($sc->getPerformanceIndex() >= $sp->getPerformanceIndex()) { $isPassIndex = true; } else { $isPassIndex = false; } } } $s0 = $sp->getSubjectCurrRelatedBySubcurrPrereq()->getSubject()->toString(); $s1 = $sp->getSubjectCurrRelatedBySubcurr()->getSubject()->toString(); // echo "<div align=left><pre>"; // echo "$s1 -> $s0 | isPassGrade:$isPassGrade isPassCredit:$isPassCredit isPassIndex:$isPassIndex"; // echo "</pre></div>"; if (!$isPassGrade || !$isPassCredit || !$isPassIndex) { $disabled[] = $o->getId(); } } } } else { foreach ($objs as $o) { $content[$o->getId()] = $o->toString(); } } $this->content = $content; $this->disabled = $disabled; }
public function executeUpdateScore() { $subject_id = $this->getRequestParameter('subject_id'); $class_id = $this->getRequestParameter('class_id'); $accal_id = $this->getRequestParameter('accal_id'); $course_id = $this->getRequestParameter('course_id'); $grade_spec_id = $this->getRequestParameter('grade_spec_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $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, $class_id); $cd->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $accal_id); $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, $subject_id); $c->add(StudentRaportPeer::CLASS_GROUP_ID, $class_id); $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal_id); $g = StudentRaportPeer::doSelectOne($c); if ($g == null) { $g = new StudentRaport(); } $g->setStudentId($ids[0]); $g->setGradeSpecId($ids[1]); $g->setGrade($score); $g->setSubjectCurrId($subject_id); $g->setClassGroupId($class_id); $g->setAcademicCalendarId($accal_id); $g->setCitationId($stu_accal->getId()); $g->save(); ## UTS Teori dan Praktek if ($ids[1] == 22 || $ids[1] == 23) { $cg = new Criteria(); $cg->add(StudentRaportPeer::STUDENT_ID, $ids[0]); $cg->add(StudentRaportPeer::GRADE_SPEC_ID, 22); $cg->add(StudentRaportPeer::SUBJECT_CURR_ID, $subject_id); $cg->add(StudentRaportPeer::CLASS_GROUP_ID, $class_id); $cg->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal_id); $praktek_uts = StudentRaportPeer::doSelectOne($cg); $cf = new Criteria(); $cf->add(StudentRaportPeer::STUDENT_ID, $ids[0]); $cf->add(StudentRaportPeer::GRADE_SPEC_ID, 23); $cf->add(StudentRaportPeer::SUBJECT_CURR_ID, $subject_id); $cf->add(StudentRaportPeer::CLASS_GROUP_ID, $class_id); $cf->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal_id); $teori_uts = StudentRaportPeer::doSelectOne($cf); if ($praktek_uts != null && $teori_uts != null) { $score_uts = round(($praktek_uts->getGrade() + $teori_uts->getGrade()) / 2); } elseif ($praktek_uts != null && $teori_uts == null) { $score_uts = $praktek_uts->getGrade(); } elseif ($praktek_uts == null && $teori_uts != null) { $score_uts = $teori_uts->getGrade(); } $f = new Criteria(); $f->add(StudentRaportPeer::STUDENT_ID, $ids[0]); $f->add(StudentRaportPeer::GRADE_SPEC_ID, 14); $f->add(StudentRaportPeer::SUBJECT_CURR_ID, $subject_id); $f->add(StudentRaportPeer::CLASS_GROUP_ID, $class_id); $f->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal_id); $uts = StudentRaportPeer::doSelectOne($f); if ($uts == null) { $uts = new StudentRaport(); } $uts->setStudentId($ids[0]); $uts->setGradeSpecId(14); $uts->setGrade($score_uts); $uts->setSubjectCurrId($subject_id); $uts->setClassGroupId($class_id); $uts->setAcademicCalendarId($accal_id); $uts->setCitationId($stu_accal->getId()); $uts->save(); ## UAS Teori dan Praktek } elseif ($ids[1] == 27 || $ids[1] == 28) { $ct = new Criteria(); $ct->add(StudentRaportPeer::STUDENT_ID, $ids[0]); $ct->add(StudentRaportPeer::GRADE_SPEC_ID, 27); $ct->add(StudentRaportPeer::SUBJECT_CURR_ID, $subject_id); $ct->add(StudentRaportPeer::CLASS_GROUP_ID, $class_id); $ct->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal_id); $praktek_uas = StudentRaportPeer::doSelectOne($ct); $ch = new Criteria(); $ch->add(StudentRaportPeer::STUDENT_ID, $ids[0]); $ch->add(StudentRaportPeer::GRADE_SPEC_ID, 28); $ch->add(StudentRaportPeer::SUBJECT_CURR_ID, $subject_id); $ch->add(StudentRaportPeer::CLASS_GROUP_ID, $class_id); $ch->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal_id); $teori_uas = StudentRaportPeer::doSelectOne($ch); if ($praktek_uas != null && $teori_uas != null) { $score_uas = round(($praktek_uas->getGrade() + $teori_uas->getGrade()) / 2); } elseif ($praktek_uas != null && $teori_uas == null) { $score_uas = $praktek_uas->getGrade(); } elseif ($praktek_uas == null && $teori_uas != null) { $score_uas = $teori_uas->getGrade(); } $f = new Criteria(); $f->add(StudentRaportPeer::STUDENT_ID, $ids[0]); $f->add(StudentRaportPeer::GRADE_SPEC_ID, 15); $f->add(StudentRaportPeer::SUBJECT_CURR_ID, $subject_id); $f->add(StudentRaportPeer::CLASS_GROUP_ID, $class_id); $f->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal_id); $uas = StudentRaportPeer::doSelectOne($f); if ($uas == null) { $uas = new StudentRaport(); } $uas->setStudentId($ids[0]); $uas->setGradeSpecId(15); $uas->setGrade($score_uas); $uas->setSubjectCurrId($subject_id); $uas->setClassGroupId($class_id); $uas->setAcademicCalendarId($accal_id); $uas->setCitationId($stu_accal->getId()); $uas->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, $subject_id); $cg->add(StudentRaportPeer::CLASS_GROUP_ID, $class_id); $cg->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal_id); $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, $subject_id); $f->add(StudentRaportPeer::CLASS_GROUP_ID, $class_id); $f->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal_id); $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($subject_id); $uh->setClassGroupId($class_id); $uh->setAcademicCalendarId($accal_id); $uh->setCitationId($stu_accal->getId()); $uh->save(); } else { if ($uh->getGrade() == null || $uh->getGrade() == 0) { $uh->setStudentId($ids[0]); $uh->setGradeSpecId($grade_spec->getParent()); $uh->setGrade($nu->getGrade()); $uh->setSubjectCurrId($subject_id); $uh->setClassGroupId($class_id); $uh->setAcademicCalendarId($accal_id); $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, $subject_id); $cg->add(StudentRaportPeer::CLASS_GROUP_ID, $class_id); $cg->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal_id); $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, $subject_id); $f->add(StudentRaportPeer::CLASS_GROUP_ID, $class_id); $f->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal_id); $uh = StudentRaportPeer::doSelectOne($f); $cw = new Criteria(); $cw->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $accal_id); $cw->add(CourseRegulationPeer::CLASS_GROUP_ID, $class_id); $cw->add(CourseRegulationPeer::SUBJECT_CURR_ID, $subject_id); $c_regulation = CourseRegulationPeer::doSelectOne($cw); if ($c_regulation) { if ($nr->getGrade() >= $c_regulation->getKkm()) { if ($uh == null) { $uh = new StudentRaport(); } $uh->setStudentId($ids[0]); $uh->setGradeSpecId($grade_spec->getParent()); $uh->setGrade($c_regulation->getKkm()); $uh->setSubjectCurrId($subject_id); $uh->setClassGroupId($class_id); $uh->setAcademicCalendarId($accal_id); $uh->setCitationId($stu_accal->getId()); $uh->save(); } elseif ($nr->getGrade() < $c_regulation->getKkm()) { if ($uh == null) { $uh = new StudentRaport(); $uh->setStudentId($ids[0]); $uh->setGradeSpecId($grade_spec->getParent()); $uh->setGrade($nr->getGrade()); $uh->setSubjectCurrId($subject_id); $uh->setClassGroupId($class_id); $uh->setAcademicCalendarId($accal_id); $uh->setCitationId($stu_accal->getId()); $uh->save(); } else { if ($nr->getGrade() > $uh->getGrade()) { $uh->setStudentId($ids[0]); $uh->setGradeSpecId($grade_spec->getParent()); $uh->setGrade($nr->getGrade()); $uh->setSubjectCurrId($subject_id); $uh->setClassGroupId($class_id); $uh->setAcademicCalendarId($accal_id); $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, $subject_id); $cg->add(StudentRaportPeer::CLASS_GROUP_ID, $class_id); $cg->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal_id); $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, $subject_id); $f->add(StudentRaportPeer::CLASS_GROUP_ID, $class_id); $f->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal_id); $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($subject_id); $uh->setClassGroupId($class_id); $uh->setAcademicCalendarId($accal_id); $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, $subject_id); $c->add(StudentRaportPeer::CLASS_GROUP_ID, $class_id); $c->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $accal_id); $g = StudentRaportPeer::doSelectOne($c); if ($g != null) { $g->delete(); } } } } return $this->redirect('course_score_new/finishScore?course_id=' . $course_id . '&grade_spec_id=' . $grade_spec_id); }
public function executeGetSubject() { $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $employee = EmployeePeer::retrieveByPK($employee_id); $this->forward404Unless($employee); $academic_calendar_id = $this->getRequestParameter('academic_calendar_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id); $this->forward404Unless($academic_calendar); if ($employee->getCustody() != null) { $c = new Criteria(); $c->add(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $c->add(CourseSchedulePeer::CLASS_GROUP_ID, $employee->getCustody()->getClassGroupId(), Criteria::IN); $c->addJoin(ClassCounselingPeer::COURSE_SCHEDULE_ID, CourseSchedulePeer::ID); $c->addAscendingOrderByColumn(ClassCounselingPeer::ID); } elseif ($employee->getStaffTypeId() == 13 || $employee->getStaffTypeId() == 14) { $c = new Criteria(); $c->add(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $c->addJoin(ClassCounselingPeer::COURSE_SCHEDULE_ID, CourseSchedulePeer::ID); $c->addAscendingOrderByColumn(ClassCounselingPeer::ID); } else { $c = new Criteria(); $c->add(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $c->addJoin(ClassCounselPeer::COURSE_SCHEDULE_ID, CourseSchedulePeer::ID); $c->addAscendingOrderByColumn(ClassCounselPeer::ID); } $this->sort($c); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if (is_array($f)) { if (strlen($f['from']) > 0 || strlen($f['to']) > 0) { $defined_filter = true; break; } } else { if ($f != null && $f != '') { $defined_filter = true; break; } } } if ($defined_filter) { $this->filters = $filters; $this->filter($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'class_counseling')); $this->getUser()->setAttribute('max_per_page', $rpp, 'class_counseling'); $pager = new sfPropelPager('ClassCounseling', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'class_counseling')); $this->getUser()->setAttribute('page', $page, 'class_counseling'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions = array(); $this->actions = $actions; $this->subtitle = $employee->toString(); $this->academic_calendar = $academic_calendar; $this->employee = $employee; }
public function executeGetSubject() { $student_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $student = StudentPeer::retrieveByPK($student_id); $this->forward404Unless($student); $academic_calendar_id = $this->getRequestParameter('academic_calendar_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id); $this->forward404Unless($academic_calendar); $cm = new Criteria(); $cm->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cm->add(StudentAccalPeer::STUDENT_ID, $student->getId()); $stu_accal = StudentAccalPeer::doSelectOne($cm); $c = new Criteria(); $c->add(CourseSchedulePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $c->add(CourseSchedulePeer::CLASS_GROUP_ID, $stu_accal->getClassGroupId()); $c->addAscendingOrderByColumn(CourseSchedulePeer::CLASS_GROUP_ID); $this->sort($c); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if (is_array($f)) { if (strlen($f['from']) > 0 || strlen($f['to']) > 0) { $defined_filter = true; break; } } else { if ($f != null && $f != '') { $defined_filter = true; break; } } } if ($defined_filter) { $this->filters = $filters; $this->filter($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'course')); $this->getUser()->setAttribute('max_per_page', $rpp, 'course'); $pager = new sfPropelPager('CourseSchedule', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'course')); $this->getUser()->setAttribute('page', $page, 'course'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions = array(array('name' => 'filter', 'color' => 'white')); $this->actions = $actions; $this->academic_calendar = $academic_calendar; $this->subtitle = $student->toString(); $this->student_id = $student_id; $this->student = $student; }
public function executeGetListForCourse() { $accal_id = $this->getRequestParameter('academic_calendar_id'); $accal = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($accal); $this->accal = $accal; $curr = CurriculumPeer::retrieveByPK($accal->getCurriculumId()); $this->curr = $curr; $subject_curriculums = $curr->getSubjectCurrs(); $subject_ids = array(); foreach ($subject_curriculums as $subject_curriculum) { $subject_ids[] = $subject_curriculum->getSubjectId(); } $c = new Criteria(); $c->add(SubjectPeer::DEPARTMENT_ID, $curr->getDepartmentId(), Criteria::IN); $c->add(SubjectPeer::ID, $subject_ids, Criteria::IN); $c->addJoin(SubjectCurrPeer::SUBJECT_ID, SubjectPeer::ID); $c->addAscendingOrderByColumn(SubjectCurrPeer::SUBJECT_ID); $this->sort($c); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if (is_array($f)) { if (strlen($f['from']) > 0 || strlen($f['to']) > 0) { $defined_filter = true; break; } } else { if ($f != null && $f != '') { $defined_filter = true; break; } } } if ($defined_filter) { $this->filters = $filters; $this->filter($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'subject_curriculum')); $this->getUser()->setAttribute('max_per_page', $rpp, 'subject_curriculum'); $pager = new sfPropelPager('SubjectCurr', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'subject_curriculum')); $this->getUser()->setAttribute('page', $page, 'subject_curriculum'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions2 = array(array('name' => 'filter', 'color' => 'white')); $this->actions2 = $actions2; }
public function executeUpdate() { $counsel_id = $this->getRequestParameter('counsel_id'); $counseling = CounselingPeer::retrieveByPK($counsel_id); $this->forward404Unless($counseling); $this->counseling = $counseling; $accal_id = $this->getRequestParameter('accal_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($academic_calendar); $this->academic_calendar = $academic_calendar; $cur13_id = $this->getRequestParameter('cur13_id'); $cur13_ki = Cur13KiPeer::retrieveByPK($cur13_id); $this->forward404Unless($cur13_ki); $this->cur13_ki = $cur13_ki; $nilai = $this->getRequestParameter('nilai'); foreach ($nilai as $studentAccalId => $n) { $studentAccal = StudentAccalPeer::retrieveByPK($studentAccalId); if (!$studentAccal) { continue; } $c = new Criteria(); $c->add(Cur13ReportPeer::STUDENT_ACCAL_ID, $studentAccal->getId(), Criteria::EQUAL); $c->add(Cur13ReportPeer::CUR13_KI_ID, $cur13_ki->getId(), Criteria::EQUAL); $nilaiSiswa = Cur13ReportPeer::doSelectOne($c); if (!$nilaiSiswa) { $nilaiSiswa = new Cur13Report(); $nilaiSiswa->setStudentAccalId($studentAccal->getId()); $nilaiSiswa->setCur13KiId($cur13_ki->getId()); } if (empty($n['modus'])) { $nilaiSiswa->setGrade(''); $nilaiSiswa->setRemark(''); $nilaiSiswa->setGradeScale(''); $nilaiSiswa->setTotalValue(''); $nilaiSiswa->setAvgValue(''); $nilaiSiswa->setDescription(''); } else { $nilaiSiswa->setRemark($n['capaian']); $nilaiSiswa->setGradeScale($n['modus']); $nilaiSiswa->setDescription($n['description']); } $nilaiSiswa->save(); } if ($cur13_id == ScoreRule::ONE) { return $this->redirect('course_sd/listRecaptKi1?accal_id=' . $academic_calendar->getId() . '&counsel_id=' . $counseling->getId()); } else { return $this->redirect('course_sd/listRecaptKi2?accal_id=' . $academic_calendar->getId() . '&counsel_id=' . $counseling->getId()); } }
public function getAcademicCalendarRelatedByParent($con = null) { include_once 'lib/model/om/BaseAcademicCalendarPeer.php'; if ($this->aAcademicCalendarRelatedByParent === null && $this->parent !== null) { $this->aAcademicCalendarRelatedByParent = AcademicCalendarPeer::retrieveByPK($this->parent, $con); } return $this->aAcademicCalendarRelatedByParent; }
public function executeGetList() { $accal_id = $this->getRequestParameter('accal_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($academic_calendar); $this->academic_calendar = $academic_calendar; $c = new Criteria(); $c->add(SchedulePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cton1 = $c->getNewCriterion(SchedulePeer::TYPE, Schedule::IS_EKSKUL, Criteria::IN); $c->add($cton1); $this->sort($c); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if (is_array($f)) { if (strlen($f['from']) > 0 || strlen($f['to']) > 0) { $defined_filter = true; break; } } else { if ($f != null && $f != '') { $defined_filter = true; break; } } } if ($defined_filter) { $this->filters = $filters; $this->filter($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'schedule')); $this->getUser()->setAttribute('max_per_page', $rpp, 'schedule'); $pager = new sfPropelPager('Schedule', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'schedule')); $this->getUser()->setAttribute('page', $page, 'schedule'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions2 = array(array('name' => 'filter', 'color' => 'white')); $this->actions2 = $actions2; }
public function executeUpdatePackaged() { $student_id = $this->getRequestParameter('student_id'); $student = StudentPeer::retrieveByPK($student_id); $this->forward404Unless($student); $this->student = $student; $academic_calendar_id = $this->getRequestParameter('academic_calendar_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id); $this->forward404Unless($academic_calendar); $class_group_id = $this->getRequestParameter('class_group_id'); $class_group = ClassGroupPeer::retrieveByPK($class_group_id); $this->forward404Unless($class_group); $status = $this->getRequestParameter('status'); $this->forward404Unless($status); $subject_accals = $academic_calendar->getSubjectAccals(); $sas = array(); foreach ($subject_accals as $sa) { if ($sa->getSubject()) { $sas[] = $sa->getId(); } } $saved_sas = array(); $saved_student_courses = $student->getStudentCourses(); foreach ($saved_student_courses as $ssc) { $saved_sas[] = $ssc->getSubjectAccalId(); } $disabled_sa = array_intersect($sas, $saved_sas); // calculate sc rules $objs = SubjectAccalPeer::doSelectByAccal(); foreach ($objs as $o) { $content[$o->getId()] = $o->toStringWithLector(); $c = new Criteria(); $c->add(SubjectAccalPeer::ID, $o->getId()); $c->add(SubjectCurrPeer::SUBJECT_ID, $o->getSubjectId()); $c->addJoin(AcademicCalendarPeer::ID, SubjectAccalPeer::ACADEMIC_CALENDAR_ID); $c->addJoin(AcademicCalendarPeer::CURRICULUM_ID, SubjectCurrPeer::CURRICULUM_ID); $c->addJoin(SubjectCurrPeer::ID, SubjectPrereqPeer::SUBCURR); $sps = SubjectPrereqPeer::doSelect($c); foreach ($sps as $sp) { $s = $sp->getSubjectCurrRelatedBySubcurrPrereq()->getSubject(); // prereq subject must be in closed state $c = new Criteria(); $c->add(SubjectAccalPeer::SUBJECT_ID, $s->getId()); $c->add(StudentCoursePeer::STUDENT_ID, $student_id); $c->add(StudentCoursePeer::STATUS, StudentCourse::STATUS_CLOSED); $c->addJoin(StudentCoursePeer::SUBJECT_ACCAL_ID, SubjectAccalPeer::ID); $scs = StudentCoursePeer::doSelect($c); $isPassGrade = false; $isPassCredit = true; $isPassIndex = true; foreach ($scs as $sc) { $grade = $sc->getFinalGrade(); $gc = GradeConversionPeer::retrieveByName($grade[0]); // check prereq subject grade if ($gc && $gc->getGrade() >= $sp->getGradeConversion()->getGrade()) { $isPassGrade = true; } else { $isPassGrade = false; } // check credit requirement if ($sp->getTotalCredit() > 0) { if ($sc->getTotalCreditClosed() >= $sp->getTotalCredit()) { $isPassCredit = true; } else { $isPassCredit = false; } } // check index requirement if ($sp->getPerformanceIndex() > 0) { if ($sc->getPerformanceIndex() >= $sp->getPerformanceIndex()) { $isPassIndex = true; } else { $isPassIndex = false; } } } $s0 = $sp->getSubjectCurrRelatedBySubcurrPrereq()->getSubject()->toString(); $s1 = $sp->getSubjectCurrRelatedBySubcurr()->getSubject()->toString(); if (!$isPassGrade || !$isPassCredit || !$isPassIndex) { $disabled_sa[] = $o->getId(); } } } $selected_sa = array_diff($sas, $disabled_sa); foreach ($selected_sa as $sa_id) { $student_course = new StudentCourse(); $student_course->setStudentId($student_id); $student_course->setSubjectAccalId($sa_id); $student_course->setStatus($status); $student_course->setClassGroupId($class_group_id); $student_course->save(); } return $this->redirect('student_course_s/list?student_id=' . $student->getId()); }
public function executeSave() { $counseling_id = $this->getRequestParameter('counseling_id'); $counseling = CounselingPeer::retrieveByPK($counseling_id); $this->forward404Unless($counseling); $term = $this->getRequestParameter('term'); $accal_id = $this->getRequestParameter('academic_calendar_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($academic_calendar); $employee_id = $this->getRequestParameter('employee_id'); $employee = EmployeePeer::retrieveByPK($employee_id); $this->forward404Unless($employee); $descs = $this->getRequestParameter('desc'); foreach ($descs as $m => $desc) { if ($desc != null) { if ($desc != '-') { $ced = new Criteria(); $ced->add(StudentDescPeer::STUDENT_ACCAL_ID, $m); $ced->add(StudentDescPeer::TERM, $term); $spec = StudentDescPeer::doSelectOne($ced); if ($spec == null) { $spec = new StudentDesc(); } $spec->setStudentAccalId($m); $spec->setTerm($term); $spec->setNote($desc); $spec->save(); } else { $ced = new Criteria(); $ced->add(StudentDescPeer::STUDENT_ACCAL_ID, $m); $ced->add(StudentDescPeer::TERM, $term); $spec = StudentDescPeer::doSelectOne($ced); if ($spec != null) { $spec->delete(); } } } } return $this->redirect('course_tk/listScore?accal_id=' . $academic_calendar->getId() . '&term=' . $term . '&counseling_id=' . $counseling->getId() . '&employee_id=' . $employee_id); }
/** * setAcademicCalendar function * function to set the academic calendar * @param int $academicCalendarId */ public function setAcademicCalendar($academicCalendarId) { $this->academicCalendar = AcademicCalendarPeer::retrieveByPK($academicCalendarId); }
public function executeListLeave() { $employee_id = $this->getRequestParameter('employee_id'); $employee = EmployeePeer::retrieveByPK($employee_id); $this->forward404Unless($employee); $accal_id = $this->getRequestParameter('academic_calendar_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($academic_calendar); $c = new Criteria(); $c->add(EmployeePermitPeer::EMPLOYEE_ID, $employee->getId(), Criteria::IN); $c->add(EmployeePermitPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $this->sortPermit($c); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if (is_array($f)) { if (strlen($f['from']) > 0 || strlen($f['to']) > 0) { $defined_filter = true; break; } } else { if ($f != null && $f != '') { $defined_filter = true; break; } } } if ($defined_filter) { $this->filters = $filters; $this->filterPermit($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'employee_permit')); $this->getUser()->setAttribute('max_per_page', $rpp, 'employee_permit'); $pager = new sfPropelPager('EmployeePermit', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'employee_permit')); $this->getUser()->setAttribute('page', $page, 'employee_permit'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions = array(); $filter_string = ""; if ($this->filters) { foreach ($this->filters as $key => $val) { $filter_string .= "&filters[{$key}]={$val}"; } $filter_string = preg_replace('/^&/', '', $filter_string); } array_unshift($actions, array('name' => 'Print Excel', 'url' => "employee_permit_recapt/listLeaveAsCSV?{$filter_string}&employee_id=" . $employee->getId() . "&academic_calendar_id=" . $academic_calendar->getId(), 'color' => 'black', 'type' => 'direct')); array_unshift($actions, array('name' => 'Print PDF', 'url' => "employee_permit_recapt/listLeaveAsPDF?{$filter_string}&employee_id=" . $employee->getId() . "&academic_calendar_id=" . $academic_calendar->getId(), 'color' => 'black', 'type' => 'direct')); $this->actions = $actions; $this->subtitle = $employee->toString(); $this->employee = $employee; $this->academic_calendar = $academic_calendar; $actions2 = array(array('name' => '<span>Rekap Cuti</span>', 'url' => 'employee_permit_recapt/list', 'color' => 'sky')); array_push($actions2, array('name' => '<span>Detail Cuti</span>', 'url' => 'employee_permit_recapt/listLeave?employee_id=' . $employee->getId() . '&academic_calendar_id=' . $academic_calendar->getId(), 'color' => 'sun', 'type' => 'direct')); $this->actions2 = $actions2; }
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); $co = new Criteria(); $co->add(SubjectPeer::SUBJECT_GROUP_ID, 7); $co->addJoin(SubjectCurrPeer::SUBJECT_ID, SubjectPeer::ID); $co->addJoin(VCoursePeer::SUBJECT_CURR_ID, SubjectCurrPeer::ID); $co->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $co->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cton1 = $co->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 319, Criteria::NOT_IN); $cton2 = $co->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 333, Criteria::NOT_IN); $cton3 = $co->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 342, Criteria::NOT_IN); $cton2->addAnd($cton3); $cton1->addAnd($cton2); $co->add($cton1); $co->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects = VCoursePeer::doSelect($co); $subject_count = VCoursePeer::doCount($co); $this->subject_count = $subject_count; $cow = new Criteria(); $cow->add(SubjectPeer::SUBJECT_GROUP_ID, 8); $cow->addJoin(SubjectCurrPeer::SUBJECT_ID, SubjectPeer::ID); $cow->addJoin(VCoursePeer::SUBJECT_CURR_ID, SubjectCurrPeer::ID); $cow->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $cow->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $cow->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects87 = VCoursePeer::doSelect($cow); $subject_count87 = VCoursePeer::doCount($cow); $this->subject_count87 = $subject_count87; $cw = new Criteria(); $cw->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN); $cw->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cton1 = $cw->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 350, Criteria::IN); $cton2 = $cw->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 351, Criteria::IN); $cton3 = $cw->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 346, Criteria::IN); $cton4 = $cw->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 339, Criteria::IN); $cton5 = $cw->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 340, Criteria::IN); $cton6 = $cw->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 337, Criteria::IN); $cton5->addOr($cton6); $cton4->addOr($cton5); $cton3->addOr($cton4); $cton2->addOr($cton3); $cton1->addOr($cton2); $cw->add($cton1); $cw->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects1 = VCoursePeer::doSelect($cw); $subject_count1 = VCoursePeer::doCount($cw); $this->subject_count1 = $subject_count1; $cm = new Criteria(); $cm->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN); $cm->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cton1 = $cm->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 353, Criteria::IN); $cton2 = $cm->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 354, Criteria::IN); $cton1->addOr($cton2); $cm->add($cton1); $cm->addAscendingOrderByColumn(VCoursePeer::CODE); $this->ipas = VCoursePeer::doSelect($cm); $ipa_count = VCoursePeer::doCount($cm); $this->ipa_count = $ipa_count; $cl = new Criteria(); $cl->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN); $cl->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cton1 = $cl->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 343, Criteria::IN); $cton2 = $cl->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 338, Criteria::IN); $cton3 = $cl->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 347, Criteria::IN); $cton2->addOr($cton3); $cton1->addOr($cton2); $cl->add($cton1); $cl->addAscendingOrderByColumn(VCoursePeer::CODE); $this->ips = VCoursePeer::doSelect($cl); $ips_count = VCoursePeer::doCount($cl); $this->ips_count = $ips_count; $cd = new Criteria(); $cd->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN); $cd->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cton1 = $cd->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 352, Criteria::IN); $cton2 = $cd->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 349, Criteria::IN); $cton3 = $cd->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 348, Criteria::IN); $cton4 = $cd->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 341, Criteria::IN); $cton5 = $cd->getNewCriterion(VCoursePeer::SUBJECT_CURR_ID, 355, Criteria::IN); $cton4->addOr($cton5); $cton3->addOr($cton4); $cton2->addOr($cton3); $cton1->addOr($cton2); $cd->add($cton1); $cd->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects2 = VCoursePeer::doSelect($cd); $subject_count2 = VCoursePeer::doCount($cd); $this->subject_count2 = $subject_count2; $cb = new Criteria(); $cb->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId(), Criteria::IN); $cb->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId(), Criteria::IN); $cb->add(VCoursePeer::SUBJECT_GROUP_ID, 7, Criteria::IN); $cb->add(VCoursePeer::SUBJECT_CURR_ID, 319, Criteria::NOT_IN); $cb->add(VCoursePeer::SUBJECT_CURR_ID, 333, Criteria::NOT_IN); $cb->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects7 = VCoursePeer::doSelect($cb); $subject_count7 = VCoursePeer::doCount($cb); $this->subject_count7 = $subject_count7; $crit = new Criteria(); $crit->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $crit->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId()); $crit->add(VCoursePeer::SUBJECT_GROUP_ID, 8); $crit->addAscendingOrderByColumn(VCoursePeer::CODE); $this->subjects8 = VCoursePeer::doSelect($crit); $subject_count8 = VCoursePeer::doCount($crit); $this->subject_count8 = $subject_count8; $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); $rpp = $this->getRequestParameter('max_per_page', 999); $pager = new sfPropelPager('VCourse', $rpp); $pager->setCriteria($co); $pager->setPage($this->getRequestParameter('page', 1)); $pager->init(); $this->pager = $pager; $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 executePrintAll() { header('Cache-Control: no-cache, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Content-type: application/json', true); /* TODO: Optimize code without file_get_contents. Use save from sfDomPdf */ /* Set Report Base Dir */ $this->reportBaseDir = WWW_ROOT . '/report'; /* Get Param */ $time = $this->getRequestParameter('time'); $time2 = $this->getRequestParameter('time2'); $tgl = $this->getRequestParameter('tgl'); $counseling_id = $this->getRequestParameter('counseling_id'); $accal_id = $this->getRequestParameter('accal_id'); $student_id = $this->getRequestParameter('student_id'); $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id); /* Preparing Directory */ /* WWW_ROOT/report/{accal_id}/{counseling_id}/{student_id} */ $studentDir = $this->prepareReportDir($accal_id, $counseling_id, $student_id); /* Set Param */ $param = "time={$time}&time2={$time2}&tgl={$tgl}&counseling_id={$counseling_id}&accal_id={$accal_id}&student_id={$student_id}"; /* Set Prefix Filename */ /* {accal_id}_{counseling_id}_{student_id}_{cover/register/final} */ $prefixFilename = $accal_id . '_' . $counseling_id . '_' . $student_id . '_'; /* Preparing zip file */ $files_to_zip = array(); /* Save Cover */ $coverUrl = 'http://' . BASE_HREF . '/bo/' . SF_ENVFILE . '.php/counseling_sd/printCover/?' . $param; $cover = file_get_contents($coverUrl); $coverFilename = $prefixFilename . 'cover.pdf'; $coverPath = $studentDir . '/' . $coverFilename; file_put_contents($coverPath, $cover); $files_to_zip[] = array('path' => $coverPath, 'filename' => $coverFilename); /* Save Register */ $registerUrl = 'http://' . BASE_HREF . '/bo/' . SF_ENVFILE . '.php/counseling_sd/printRegister/?' . $param; $register = file_get_contents($registerUrl); $registerFilename = $prefixFilename . 'register.pdf'; $registerPath = $studentDir . '/' . $registerFilename; file_put_contents($registerPath, $register); $files_to_zip[] = array('path' => $registerPath, 'filename' => $registerFilename); /* Save Final */ if ($academic_calendar->getDepartment()->getCourseModel() == Department::CM_TK) { $finalUrl = 'http://' . BASE_HREF . '/bo/' . SF_ENVFILE . '.php/counseling_sd/printReport/?' . $param; } else { $finalUrl = 'http://' . BASE_HREF . '/bo/' . SF_ENVFILE . '.php/counseling_sd/printFinal/?' . $param; } $final = file_get_contents($finalUrl); $finalFilename = $prefixFilename . 'final.pdf'; $finalPath = $studentDir . '/' . $finalFilename; file_put_contents($finalPath, $final); $files_to_zip[] = array('path' => $finalPath, 'filename' => $finalFilename); $result = $this->create_zip($files_to_zip, $studentDir . '/' . $prefixFilename . 'report.zip', true); $zipFile = 'http://' . BASE_HREF . '/bo/report/' . $accal_id . '/' . $counseling_id . '/' . $student_id . '/' . $prefixFilename . 'report.zip'; $coverFile = 'http://' . BASE_HREF . '/bo/report/' . $accal_id . '/' . $counseling_id . '/' . $student_id . '/' . $prefixFilename . 'cover.pdf'; $registerFile = 'http://' . BASE_HREF . '/bo/report/' . $accal_id . '/' . $counseling_id . '/' . $student_id . '/' . $prefixFilename . 'register.pdf'; $finalFile = 'http://' . BASE_HREF . '/bo/report/' . $accal_id . '/' . $counseling_id . '/' . $student_id . '/' . $prefixFilename . 'final.pdf'; $output = array('zip' => $zipFile, 'cover' => $coverFile, 'register' => $registerFile, 'final' => $finalFile, 'finalUrl' => $finalUrl); $this->jsonwrapper->print_json($output); die; }
public static function doSelectAllByDepartmentFromAccal() { $accal_id = sfContext::getInstance()->getRequest()->getParameter('accal_id'); $accal = AcademicCalendarPeer::retrieveByPK($accal_id); if ($accal == null) { return array(); } $depts = $accal->getDepartment()->getIdRecurs(); $depts = explode(',', $depts); $c = new Criteria(); $c->add(SubjectPeer::DEPARTMENT_ID, $depts, Criteria::IN); $c->addJoin(SubjectAccalPeer::SUBJECT_ID, SubjectPeer::ID); $c->addJoin(SubjectAccalPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); $c->addAscendingOrderByColumn(SubjectPeer::NAME); return SubjectPeer::doSelect($c); }
public function executePrintCounseling() { $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'); $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); $ce = new Criteria(); $ce->add(DepartmentDetailPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId()); $this->department_detail = DepartmentDetailPeer::doSelectOne($ce); $c = new Criteria(); $c->add(CounselingSpecPeer::PARENT, 0); $c->addAscendingOrderByColumn(CounselingSpecPeer::ID); $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'counseling_spec')); $this->getUser()->setAttribute('max_per_page', $rpp, 'counseling_spec'); $pager = new sfPropelPager('CounselingSpec', $rpp); $pager->setPeerMethod('doSelectOrdered'); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'counseling_spec')); $this->getUser()->setAttribute('page', $page, 'counseling_spec'); $pager->setPage($page); $pager->init(); $this->pager = $pager; ## 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; $this->students = $students; $this->subtitle = ''; $this->counseling = $counseling; $this->tanggal = $time; $this->tgl_cetak = $tgl; $this->time2 = $time2; $this->academic_calendar = $academic_calendar; $this->papersize = 'a4'; $this->orientation = 'portrait'; $this->setViewClass('sfDomPDF'); }
public function executeSave() { $accal_id = $this->getRequestParameter('accal_id'); $accal = AcademicCalendarPeer::retrieveByPK($accal_id); $this->forward404Unless($accal); $this->accal = $accal; $i18n = new sfI18N(); $i18n->initialize($this->getContext()); $i18n->setCulture($this->getUser()->getCulture()); $action_i18n = $i18n->globalMessageFormat->format('save as new'); $action_type = $this->getRequestParameter('action_type'); $params = array(); foreach (explode('&', $this->getRequestParameter('subject_list_ser')) as $p) { $p = explode('=', $p); $params[rawurldecode($p[0])][] = rawurldecode($p[1]); } if (array_key_exists('subjects', $params)) { foreach ($params['subjects'] as $su_id) { $subject_accal = new SubjectAccal(); $subject_accal->setSubjectId($su_id); $subject_accal->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id')); $subject_accal->save(); } } return $this->redirect('subject_accal/list?accal_id=' . $accal->getId()); }