public static function doSelectOrdered(Criteria $criteria, $con = null) { #$dept = sfContext::getInstance()->getUser()->getAttribute('department',null, 'bo'); #$depts = $dept->getChildRecurs(array()); $criteria->add(TestApplicantPeer::STATUS, 3, Criteria::NOT_IN); $criteria->addAscendingOrderByColumn(TestApplicantPeer::CODE); // $criteria->add(TestApplicantPeer::ENROLLED, 0); return TestApplicantPeer::doSelect($criteria); }
public function getTestApplicants($criteria = null, $con = null) { include_once 'lib/model/om/BaseTestApplicantPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collTestApplicants === null) { if ($this->isNew()) { $this->collTestApplicants = array(); } else { $criteria->add(TestApplicantPeer::TEST_APPLICANT_DETAIL_ID, $this->getId()); TestApplicantPeer::addSelectColumns($criteria); $this->collTestApplicants = TestApplicantPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(TestApplicantPeer::TEST_APPLICANT_DETAIL_ID, $this->getId()); TestApplicantPeer::addSelectColumns($criteria); if (!isset($this->lastTestApplicantCriteria) || !$this->lastTestApplicantCriteria->equals($criteria)) { $this->collTestApplicants = TestApplicantPeer::doSelect($criteria, $con); } } } $this->lastTestApplicantCriteria = $criteria; return $this->collTestApplicants; }
public function getTestApplicantsRelatedByDepartment2($criteria = null, $con = null) { include_once 'lib/model/om/BaseTestApplicantPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collTestApplicantsRelatedByDepartment2 === null) { if ($this->isNew()) { $this->collTestApplicantsRelatedByDepartment2 = array(); } else { $criteria->add(TestApplicantPeer::DEPARTMENT_2, $this->getId()); TestApplicantPeer::addSelectColumns($criteria); $this->collTestApplicantsRelatedByDepartment2 = TestApplicantPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(TestApplicantPeer::DEPARTMENT_2, $this->getId()); TestApplicantPeer::addSelectColumns($criteria); if (!isset($this->lastTestApplicantRelatedByDepartment2Criteria) || !$this->lastTestApplicantRelatedByDepartment2Criteria->equals($criteria)) { $this->collTestApplicantsRelatedByDepartment2 = TestApplicantPeer::doSelect($criteria, $con); } } } $this->lastTestApplicantRelatedByDepartment2Criteria = $criteria; return $this->collTestApplicantsRelatedByDepartment2; }
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(TestApplicantPeer::ID, $pks, Criteria::IN); $objs = TestApplicantPeer::doSelect($criteria, $con); } return $objs; }
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; }
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() . '®_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; }