本文整理汇总了PHP中DepartmentPeer::retrieveByUuid方法的典型用法代码示例。如果您正苦于以下问题:PHP DepartmentPeer::retrieveByUuid方法的具体用法?PHP DepartmentPeer::retrieveByUuid怎么用?PHP DepartmentPeer::retrieveByUuid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DepartmentPeer
的用法示例。
在下文中一共展示了DepartmentPeer::retrieveByUuid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeUpdateProfile
public function executeUpdateProfile()
{
$profile = $this->getUser()->getProfile();
//$profile->setCampusId($this->getRequestParameter('campus'));
//$profile->setDepartmentId($this->getRequestParameter('department'));
//$profile->setSubdepartmentId($this->getRequestParameter('subdepartment'));
//$profile->setFirstName($this->getRequestParameter('first_name'));
//$profile->setLastName($this->getRequestParameter('last_name'));
//$profile->setTitle($this->getRequestParameter('title'));
//$profile->setPicture($this->getRequestParameter('picture'));
//$privacy = $this->getRequestParameter('privacy');
/*
$tab = $this->getRequestParameter('tab');
if ($tab == "personal")
{
$this->logMessage('tab: ['.$tab.']');
if (is_array($privacy))
{
$privacy = $privacy[0];
}
if (is_numeric($privacy))
{
$profile->setPrivacyLevel($privacy);
}
$department = DepartmentPeer::retrieveByUuid($this->getRequestParameter('department'));
$subdepartment = SubdepartmentPeer::retrieveByUuid($this->getRequestParameter('subdepartment'));
$this->forward404Unless($department != null && $subdepartment != null, 'department or subdepartment not found');
$profile->setDepartmentId($department->getId());
$profile->setSubdepartmentId($subdepartment->getId());
$this->departments = DepartmentPeer::doSelect(new Criteria());
$this->subdepartments = SubdepartmentPeer::doSelect(new Criteria());
$this->getUser()->setCulture($this->getRequestParameter('language', 'en_US');
}
if ($tab == "photo")
{
$this->logMessage('Checking to see if we need to remove the photo');
$currentFile = sfConfig::get('sf_upload_dir')."/photos/".$profile->getPicture();
$photo_remove = $this->getRequestParameter('photo_remove', null);
if (!$this->getRequest()->hasErrors() && !is_null($photo_remove))
{
$this->logMessage('We need to remove it!');
$profile->setNoPicture();
if (is_file($currentFile))
{
unlink($currentFile);
}
}
$this->logMessage('Attempting to set photo');
if (!$this->getRequest()->hasErrors() && $this->getRequest()->getFileSize('photo'))
{
$fileName = md5($this->getRequest()->getFileName('photo').time().rand(0, 99999));
$ext = $this->getRequest()->getFileExtension('photo');
if (is_file($currentFile))
{
unlink($currentFile);
}
$this->getRequest()->moveFile('photo', sfConfig::get('sf_upload_dir')."/photos/".$fileName.$ext);
$profile->setPicture($fileName.$ext);
$this->logMessage('Photo set to ['.$fileName.'.'.$ext.']');
}
$this->logMessage('Was the photo set?');
}
*/
$department = DepartmentPeer::retrieveByUuid($this->getRequestParameter('departments'));
$this->forward404Unless($department, 'Dept not found, unable to set.');
$subdepartment = SubdepartmentPeer::retrieveByName(trim($this->getRequestParameter('subdepartment')));
if ($subdepartment == null) {
$subdept = new Subdepartment();
$subdept->setDepartmentId($department->getId());
$subdept->setName($this->getRequestParameter('subdepartment'));
$subdept->setAbbreviation($this->getRequestParameter('subdepartment'));
$subdept->save();
$subdepartment = $subdept;
}
$profile->setDepartmentId($department->getId());
$profile->setSubdepartmentId($subdepartment->getId());
if ($this->getRequestParameter('about') != null) {
$profile->setAbout($this->getRequestParameter('about'));
}
if ($this->getRequestParameter('gender') == sfConfig::get('app_profile_gender_male') || $this->getRequestParameter('gender') == sfConfig::get('app_profile_gender_female')) {
$profile->setGender($this->getRequestParameter('gender'));
}
if ($this->getRequestParameter('language') != null) {
$this->getUser()->setCulture($this->getRequestParameter('language'));
}
$this->logMessage("User culture set to {$this->getUser}()->getCulture()");
$profile->save();
$contactInfo = $this->getUser()->getProfile()->getPrimaryContactInfo();
//.........这里部分代码省略.........