public static function doSelectFiltered(Criteria $criteria, $con = null) { $dept = sfContext::getInstance()->getUser()->getAttribute('department', null, 'bo'); $depts = $dept->getChildRecurs(array()); $criteria->add(AcademicCalendarPeer::DEPARTMENT_ID, $depts, Criteria::IN); $criteria->addJoin(NgRegPeriodPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); $criteria->addDescendingOrderByColumn(NgRegPeriodPeer::ID); return NgRegPeriodPeer::doSelect($criteria); }
public function executeEdit() { $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->ng_test_applicant = NgTestApplicantPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($this->ng_test_applicant); $actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value"))); if ($acl->getRemovePriv()) { array_push($actions, array('name' => 'delete', 'url' => 'ng_test_applicant/delete?id=' . $this->ng_test_applicant->getId(), 'color' => 'red')); } array_push($actions, array('name' => 'cancel', 'url' => 'ng_test_applicant/list', 'color' => 'black')); $cw = new Criteria(); $cw->add(VClassGroupPeer::DEPARTMENT_ID, $this->ng_test_applicant->getDepartmentId()); $objs = VClassGroupPeer::doSelect($cw); ksort($objs); $class_groups = array(); foreach ($objs as $r) { $class_groups[$r->getId()] = $r->toString(); } $this->class_groups = $class_groups; $this->selected_class_group = $this->ng_test_applicant->getId(); $cwt = new Criteria(); $cwt->add(AcademicCalendarPeer::DEPARTMENT_ID, $this->ng_test_applicant->getDepartmentId()); $cwt->addJoin(NgRegPeriodPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); $cwt->add(NgRegPeriodPeer::STATUS, NgRegPeriod::OPEN); $nrps = NgRegPeriodPeer::doSelect($cwt); $periods = array(); foreach ($nrps as $s) { $periods[$s->getId()] = $s->toString(); } $this->ng_reg_periods = $periods; $this->selected_reg_periods = $this->ng_test_applicant->getNgRegTestPeriod()->getNgRegPeriod(); $this->subtitle = $this->ng_test_applicant->getName() . ' - id:' . $this->ng_test_applicant->getId(); $this->type = 'edit'; $this->actions = $actions; $this->tab_attr_tmpl = $this->getContext()->getModuleDirectory() . "/templates/tmplTabSuccess.php"; if ($this->ng_test_applicant->getNgStatusApplicant()->getTypeStatus() != NgStatusApplicant::ONLINE) { $this->tipe = 'applicant'; $actions2 = array(array('name' => 'TestApplicant', 'url' => 'ng_test_applicant/list', 'color' => 'sky')); array_push($actions2, array('name' => 'Identity Detail', 'url' => 'ng_test_applicant/edit?id=' . $this->ng_test_applicant->getId(), 'color' => 'sun', 'type' => 'direct')); array_push($actions2, array('name' => 'Education Detail', 'url' => 'ng_test_applicant/education?id=' . $this->ng_test_applicant->getId(), 'color' => 'sky')); array_push($actions2, array('name' => 'Parents Detail', 'url' => 'ng_test_applicant/parent?id=' . $this->ng_test_applicant->getId(), 'color' => 'sky')); array_push($actions2, array('name' => 'Home Detail', 'url' => 'ng_test_applicant/home?id=' . $this->ng_test_applicant->getId(), 'color' => 'sky')); array_push($actions2, array('name' => 'Medical Detail', 'url' => 'ng_test_applicant/medical?id=' . $this->ng_test_applicant->getId(), 'color' => 'sky')); array_push($actions2, array('name' => 'Talent Detail', 'url' => 'ng_test_applicant/talent?id=' . $this->ng_test_applicant->getId(), 'color' => 'sky')); array_push($actions2, array('name' => 'Achievement Detail', 'url' => 'ng_test_applicant/achievement?id=' . $this->ng_test_applicant->getId(), 'color' => 'sky')); $this->actions2 = $actions2; } else { $this->tipe = 'animo'; $actions2 = array(array('name' => 'TestApplicant', 'url' => 'ng_test_applicant/list', 'color' => 'sky')); array_push($actions2, array('name' => 'Identity Detail', 'url' => 'ng_test_applicant/edit?id=' . $this->ng_test_applicant->getId(), 'color' => 'sun', 'type' => 'direct')); $this->actions2 = $actions2; } }
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(NgRegPeriodPeer::ID, $pks, Criteria::IN); $objs = NgRegPeriodPeer::doSelect($criteria, $con); } return $objs; }