本文整理汇总了PHP中DepartmentPeer类的典型用法代码示例。如果您正苦于以下问题:PHP DepartmentPeer类的具体用法?PHP DepartmentPeer怎么用?PHP DepartmentPeer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DepartmentPeer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doSelectByRegPeriod
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;
}
示例2: getAllParentDepartmentId
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;
}
示例3: filter
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);
}
}
}
}
}
示例4: departmentAvailable
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()
}
示例5: GetDepartment
public static function GetDepartment()
{
$c = new Criteria();
$c->add(DepartmentPeer::STATUS, Constant::RECORD_STATUS_ACTIVE);
$departments = DepartmentPeer::doSelect($c);
return $departments;
}
示例6: select_tag_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);
}
示例7: executeDelete
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');
}
示例8: doSelectByStudent
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;
}
示例9: executeEnquirer
public function executeEnquirer()
{
$this->applicant = $this->applicant;
$this->error = false;
$this->department = DepartmentPeer::retrieveByPK($this->applicant->getDepartment1());
$this->classGroup = ClassGroupPeer::retrieveByPK($this->applicant->getClassGroup1());
}
示例10: generateApplicantCode
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;
}
示例11: executeIndex
/**
* 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');
}
示例12: getCourseModelRecurs
public function getCourseModelRecurs()
{
if (!$this->getCourseModel()) {
if ($this->getParent()) {
$p = DepartmentPeer::retrieveByPK($this->getParent());
return $p->getCourseModelRecurs();
}
return self::CM_CUSTOM;
}
return $this->getCourseModel();
}
示例13: getlist
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);
}
示例14: smsAvailable
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;
}
}
示例15: get
/**
* 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;
}