Beispiel #1
0
 public function executeSaveUploadTryout()
 {
     $scores = $this->getRequestParameter('score');
     $id_course = 0;
     foreach ($scores as $k => $score) {
         if ($score != null) {
             if ($score != '-') {
                 $ids = split('_', $k);
                 #$ids [0] == Id Student
                 #$ids [1] == Id Course Schedule
                 #$ids [2] == Id Grade Spec
                 $course_schedule = CourseSchedulePeer::retrieveByPK($ids[1]);
                 $id_course = $course_schedule->getId();
                 $c = new Criteria();
                 $c->add(StudentTryoutPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                 $c->add(StudentTryoutPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                 $c->add(StudentTryoutPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                 $c->add(StudentTryoutPeer::STUDENT_ID, $ids[0]);
                 $c->add(StudentTryoutPeer::GRADE_SPEC_ID, $ids[2]);
                 $st = StudentTryoutPeer::doSelectOne($c);
                 if ($st == null) {
                     $st = new StudentTryout();
                 }
                 $st->setStudentId($ids[0]);
                 $st->setGradeSpecId($ids[2]);
                 $st->setAcademicCalendarId($course_schedule->getAcademicCalendarId());
                 $st->setClassGroupId($course_schedule->getClassGroupId());
                 $st->setSubjectCurrId($course_schedule->getSubjectCurrId());
                 $st->setGrade($score);
                 $st->save();
             } else {
                 $ids = split('_', $k);
                 #$ids [0] == Id Student
                 #$ids [1] == Id Course Schedule
                 #$ids [2] == Id Grade Spec
                 $course_schedule = CourseSchedulePeer::retrieveByPK($ids[1]);
                 $id_course = $course_schedule->getId();
                 $c = new Criteria();
                 $c->add(StudentTryoutPeer::SUBJECT_CURR_ID, $course_schedule->getSubjectCurrId());
                 $c->add(StudentTryoutPeer::CLASS_GROUP_ID, $course_schedule->getClassGroupId());
                 $c->add(StudentTryoutPeer::ACADEMIC_CALENDAR_ID, $course_schedule->getAcademicCalendarId());
                 $c->add(StudentTryoutPeer::STUDENT_ID, $ids[0]);
                 $c->add(StudentTryoutPeer::GRADE_SPEC_ID, $ids[2]);
                 $st = StudentTryoutPeer::doSelectOne($c);
                 if ($st != null) {
                     $st->delete();
                 }
             }
         }
     }
     return $this->redirect('course_score_new/uploadTryoutFinish?course_id=' . $id_course);
 }
</td>									
					<?php 
            }
            ?>
                    
                    <?php 
            $total2 = 0;
            $j = 0;
            foreach ($sd_subjects8 as $subject8) {
                $c = new Criteria();
                $c->add(StudentTryoutPeer::STUDENT_ID, $student->getId());
                $c->add(StudentTryoutPeer::SUBJECT_CURR_ID, $subject8->getSubjectCurrId());
                $c->add(StudentTryoutPeer::CLASS_GROUP_ID, $counseling->getClassGroupId());
                $c->add(StudentTryoutPeer::ACADEMIC_CALENDAR_ID, $academic_calendar->getId());
                $c->add(StudentTryoutPeer::GRADE_SPEC_ID, $grade_id);
                $st = StudentTryoutPeer::doSelectOne($c);
                if ($st) {
                    $total2 += $st->getGrade();
                }
                ?>
					
                    		<td style="text-align:center; vertical-align: middle; font-size: 10px; font-weight: bold;" width="5%" <?php 
                ++$j;
                if ($j % 2 != 0) {
                    echo 'class="first"';
                }
                ?>
>
							<?php 
                echo $st != null ? $st->getGrade() ? $st->getGrade() : '-' : '-';
                ?>
Beispiel #3
0
 public function executeSaveTryout()
 {
     $subject_id = $this->getRequestParameter('subject_id');
     $class_id = $this->getRequestParameter('class_id');
     $accal_id = $this->getRequestParameter('accal_id');
     $course_id = $this->getRequestParameter('course_id');
     $course_schedule = CourseSchedulePeer::retrieveByPK($course_id);
     $this->forward404Unless($course_schedule);
     $scores = $this->getRequestParameter('score');
     foreach ($scores as $k => $score) {
         if ($score != null) {
             if ($score != '-') {
                 $ids = split('_', $k);
                 $c = new Criteria();
                 $c->add(StudentTryoutPeer::SUBJECT_CURR_ID, $subject_id);
                 $c->add(StudentTryoutPeer::CLASS_GROUP_ID, $class_id);
                 $c->add(StudentTryoutPeer::ACADEMIC_CALENDAR_ID, $accal_id);
                 $c->add(StudentTryoutPeer::STUDENT_ID, $ids[0]);
                 $c->add(StudentTryoutPeer::GRADE_SPEC_ID, $ids[1]);
                 $st = StudentTryoutPeer::doSelectOne($c);
                 if ($st == null) {
                     $st = new StudentTryout();
                 }
                 $st->setStudentId($ids[0]);
                 $st->setGradeSpecId($ids[1]);
                 $st->setAcademicCalendarId($accal_id);
                 $st->setClassGroupId($class_id);
                 $st->setSubjectCurrId($subject_id);
                 $st->setGrade($score);
                 $st->save();
             } else {
                 $ids = split('_', $k);
                 $c = new Criteria();
                 $c->add(StudentTryoutPeer::SUBJECT_CURR_ID, $subject_id);
                 $c->add(StudentTryoutPeer::CLASS_GROUP_ID, $class_id);
                 $c->add(StudentTryoutPeer::ACADEMIC_CALENDAR_ID, $accal_id);
                 $c->add(StudentTryoutPeer::STUDENT_ID, $ids[0]);
                 $c->add(StudentTryoutPeer::GRADE_SPEC_ID, $ids[1]);
                 $st = StudentTryoutPeer::doSelectOne($c);
                 if ($st != null) {
                     $st->delete();
                 }
             }
         }
     }
     return $this->redirect('course_score/listTryout?course_id=' . $course_schedule->getId());
 }