本文整理汇总了PHP中DepartmentPeer::retrieveByPk方法的典型用法代码示例。如果您正苦于以下问题:PHP DepartmentPeer::retrieveByPk方法的具体用法?PHP DepartmentPeer::retrieveByPk怎么用?PHP DepartmentPeer::retrieveByPk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DepartmentPeer
的用法示例。
在下文中一共展示了DepartmentPeer::retrieveByPk方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: getParentName
public function getParentName()
{
if ($this->getParent() != null && $this->getParent() != 0) {
return DepartmentPeer::retrieveByPk($this->getParent())->getName();
}
return '-';
}
示例3: executeDelete
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');
}
示例4: 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')));
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');
}
}
示例5: addUserToDepartment
public function addUserToDepartment($depId, $userId, $manager, $updateManager = false)
{
try {
//update the field in user table
$oUser = UsersPeer::retrieveByPk($userId);
$user = $oUser->loadDetailed($userId);
$dptoTitle = $this->Load($depId);
if (is_object($oUser) && get_class($oUser) == 'Users') {
$oUser->setDepUid($depId);
$oUser->save();
G::auditLog("AssignUserToDepartament", "Assign user " . $user['USR_USERNAME'] . " (" . $userId . ") to departament " . $dptoTitle['DEPO_TITLE'] . " (" . $depId . ") ");
}
//if the user is a manager update Department Table
if ($manager) {
$oDept = DepartmentPeer::retrieveByPk($depId);
if (is_object($oDept) && get_class($oDept) == 'Department') {
$oDept->setDepManager($userId);
$oDept->save();
}
}
//now update the reportsto to all
if ($updateManager) {
$this->updateDepartmentManager($depId);
}
return true;
} catch (Exception $oError) {
throw $oError;
}
}
示例6: getAllInformation
public function getAllInformation ($userUid)
{
if (! isset( $userUid ) || $userUid == "") {
throw (new Exception( "$userUid is empty." ));
}
try {
require_once ("classes/model/IsoCountry.php");
require_once ("classes/model/IsoLocation.php");
require_once ("classes/model/IsoSubdivision.php");
require_once ("classes/model/Language.php");
G::LoadClass( "calendar" );
$aFields = $this->load( $userUid );
$c = new Criteria( "workflow" );
$c->add( IsoCountryPeer::IC_UID, $aFields["USR_COUNTRY"] );
$rs = IsoCountryPeer::doSelectRS( $c );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rs->next();
$rowC = $rs->getRow();
$c->clearSelectColumns();
$c->add( IsoSubdivisionPeer::IC_UID, $aFields["USR_COUNTRY"] );
$c->add( IsoSubdivisionPeer::IS_UID, $aFields["USR_CITY"] );
$rs = IsoSubdivisionPeer::doSelectRS( $c );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rs->next();
$rowS = $rs->getRow();
$c->clearSelectColumns();
$c->add( IsoLocationPeer::IC_UID, $aFields["USR_COUNTRY"] );
$c->add( IsoLocationPeer::IL_UID, $aFields["USR_LOCATION"] );
$rs = IsoLocationPeer::doSelectRS( $c );
$rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$rs->next();
$rowL = $rs->getRow();
//Calendar
$calendar = new Calendar();
$calendarInfo = $calendar->getCalendarFor( $userUid, $userUid, $userUid );
$aFields["USR_CALENDAR"] = ($calendarInfo["CALENDAR_APPLIED"] != "DEFAULT") ? $calendarInfo["CALENDAR_UID"] : "";
//Photo
$pathPhoto = PATH_IMAGES_ENVIRONMENT_USERS . $userUid . ".gif";
if (! file_exists( $pathPhoto )) {
$pathPhoto = PATH_HOME . "public_html" . PATH_SEP . "images" . PATH_SEP . "user.gif";
}
//Data
$arrayData = array ();
$arrayData["username"] = $aFields["USR_USERNAME"];
$arrayData["firstname"] = $aFields["USR_FIRSTNAME"];
$arrayData["lastname"] = $aFields["USR_LASTNAME"];
$arrayData["mail"] = $aFields["USR_EMAIL"];
$arrayData["address"] = $aFields["USR_ADDRESS"];
$arrayData["zipcode"] = $aFields["USR_ZIP_CODE"];
$arrayData["country"] = $rowC["IC_NAME"];
$arrayData["state"] = $rowS["IS_NAME"];
$arrayData["location"] = $rowL["IL_NAME"];
$arrayData["phone"] = $aFields["USR_PHONE"];
$arrayData["fax"] = $aFields["USR_FAX"];
$arrayData["cellular"] = $aFields["USR_CELLULAR"];
$arrayData["birthday"] = $aFields["USR_BIRTHDAY"];
$arrayData["position"] = $aFields["USR_POSITION"];
$arrayData["replacedby"] = $aFields["USR_REPLACED_BY"];
if(strlen($arrayData["replacedby"] != 0)){
$oUser = UsersPeer::retrieveByPK( $arrayData["replacedby"] );
$arrayData["replacedbyfullname"] = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname();
}
$arrayData["duedate"] = $aFields["USR_DUE_DATE"];
$arrayData["calendar"] = $aFields["USR_CALENDAR"];
if(strlen($aFields["USR_CALENDAR"] != 0)){
$arrayData["calendarname"] = $calendar->calendarName( $aFields["USR_CALENDAR"] );
}
$arrayData["status"] = $aFields["USR_STATUS"];
$arrayData["department"] = $aFields["DEP_UID"];
if (strlen($arrayData["department"]) != 0) {
$oDepart = DepartmentPeer::retrieveByPk( $arrayData["department"] );
$arrayData["departmentname"] = $oDepart->getDepTitle();
}
$arrayData["reportsto"] = $aFields["USR_REPORTS_TO"];
$arrayData["userexperience"] = $aFields["USR_UX"];
$arrayData["photo"] = $pathPhoto;
return $arrayData;
} catch (Exception $e) {
throw $e;
}
}
示例7: executeEditResult
public function executeEditResult()
{
$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->can_add = $acl->getAddPriv() == 1;
$this->can_edit = $acl->getEditPriv() == 1;
$this->can_remove = $acl->getRemovePriv() == 1;
$c = new Criteria();
$c->add(TestApplSchedPeer::TEST_SCHEDULE_ID, $this->getRequestParameter('id'));
$c->add(TestApplSchedPeer::TEST_APPLICANT_ID, $this->getRequestParameter('appl_id'));
$this->test_appl_sched = TestApplSchedPeer::doSelectOne($c);
$this->forward404Unless($this->test_appl_sched);
$this->test_applicant = TestApplicantPeer::retrieveByPk($this->getRequestParameter('appl_id'));
$this->forward404Unless($this->test_applicant);
$this->test_schedule = TestSchedulePeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($this->test_schedule);
$this->department = DepartmentPeer::retrieveByPk($this->getRequestParameter('dept_id'));
$this->forward404Unless($this->department);
}
示例8: executeDelete
public function executeDelete()
{
$department = DepartmentPeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($department);
$ref_error = 0;
foreach ($department->getRefCountMethods() as $ref) {
$method = "count" . $ref['affix'];
$count = $department->{$method}();
if ($count > 0) {
++$ref_error;
$this->getRequest()->setError('department/delete/' . sfInflector::camelize($ref['table']), $count);
}
}
if ($ref_error > 0) {
$this->getRequest()->setError('department/delete', '_ERR_DELETE_ (' . $department->toString() . ' - id:' . $department->getId() . ')');
} else {
$department->delete();
}
return $this->forward('department', 'list');
}
示例9: addUserToDepartment
public function addUserToDepartment($depId, $userId, $manager, $updateManager = false)
{
try {
//update the field in user table
$oUser = UsersPeer::retrieveByPk($userId);
if (is_object($oUser) && get_class($oUser) == 'Users') {
$oUser->setDepUid($depId);
$oUser->save();
}
//if the user is a manager update Department Table
if ($manager) {
$oDept = DepartmentPeer::retrieveByPk($depId);
if (is_object($oDept) && get_class($oDept) == 'Department') {
$oDept->setDepManager($userId);
$oDept->save();
}
}
//now update the reportsto to all
if ($updateManager) {
$this->updateDepartmentManager($depId);
}
return true;
} catch (Exception $oError) {
throw $oError;
}
}
示例10:
echo $applicant_detail->getSchoolOfOriginAddress() ? $applicant_detail->getSchoolOfOriginAddress() : '-';
?>
</p>
<label style="width: 150px;">NISN</label><p style="font-weight: bold; margin-top: -27px; margin-left: 150px;">: <?php
echo $applicant->getCode2() ? $applicant->getCode2() : '-';
?>
</p>
</div>
</fieldset>
<fieldset style="margin-top: 5px;">
<legend>Sekolah Pilihan</legend>
<div>
<label style="width: 150px;">Tingkat *</label><p style="font-weight: bold; margin-top: -27px; margin-left: 150px;">:
<?php
$depart = DepartmentPeer::retrieveByPk($applicant->getDepartment1());
echo $applicant->getDepartment1() ? $depart->toString() : '-';
?>
</p>
<label style="width: 150px;">Kelas Pilihan *</label><p style="font-weight: bold; margin-top: -27px; margin-left: 150px;">:
<?php
$cls = ClassGroupPeer::retrieveByPk($applicant->getClassGroup1());
echo $applicant->getClassGroup1() ? $cls->toString() : '-';
?>
</p>
<?php
if ($depart->getCourseModel() == Department::CM_SMP) {
?>
<label style="width: 150px;">Pilihan Test</label><p style="font-weight: bold; margin-top: -27px; margin-left: 150px;">:
<?php
示例11: executeUpdate
public function executeUpdate()
{
## Kelas yang dipilih
$class = ClassGroupPeer::retrieveByPK($this->getRequestParameter('class_group1'));
$dept = DepartmentPeer::retrieveByPk($this->getRequestParameter('department_id'));
$cd = new Criteria();
$cd->add(AcademicCalendarPeer::CURR_SYSTEM_ID, 2);
$cd->add(AcademicCalendarPeer::COURSE_MODEL, 'C');
$cd->add(AcademicCalendarPeer::DEPARTMENT_ID, $dept->getId());
$accal_applicant = AcademicCalendarPeer::doSelectOne($cd);
$applicant_detail = new TestApplicantDetail();
$applicant_detail->setId($this->getRequestParameter('test_applicant_detail_id'));
$applicant_detail->setShortName($this->getRequestParameter('short_name'));
$applicant_detail->setPob($this->getRequestParameter('pob'));
if ($this->getRequestParameter('dob')) {
$applicant_detail->setDob($this->getRequestParameter('dob'));
}
$applicant_detail->setSex($this->getRequestParameter('sex'));
$applicant_detail->setReligionId($this->getRequestParameter('religion_id'));
$applicant_detail->setCountryId($this->getRequestParameter('country_id'));
$applicant_detail->setNativeLanguage($this->getRequestParameter('native_language'));
$applicant_detail->setFather($this->getRequestParameter('father'));
$applicant_detail->setMother($this->getRequestParameter('mother'));
$applicant_detail->setFatherJob($this->getRequestParameter('father_job'));
$applicant_detail->setMotherJob($this->getRequestParameter('mother_job'));
$applicant_detail->setDetailFatherJob($this->getRequestParameter('detail_father_job'));
$applicant_detail->setDetailMotherJob($this->getRequestParameter('detail_mother_job'));
$applicant_detail->setAddress($this->getRequestParameter('address'));
$applicant_detail->setPostCode($this->getRequestParameter('post_code'));
$applicant_detail->setRegionId($this->getRequestParameter('region_id'));
$applicant_detail->setPhone($this->getRequestParameter('home_phone'));
$applicant_detail->setCellphone($this->getRequestParameter('father_cellphone'));
$applicant_detail->setCompany($this->getRequestParameter('company'));
$applicant_detail->setParentName($this->getRequestParameter('father'));
$applicant_detail->setJobTitle($this->getRequestParameter('job_title'));
$applicant_detail->setSchoolOfOrigin($this->getRequestParameter('school_of_origin'));
$applicant_detail->setSchoolOfOriginAddress($this->getRequestParameter('school_of_origin_address'));
$applicant_detail->setRegNote($this->getRequestParameter('reg_note'));
$applicant_detail->setChildNumber($this->getRequestParameter('child_number'));
$applicant_detail->setBloodSiblings($this->getRequestParameter('blood_siblings'));
$applicant_detail->setStepSiblings($this->getRequestParameter('step_siblings'));
$applicant_detail->setOrphanageStatus($this->getRequestParameter('orphanage_status'));
$applicant_detail->setResidenceStatus($this->getRequestParameter('residence_status'));
$applicant_detail->setHomeDistance($this->getRequestParameter('home_distance'));
$applicant_detail->setTransport($this->getRequestParameter('transport'));
#$applicant_detail->setAcademicCalendarId($accal_applicant->getId());
$applicant_detail->setIllness($this->getRequestParameter('illness'));
$applicant_detail->setIllnessNote($this->getRequestParameter('illness_note'));
$applicant_detail->setGraduationGrade($this->getRequestParameter('graduation_grade'));
$applicant_detail->setGraduationYear($this->getRequestParameter('graduation_year'));
$applicant_detail->setBloodType($this->getRequestParameter('blood_type'));
$applicant_detail->setTall($this->getRequestParameter('tall'));
$applicant_detail->setWeight($this->getRequestParameter('weight'));
$applicant_detail->save();
$applicant = new TestApplicant();
$is_new = true;
$applicant->setId($this->getRequestParameter('id'));
$applicant->setName($this->getRequestParameter('name'));
$applicant->setCode2($this->getRequestParameter('code2'));
$applicant->setClassGroup1($this->getRequestParameter('class_group1'));
$applicant->setDepartment1($this->getRequestParameter('department_id'));
## Siswa Dalam
if ($this->getRequestParameter('is_alazhar') == TestApplicant::IS_ALAZHAR) {
$code_appl = '.' . $dept->getCode() . '.A';
} else {
$code_appl = '.' . $dept->getCode() . '.B';
}
$stu_code = ParamsPeer::retrieveByCode('sma_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] == 'year') {
$code_a = substr($accal_applicant->getName(), 2, 2);
$code_b = substr($accal_applicant->getName(), 7, 2);
$yr = $code_a . '/' . $code_b;
if (strlen($yr) <= $v[1]) {
$code .= str_pad($yr, $v[1], '0', STR_PAD_LEFT);
} else {
$code .= substr($yr, strlen($yr) - $v[1]);
}
$code_len += $v[1];
} elseif ($v[0] == 'app') {
$code_len += $v[1];
$code .= str_pad($code_appl, $v[1], '0', STR_PAD_LEFT);
} elseif ($v[0] == 'seq') {
$c = new Criteria();
$c->add(TestApplicantPeer::CODE, $code . '%', Criteria::LIKE);
$c->addDescendingOrderByColumn(TestApplicantPeer::CODE);
$c->setLimit(1);
$last_applicant = TestApplicantPeer::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);
//.........这里部分代码省略.........
示例12: executeEditLocation
public function executeEditLocation()
{
$group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
$c = new Criteria();
$c->add(JobPeer::CODE, 'reg_test_period');
$job = JobPeer::doSelectOne($c);
$acl = AclPeer::retrieveByPK($group_id, $job->getId());
if (!$acl) {
$this->forward('default', 'error404');
}
$this->can_add = $acl->getAddPriv() == 1;
$this->can_edit = $acl->getEditPriv() == 1;
$this->can_remove = $acl->getRemovePriv() == 1;
$test_schedule = TestSchedulePeer::retrieveByPk($this->getRequestParameter('id'));
$this->test_schedule = $test_schedule;
$c = new Criteria();
$c->add(TestApplSchedPeer::TEST_SCHEDULE_ID, $test_schedule->getId());
$c->addJoin(TestApplicantPeer::ID, TestApplSchedPeer::TEST_APPLICANT_ID);
$c->addDescendingOrderByColumn(TestApplSchedPeer::AVG_GRADE);
$this->applicants = TestApplicantPeer::doSelect($c);
$this->forward404Unless($this->applicants);
$dept_id = DepartmentPeer::retrieveByPk($test_schedule->getRegTestPeriod()->getRegPeriod()->getAcademicCalendar()->getDepartmentId());
$this->dept_id = $dept_id;
$dept = sfContext::getInstance()->getUser()->getAttribute('department', null, 'bo');
$depts = $dept->getChildRecurs(array());
$locate_options = array();
$c = new Criteria();
$c->add(AcademicCalendarPeer::DEPARTMENT_ID, $dept_id->getId());
$c->addJoin(RegPeriodPeer::ACADEMIC_CALENDAR_ID, AcademicCalendarPeer::ID);
$c->addJoin(RegTestPeriodPeer::REG_PERIOD_ID, RegPeriodPeer::ID);
$c->addJoin(TestSchedulePeer::REG_TEST_PERIOD_ID, RegTestPeriodPeer::ID);
$c->addDescendingOrderByColumn(TestSchedulePeer::LOCATION_ID);
$accals = TestSchedulePeer::doSelect($c);
foreach ($accals as $accal) {
$locate_options[$accal->getId()] = $accal->getLocation()->getCampus();
}
$this->locate_options = $locate_options;
$cr = new Criteria();
$cr->add(TestSubjectPeer::DEPARTMENT_ID, $dept->getId());
$this->t_subject = TestSubjectPeer::doSelect($cr);
$this->t_count = TestSubjectPeer::doCount($cr);
$rpp = $this->getRequestParameter('max_per_page', 999);
$pager = new sfPropelPager('TestApplicant', $rpp);
$pager->setCriteria($c);
$pager->setPage($this->getRequestParameter('page', 1));
$pager->init();
$this->pager = $pager;
$actions = array(array('name' => 'save', 'type' => 'submit', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value")));
array_push($actions, array('name' => 'cancel', 'url' => 'locate_test/listApplicant?id=' . $test_schedule->getId(), 'color' => 'black'));
$type = 'edit';
$subtitle = $test_schedule->getRegTestPeriod()->getName() . ' - ' . $test_schedule->getRegTestPeriod()->getRegPeriod()->toString();
$this->actions = $actions;
$this->subtitle = $subtitle;
$this->type = $type;
$actions2 = array(array('name' => '<span>Daftar Ruangan Test</span>', 'url' => 'locate_test/listTest?id=' . $test_schedule->getRegTestPeriodId() . '®_period_id=' . $test_schedule->getRegTestPeriod()->getRegPeriodId(), 'color' => 'sky'));
array_push($actions2, array('name' => '<span>Jumlah Peserta</span>', 'url' => 'locate_test/listApplicant?id=' . $test_schedule->getId(), 'color' => 'sky'));
array_push($actions2, array('name' => '<span>Penilaian Peserta</span>', 'url' => 'locate_test/editApplicant?id=' . $test_schedule->getId(), 'color' => 'sky'));
array_push($actions2, array('name' => '<span>Lokasi Peserta</span>', 'url' => 'locate_test/editLocation?id=' . $test_schedule->getId(), 'color' => 'sun', 'type' => 'direct'));
$this->actions2 = $actions2;
}