Пример #1
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());
 }
Пример #2
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());
 }
Пример #3
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());
 }