コード例 #1
0
ファイル: TestSubjectPeer.php プロジェクト: taryono/school
 public static function doSelectByRegPeriod(Criteria $c = null, $rpi = null)
 {
     $tsi = null;
     if ($rpi == null) {
         $tsi = sfContext::getInstance()->getRequest()->getParameter('id');
     }
     if ($rpi == null && $tsi == null) {
         return array();
     }
     $ids = '';
     if ($rpi != null) {
         $c = new Criteria();
         $c->addJoin(RegPeriodPeer::CURRICULUM_ID, CurriculumPeer::ID);
         $c->addJoin(CurriculumPeer::DEPARTMENT_ID, DepartmentPeer::ID);
         $c->add(RegPeriodPeer::ID, $rpi);
         $dept = DepartmentPeer::doSelectOne($c);
         $ids = $dept->getIdRecurs();
     }
     if ($tsi != null) {
         $c = new Criteria();
         $c->addJoin(RegPeriodPeer::CURRICULUM_ID, CurriculumPeer::ID);
         $c->addJoin(CurriculumPeer::DEPARTMENT_ID, DepartmentPeer::ID);
         $c->addJoin(TestSchedulePeer::REG_TEST_PERIOD_ID, RegTestPeriodPeer::ID);
         $c->add(TestSchedulePeer::ID, $tsi);
         $dept = DepartmentPeer::doSelectOne($c);
         $ids = $dept->getIdRecurs();
     }
     $sql = "select * from test_subject where department_id in ({$ids})";
     $connection = Propel::getConnection();
     $statement = $connection->createStatement();
     $result = $statement->executeQuery($sql, ResultSet::FETCHMODE_NUM);
     $objs = TestSubjectPeer::populateObjects($result);
     return $objs;
 }
コード例 #2
0
ファイル: components.class.php プロジェクト: taryono/school
 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;
 }
コード例 #3
0
ファイル: resultSuccess.php プロジェクト: taryono/school
?>
   
                 </p>
                 <?php 
$c = new Criteria();
$c->add(TestApplSchedPeer::TEST_APPLICANT_ID, $applicant->getId());
$c->add(AcademicCalendarPeer::DEPARTMENT_ID, $applicant->getDepartment1());
$c->addJoin(AcademicCalendarPeer::ID, RegPeriodPeer::ACADEMIC_CALENDAR_ID);
$c->addJoin(RegPeriodPeer::ID, RegTestPeriodPeer::REG_PERIOD_ID);
$c->addJoin(RegTestPeriodPeer::ID, TestSchedulePeer::REG_TEST_PERIOD_ID);
$c->addJoin(TestSchedulePeer::ID, TestApplSchedPeer::TEST_SCHEDULE_ID);
$appl_sched1 = TestApplSchedPeer::doSelectJoinTestSchedule($c);
$cr = new Criteria();
$cr->add(TestSubjectPeer::DEPARTMENT_ID, $applicant->getDepartment1());
$t_subject1 = TestSubjectPeer::doSelect($cr);
$t_count1 = TestSubjectPeer::doCount($cr);
?>
                <fieldset>
                    <legend>Hasil Test</legend>
						<div style="width:100%;">
                    		<table cellspacing="0" cellpadding="0" class="fancy" style="width:100%">
								<tbody>
									<tr>
										<th style="border-right: 1px solid #ffffff;" colspan="2"><?php 
echo __('Pendaftaran');
?>
</th>
                                		<th style="width: 38%;"><?php 
echo __('Menu Pendaftaran');
?>
</th>
コード例 #4
0
 public function getTestSubject($con = null)
 {
     include_once 'lib/model/om/BaseTestSubjectPeer.php';
     if ($this->aTestSubject === null && $this->test_subject_id !== null) {
         $this->aTestSubject = TestSubjectPeer::retrieveByPK($this->test_subject_id, $con);
     }
     return $this->aTestSubject;
 }
コード例 #5
0
 public static function doSelectJoinAllExceptRegTestPeriod(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     RegScheduleTestPeer::addSelectColumns($c);
     $startcol2 = RegScheduleTestPeer::NUM_COLUMNS - RegScheduleTestPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     TestSubjectPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + TestSubjectPeer::NUM_COLUMNS;
     $c->addJoin(RegScheduleTestPeer::TEST_SUBJECT_ID, TestSubjectPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = RegScheduleTestPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = TestSubjectPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getTestSubject();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addRegScheduleTest($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initRegScheduleTests();
             $obj2->addRegScheduleTest($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
コード例 #6
0
ファイル: BaseDepartment.php プロジェクト: taryono/school
 public function countTestSubjects($criteria = null, $distinct = false, $con = null)
 {
     include_once 'lib/model/om/BaseTestSubjectPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     $criteria->add(TestSubjectPeer::DEPARTMENT_ID, $this->getId());
     return TestSubjectPeer::doCount($criteria, $distinct, $con);
 }
コード例 #7
0
ファイル: actions.class.php プロジェクト: taryono/school
 public function executeEditLocation()
 {
     $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_add = $acl->getAddPriv() == 1;
     $this->can_edit = $acl->getEditPriv() == 1;
     $this->can_remove = $acl->getRemovePriv() == 1;
     $ts = TestSchedulePeer::retrieveByPk($this->getRequestParameter('id'));
     $this->test_schedule = $ts;
     $c = new Criteria();
     $c->add(VTestApplSchedPeer::TEST_SCHEDULE_ID, $this->getRequestParameter('id'));
     $c->add(VTestApplSchedPeer::LOCATION1, $this->getRequestParameter('location_id'));
     $c->addJoin(TestApplicantPeer::ID, VTestApplSchedPeer::TEST_APPLICANT_ID);
     $c->addDescendingOrderByColumn(VTestApplSchedPeer::AVG_GRADE);
     $this->applicants = TestApplicantPeer::doSelect($c);
     $this->forward404Unless($this->test_schedule);
     $dept = DepartmentPeer::retrieveByPk($this->getRequestParameter('dept_id'));
     $this->dept = $dept;
     $location = LocationPeer::retrieveByPk($this->getRequestParameter('location_id'));
     $this->location = $location;
     $accal = AcademicCalendarPeer::retrieveByPk($this->getRequestParameter('accal_id'));
     $this->accal = $accal;
     $dept = sfContext::getInstance()->getUser()->getAttribute('department', null, 'bo');
     $depts = $dept->getChildRecurs(array());
     $cr = new Criteria();
     $cr->add(TestApplSchedPeer::TEST_SCHEDULE_ID, $this->getRequestParameter('id'));
     $count_appl = TestApplSchedPeer::doCount($cr);
     $accal_options = array();
     $c = new Criteria();
     $c->add(LocationPeer::ACADEMIC_CALENDAR_ID, $accal, Criteria::IN);
     $c->add(LocationPeer::LOCATION_CATEGORY_ID, 22, Criteria::IN);
     $c->add(LocationPeer::CAPACITY, $count_appl, Criteria::NOT_IN);
     $c->addDescendingOrderByColumn(LocationPeer::CODE);
     $accals = LocationPeer::doSelect($c);
     foreach ($accals as $accal) {
         $accal_options[$accal->getId()] = $accal->getCampus();
     }
     $this->accal_options = $accal_options;
     $cr = new Criteria();
     $cr->add(TestSubjectPeer::DEPARTMENT_ID, $dept->getId());
     $this->t_subject = TestSubjectPeer::doSelect($cr);
     $this->t_count = TestSubjectPeer::doCount($cr);
     $rpp = $this->getRequestParameter('max_per_page', 999);
     $pager = new sfPropelPager('TestApplicant', $rpp);
     $pager->setCriteria($c);
     $pager->setPage($this->getRequestParameter('page', 1));
     $pager->init();
     $this->pager = $pager;
 }
コード例 #8
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(TestSubjectPeer::ID, $pks, Criteria::IN);
         $objs = TestSubjectPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
コード例 #9
0
ファイル: actions.class.php プロジェクト: taryono/school
 public function executeEditLocation()
 {
     $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
     $c = new Criteria();
     $c->add(JobPeer::CODE, 'reg_test_period');
     $job = JobPeer::doSelectOne($c);
     $acl = AclPeer::retrieveByPK($group_id, $job->getId());
     if (!$acl) {
         $this->forward('default', 'error404');
     }
     $this->can_add = $acl->getAddPriv() == 1;
     $this->can_edit = $acl->getEditPriv() == 1;
     $this->can_remove = $acl->getRemovePriv() == 1;
     $test_schedule = TestSchedulePeer::retrieveByPk($this->getRequestParameter('id'));
     $this->test_schedule = $test_schedule;
     $c = new Criteria();
     $c->add(TestApplSchedPeer::TEST_SCHEDULE_ID, $test_schedule->getId());
     $c->addJoin(TestApplicantPeer::ID, TestApplSchedPeer::TEST_APPLICANT_ID);
     $c->addDescendingOrderByColumn(TestApplSchedPeer::AVG_GRADE);
     $this->applicants = TestApplicantPeer::doSelect($c);
     $this->forward404Unless($this->applicants);
     $dept_id = DepartmentPeer::retrieveByPk($test_schedule->getRegTestPeriod()->getRegPeriod()->getAcademicCalendar()->getDepartmentId());
     $this->dept_id = $dept_id;
     $dept = sfContext::getInstance()->getUser()->getAttribute('department', null, 'bo');
     $depts = $dept->getChildRecurs(array());
     $locate_options = array();
     $c = new Criteria();
     $c->add(AcademicCalendarPeer::DEPARTMENT_ID, $dept_id->getId());
     $c->addJoin(RegPeriodPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
     $c->addJoin(RegTestPeriodPeer::REG_PERIOD_ID, RegPeriodPeer::ID);
     $c->addJoin(TestSchedulePeer::REG_TEST_PERIOD_ID, RegTestPeriodPeer::ID);
     $c->addDescendingOrderByColumn(TestSchedulePeer::LOCATION_ID);
     $accals = TestSchedulePeer::doSelect($c);
     foreach ($accals as $accal) {
         $locate_options[$accal->getId()] = $accal->getLocation()->getCampus();
     }
     $this->locate_options = $locate_options;
     $cr = new Criteria();
     $cr->add(TestSubjectPeer::DEPARTMENT_ID, $dept->getId());
     $this->t_subject = TestSubjectPeer::doSelect($cr);
     $this->t_count = TestSubjectPeer::doCount($cr);
     $rpp = $this->getRequestParameter('max_per_page', 999);
     $pager = new sfPropelPager('TestApplicant', $rpp);
     $pager->setCriteria($c);
     $pager->setPage($this->getRequestParameter('page', 1));
     $pager->init();
     $this->pager = $pager;
     $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")));
     array_push($actions, array('name' => 'cancel', 'url' => 'locate_test/listApplicant?id=' . $test_schedule->getId(), 'color' => 'black'));
     $type = 'edit';
     $subtitle = $test_schedule->getRegTestPeriod()->getName() . ' - ' . $test_schedule->getRegTestPeriod()->getRegPeriod()->toString();
     $this->actions = $actions;
     $this->subtitle = $subtitle;
     $this->type = $type;
     $actions2 = array(array('name' => '<span>Daftar Ruangan Test</span>', 'url' => 'locate_test/listTest?id=' . $test_schedule->getRegTestPeriodId() . '&reg_period_id=' . $test_schedule->getRegTestPeriod()->getRegPeriodId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Jumlah Peserta</span>', 'url' => 'locate_test/listApplicant?id=' . $test_schedule->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Penilaian Peserta</span>', 'url' => 'locate_test/editApplicant?id=' . $test_schedule->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Lokasi Peserta</span>', 'url' => 'locate_test/editLocation?id=' . $test_schedule->getId(), 'color' => 'sun', 'type' => 'direct'));
     $this->actions2 = $actions2;
 }
コード例 #10
0
ファイル: BaseTestSubject.php プロジェクト: taryono/school
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = TestSubjectPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setCode($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setName($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setDepartmentId($arr[$keys[3]]);
     }
 }