public static function doSelectByRegPeriod(Criteria $c = null, $rpi = null) { $tsi = null; if ($rpi == null) { $tsi = sfContext::getInstance()->getRequest()->getParameter('id'); } if ($rpi == null && $tsi == null) { return array(); } $ids = ''; if ($rpi != null) { $c = new Criteria(); $c->addJoin(RegPeriodPeer::CURRICULUM_ID, CurriculumPeer::ID); $c->addJoin(CurriculumPeer::DEPARTMENT_ID, DepartmentPeer::ID); $c->add(RegPeriodPeer::ID, $rpi); $dept = DepartmentPeer::doSelectOne($c); $ids = $dept->getIdRecurs(); } if ($tsi != null) { $c = new Criteria(); $c->addJoin(RegPeriodPeer::CURRICULUM_ID, CurriculumPeer::ID); $c->addJoin(CurriculumPeer::DEPARTMENT_ID, DepartmentPeer::ID); $c->addJoin(TestSchedulePeer::REG_TEST_PERIOD_ID, RegTestPeriodPeer::ID); $c->add(TestSchedulePeer::ID, $tsi); $dept = DepartmentPeer::doSelectOne($c); $ids = $dept->getIdRecurs(); } $sql = "select * from test_subject where department_id in ({$ids})"; $connection = Propel::getConnection(); $statement = $connection->createStatement(); $result = $statement->executeQuery($sql, ResultSet::FETCHMODE_NUM); $objs = TestSubjectPeer::populateObjects($result); return $objs; }
public function getAllParentDepartmentId($departmentId) { $thisDepartment = DepartmentPeer::retrieveByPK($departmentId); if (!$thisDepartment) { if (SF_ENVIRONMENT == 'dev') { echo 'department dengan id ' . $departmentId . ' tidak ditemukan'; } return false; } $department = array(); $department[] = $thisDepartment->getId(); $current = $thisDepartment; $stop = false; $n = 0; while (!$stop) { if ($current->getParent() < 1) { $stop = true; break; } $parent = DepartmentPeer::retrieveByPK($current->getParent()); if (!$parent) { $stop = true; break; } else { $department[] = $parent->getId(); $current = $parent; } } return $department; }
public function filter($c, $filters) { $filters_key = array_keys($filters); foreach ($filters_key as $key) { $value = $filters[$key]; if ($value == '' || $value == null) { continue; } $column = DepartmentPeer::getTableMap()->getColumn($key); $name = $column->getFullyQualifiedName(); $creoleType = $column->getCreoleType(); if ($creoleType == CreoleTypes::TIMESTAMP) { $from = $value['from']; $to = $value['to']; if ($from != '' && $from != null) { $c->add($name, $from, Criteria::GREATER_EQUAL); } if ($to != '' && $to != null) { $c->add($name, $to, Criteria::LESS_EQUAL); } } else { if ($creoleType == CreoleTypes::INTEGER) { $c->add($name, $value, Criteria::EQUAL); } else { if ($creoleType == CreoleTypes::VARCHAR) { $c->add($name, "%{$value}%", Criteria::LIKE); } } } } }
public function departmentAvailable($id) { $return = array(); $current = DepartmentPeer::retrieveByPK($id); if ($current) { $return[] = $id; } else { return null; } $childCriteria = new Criteria(); $childCriteria->add(DepartmentPeer::PARENT, $id, Criteria::EQUAL); $child = DepartmentPeer::doSelect($childCriteria); if (!$child) { return $return; } $childArray = array(); foreach ($child as $c) { $return[] = $c->getId(); $childArray[] = $c->getId(); } $moreChildCriteria = new Criteria(); $moreChildCriteria->add(DepartmentPeer::PARENT, $childArray, Criteria::IN); $moreChild = DepartmentPeer::doSelect($moreChildCriteria); if (!$moreChild) { return $return; } foreach ($moreChild as $c) { $return[] = $c->getId(); } return $return; //$moreChildCriteria = new Criteria() }
public static function GetDepartment() { $c = new Criteria(); $c->add(DepartmentPeer::STATUS, Constant::RECORD_STATUS_ACTIVE); $departments = DepartmentPeer::doSelect($c); return $departments; }
function select_tag_departments($name = 'departments', $selected = 2, $options = array()) { $c = new Criteria(); $c->addAscendingOrderByColumn(DepartmentPeer::NAME); $departments = DepartmentPeer::doSelect($c); return select_tag($name, objects_for_select($departments, 'getUuid', 'getName', $selected, array()), $options); }
public function executeDelete(sfWebRequest $request) { $request->checkCSRFProtection(); $this->forward404Unless($department = DepartmentPeer::retrieveByPk($request->getParameter('id')), sprintf('Object department does not exist (%s).', $request->getParameter('id'))); $department->delete(); $this->redirect('admindepartment/index'); }
public static function doSelectByStudent(Criteria $criteria, $con = null) { $usertype = sfContext::getInstance()->getUser()->getAttribute('usertype', 'common', 'bo'); $student = null; $student_id = null; if ($usertype == 'student') { $student_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $student = StudentPeer::retrieveByPK($student_id); } if ($student == null) { $student_id = sfContext::getInstance()->getRequest()->getParameter('student_id'); $student = StudentPeer::retrieveByPK($student_id); } $criteria->add(StudentPeer::CURRICULUM_ID, $student->getCurriculumId()); $criteria->addJoin(StudentPeer::CURRICULUM_ID, CurriculumPeer::ID); $criteria->addJoin(CurriculumPeer::DEPARTMENT_ID, DepartmentPeer::ID); $tmp_depts = DepartmentPeer::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->setdescription($prefix . $val->getDescription()); $val->setCode($prefix . $val->getCode()); $depts[$pi] = $val; } ksort($depts); $result = array(); foreach ($depts as $r) { $result[] = $r; } return $result; }
public function executeEnquirer() { $this->applicant = $this->applicant; $this->error = false; $this->department = DepartmentPeer::retrieveByPK($this->applicant->getDepartment1()); $this->classGroup = ClassGroupPeer::retrieveByPK($this->applicant->getClassGroup1()); }
public function generateApplicantCode($status, $department) { $year = date('Y'); $month = date('m'); if ($status != NgStatusApplicant::CONFIRMED) { $code_appl = 'REG'; } else { $code_appl = 'FRM'; } $dept_code = DepartmentPeer::retrieveByPK($department)->getNumCode() . '-'; $stu_code = ParamsPeer::retrieveByCode('applicant_code'); $sc = $stu_code->getValue(); $sc = explode('$', $sc); array_shift($sc); $code_len = 0; $code = ''; foreach ($sc as $k => $v) { $v = explode('#', $v); if ($v[0] == 'app') { $code_len += $v[1]; $code .= str_pad($code_appl, $v[1], '0', STR_PAD_LEFT); } elseif ($v[0] == 'dept') { $code .= str_pad($dept_code, $v[1], '0', STR_PAD_LEFT); $code_len += $v[1]; } elseif ($v[0] == 'year') { if (strlen($year) <= $v[1]) { $code .= str_pad($year, $v[1], '0', STR_PAD_LEFT); } else { $code .= substr($year, strlen($year) - $v[1]); } $code_len += $v[1]; } elseif ($v[0] == 'month') { if (strlen($month) <= $v[1]) { $code .= str_pad($month, $v[1], '0', STR_PAD_LEFT); } else { $code .= substr($month, strlen($month) - $v[1]); } $code_len += $v[1]; } elseif ($v[0] == 'seq') { $c = new Criteria(); $c->add(NgTestApplicantPeer::CODE, $code . '%', Criteria::LIKE); $c->addDescendingOrderByColumn(NgTestApplicantPeer::CODE); $c->setLimit(1); $last_applicant = NgTestApplicantPeer::doSelectOne($c); if ($last_applicant) { $lap = $last_applicant->getCode(); $lap = substr_replace($lap, '', 0, $code_len); $lap = substr($lap, 0, $v[1]); $lap++; $code .= str_pad($lap, $v[1], '0', STR_PAD_LEFT); } else { $code .= str_pad(1, $v[1], '0', STR_PAD_LEFT); break; } } $sc[$k] = $v; } return $code; }
/** * Executes index action * */ public function executeIndex() { if ($this->getUser()->isAuthenticated()) { $this->redirect('@show_user_personal'); return sfView::SUCCESS; } $this->departments = DepartmentPeer::doSelect(new Criteria()); //$this->forward('default', 'module'); }
public function getCourseModelRecurs() { if (!$this->getCourseModel()) { if ($this->getParent()) { $p = DepartmentPeer::retrieveByPK($this->getParent()); return $p->getCourseModelRecurs(); } return self::CM_CUSTOM; } return $this->getCourseModel(); }
public function getlist($param) { $department_id = $param['department_id']; $departmentAvailable = $this->tools->departmentAvailable($department_id); $this->criteria->add(DepartmentPeer::ID, $departmentAvailable, Criteria::IN); $this->criteria->addAscendingOrderByColumn(DepartmentPeer::NAME); $sectionTemp = DepartmentPeer::doSelect($this->criteria); $sections = array(); foreach ($sectionTemp as $section) { $sections[] = $section->toArray(); } $output = array('success' => 1, 'data' => $sections); $this->jsonwrapper->print_json($output); }
public function smsAvailable($departmentId) { return true; $departmentAvailable = array('TK'); $dc = new Criteria(); $dc->add(DepartmentPeer::CODE, $departmentAvailable, Criteria::IN); $dc->add(DepartmentPeer::ID, $departmentId, Criteria::EQUAL); $department = DepartmentPeer::doSelect($dc); if ($department) { return true; } else { return false; } }
/** * Implementation for 'GET' method for Rest API * * @param mixed $depUid Primary key * * @return array $result Returns array within multiple records or a single record depending if * a single selection was requested passing id(s) as param */ protected function get($depUid = null) { $result = array(); try { $noArguments = true; $argumentList = func_get_args(); foreach ($argumentList as $arg) { if (!is_null($arg)) { $noArguments = false; } } if ($noArguments) { $criteria = new Criteria('workflow'); $criteria->addSelectColumn(DepartmentPeer::DEP_UID); $criteria->addSelectColumn(DepartmentPeer::DEP_PARENT); $criteria->addSelectColumn(DepartmentPeer::DEP_MANAGER); $criteria->addSelectColumn(DepartmentPeer::DEP_LOCATION); $criteria->addSelectColumn(DepartmentPeer::DEP_STATUS); $criteria->addSelectColumn(DepartmentPeer::DEP_REF_CODE); $criteria->addSelectColumn(DepartmentPeer::DEP_LDAP_DN); $dataset = AppEventPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($dataset->next()) { $result[] = $dataset->getRow(); } } else { $record = DepartmentPeer::retrieveByPK($depUid); if ($record) { $result = $record->toArray(BasePeer::TYPE_FIELDNAME); } else { $paramValues = ""; foreach ($argumentList as $arg) { $paramValues .= strlen($paramValues) ? ', ' : ''; if (!is_null($arg)) { $paramValues .= "{$arg}"; } else { $paramValues .= "NULL"; } } throw new RestException(417, "table Department ({$paramValues})"); } } } catch (RestException $e) { throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } return $result; }
public function executeDelete(sfWebRequest $request) { $department = DepartmentPeer::retrieveByPk(Utility::DecryptQueryString($request->getParameter('id'))); if ($department) { $department->setStatus(Constant::RECORD_STATUS_DELETED); if ($department->save()) { $this->getUser()->setFlash('SUCCESS_MESSAGE', Constant::RECORD_STATUS_DELETED_SUCCESSFULLY); } else { $this->getUser()->setFlash('ERROR_MESSAGE', Constant::DB_ERROR); } } else { $this->getUser()->setFlash('ERROR_MESSAGE', Constant::INVALID_REQUEST); } $this->redirect('Department/list'); }
public function executeDelete(sfWebRequest $request) { $request->checkCSRFProtection(); $this->forward404Unless($department = DepartmentPeer::retrieveByPk($request->getParameter('id')), sprintf('Object department does not exist (%s).', $request->getParameter('id'))); try { $department->delete(); if ($request->hasParameter("page")) { $par = "?page=" . $request->getParameter("page"); } $this->redirect('admindepartment/index' . $par); } catch (Exception $e) { $this->globalErrors = $e->getMessage(); $this->department_list = $this->getDepartmentList(); $this->form = new DepartmentForm($department); $this->setTemplate('index'); } }
public function signInTestApplicant($user) { $this->addCredential('bo'); $this->setAttribute('user_id', $user->getId(), 'bo'); $this->setAttribute('username_long', $user->getName(), 'bo'); $this->setAuthenticated2(true, 'bo'); $this->setAttribute('username', $user->getCode(), 'bo'); $this->setAttribute('department_id1', DepartmentPeer::retrieveByPK($user->getDepartment1())->getId(), 'bo'); $this->setAttribute('department1_name', DepartmentPeer::retrieveByPK($user->getDepartment1())->getName(), 'bo'); #$this->setAttribute('department_id2', $user->getDepartment2()? DepartmentPeer::retrieveByPK($user->getDepartment2())->getId() : '', 'bo'); #$this->setAttribute('department2_name', $user->getDepartment2()? DepartmentPeer::retrieveByPK($user->getDepartment2())->getName() : '', 'bo'); $this->setAttribute('class_name1', ClassGroupPeer::retrieveByPK($user->getClassGroup1())->getName(), 'bo'); $this->setAttribute('class_parent1', ClassGroupPeer::retrieveByPK($user->getClassGroup1())->getParentName(), 'bo'); #$this->setAttribute('class_name2', $user->getClassGroup2()? ClassGroupPeer::retrieveByPK($user->getClassGroup2())->getName() : '', 'bo'); #$this->setAttribute('class_parent2', $user->getClassGroup2()? ClassGroupPeer::retrieveByPK($user->getClassGroup2())->getParentName() : '', 'bo'); $this->setAttribute('login_time', time(), 'bo'); }
/** * Verify if exists the title of a Department * * @param string $departmentTitle Title * @param string $departmentUidExclude Unique id of Department to exclude * * return bool Return true if exists the title of a Department, false otherwise */ public function existsTitle($departmentTitle, $departmentUidExclude = "") { try { $delimiter = \DBAdapter::getStringDelimiter(); $criteria = new \Criteria("workflow"); $criteria->addSelectColumn(\DepartmentPeer::DEP_UID); $criteria->addAlias("CT", \ContentPeer::TABLE_NAME); $arrayCondition = array(); $arrayCondition[] = array(\DepartmentPeer::DEP_UID, "CT.CON_ID", \Criteria::EQUAL); $arrayCondition[] = array("CT.CON_CATEGORY", $delimiter . "DEPO_TITLE" . $delimiter, \Criteria::EQUAL); $arrayCondition[] = array("CT.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL); $criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN); if ($departmentUidExclude != "") { $criteria->add(\DepartmentPeer::DEP_UID, $departmentUidExclude, \Criteria::NOT_EQUAL); } $criteria->add("CT.CON_VALUE", $departmentTitle, \Criteria::EQUAL); $rsCriteria = \DepartmentPeer::doSelectRS($criteria); return $rsCriteria->next() ? true : false; } catch (\Exception $e) { throw $e; } }
public function executeSearchByDepartment(sfWebRequest $request) { $conn = Propel::getConnection(); $this->searchType = searchActions::SEARCH_BY_DEPARTMENT; $rawDeptList = DepartmentPeer::getAll($conn); $deptList = array(); foreach ($rawDeptList as $obj) { $deptList[$obj->getId()] = $obj->getId(); } $this->deptList = $deptList; if ($request->hasParameter("deptId")) { $deptId = $request->getParameter("deptId"); if (helperFunctions::isMaliciousString($deptId)) { $this->forward404(); } $this->deptId = $deptId; $deptObj = DepartmentPeer::retrieveByPK($deptId, $conn); $this->resultTitle = "Results for " . $deptObj->getId() . " (" . $deptObj->getDescr() . ")"; $this->results = $deptObj->getCourses(null, $conn); } else { $this->deptId = $rawDeptList[0]->getId(); } }
public function filter($c, $filters) { $filters_key = array_keys($filters); foreach ($filters_key as $key) { $value = $filters[$key]; if ($value == '' || $value == null) { continue; } if ($key == 'DEPARTMENT_ID') { $c->addJoin(DepartmentPeer::ID, AcademicCalendarPeer::DEPARTMENT_ID); $c->addJoin(CounselingPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); $column = DepartmentPeer::getTableMap()->getColumn('ID'); } elseif ($key == 'CODE_CLASS') { $c->addJoin(CounselingPeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $column = ClassGroupPeer::getTableMap()->getColumn('NAME'); } elseif ($key == 'CLASS_GROUP_ID') { $c->addJoin(CounselingPeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $c->addJoin(VClassParentPeer::ID, ClassGroupPeer::PARENT); $column = VClassParentPeer::getTableMap()->getColumn('ID'); } elseif ($key == 'EMPLOYEE_NAME') { $c->addJoin(EmployeePeer::ID, CounselingTutorPeer::EMPLOYEE_ID); $c->addJoin(CounselingPeer::ID, CounselingTutorPeer::COUNSELING_ID); $column = EmployeePeer::getTableMap()->getColumn('NAME'); } else { $column = CounselingPeer::getTableMap()->getColumn($key); } $name = $column->getFullyQualifiedName(); $creoleType = $column->getCreoleType(); if ($creoleType == CreoleTypes::TIMESTAMP) { $from = $value['from']; $to = $value['to']; if ($from != '' && $from != null) { $c->add($name, $from, Criteria::GREATER_EQUAL); } if ($to != '' && $to != null) { $c->add($name, $to, Criteria::LESS_EQUAL); } } else { if ($creoleType == CreoleTypes::INTEGER) { $c->add($name, $value, Criteria::EQUAL); } else { if ($creoleType == CreoleTypes::VARCHAR) { $c->add($name, "%{$value}%", Criteria::LIKE); } } } } }
public static function doSelectJoinAllExceptCampus(Criteria $c, $con = null) { foreach (sfMixer::getCallables('BaseProjectApplicationPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable) { call_user_func($callable, 'BaseProjectApplicationPeer', $c, $con); } $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } ProjectApplicationPeer::addSelectColumns($c); $startcol2 = ProjectApplicationPeer::NUM_COLUMNS - ProjectApplicationPeer::NUM_LAZY_LOAD_COLUMNS + 1; sfGuardUserPeer::addSelectColumns($c); $startcol3 = $startcol2 + sfGuardUserPeer::NUM_COLUMNS; sfGuardUserPeer::addSelectColumns($c); $startcol4 = $startcol3 + sfGuardUserPeer::NUM_COLUMNS; DepartmentPeer::addSelectColumns($c); $startcol5 = $startcol4 + DepartmentPeer::NUM_COLUMNS; $c->addJoin(ProjectApplicationPeer::CREATED_BY, sfGuardUserPeer::ID); $c->addJoin(ProjectApplicationPeer::OWNER_ID, sfGuardUserPeer::ID); $c->addJoin(ProjectApplicationPeer::DEPARTMENT_ID, DepartmentPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = ProjectApplicationPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = sfGuardUserPeer::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->getsfGuardUserRelatedByCreatedBy(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addProjectApplicationRelatedByCreatedBy($obj1); break; } } if ($newObject) { $obj2->initProjectApplicationsRelatedByCreatedBy(); $obj2->addProjectApplicationRelatedByCreatedBy($obj1); } $omClass = sfGuardUserPeer::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->getsfGuardUserRelatedByOwnerId(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addProjectApplicationRelatedByOwnerId($obj1); break; } } if ($newObject) { $obj3->initProjectApplicationsRelatedByOwnerId(); $obj3->addProjectApplicationRelatedByOwnerId($obj1); } $omClass = DepartmentPeer::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->getDepartment(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addProjectApplication($obj1); break; } } if ($newObject) { $obj4->initProjectApplications(); $obj4->addProjectApplication($obj1); } $results[] = $obj1; } return $results; }
public static function doSelectJoinAllExceptGradeSpec(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } GradeComponentPeer::addSelectColumns($c); $startcol2 = GradeComponentPeer::NUM_COLUMNS - GradeComponentPeer::NUM_LAZY_LOAD_COLUMNS + 1; DepartmentPeer::addSelectColumns($c); $startcol3 = $startcol2 + DepartmentPeer::NUM_COLUMNS; $c->addJoin(GradeComponentPeer::DEPARTMENT_ID, DepartmentPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = GradeComponentPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = DepartmentPeer::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->getDepartment(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addGradeComponent($obj1); break; } } if ($newObject) { $obj2->initGradeComponents(); $obj2->addGradeComponent($obj1); } $results[] = $obj1; } return $results; }
<p style="font-size: 10px; margin-top: -7px; margin-left: 150px;"></p> <label style="width: 150px;">Agama *</label> <?php echo object_select_tag($applicant_detail, 'getReligionId', array('related_class' => 'Religion', 'include_blank' => true)); ?> <?php echo form_error('religion_id'); ?> </div> </fieldset> <fieldset style="margin-top: 5px;"> <legend>Program Pilihan</legend> <div> <label style="width: 150px;">Tingkat *</label> <?php echo my_object_select_tag('department_id', 'department_id', DepartmentPeer::getParents(), array('related_class' => 'Department', 'include_blank' => true, 'peer_method' => 'doSelectOrdered')); ?> <?php echo form_error('department_id'); ?> <p style="font-size: 10px; margin-top: -7px; margin-left: 150px;">Pilih Tingkat</p> <label style="width: 150px;">Kelas Pilihan *</label> <?php echo object_select_tag($applicant, 'getClassGroup1', array('related_class' => 'VClassGroup', 'include_blank' => true, 'peer_method' => 'doSelectAll')); ?> <?php echo observe_field('department_id', array('update' => 'class_group1', 'url' => 'applicant/selectByDept', 'with' => "'department_id='+\$('department_id').value")); ?> <?php echo form_error('class_group1'); ?>
public function filterEkskul($c, $filters) { $filters_key = array_keys($filters); foreach ($filters_key as $key) { $value = $filters[$key]; if ($value == '' || $value == null) { continue; } if ($key == 'DEPARTMENT_ID') { $c->addJoin(DepartmentPeer::ID, AcademicCalendarPeer::DEPARTMENT_ID); $c->addJoin(SchedulePeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID); $column = DepartmentPeer::getTableMap()->getColumn('ID'); } elseif ($key == 'CODE_CLASS') { $c->addJoin(SchedulePeer::CLASS_GROUP_ID, ClassGroupPeer::ID); $column = ClassGroupPeer::getTableMap()->getColumn('NAME'); } elseif ($key == 'EMPLOYEE_NAME') { $c->addJoin(SchedulePeer::EMPLOYEE_ID, EmployeePeer::ID); $column = EmployeePeer::getTableMap()->getColumn('NAME'); } elseif ($key == 'SUBJECT_ID') { $c->addJoin(SubjectPeer::ID, SubjectCurrPeer::SUBJECT_ID); $c->addJoin(SubjectCurrPeer::ID, SchedulePeer::SUBJECT_CURR_ID); $column = SubjectPeer::getTableMap()->getColumn('ID'); } elseif ($key == 'SUBJECT_NAME') { $c->addJoin(SubjectPeer::ID, SubjectCurrPeer::SUBJECT_ID); $c->addJoin(SubjectCurrPeer::ID, SchedulePeer::SUBJECT_CURR_ID); $column = SubjectPeer::getTableMap()->getColumn('NAME'); } elseif ($key == 'EKSUL_NAME') { $c->addJoin(SchedulePeer::GRADE_COMPONENT_ID, GradeComponentPeer::ID); $column = GradeComponentPeer::getTableMap()->getColumn('NAME'); } else { $column = SchedulePeer::getTableMap()->getColumn($key); } $name = $column->getFullyQualifiedName(); $creoleType = $column->getCreoleType(); if ($creoleType == CreoleTypes::TIMESTAMP) { $from = $value['from']; $to = $value['to']; if ($from != '' && $from != null) { $c->add($name, $from, Criteria::GREATER_EQUAL); } if ($to != '' && $to != null) { $c->add($name, $to, Criteria::LESS_EQUAL); } } else { if ($creoleType == CreoleTypes::DATE) { $c->add($name, $value, Criteria::LIKE); } else { if ($creoleType == CreoleTypes::INTEGER) { $c->add($name, $value, Criteria::EQUAL); } else { if ($creoleType == CreoleTypes::VARCHAR) { $c->add($name, "%{$value}%", Criteria::LIKE); } } } } } }
public function getDepartment($con = null) { include_once 'lib/model/om/BaseDepartmentPeer.php'; if ($this->aDepartment === null && $this->department_id !== null) { $this->aDepartment = DepartmentPeer::retrieveByPK($this->department_id, $con); } return $this->aDepartment; }
public static function doSelectJoinAllExceptColLocation(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } VOpacPeer::addSelectColumns($c); $startcol2 = VOpacPeer::NUM_COLUMNS - VOpacPeer::NUM_LAZY_LOAD_COLUMNS + 1; CatalogPeer::addSelectColumns($c); $startcol3 = $startcol2 + CatalogPeer::NUM_COLUMNS; DepartmentPeer::addSelectColumns($c); $startcol4 = $startcol3 + DepartmentPeer::NUM_COLUMNS; CatCategoryPeer::addSelectColumns($c); $startcol5 = $startcol4 + CatCategoryPeer::NUM_COLUMNS; ColStatusPeer::addSelectColumns($c); $startcol6 = $startcol5 + ColStatusPeer::NUM_COLUMNS; $c->addJoin(VOpacPeer::CATALOG_ID, CatalogPeer::ID); $c->addJoin(VOpacPeer::DEPARTMENT_ID, DepartmentPeer::ID); $c->addJoin(VOpacPeer::CAT_CATEGORY_ID, CatCategoryPeer::ID); $c->addJoin(VOpacPeer::COL_STATUS_ID, ColStatusPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = VOpacPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = CatalogPeer::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->getCatalog(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addVOpac($obj1); break; } } if ($newObject) { $obj2->initVOpacs(); $obj2->addVOpac($obj1); } $omClass = DepartmentPeer::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->getDepartment(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addVOpac($obj1); break; } } if ($newObject) { $obj3->initVOpacs(); $obj3->addVOpac($obj1); } $omClass = CatCategoryPeer::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->getCatCategory(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addVOpac($obj1); break; } } if ($newObject) { $obj4->initVOpacs(); $obj4->addVOpac($obj1); } $omClass = ColStatusPeer::getOMClass(); $cls = Propel::import($omClass); $obj5 = new $cls(); $obj5->hydrate($rs, $startcol5); $newObject = true; for ($j = 0, $resCount = count($results); $j < $resCount; $j++) { $temp_obj1 = $results[$j]; $temp_obj5 = $temp_obj1->getColStatus(); if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) { $newObject = false; $temp_obj5->addVOpac($obj1); break; } } if ($newObject) { $obj5->initVOpacs(); $obj5->addVOpac($obj1); } $results[] = $obj1; } return $results; }
public function getOwnersByType($data) { $this->setResponseType('json'); $result = new stdclass(); $result->status = 'OK'; try { switch ($data->type) { case 'EVERYBODY': $result->total = 0; $result->owners = array(); break; case 'USER': require_once 'classes/model/Users.php'; $users = array(); $usersInstance = new Users(); $allUsers = $usersInstance->getAll(); foreach ($allUsers->data as $user) { $users[] = array('OWNER_UID' => $user['USR_UID'], 'OWNER_NAME' => $user['USR_FIRSTNAME'] . ' ' . $user['USR_LASTNAME']); } usort($users, function ($str1, $str2) { return strcmp(strtolower($str1["OWNER_NAME"]), strtolower($str2["OWNER_NAME"])); }); $result->total = $allUsers->totalCount; $result->owners = $users; break; case 'DEPARTMENT': require_once 'classes/model/Department.php'; require_once 'classes/model/Content.php'; $departments = array(); //SELECT $criteria = new Criteria('workflow'); $criteria->setDistinct(); $criteria->addSelectColumn(DepartmentPeer::DEP_UID); $criteria->addSelectColumn(ContentPeer::CON_VALUE); //FROM $conditions = array(); $conditions[] = array(DepartmentPeer::DEP_UID, ContentPeer::CON_ID); $conditions[] = array(ContentPeer::CON_CATEGORY, DBAdapter::getStringDelimiter() . 'DEPO_TITLE' . DBAdapter::getStringDelimiter()); $conditions[] = array(ContentPeer::CON_LANG, DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter()); $criteria->addJoinMC($conditions, Criteria::LEFT_JOIN); //WHERE $criteria->add(DepartmentPeer::DEP_STATUS, 'ACTIVE'); //ORDER BY $criteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE); $dataset = DepartmentPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); while ($row = $dataset->getRow()) { $departments[] = array('OWNER_UID' => $row['DEP_UID'], 'OWNER_NAME' => $row['CON_VALUE']); $dataset->next(); } $result->total = DepartmentPeer::doCount($criteria); $result->owners = $departments; break; case 'GROUP': require_once 'classes/model/Groupwf.php'; require_once 'classes/model/Content.php'; $groups = array(); //SELECT $criteria = new Criteria('workflow'); $criteria->setDistinct(); $criteria->addSelectColumn(GroupwfPeer::GRP_UID); $criteria->addSelectColumn(ContentPeer::CON_VALUE); //FROM $conditions = array(); $conditions[] = array(GroupwfPeer::GRP_UID, ContentPeer::CON_ID); $conditions[] = array(ContentPeer::CON_CATEGORY, DBAdapter::getStringDelimiter() . 'GRP_TITLE' . DBAdapter::getStringDelimiter()); $conditions[] = array(ContentPeer::CON_LANG, DBAdapter::getStringDelimiter() . 'en' . DBAdapter::getStringDelimiter()); $criteria->addJoinMC($conditions, Criteria::LEFT_JOIN); //WHERE $criteria->add(GroupwfPeer::GRP_STATUS, 'ACTIVE'); //ORDER BY $criteria->addAscendingOrderByColumn(ContentPeer::CON_VALUE); $dataset = GroupwfPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $dataset->next(); while ($row = $dataset->getRow()) { $groups[] = array('OWNER_UID' => $row['GRP_UID'], 'OWNER_NAME' => $row['CON_VALUE']); $dataset->next(); } $result->total = GroupwfPeer::doCount($criteria); $result->owners = $groups; break; } } catch (Exception $error) { $result->status = 'ERROR'; $result->message = $error->getMessage(); } return $result; }
?> </td> <td class='filter_first'><?php echo input_tag('filters[CODE]', isset($filters['CODE']) ? $filters['CODE'] : null, array('size' => 15)); ?> </td> <td class='filter'><?php echo input_tag('filters[CODE2]', isset($filters['CODE2']) ? $filters['CODE2'] : null, array('size' => 10)); ?> </td> <td class='filter'><?php echo input_tag('filters[NAME]', isset($filters['NAME']) ? $filters['NAME'] : null, array('size' => 15)); ?> </td> <td class='filter'><?php echo my_object_select_tag(isset($filters['DEPARTMENT_ID']) ? $filters['DEPARTMENT_ID'] : null, null, DepartmentPeer::getParents(), array('include_blank' => true, 'related_class' => 'Department', 'peer_method' => 'doSelectFiltered', 'control_name' => 'filters[DEPARTMENT_ID]')); ?> </td> <td class='filter'><?php echo input_tag('filters[YEAR]', isset($filters['YEAR']) ? $filters['YEAR'] : null, array('size' => 5)); ?> </td> <td class='filter'><?php echo object_select_tag(isset($filters['ACADEMIC_CALENDAR_ID']) ? $filters['ACADEMIC_CALENDAR_ID'] : null, null, array('include_blank' => true, 'related_class' => 'AcademicCalendar', 'text_method' => '__toString', 'control_name' => 'filters[ACADEMIC_CALENDAR_ID]', 'peer_method' => 'doSelectFiltered', 'style' => 'width: 130px;')); ?> </td> <td class='filter'><?php echo input_tag('filters[CLASS_NAME]', isset($filters['CLASS_NAME']) ? $filters['CLASS_NAME'] : null, array('size' => 5)); ?> </td> </tr>
public static function doSelectJoinAllExceptAcademicCalendar(Criteria $c, $con = null) { $c = clone $c; if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } LocationPeer::addSelectColumns($c); $startcol2 = LocationPeer::NUM_COLUMNS - LocationPeer::NUM_LAZY_LOAD_COLUMNS + 1; LocationCategoryPeer::addSelectColumns($c); $startcol3 = $startcol2 + LocationCategoryPeer::NUM_COLUMNS; LocationConditionPeer::addSelectColumns($c); $startcol4 = $startcol3 + LocationConditionPeer::NUM_COLUMNS; DepartmentPeer::addSelectColumns($c); $startcol5 = $startcol4 + DepartmentPeer::NUM_COLUMNS; $c->addJoin(LocationPeer::LOCATION_CATEGORY_ID, LocationCategoryPeer::ID); $c->addJoin(LocationPeer::LOCATION_CONDITION_ID, LocationConditionPeer::ID); $c->addJoin(LocationPeer::DEPARTMENT_ID, DepartmentPeer::ID); $rs = BasePeer::doSelect($c, $con); $results = array(); while ($rs->next()) { $omClass = LocationPeer::getOMClass(); $cls = Propel::import($omClass); $obj1 = new $cls(); $obj1->hydrate($rs); $omClass = LocationCategoryPeer::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->getLocationCategory(); if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) { $newObject = false; $temp_obj2->addLocation($obj1); break; } } if ($newObject) { $obj2->initLocations(); $obj2->addLocation($obj1); } $omClass = LocationConditionPeer::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->getLocationCondition(); if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) { $newObject = false; $temp_obj3->addLocation($obj1); break; } } if ($newObject) { $obj3->initLocations(); $obj3->addLocation($obj1); } $omClass = DepartmentPeer::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->getDepartment(); if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) { $newObject = false; $temp_obj4->addLocation($obj1); break; } } if ($newObject) { $obj4->initLocations(); $obj4->addLocation($obj1); } $results[] = $obj1; } return $results; }