Esempio n. 1
0
 public function executeRun()
 {
     $this->applicant = $this->applicant;
     $this->error = false;
     $this->regTestPeriod = RegTestPeriodPeer::retrieveByPK($this->applicant->getRegTestPeriod1());
     if (!$this->regTestPeriod) {
         $this->success = true;
         $this->messageError = 'RegTestPeriod not found';
         return false;
     }
     $testSubjectCriteria = new Criteria();
     $testSubjectCriteria->add(TestSubjectPeer::DEPARTMENT_ID, $this->applicant->getDepartment1());
     $testSubject = TestSubjectPeer::doSelect($testSubjectCriteria);
     $testSubjectCount = TestSubjectPeer::doCount($testSubjectCriteria);
     if ($testSubjectCount < 1) {
         $this->success = true;
         $this->messageError = 'Test Subject not found';
         return false;
     }
     $testSubjectId = array();
     foreach ($testSubject as $t) {
         $testSubjectId[] = $t->getId();
     }
     $testScoreCriteria = new Criteria();
     $testScoreCriteria->add(TestScorePeer::TEST_APPLICANT_ID, $this->applicant->getId(), Criteria::EQUAL);
     $testScoreCriteria->add(TestScorePeer::TEST_SUBJECT_ID, $testSubjectId, Criteria::IN);
     $testScoresTemp = TestScorePeer::doSelect($testScoreCriteria);
     $testScores = array();
     foreach ($testScoresTemp as $t) {
         $testScores[$t->getTestSubjectId()] = $t;
     }
     $this->testSubject = $testSubject;
     $this->testSubjectCount = $testSubjectCount;
     $this->testScores = $testScores;
 }
Esempio n. 2
0
        ?>
												<th style="font-size: 11px;"><?php 
        echo $t_sub->getCode();
        ?>
</th>
                                        	<?php 
    }
    ?>
                                        </tr>
                                        <tr class="x">
										<?php 
    foreach ($t_subject1 as $t_sub) {
        $cw = new Criteria();
        $cw->add(TestScorePeer::TEST_APPLICANT_ID, $applicant->getId());
        $cw->add(TestScorePeer::TEST_SUBJECT_ID, $t_sub->getId());
        $tg = TestScorePeer::doSelectOne($cw);
        ?>
											<td><?php 
        echo $tg != null ? $tg->getGrade() : '-';
        ?>
</td>
										<?php 
    }
    ?>
                                        </tr>
                                    </tbody>
                                </table>
                                <?php 
} else {
    echo '';
}
Esempio n. 3
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = TestScorePeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setGrade($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setTestApplicantId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setTestSubjectId($arr[$keys[3]]);
     }
 }
Esempio n. 4
0
 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(TestScorePeer::ID, $pks, Criteria::IN);
         $objs = TestScorePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Esempio n. 5
0
 public function executeUpdateApplicantGrade()
 {
     $grades = $this->getRequestParameter('grade');
     foreach ($grades as $k => $grade) {
         if ($grade != null) {
             $ids = split('_', $k);
             $c = new Criteria();
             $c->add(TestScorePeer::TEST_APPLICANT_ID, $ids[0]);
             $c->add(TestScorePeer::TEST_SUBJECT_ID, $ids[1]);
             $g = TestScorePeer::doSelectOne($c);
             if ($g == null) {
                 $g = new TestScore();
             }
             $g->setTestApplicantId($ids[0]);
             $g->setTestSubjectId($ids[1]);
             $g->setGrade($grade);
             $g->save();
         }
     }
     $ts = TestSchedulePeer::retrieveByPK($this->getRequestParameter('id'));
     $avgGrades = $this->getRequestParameter('avgGrade');
     foreach ($avgGrades as $appl_id => $avgGrade) {
         $c = new Criteria();
         $c->add(TestApplSchedPeer::TEST_APPLICANT_ID, $appl_id);
         $c->add(TestApplSchedPeer::TEST_SCHEDULE_ID, $ts->getId());
         $g = TestApplSchedPeer::doSelectOne($c);
         #if ($g == null) $g = new TestGrade();
         $g->setTestApplicantId($appl_id);
         $g->setTestScheduleId($ts->getId());
         $g->setAvgGrade($avgGrade);
         $g->save();
     }
     $ranks = $this->getRequestParameter('rank');
     foreach ($ranks as $appl_id => $rank) {
         $c = new Criteria();
         $c->add(TestApplSchedPeer::TEST_APPLICANT_ID, $appl_id);
         $c->add(TestApplSchedPeer::TEST_SCHEDULE_ID, $ts->getId());
         $g = TestApplSchedPeer::doSelectOne($c);
         #if ($g == null) $g = new TestGrade();
         $g->setTestApplicantId($appl_id);
         $g->setTestScheduleId($ts->getId());
         $g->setRank($rank);
         $g->save();
     }
     $status_ = $this->getRequestParameter('status');
     if ($status_) {
         foreach ($status_ as $appl_id => $status) {
             $c = new Criteria();
             $c->add(TestApplicantPeer::ID, $appl_id);
             $ta = TestApplicantPeer::doSelectOne($c);
             #if ($g == null) $g = new TestGrade();
             $ta->setId($appl_id);
             $ta->setStatus($status);
             $ta->save();
         }
     }
     /**
     		$location1_ = $this->getRequestParameter('location1');
     		if ($location1_) {
     			foreach ($location1_ as $appl_id => $location) {
     				$c = new Criteria();
     				$c->add(TestApplicantPeer::ID, $appl_id);
     				$ta = TestApplicantPeer::doSelectOne($c);
     				
     				$ta->setId($appl_id);
     				$ta->setLocation1($location);
     				$ta->save();
     			}
     		}
     		**/
     return $this->redirect('test_schedule/listApplicant?id=' . $ts->getId() . '&dept_id=' . $this->getRequestParameter('department_id') . '&location_id=' . $this->getRequestParameter('location_id'));
 }
Esempio n. 6
0
 public function getTestScoresJoinTestSubject($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseTestScorePeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collTestScores === null) {
         if ($this->isNew()) {
             $this->collTestScores = array();
         } else {
             $criteria->add(TestScorePeer::TEST_APPLICANT_ID, $this->getId());
             $this->collTestScores = TestScorePeer::doSelectJoinTestSubject($criteria, $con);
         }
     } else {
         $criteria->add(TestScorePeer::TEST_APPLICANT_ID, $this->getId());
         if (!isset($this->lastTestScoreCriteria) || !$this->lastTestScoreCriteria->equals($criteria)) {
             $this->collTestScores = TestScorePeer::doSelectJoinTestSubject($criteria, $con);
         }
     }
     $this->lastTestScoreCriteria = $criteria;
     return $this->collTestScores;
 }