本文整理汇总了PHP中DepartmentPeer::retrieveByPK方法的典型用法代码示例。如果您正苦于以下问题:PHP DepartmentPeer::retrieveByPK方法的具体用法?PHP DepartmentPeer::retrieveByPK怎么用?PHP DepartmentPeer::retrieveByPK使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DepartmentPeer
的用法示例。
在下文中一共展示了DepartmentPeer::retrieveByPK方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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());
}
示例2: 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()
}
示例3: 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;
}
示例4: 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;
}
示例5: 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();
}
示例6: 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;
}
示例7: signInTestApplicant
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');
}
示例8: executeSearchByDepartment
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();
}
}
示例9: __
</td>
</tr>
</table>
</td>
<td width="50%" class="first">
<table border="0" width="100%">
<tr>
<td class="first" style="vertical-align:middle;" width="30%"><label><?php
echo __('Department_2');
?>
</label></td>
<td class="first" width="2%" style="text-align:center; vertical-align:middle;">:</td>
<td class="first" style="vertical-align:middle;">
<p class="detail">
<b><?php
echo $test_applicant->getDepartment2() ? DepartmentPeer::retrieveByPK($test_applicant->getDepartment2())->toString() : '-';
?>
</b></p>
</td>
</tr>
<tr>
<td style="vertical-align:middle;" width="30%"><label><?php
echo __('Class Group');
?>
</label></td>
<td width="2%" style="text-align:center; vertical-align:middle;">:</td>
<td style="vertical-align:middle;">
<p class="detail"><b>
<?php
echo $test_applicant->getClassGroup2() ? ClassGroupPeer::retrieveByPK($test_applicant->getClassGroup2())->toString() : '-';
?>
示例10: executeGetByDepartment
public function executeGetByDepartment()
{
$dept_id = $this->getRequestParameter('department_id');
$dept = DepartmentPeer::retrieveByPK($dept_id);
$this->forward404Unless($dept);
$c = new Criteria();
$c->add(AcademicCalendarPeer::CURRICULUM_ID, CurriculumPeer::ID);
$c->add(CurriculumPeer::DEPARTMENT_ID, $dept_id);
$objs = AcademicCalendarPeer::doSelectFiltered($c);
$array = array();
if ($this->getRequestParameter('include_blank') == 'true') {
$array[] = '';
}
foreach ($objs as $obj) {
$array[$obj->getId()] = $obj->toString();
}
$this->content = $array;
$this->setTemplate('buildOptions');
}
示例11: Criteria
?>
</div>
<div style="float:left; width: 50%;">
<h2 class="titlesubmenu">Username</h2>
<h3 class="titletext"><?php
echo $this->getContext()->getUser()->getAttribute('username', '', 'bo');
?>
</h3>
<h2 class="titlesubmenu">Role</h2>
<h3 class="titletext"><?php
echo UserGroupPeer::retrieveByPK($this->getContext()->getUser()->getAttribute('group_id', '', 'bo'))->getName();
?>
</h3>
<h2 class="titlesubmenu">Tingkat</h2>
<h3 class="titletext"><?php
echo DepartmentPeer::retrieveByPK($this->getContext()->getUser()->getAttribute('department_id', '', 'bo'))->getName();
?>
</h3>
</div>
</div>
<?php
$c = new Criteria();
$dept = $this->getContext()->getUser()->getAttribute('department', null, 'bo');
$c->add(PublicInformationPeer::DEPARTMENT_ID, $dept->getChildRecurs(), Criteria::IN);
$c->add(PublicInformationPeer::PUBLISHED, 1, Criteria::IN);
$information = PublicInformationPeer::doSelect($c);
?>
<div class="home_news">
<h1 class="titlecontent"><?php
echo __('PublicInformation');
?>
示例12: elseif
</td>
<td class='first' nowrap>
<?php
echo DepartmentPeer::retrieveByPK($test_applicant->getDepartment1())->toString() . ' (' . $test_applicant->getIsPass1() . '-' . $test_applicant->getRank1() . ')';
?>
</td>
<td class='first'><?php
echo ClassGroupPeer::retrieveByPK($test_applicant->getClassGroup1())->toString();
?>
</td>
<td class='first'><?php
echo $test_applicant->getRegTestPeriod1() ? RegTestPeriodPeer::retrieveByPK($test_applicant->getRegTestPeriod1())->getRegPeriod()->getName() : '-';
?>
</td>
<td nowrap><?php
echo $test_applicant->getDepartment2() ? DepartmentPeer::retrieveByPK($test_applicant->getDepartment2())->toString() . ' (' . $test_applicant->getIsPass1() . '-' . $test_applicant->getRank1() . ')' : '-';
?>
</td>
<td><?php
echo $test_applicant->getClassGroup2() ? ClassGroupPeer::retrieveByPK($test_applicant->getClassGroup2())->toString() : '-';
?>
</td>
<td><?php
echo $test_applicant->getRegTestPeriod2() ? RegTestPeriodPeer::retrieveByPK($test_applicant->getRegTestPeriod2())->getRegPeriod()->getName() : '-';
?>
</td>
<td ><?php
if ($test_applicant->getApplicantType() == TestApplicant::STATUS_NEW) {
echo __('Baru');
} elseif ($test_applicant->getApplicantType() == TestApplicant::STATUS_TRANSFER) {
echo __('Pindahan');
示例13: save
public function save($param)
{
$department_id = $param['department_id'];
$departmentAvailable = $this->tools->departmentAvailable($department_id);
$article = new WebArticle();
if (empty($param['section'])) {
$this->jsonwrapper->show_json_error('section', 'Kolom section harap diisi.');
}
$articleSection = DepartmentPeer::retrieveByPK($param['section']);
if (!$articleSection) {
$this->jsonwrapper->show_json_error('type', 'Kolom article type harap diisi.');
}
if (!in_array($param['section'], $departmentAvailable)) {
$this->jsonwrapper->show_json_error('forbidden', 'Maaf, anda tidak dapat membuat article dalam section ini.');
}
if (empty($param['title'])) {
$this->jsonwrapper->show_json_error('title', 'Kolom title harap diisi.');
}
if (empty($param['initial'])) {
$this->jsonwrapper->show_json_error('initial', 'Kolom initial harap diisi.');
}
if (empty($param['description'])) {
$this->jsonwrapper->show_json_error('description', 'Kolom description harap diisi.');
}
if (!empty($param['id'])) {
$article = WebArticlePeer::retrieveByPK($param['id']);
if (!$article) {
$this->jsonwrapper->show_json_error('id', 'Article tidak ditemukan.');
}
if (!in_array($article->getDepartmentId(), $departmentAvailable)) {
$this->jsonwrapper->show_json_error('forbidden', 'Maaf, anda tidak dapat mengedit article ini.');
}
} else {
$article->setPublished(0);
$article->setCreated(date('Y-m-d H:i:s'));
}
/* Add */
$article->setTitle($param['title']);
$article->setInitial($param['initial']);
$article->setDepartmentId($param['section']);
$article->setDescription($param['description']);
if (!$article->validate()) {
var_dump($article->validate());
}
$article->save();
$output = array('success' => 1, 'data' => $param);
$this->jsonwrapper->print_json($output);
}
示例14: doImport
/**
* Start browsing the directory and register files
*
* @return Exception code = 400 if directory non-existent
* An array containing list of non-imported files if successful
*/
public function doImport()
{
if (!file_exists($this->_dir)) {
throw new Exception("directory non-existent", 400);
}
$errArr = array();
$handler = opendir($this->_dir);
// TODO: does not do recrusive listing, do we need that?
while (false !== ($file = readdir($handler))) {
if ($file != '.' && $file != '..') {
$err = false;
$pos = strrpos($file, '.');
$fileName = strtoupper(substr($file, 0, $pos));
$token = strtok($fileName, '_');
$counter = 0;
while (false !== $token) {
switch ($counter) {
case 0:
if (strlen($token) != 7) {
$err = true;
}
$rawCourseCode = $token;
break;
case 1:
if ($token != substr($this->_year, 0, 4)) {
$err = true;
}
break;
case 2:
if ($token != "EXAM") {
if (substr($token, 0, 5) == "EXAM(") {
// name could have the following syntax: AER205S_2009_EXAM(2).pdf
$count = strtok($token, '(');
$count = strtok('(');
$count = strtok($count, ')');
if ($count === false || !is_numeric($count)) {
$err = true;
}
} else {
$err = true;
}
}
break;
}
$token = strtok("_");
$counter++;
}
if ($counter != 3 || $err) {
$err = true;
} else {
// assume course code is 7 chars in length with the last char being either S, F or Y
$part1 = substr($rawCourseCode, 0, 6);
//e.g. AER205
$part2 = substr($rawCourseCode, 6, 1);
//e.g. F
switch ($part2) {
case "F":
case "S":
$courseCode = $part1 . "H1";
$descr = $part1 . " " . $this->_year . " Official Exam" . (isset($count) ? ' (' . $count . ')' : '');
break;
case "Y":
$courseCode = $part1 . "Y1";
$descr = $part1 . " " . $this->_year . " Official Exam" . (isset($count) ? ' (' . $count . ')' : '');
break;
default:
$err = true;
break;
}
if (!$err) {
$conn = Propel::getConnection();
// check if we have exam of this descr already
$examArr = ExamPeer::getExamsForYearAndCourseId($courseCode, $this->_year, $conn);
foreach ($examArr as $ex) {
if ($ex->getType() == EnumItemPeer::EXAM && $ex->getDescr() == $descr) {
$err = true;
break;
}
}
if (!$err) {
// first check if course exists
$course = CoursePeer::retrieveByPK($courseCode, $conn);
if (!isset($course)) {
$course = new Course();
//$course->setDeptId(substr($courseCode, 0, 3));
$course->setDescr($courseCode);
$course->setIsEng(1);
$course->setId($courseCode);
$dept = DepartmentPeer::retrieveByPK(substr($courseCode, 0, 3), $conn);
if (!isset($dept)) {
$dept = new Department();
$dept->setId(substr($courseCode, 0, 3));
$dept->setDescr(substr($courseCode, 0, 3));
$dept->save($conn);
//.........这里部分代码省略.........
示例15: remove
/**
* Remove the row
*
* @param array $aData or string $ProUid
* @return string
*
*/
public function remove($ProUid)
{
if (is_array($ProUid)) {
$ProUid = isset($ProUid['DEP_UID']) ? $ProUid['DEP_UID'] : '';
}
try {
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(UsersPeer::USR_UID);
$oCriteria->add(UsersPeer::DEP_UID, $ProUid, Criteria::EQUAL);
$oDataset = UsersPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aFields = array();
while ($aRow = $oDataset->getRow()) {
$aFields['USR_UID'] = $aRow['USR_UID'];
$aFields['DEP_UID'] = '';
$oDepto = UsersPeer::retrieveByPk($aFields['USR_UID']);
if (is_object($oDepto) && get_class($oDepto) == 'UsersPeer') {
return true;
} else {
$oDepto = new Users();
$oDepto->update($aFields);
}
$oDataset->next();
}
$oPro = DepartmentPeer::retrieveByPK($ProUid);
if (!is_null($oPro)) {
$dptoTitle = $this->Load($oPro->getDepUid());
Content::removeContent('DEPO_TITLE', '', $oPro->getDepUid());
Content::removeContent('DEPO_DESCRIPTION', '', $oPro->getDepUid());
G::auditLog("DeleteDepartament", "Departament Name: " . $dptoTitle['DEPO_TITLE'] . " Departament ID: (" . $oPro->getDepUid() . ") ");
return $oPro->delete();
} else {
throw new Exception("The row '{$ProUid}' in table Group doesn't exist!");
}
} catch (Exception $oError) {
throw $oError;
}
}