$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;
        }
    }
    $cm = new Criteria();
    $cm->add(StudentHabitPeer::STUDENT_ID, $student->getId());
    $cm->add(StudentHabitPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
    $cm->add(StudentHabitPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
    $student_habits = StudentHabitPeer::doSelect($cm);
    $habit = array();
    foreach ($student_habits as $student_habit) {
        $habit[$student_habit->getGradeComponentId()] = $student_habit;
    }
    $cd = new Criteria();
    $cd->add(GradeComponentPeer::GRADE_SPEC_ID, 21);
    $cd->add(GradeComponentPeer::PUBLISHED, 1);
    $cd->addJoin(StudentRaportPeer::GRADE_COMPONENT_ID, GradeComponentPeer::ID);
    $cd->add(StudentRaportPeer::STUDENT_ID, $student->getId());
    $cd->add(StudentRaportPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
    $cd->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
    $ekskuls = StudentRaportPeer::doSelect($cd);
    $count_ekskul = StudentRaportPeer::doCount($cd);
    ?>
Exemple #2
0
        ?>
</td>

						<td valign="middle"><b><?php 
        echo $grade_component->getName() ? $grade_component->getName() : 'n/a';
        ?>
</td>

                        <td valign="middle" style="text-align: center;">
                        <?php 
        $c = new Criteria();
        $c->add(StudentHabitPeer::STUDENT_ID, $student->getId());
        $c->add(StudentHabitPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
        $c->add(StudentHabitPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
        $c->add(StudentHabitPeer::GRADE_COMPONENT_ID, $grade_component->getId());
        $sh = StudentHabitPeer::doSelectOne($c);
        if ($sh == null) {
            $sh = new StudentHabit();
        }
        if ($sh->getGrade() == '80') {
            echo "<font class='level_green'>" . __('A') . "</font>";
        } elseif ($sh->getGrade() == '70') {
            echo "<font class='level_green'>" . __('B') . "</font>";
        } elseif ($sh->getGrade() == '60') {
            echo "<font class='level_yellow'>" . __('C') . "</font>";
        } elseif ($sh->getGrade() == '50') {
            echo "<font class='level_red'>" . __('D') . "</font>";
        } else {
            echo '-';
        }
        ?>
Exemple #3
0
 public function executeSaveRanks()
 {
     $counseling = CounselingPeer::retrieveByPK($this->getRequestParameter('counseling_id'));
     $this->forward404Unless($counseling);
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($this->getRequestParameter('accal_id'));
     $this->forward404Unless($academic_calendar);
     $ranks = $this->getRequestParameter('rank');
     foreach ($ranks as $student_id => $rank) {
         $c = new Criteria();
         $c->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
         $c->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
         $c->add(StudentAccalPeer::STUDENT_ID, $student_id);
         $sa = StudentAccalPeer::doSelectOne($c);
         if ($sa == null) {
             $sa = new StudentAccal();
         }
         $sa->setStudentId($student_id);
         $sa->setAcademicCalendarId($academic_calendar->getId());
         $sa->setClassGroupId($counseling->getClassGroupId());
         $sa->setClassRank($rank);
         $sa->save();
     }
     $totalScores = $this->getRequestParameter('totalScore');
     foreach ($totalScores as $student_id => $totalScore) {
         $c = new Criteria();
         $c->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
         $c->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
         $c->add(StudentAccalPeer::STUDENT_ID, $student_id);
         $sa = StudentAccalPeer::doSelectOne($c);
         if ($sa == null) {
             $sa = new StudentAccal();
         }
         $sa->setStudentId($student_id);
         $sa->setAcademicCalendarId($academic_calendar->getId());
         $sa->setClassGroupId($counseling->getClassGroupId());
         $sa->setTotalScore($totalScore);
         $sa->save();
     }
     $avgScores = $this->getRequestParameter('avgScore');
     foreach ($avgScores as $student_id => $avgScore) {
         $c = new Criteria();
         $c->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
         $c->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
         $c->add(StudentAccalPeer::STUDENT_ID, $student_id);
         $sa = StudentAccalPeer::doSelectOne($c);
         if ($sa == null) {
             $sa = new StudentAccal();
         }
         $sa->setStudentId($student_id);
         $sa->setAcademicCalendarId($academic_calendar->getId());
         $sa->setClassGroupId($counseling->getClassGroupId());
         $sa->setAvgScore($avgScore);
         $sa->save();
     }
     $statues = $this->getRequestParameter('status');
     foreach ($statues as $student_id => $status) {
         $cr = new Criteria();
         $cr->add(StudentRaportPeer::STUDENT_ID, $student_id);
         $cr->add(StudentRaportPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
         $cr->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
         $cr->add(StudentRaportPeer::GRADE_SPEC_ID, 57);
         $sr = StudentRaportPeer::doSelectOne($cr);
         if ($sr == null) {
             $sr = new StudentRaport();
         }
         $sr->setStudentId($student_id);
         $sr->setAcademicCalendarId($academic_calendar->getId());
         $sr->setClassGroupId($counseling->getClassGroupId());
         $sr->setGradeSpecId(57);
         $sr->setRemark($status);
         $sr->save();
     }
     $scores = $this->getRequestParameter('score');
     foreach ($scores as $k => $score) {
         if ($score != null) {
             if ($score != '-') {
                 $ids = split('_', $k);
                 $cb = new Criteria();
                 $cb->add(StudentHabitPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
                 $cb->add(StudentHabitPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
                 $cb->add(StudentHabitPeer::STUDENT_ID, $ids[0]);
                 $cb->add(StudentHabitPeer::GRADE_COMPONENT_ID, $ids[1]);
                 $sh = StudentHabitPeer::doSelectOne($cb);
                 if ($sh == null) {
                     $sh = new StudentHabit();
                 }
                 $sh->setStudentId($ids[0]);
                 $sh->setGradeComponentId($ids[1]);
                 $sh->setAcademicCalendarId($academic_calendar->getId());
                 $sh->setClassGroupId($counseling->getClassGroupId());
                 $sh->setGrade($score);
                 $sh->save();
             } else {
                 $ids = split('_', $k);
                 $cb = new Criteria();
                 $cb->add(StudentHabitPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
                 $cb->add(StudentHabitPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
                 $cb->add(StudentHabitPeer::STUDENT_ID, $ids[0]);
                 $cb->add(StudentHabitPeer::GRADE_COMPONENT_ID, $ids[1]);
                 $sh = StudentHabitPeer::doSelectOne($cb);
                 if ($sh == null) {
                     $sh->delete();
                 }
             }
         }
     }
     return $this->redirect('counseling_hist/listLedger?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId());
 }
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(StudentHabitPeer::ID, $pks, Criteria::IN);
         $objs = StudentHabitPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Exemple #5
0
 public function executeListLedgerAll()
 {
     $counseling_id = $this->getRequestParameter('counseling_id');
     $counseling = CounselingPeer::retrieveByPK($counseling_id);
     $this->forward404Unless($counseling);
     $accal_id = $this->getRequestParameter('accal_id');
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id);
     $this->forward404Unless($academic_calendar);
     ## Daftar Mata Pelajaran di Jadwal Pelajaran
     $cw = new Criteria();
     $cw->add(VCoursePeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
     $cw->add(VCoursePeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
     $subjects = VCoursePeer::doSelect($cw);
     $subject_ids = array();
     foreach ($subjects as $subject) {
         $subject_ids[] = $subject->getSubjectCurrId();
         $course_ids[$subject->getSubjectCurrId()] = $subject->getId();
     }
     $this->subjects = $subjects;
     $this->course_ids = $course_ids;
     ## Mengelompokkan Penilaian Anak berdasarkan Tahun Ajaran dan Kelas
     $cr = new Criteria();
     $cr->add(StudentRaportPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
     #$cr->add(StudentRaportPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
     $stugrades = StudentRaportPeer::doSelect($cr);
     $this->stugrades = $stugrades;
     $cblek = new Criteria();
     $cblek->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
     $s_accal = StudentAccalPeer::doSelect($cblek);
     $this->s_accal = $s_accal;
     $cmiw = new Criteria();
     $cmiw->add(AcademicCalendarPeer::PARENT, $academic_calendar->getParent());
     $accals = AcademicCalendarPeer::doSelect($cmiw);
     $this->accals = $accals;
     $cq = new Criteria();
     $cq->add(AcademicCalendarPeer::COURSE_MODEL, 'A');
     $cq->add(AcademicCalendarPeer::PARENT, $academic_calendar->getParent());
     $accal1 = AcademicCalendarPeer::doSelectOne($cq);
     $this->accal1 = $accal1;
     $cb = new Criteria();
     $cb->add(AcademicCalendarPeer::COURSE_MODEL, 'B');
     $cb->add(AcademicCalendarPeer::PARENT, $academic_calendar->getParent());
     $accal2 = AcademicCalendarPeer::doSelectOne($cb);
     $this->accal2 = $accal2;
     $cmi = new Criteria();
     $cmi->add(StudentHabitPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
     $cmi->add(StudentHabitPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
     $student_habits = StudentHabitPeer::doSelect($cmi);
     $this->student_habits = $student_habits;
     $cwi = new Criteria();
     $cwi->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
     $cwi->add(CourseRegulationPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
     $c_regulations = CourseRegulationPeer::doSelect($cwi);
     $this->c_regulations = $c_regulations;
     # Menentukan Aturan Penilaian
     $cd = new Criteria();
     #$cd->add(ScoreRulePeer::ACADEMIC_CALENDAR_ID, $counseling->getAcademicCalendarId());
     $cd->add(ClassGroupPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId());
     $cd->addJoin(ScoreRulePeer::CLASS_GROUP_ID, ClassGroupPeer::ID);
     $cd->add(ScoreRulePeer::TYPE, 4);
     $score_rule = ScoreRulePeer::doSelectOne($cd);
     $this->score_rule = $score_rule;
     #Khusus SMP 9
     if ($counseling->getAcademicCalendar()->getDepartmentId() == 11) {
         ## 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);
         $cton1 = $cm->getNewCriterion(ScoreRuleSubjectPeer::SUBJECT_TYPE, 1, Criteria::IN);
         $cton2 = $cm->getNewCriterion(ScoreRuleSubjectPeer::SUBJECT_TYPE, 3, Criteria::IN);
         $cton1->addOr($cton2);
         $cm->add($cton1);
         $cm->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE);
         $list_subs = ScoreRuleSubjectPeer::doSelect($cm);
         $subject_count = ScoreRuleSubjectPeer::doCount($cm);
     } else {
         ## Menentukan Aturan Penilaian Yang digunakan
         $cm = new Criteria();
         $cm->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN);
         $cm->add(ScoreRuleSubjectPeer::PUBLISHED, 1, Criteria::IN);
         $cm->add(ScoreRuleSubjectPeer::SUBJECT_CURR_ID, $subject_ids, Criteria::IN);
         $cm->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE);
         $list_subs = ScoreRuleSubjectPeer::doSelect($cm);
         $subject_count = ScoreRuleSubjectPeer::doCount($cm);
     }
     $this->list_subs = $list_subs;
     $this->subject_count = $subject_count;
     $cwe = new Criteria();
     $cwe->add(GradeComponentPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId(), Criteria::IN);
     $cton1 = $cwe->getNewCriterion(GradeComponentPeer::GRADE_SPEC_ID, 20, Criteria::IN);
     $cton2 = $cwe->getNewCriterion(GradeComponentPeer::PUBLISHED, 1, Criteria::IN);
     $cton1->addAnd($cton2);
     $cwe->add($cton1);
     $this->grade_components = GradeComponentPeer::doSelect($cwe);
     $this->grade_count = GradeComponentPeer::doCount($cwe);
     $cmot = new Criteria();
     $cmot->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
     $cmot->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
     $cmot->addJoin(StudentPeer::ID, StudentAccalPeer::STUDENT_ID);
     $cmot->add(StudentPeer::STATUS, 2, Criteria::NOT_EQUAL);
     $cmot->add(StudentPeer::STATUS, 3, Criteria::NOT_EQUAL);
     $this->student_count = StudentPeer::doCount($cmot);
     $c = new Criteria();
     $c->addJoin(StudentAccalPeer::STUDENT_ID, StudentPeer::ID);
     $c->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
     $c->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
     $this->sortStudentAccal($c);
     $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'student_accal'));
     $this->getUser()->setAttribute('max_per_page', $rpp, 'student_accal');
     $pager = new sfPropelPager('StudentAccal', $rpp);
     $pager->setCriteria($c);
     $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'student_accal'));
     $this->getUser()->setAttribute('page', $page, 'student_accal');
     $pager->setPage($page);
     $pager->init();
     $this->pager = $pager;
     $actions = array();
     array_unshift($actions, array('name' => 'Print PDF', 'url' => "counseling/listLedgerAllAsPDF?accal_id=" . $academic_calendar->getId() . "&counseling_id=" . $counseling->getId(), 'color' => 'black', 'type' => 'direct'));
     array_unshift($actions, array('name' => 'Print Excel', 'url' => "counseling/listLedgerAllAsCSV?accal_id=" . $academic_calendar->getId() . "&counseling_id=" . $counseling->getId(), 'color' => 'black', 'type' => 'direct'));
     $this->actions = $actions;
     $actions2 = array(array('name' => '<span>' . $academic_calendar->toString() . '</span>', 'url' => 'counseling/listByEmployee', 'color' => 'volcadot'));
     array_push($actions2, array('name' => '<span>Ledger Nilai Raport</span>', 'url' => 'counseling/listLedger?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sun'));
     array_push($actions2, array('name' => '<span>Ledger Pembiasaan</span>', 'url' => 'counseling/listLedgerHabit?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sun'));
     array_push($actions2, array('name' => '<span>Ledger Gabungan</span>', 'url' => 'counseling/listLedgerAll?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sky', 'type' => 'direct'));
     array_push($actions2, array('name' => '<span>Ranking Paralel</span>', 'url' => 'counseling/listParalel?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId(), 'color' => 'sun'));
     $this->actions2 = $actions2;
     $this->counseling = $counseling;
     $this->subtitle = $academic_calendar->getName() . ' # Kelas : ' . $counseling->getClassGroup()->toString();
     $this->academic_calendar = $academic_calendar;
 }
Exemple #6
0
 public function executeSaveHabit()
 {
     $counseling = CounselingPeer::retrieveByPK($this->getRequestParameter('counseling_id'));
     $this->forward404Unless($counseling);
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($this->getRequestParameter('accal_id'));
     $this->forward404Unless($academic_calendar);
     $scores = $this->getRequestParameter('score');
     foreach ($scores as $k => $score) {
         if ($score != null) {
             if ($score != '-') {
                 $ids = split('_', $k);
                 $cb = new Criteria();
                 $cb->add(StudentHabitPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
                 $cb->add(StudentHabitPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
                 $cb->add(StudentHabitPeer::STUDENT_ID, $ids[0]);
                 $cb->add(StudentHabitPeer::GRADE_COMPONENT_ID, $ids[1]);
                 $sh = StudentHabitPeer::doSelectOne($cb);
                 if ($sh == null) {
                     $sh = new StudentHabit();
                 }
                 $sh->setStudentId($ids[0]);
                 $sh->setGradeComponentId($ids[1]);
                 $sh->setAcademicCalendarId($academic_calendar->getId());
                 $sh->setClassGroupId($counseling->getClassGroupId());
                 $sh->setGrade($score);
                 $sh->save();
             } else {
                 $ids = split('_', $k);
                 $cb = new Criteria();
                 $cb->add(StudentHabitPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
                 $cb->add(StudentHabitPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
                 $cb->add(StudentHabitPeer::STUDENT_ID, $ids[0]);
                 $cb->add(StudentHabitPeer::GRADE_COMPONENT_ID, $ids[1]);
                 $sh = StudentHabitPeer::doSelectOne($cb);
                 #if ($sh == null) $sh->delete();
             }
         }
     }
     return $this->redirect('counseling/listLedgerHabit?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId());
 }
Exemple #7
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = StudentHabitPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setStudentId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setSubjectCurrId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setClassGroupId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setAcademicCalendarId($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setGradeComponentId($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setGrade($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setRemark($arr[$keys[7]]);
     }
 }
Exemple #8
0
 public function executeSavePersonality()
 {
     $course_id = $this->getRequestParameter('course_id');
     $course_schedule = CourseSchedulePeer::retrieveByPK($course_id);
     $this->forward404Unless($course_schedule);
     ## Penilaian Umum
     $scores = $this->getRequestParameter('score');
     foreach ($scores as $k => $score) {
         if ($score != null) {
             if ($score != '-') {
                 $ids = split('_', $k);
                 $id_student = $ids[0];
                 $id_component = $ids[1];
                 $id_remark = $ids[2];
                 $c = new Criteria();
                 $c->add(StudentHabitPeer::STUDENT_ID, $id_student);
                 $c->add(StudentHabitPeer::GRADE_COMPONENT_ID, $id_component);
                 $c->add(StudentHabitPeer::REMARK, $id_remark);
                 $c->add(StudentHabitPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                 $c->add(StudentHabitPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                 $c->add(StudentHabitPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                 $g = StudentHabitPeer::doSelectOne($c);
                 if ($g == null) {
                     $g = new StudentHabit();
                 }
                 $g->setStudentId($id_student);
                 $g->setGradeComponentId($id_component);
                 $g->setRemark($id_remark);
                 $g->setGrade($score);
                 $g->setSubjectCurrId($course_schedule->getSubjectCurrId());
                 $g->setClassGroupId($course_schedule->getClassGroupId());
                 $g->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                 $g->save();
             } else {
                 $ids = split('_', $k);
                 $id_student = $ids[0];
                 $id_component = $ids[1];
                 $id_remark = $ids[2];
                 $c = new Criteria();
                 $c->add(StudentHabitPeer::STUDENT_ID, $id_student);
                 $c->add(StudentHabitPeer::GRADE_COMPONENT_ID, $id_component);
                 $c->add(StudentHabitPeer::REMARK, $id_remark);
                 $c->add(StudentHabitPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                 $c->add(StudentHabitPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                 $c->add(StudentHabitPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                 $g = StudentHabitPeer::doSelectOne($c);
                 if ($g != null) {
                     $g->delete();
                 }
             }
         }
     }
     ## Penilaian Rata2
     $avgs = $this->getRequestParameter('avg');
     foreach ($avgs as $k => $avg) {
         if ($avg != null) {
             if ($avg != '-') {
                 $ids = split('_', $k);
                 $id_student = $ids[0];
                 $id_component = $ids[1];
                 $id_remark = $ids[2];
                 $c = new Criteria();
                 $c->add(StudentHabitPeer::STUDENT_ID, $id_student);
                 $c->add(StudentHabitPeer::GRADE_COMPONENT_ID, $id_component);
                 $c->add(StudentHabitPeer::REMARK, $id_remark);
                 $c->add(StudentHabitPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                 $c->add(StudentHabitPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                 $c->add(StudentHabitPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                 $g = StudentHabitPeer::doSelectOne($c);
                 if ($g == null) {
                     $g = new StudentHabit();
                 }
                 $g->setStudentId($id_student);
                 $g->setGradeComponentId($id_component);
                 $g->setRemark($id_remark);
                 $g->setGrade($avg);
                 $g->setSubjectCurrId($course_schedule->getSubjectCurrId());
                 $g->setClassGroupId($course_schedule->getClassGroupId());
                 $g->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                 $g->save();
             } else {
                 $ids = split('_', $k);
                 $id_student = $ids[0];
                 $id_component = $ids[1];
                 $id_remark = $ids[2];
                 $c = new Criteria();
                 $c->add(StudentHabitPeer::STUDENT_ID, $id_student);
                 $c->add(StudentHabitPeer::GRADE_COMPONENT_ID, $id_component);
                 $c->add(StudentHabitPeer::REMARK, $id_remark);
                 $c->add(StudentHabitPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                 $c->add(StudentHabitPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                 $c->add(StudentHabitPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                 $g = StudentHabitPeer::doSelectOne($c);
                 if ($g != null) {
                     $g->delete();
                 }
             }
         }
     }
     return $this->redirect('course_score/listPersonality?course_id=' . $course_schedule->getId());
 }
Exemple #9
0
 public function executePrintFinal2()
 {
     $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);
     ## 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);
     $course_ids = array();
     $subject_ids = array();
     foreach ($subjects as $subject) {
         $subject_ids[] = $subject->getSubjectCurrId();
         $course_ids[$subject->getSubjectCurrId()] = $subject->getId();
     }
     $this->subjects = $subjects;
     $this->course_ids = $course_ids;
     ## Menentukan Aturan Penilaian (Akhir Semester)
     $cd = new Criteria();
     $cd->add(ScoreRulePeer::CLASS_GROUP_ID, $counseling->getClassGroup()->getParent());
     $cd->add(ScoreRulePeer::ACADEMIC_CALENDAR_ID, $counseling->getAcademicCalendarId());
     $cd->add(ScoreRulePeer::TYPE, ScoreRule::TYPE_TWO);
     $score_rule = ScoreRulePeer::doSelectOne($cd);
     $this->score_rule = $score_rule;
     ## Menentukan Aturan Penilaian (Tengah Semester)
     $cd = new Criteria();
     $cd->add(ScoreRulePeer::CLASS_GROUP_ID, $counseling->getClassGroup()->getParent());
     $cd->add(ScoreRulePeer::ACADEMIC_CALENDAR_ID, $counseling->getAcademicCalendarId());
     $cd->add(ScoreRulePeer::TYPE, ScoreRule::TYPE_ONE);
     $cd->add(ScoreRulePeer::CLASS_TYPE_ID, $counseling->getClassTypeId());
     $score_rule = ScoreRulePeer::doSelectOne($cd);
     $this->score_rule = $score_rule;
     ## Memunculkan semua mata pelajaran yang ada di aturan penilaian
     ## Mengelompokannya untuk kelompok A
     $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);
     $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, $score_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;
     $cmti = new Criteria();
     $cmti->add(ScoreRuleSubjectPeer::SCORE_RULE_ID, $score_rule->getId(), Criteria::IN);
     $cmti->add(ScoreRuleSubjectPeer::PUBLISHED, ScoreRule::ONE, Criteria::IN);
     $cmti->add(ScoreRuleSubjectPeer::SUBJECT_TYPE, 5, Criteria::IN);
     $cmti->addAscendingOrderByColumn(ScoreRuleSubjectPeer::SEQUENCE);
     $group_b = ScoreRuleSubjectPeer::doSelectOne($cmti);
     $this->group_b = $group_b;
     $cte = new Criteria();
     $cte->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
     $cte->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
     $stuaccals = StudentAccalPeer::doSelect($cte);
     $this->stuaccals = $stuaccals;
     $stuaccal_id = array();
     foreach ($stuaccals as $stuaccal) {
         $stuaccal_id[$stuaccal->getStudentId()] = $stuaccal->getId();
     }
     $this->stuaccal_id = $stuaccal_id;
     ## Mengelompokkan Penilaian Pengetahuan berdasarkan Tahun Ajaran dan Kelas
     $cr = new Criteria();
     $stugrades = StudentGradeRaportPeer::doSelect($cr);
     $this->stugrades = $stugrades;
     $grades = array();
     $grades_value = array();
     $remarks = array();
     $grade_avg = array();
     foreach ($stugrades as $stugrade) {
         $grades[$stugrade->getStudentAccalId() . '#' . $stugrade->getCourseScheduleId() . '#' . $stugrade->getGradeSpecId()] = $stugrade->getGrade();
         $grades_value[$stugrade->getStudentAccalId() . '#' . $stugrade->getCourseScheduleId() . '#' . $stugrade->getGradeSpecId()] = $stugrade->getGradeValue();
         $remarks[$stugrade->getStudentAccalId() . '#' . $stugrade->getCourseScheduleId() . '#' . $stugrade->getGradeSpecId()] = $stugrade->getRemark();
         $grade_avg[$stugrade->getCourseScheduleId() . '#' . $stugrade->getGradeSpecId()] = (array_key_exists($stugrade->getCourseScheduleId() . '#' . $stugrade->getGradeSpecId(), $grade_avg) ? $grade_avg[$stugrade->getCourseScheduleId() . '#' . $stugrade->getGradeSpecId()] : 0) + $stugrade->getGradeValue();
     }
     $this->grades = $grades;
     $this->grade_avg = $grade_avg;
     $this->grades_value = $grades_value;
     $this->remarks = $remarks;
     $cmi = new Criteria();
     $cmi->add(GradeConversionPeer::DEPARTMENT_ID, $academic_calendar->getDepartmentId());
     $cmi->add(GradeConversionPeer::TYPE_CONVERSION, GradeConversion::TYPE_ALL);
     $grade_conversions = GradeConversionPeer::doSelect($cmi);
     $grade_select = array();
     $detail_select = array();
     foreach ($grade_conversions as $grade_conv) {
         $grade_select[$grade_conv->getName()] = $grade_conv->getDescription();
         $detail_select[$grade_conv->getName()] = $grade_conv->getDetail();
     }
     $this->detail_select = $detail_select;
     $this->grade_select = $grade_select;
     $this->grade_conversions = $grade_conversions;
     $cmit = new Criteria();
     $cmit->add(GradeConversionPeer::DEPARTMENT_ID, $academic_calendar->getDepartmentId());
     $grade_convs = GradeConversionPeer::doSelect($cmit);
     $remark_select = array();
     $name_select = array();
     $descript_select = array();
     foreach ($grade_convs as $grade_conve) {
         $remark_select[$grade_conve->getName() . '#' . $grade_conve->getTypeConversion()] = $grade_conve->getDescription();
         $name_select[$grade_conve->getGrade() . '#' . $grade_conve->getTypeConversion()] = $grade_conve->getName();
         $descript_select[$grade_conve->getGrade() . '#' . $grade_conve->getTypeConversion()] = $grade_conve->getDetail();
     }
     $cbt = new Criteria();
     $cbt->add(GradeConversionPeer::DEPARTMENT_ID, $academic_calendar->getDepartmentId());
     $cbt->add(GradeConversionPeer::TYPE_CONVERSION, GradeConversion::TYPE_KNOWLEDGE);
     $know_convs = GradeConversionPeer::doSelect($cbt);
     $this->know_convs = $know_convs;
     $cbti = new Criteria();
     $cbti->add(GradeConversionPeer::DEPARTMENT_ID, $academic_calendar->getDepartmentId());
     $cbti->add(GradeConversionPeer::TYPE_CONVERSION, GradeConversion::TYPE_SKILL);
     $skill_convs = GradeConversionPeer::doSelect($cbti);
     $this->skill_convs = $skill_convs;
     $this->name_select = $name_select;
     $this->remark_select = $remark_select;
     $this->grade_conversions = $grade_conversions;
     ## Penilaian Habit
     $cmi = new Criteria();
     $cmi->add(StudentHabitPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
     $cmi->add(StudentHabitPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
     $student_habits = StudentHabitPeer::doSelect($cmi);
     $habit = array();
     foreach ($student_habits as $student_habit) {
         $habit[$student_habit->getGradeComponentId() . '#' . $student_habit->getStudentId()] = $student_habit;
     }
     $this->student_habits = $student_habits;
     $this->habit = $habit;
     $cwi = new Criteria();
     $cwi->add(CourseRegulationPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
     $cwi->add(CourseRegulationPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
     $c_regulations = CourseRegulationPeer::doSelect($cwi);
     $course_reg = array();
     foreach ($c_regulations as $cr) {
         $course_reg[$cr->getAcademicCalendarId() . '#' . $cr->getSubjectCurrId() . '#' . $cr->getClassGroupId()] = $cr->getKkm();
     }
     $this->c_regulations = $c_regulations;
     $this->course_reg = $course_reg;
     ## Ekskul
     $cwe = new Criteria();
     $cwe->add(GradeComponentPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId(), Criteria::IN);
     $cton1 = $cwe->getNewCriterion(GradeComponentPeer::GRADE_SPEC_ID, 20, Criteria::IN);
     $cton2 = $cwe->getNewCriterion(GradeComponentPeer::PUBLISHED, 1, Criteria::IN);
     $cton1->addAnd($cton2);
     $cwe->add($cton1);
     $this->grade_components = GradeComponentPeer::doSelect($cwe);
     $this->grade_count = GradeComponentPeer::doCount($cwe);
     $this->course_reg = $course_reg;
     $ce = new Criteria();
     $ce->add(DepartmentDetailPeer::DEPARTMENT_ID, $counseling->getAcademicCalendar()->getDepartmentId());
     $this->department_detail = DepartmentDetailPeer::doSelectOne($ce);
     $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->getStudentId()] = (array_key_exists($sa->getStatus() . '#' . $sa->getStudentId(), $absence) ? $absence[$sa->getStatus() . '#' . $sa->getStudentId()] : 0) + 1;
         }
     }
     $this->absence = $absence;
     $cmot = new Criteria();
     $cmot->add(StudentAccalPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
     $cmot->add(StudentAccalPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
     $cmot->addJoin(StudentPeer::ID, StudentAccalPeer::STUDENT_ID);
     $this->student_count = StudentPeer::doCount($cmot);
     $this->students = $students;
     $this->subtitle = '';
     $this->counseling = $counseling;
     $this->tanggal = $time;
     $this->tgl_cetak = $tgl;
     $this->time2 = $time2;
     $this->academic_calendar = $academic_calendar;
     $this->orientation = 'portrait';
     $this->papersize = 'a4';
     $this->setViewClass('sfDomPDF');
 }