public function executeEditResult() { $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; $c = new Criteria(); $c->add(TestApplSchedPeer::TEST_SCHEDULE_ID, $this->getRequestParameter('id')); $c->add(TestApplSchedPeer::TEST_APPLICANT_ID, $this->getRequestParameter('appl_id')); $this->test_appl_sched = TestApplSchedPeer::doSelectOne($c); $this->forward404Unless($this->test_appl_sched); $this->test_applicant = TestApplicantPeer::retrieveByPk($this->getRequestParameter('appl_id')); $this->forward404Unless($this->test_applicant); $this->test_schedule = TestSchedulePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($this->test_schedule); $this->department = DepartmentPeer::retrieveByPk($this->getRequestParameter('dept_id')); $this->forward404Unless($this->department); }
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; }