Exemplo n.º 1
0
 public function executeSelectByDept()
 {
     $dept_id = $this->getRequestParameter('department_id');
     $this->forward404Unless($dept_id);
     $content = array();
     $disabled = array();
     $c = new Criteria();
     $c->add(VClassGroupPeer::DEPARTMENT_ID, $dept_id, Criteria::IN);
     $tmp_depts = VClassGroupPeer::doSelect($c);
     $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->setName($prefix . $val->getName());
         $val->setCode($prefix . $val->getCode());
         $depts[$pi] = $val;
     }
     ksort($depts);
     $result = array();
     foreach ($depts as $r) {
         $result[$r->getId()] = $r->toString();
     }
     $this->content = $result;
     $this->disabled = $disabled;
 }
Exemplo n.º 2
0
 public function executeGetClassGroup()
 {
     $departmentId = $this->getRequestParameter('department');
     if (empty($departmentId)) {
         $this->jsonwrapper->show_json_error('missing param', 'Missing parameter department');
     }
     /* get class group */
     $c = new Criteria();
     $c->add(VClassGroupPeer::DEPARTMENT_ID, $departmentId, Criteria::EQUAL);
     $c->addAscendingOrderByColumn(VClassGroupPeer::PARENT);
     $classes = VClassGroupPeer::doSelect($c);
     /* mapping class group */
     $classesArray = array();
     foreach ($classes as $class) {
         $classesArray[$class->getParent()][] = $class->toArray();
     }
     $output = array('success' => true, 'data' => $classesArray);
     $this->jsonwrapper->print_json($output);
 }
Exemplo n.º 3
0
 public function getVClassGroupsRelatedByParent($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseVClassGroupPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collVClassGroupsRelatedByParent === null) {
         if ($this->isNew()) {
             $this->collVClassGroupsRelatedByParent = array();
         } else {
             $criteria->add(VClassGroupPeer::PARENT, $this->getId());
             VClassGroupPeer::addSelectColumns($criteria);
             $this->collVClassGroupsRelatedByParent = VClassGroupPeer::doSelect($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(VClassGroupPeer::PARENT, $this->getId());
             VClassGroupPeer::addSelectColumns($criteria);
             if (!isset($this->lastVClassGroupRelatedByParentCriteria) || !$this->lastVClassGroupRelatedByParentCriteria->equals($criteria)) {
                 $this->collVClassGroupsRelatedByParent = VClassGroupPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastVClassGroupRelatedByParentCriteria = $criteria;
     return $this->collVClassGroupsRelatedByParent;
 }
Exemplo n.º 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;
     }
 }
Exemplo n.º 5
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(VClassGroupPeer::ID, $pks, Criteria::IN);
         $objs = VClassGroupPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Exemplo n.º 6
0
 public static function doSelectByDept($dept)
 {
     $criteria->add(VClassGroupPeer::DEPARTMENT_ID, $dept, Criteria::IN);
     $tmp_depts = VClassGroupPeer::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->setName($prefix . $val->getName());
         $val->setCode($prefix . $val->getCode());
         $depts[$pi] = $val;
     }
     ksort($depts);
     $result = array();
     foreach ($depts as $r) {
         $result[] = $r;
     }
     return $result;
 }
Exemplo n.º 7
0
 public function executeSelectClassByAccal()
 {
     $accal_id = $this->getRequestParameter('accal_id');
     $accal = AcademicCalendarPeer::retrieveByPK($accal_id);
     $content = array();
     $c = new Criteria();
     $c->add(VClassGroupPeer::DEPARTMENT_ID, $accal->getDepartmentId());
     $objs = VClassGroupPeer::doSelect($c);
     foreach ($objs as $key => $val) {
         $pi = $val->getParentalIndex();
         $prefix = '';
         for ($i = 0; $i < $val->level - 1; $i++) {
             $prefix .= ParamsPeer::retrieveByCode('tree_node_mark')->getValue();
         }
         $val->setName($prefix . $val->getName());
         $val->setCode($prefix . $val->getCode());
         $objs[$pi] = $val;
     }
     ksort($objs);
     $content = array();
     foreach ($objs as $r) {
         $content[$r->getId()] = $r->toString();
     }
     $this->content = $content;
     $this->disabled = $disabled;
 }