예제 #1
0
 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);
 }
예제 #2
0
 public static function doFiltered(Criteria $criteria, $con = null)
 {
     $id = sfContext::getInstance()->getRequest()->getParameter('ng_reg_period_id');
     $nrp = NgRegPeriodPeer::retrieveByPK($id);
     $criteria->add(NgRegTestPeriodPeer::NG_REG_PERIOD_ID, $nrp->getId());
     $criteria->add(NgRegTestPeriodPeer::REG_TYPE, NgRegTestPeriod::TEST);
     $criteria->addDescendingOrderByColumn(NgRegTestPeriodPeer::ID);
     return NgRegTestPeriodPeer::doSelect($criteria);
 }
예제 #3
0
 public function getNgRegPeriod($con = null)
 {
     include_once 'lib/model/om/BaseNgRegPeriodPeer.php';
     if ($this->aNgRegPeriod === null && $this->ng_reg_period_id !== null) {
         $this->aNgRegPeriod = NgRegPeriodPeer::retrieveByPK($this->ng_reg_period_id, $con);
     }
     return $this->aNgRegPeriod;
 }
예제 #4
0
 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;
     }
 }
예제 #5
0
 public function executeUpdateScore()
 {
     $this->ng_reg_period = NgRegPeriodPeer::retrieveByPK($this->getRequestParameter('ng_reg_period_id'));
     $this->forward404Unless($this->ng_reg_period);
     $scores = $this->getRequestParameter('score');
     foreach ($scores as $m => $score) {
         $ids = split('_', $m);
         $ng_test_applicant = NgTestApplicantPeer::retrieveByPK($ids[1]);
         $ng_test_applicant->setNgStatusApplicantId(4);
         $ng_test_applicant->save();
     }
     return $this->redirect('ng_reg_detail/list?id=' . $this->ng_reg_period->getId());
 }
예제 #6
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = NgRegPeriodPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setAcademicCalendarId($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setStart($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setEnd($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setCode($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setName($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setGraduationCode($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setStatus($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setCreated($arr[$keys[8]]);
     }
 }
예제 #7
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(NgRegPeriodPeer::ID, $pks, Criteria::IN);
         $objs = NgRegPeriodPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
예제 #8
0
 public static function doSelectJoinAll(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     NgRegTestPeriodPeer::addSelectColumns($c);
     $startcol2 = NgRegTestPeriodPeer::NUM_COLUMNS - NgRegTestPeriodPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     NgRegPeriodPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + NgRegPeriodPeer::NUM_COLUMNS;
     $c->addJoin(NgRegTestPeriodPeer::NG_REG_PERIOD_ID, NgRegPeriodPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = NgRegTestPeriodPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = NgRegPeriodPeer::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->getNgRegPeriod();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addNgRegTestPeriod($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initNgRegTestPeriods();
             $obj2->addNgRegTestPeriod($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
예제 #9
0
 public function executeDelete()
 {
     $ng_reg_period = NgRegPeriodPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($ng_reg_period);
     $ref_error = 0;
     foreach ($ng_reg_period->getRefCountMethods() as $ref) {
         $method = "count" . $ref['affix'];
         $count = $ng_reg_period->{$method}();
         if ($count > 0) {
             ++$ref_error;
             $this->getRequest()->setError('ng_reg_period/delete/' . sfInflector::camelize($ref['table']), $count);
         }
     }
     if ($ref_error > 0) {
         $this->getRequest()->setError('ng_reg_period/delete', '_ERR_DELETE_ (' . $ng_reg_period->toString() . ' - id:' . $ng_reg_period->getId() . ')');
     } else {
         $ng_reg_period->delete();
     }
     return $this->forward('ng_reg_period', 'list');
 }
예제 #10
0
 public static function doSelectJoinAllExceptNgApplicantCategory(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     NgRegPeriodRulePeer::addSelectColumns($c);
     $startcol2 = NgRegPeriodRulePeer::NUM_COLUMNS - NgRegPeriodRulePeer::NUM_LAZY_LOAD_COLUMNS + 1;
     NgRegPeriodPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + NgRegPeriodPeer::NUM_COLUMNS;
     AcademicCostComponentPeer::addSelectColumns($c);
     $startcol4 = $startcol3 + AcademicCostComponentPeer::NUM_COLUMNS;
     JobTypePeer::addSelectColumns($c);
     $startcol5 = $startcol4 + JobTypePeer::NUM_COLUMNS;
     $c->addJoin(NgRegPeriodRulePeer::NG_REG_PERIOD_ID, NgRegPeriodPeer::ID);
     $c->addJoin(NgRegPeriodRulePeer::ACADEMIC_COST_COMPONENT_ID, AcademicCostComponentPeer::ID);
     $c->addJoin(NgRegPeriodRulePeer::JOB_TYPE_ID, JobTypePeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = NgRegPeriodRulePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = NgRegPeriodPeer::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->getNgRegPeriod();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addNgRegPeriodRule($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initNgRegPeriodRules();
             $obj2->addNgRegPeriodRule($obj1);
         }
         $omClass = AcademicCostComponentPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getAcademicCostComponent();
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addNgRegPeriodRule($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj3->initNgRegPeriodRules();
             $obj3->addNgRegPeriodRule($obj1);
         }
         $omClass = JobTypePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj4 = new $cls();
         $obj4->hydrate($rs, $startcol4);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj4 = $temp_obj1->getJobType();
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addNgRegPeriodRule($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj4->initNgRegPeriodRules();
             $obj4->addNgRegPeriodRule($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
예제 #11
0
 public static function doSelectByTestPeriod(Criteria $criteria, $con = null)
 {
     $ng_reg_period_id = sfContext::getInstance()->getRequest()->getParameter('ng_reg_period_id');
     $ng_reg_period = NgRegPeriodPeer::retrieveByPK($ng_reg_period_id);
     if ($ng_reg_period == null) {
         return array();
     }
     $criteria->add(LocationPeer::DEPARTMENT_ID, $ng_reg_period->getAcademicCalendar()->getDepartmentId(), Criteria::IN);
     $tmp_depts = LocationPeer::doSelect($criteria);
     $depts = array();
     foreach ($tmp_depts as $key => $val) {
         $pi = $val->getParentalIndex();
         $prefix = '';
         for ($i = 0; $i < $val->level - 1; $i++) {
             $prefix .= ParamsPeer::retrieveByCode('tree_node_mark')->getValue();
         }
         $val->setCampus($prefix . $val->getCampus());
         $val->setCode($prefix . $val->getCode());
         $depts[$pi] = $val;
     }
     ksort($depts);
     $result = array();
     foreach ($depts as $r) {
         $result[] = $r;
     }
     return $result;
 }