本文整理汇总了PHP中sfGuardUserPeer::retrieveByPK方法的典型用法代码示例。如果您正苦于以下问题:PHP sfGuardUserPeer::retrieveByPK方法的具体用法?PHP sfGuardUserPeer::retrieveByPK怎么用?PHP sfGuardUserPeer::retrieveByPK使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfGuardUserPeer
的用法示例。
在下文中一共展示了sfGuardUserPeer::retrieveByPK方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @param sfWebRequest $request
* @return void
*/
public function execute($request)
{
$this->user = sfGuardUserPeer::retrieveByPK($request->getParameter('id'));
$this->forward404Unless($this->user, 'User Not Found');
$this->statusActions = StatusActionPeer::getStatusActionsForBoard($this->user->getId());
$this->commentBoards = CommentPeer::getCommentsForBoard($this->user->getId());
}
示例2: getSfGuardUser
function getSfGuardUser()
{
if (!$this->sf_guard_user) {
$this->sf_guard_user = sfGuardUserPeer::retrieveByPK($this->sf_guard_user_id);
}
return $this->sf_guard_user;
}
示例3: bindAndSave
/**
* Bind values and save new password
* @param array $values tainted values
* @return boolean
*/
public function bindAndSave(array $values)
{
$this->bind($values);
if ($this->isValid()) {
$user = sfGuardUserPeer::retrieveByPK($this->getOption('userid'));
$user->setPassword($values['password']);
$user->save();
return true;
} else {
return false;
}
}
示例4: executeConfirmation
public function executeConfirmation($request)
{
$key = $request->getParameter('key');
if ($key) {
$user_profile = sfGuardUserProfilePeer::retrieveByActivationKey($key);
if ($user_profile) {
$user = sfGuardUserPeer::retrieveByPK($user_profile->getUserId());
$user->setIsActive(true);
$user->save();
$this->getUser()->setFlash('info', 'Your account has been activated.');
$this->forward('site', 'message');
}
}
$this->getUser()->setFlash('error', 'Activation link is not valid.');
$this->forward('site', 'message');
}
示例5: executeChangeGradeItem
public function executeChangeGradeItem(sfWebRequest $request)
{
if ($request->isXmlHttpRequest()) {
if ($request->getParameter('idgradeunit') != '') {
try {
updateGradeImte($request->getParameter('idgradeunit'), $request->getParameter('idhorario'), $request->getParameter('iddisciplina'), $request->getParameter('idprofessor'), $request->getParameter('idlocal'), $request->getParameter('idweekday'));
} catch (Exception $e) {
}
$c = new Criteria();
$c->add(GradeunitPeer::ID, intval($request->getParameter('idgradeunit')));
$this->content = ContentPeer::doSelectOne($c);
if ($this->content) {
$this->user = sfGuardUserPeer::retrieveByPK($this->content->getUserId());
}
return $this->content ? sfView::SUCCESS : sfView::ERROR;
}
}
$this->forward404();
}
示例6: getsfGuardUser
public function getsfGuardUser($con = null)
{
if ($this->asfGuardUser === null && $this->user_id !== null) {
include_once 'plugins/sfGuardPlugin/lib/model/om/BasesfGuardUserPeer.php';
$this->asfGuardUser = sfGuardUserPeer::retrieveByPK($this->user_id, $con);
}
return $this->asfGuardUser;
}
示例7: executeConfirmRegistrationText
public function executeConfirmRegistrationText()
{
sfPropelApprovableBehavior::disable();
$this->user = sfGuardUserPeer::retrieveByPK($this->getRequest()->getAttribute('user_id'));
$this->url = $this->user->getApprovalUrl();
}
示例8: executeJsonUpdateUserService
public function executeJsonUpdateUserService(sfWebRequest $request)
{
$isAjax = $request->isXmlHttpRequest();
if (!$isAjax) {
return $this->redirect('@homepage');
}
$id = $request->getParameter('id');
if (!($sf_user = sfGuardUserPeer::retrieveByPK($id))) {
$msg_i18n = $this->getContext()->getI18N()->__(sfGuardUserPeer::_ERR_NOTFOUND_ID_, array('%id%' => $id));
$error = array('success' => false, 'agent' => sfConfig::get('config_acronym'), 'error' => $msg_i18n, 'info' => $msg_i18n);
// if is browser request return text renderer
$error = $this->setJsonError($error);
return $this->renderText($error);
}
$service_id = $request->getParameter('service_id');
//$this->forward404Unless($etva_service = EtvaServicePeer::retrieveByPk($service_id), sprintf('Object etva_service does not exist (%s).', $service_id));
if (!EtvaServicePeer::retrieveByPk($service_id)) {
$msg_i18n = $this->getContext()->getI18N()->__('Object etva_service does not exist (%service_id%).', array('%service_id%' => $service_id));
$error = array('success' => false, 'agent' => sfConfig::get('config_acronym'), 'error' => $msg_i18n, 'info' => $msg_i18n);
// if is browser request return text renderer
$error = $this->setJsonError($error);
return $this->renderText($error);
}
$etva_user_service = EtvaUserServicePeer::retrieveByPK($id, $service_id);
if (!$etva_user_service) {
$etva_user_service = new EtvaUserService();
$etva_user_service->setUserId($id);
$etva_user_service->setServiceId($service_id);
}
$extra = $request->getParameter('extra');
$etva_user_service->setExtra($extra);
$etva_user_service->save();
$msg_i18n = $this->getContext()->getI18N()->__('User and service saved successfully');
$response = array('success' => true, 'agent' => 'Central Management', 'response' => $msg_i18n, 'user_id' => $id, 'service_id' => $service_id);
$return = json_encode($response);
$this->getResponse()->setHttpHeader('Content-type', 'application/json');
return $this->renderText($return);
}
示例9: userExists
/**
* Check if a user exists given to an id.
* @param Int $user_id
* @return Boolean
*/
public static function userExists($id)
{
return sfGuardUserPeer::retrieveByPK($id) ? true : false;
}
示例10: executePermissions
public function executePermissions(sfWebRequest $request)
{
$module = 'sfGuardUser';
if (!in_array($module, array_keys(sfPlop::getSafePluginModules()))) {
$this->redirect('@sf_plop_dashboard');
}
if ($request->isMethod(sfRequest::POST)) {
if ($request->isXmlHttpRequest()) {
$this->setTemplate('ajaxPermissions');
$this->setLayout(false);
}
$group_id = $request->getParameter('g');
$user_id = $request->getParameter('u');
$permission_id = $request->getParameter('p');
if ($group_id) {
$group_exists = sfPlopGuard::groupExists($group_id);
if (!$group_exists && $request->isXmlHttpRequest()) {
return sfView::ERROR;
} else {
if (!$group_exists) {
$this->redirect('@sf_plop_dashboard_permissions');
}
}
}
if ($user_id) {
$user_exists = sfPlopGuard::userExists($user_id);
if (!$user_exists && $request->isXmlHttpRequest()) {
return sfView::ERROR;
} else {
if (!$user_exists) {
$this->redirect('@sf_plop_dashboard_permissions');
}
}
}
if (isset($group_exists) && isset($user_exists)) {
$user_group = sfGuardUserGroupPeer::retrieveByPK($user_id, $group_id);
if ($user_group) {
$user_group->delete();
} else {
$user_group = new sfGuardUsergroup();
$user_group->setUserId($user_id);
$user_group->setGroupId($group_id);
$user_group->save();
$this->getResponse()->setStatusCode(201);
}
}
if ($permission_id) {
if ($permission_id == 'super') {
if (!sfPlopGuard::isLastSuperAdminUser($user_id)) {
$user = sfGuardUserPeer::retrieveByPK($user_id);
if ($user->getIsSuperAdmin()) {
$user->setIsSuperAdmin(false);
} else {
$user->setIsSuperAdmin(true);
}
$user->save();
} else {
$this->getResponse()->setStatusCode(202);
return sfView::ERROR;
}
} else {
if (!is_int($permission_id)) {
$permission_exists = sfPlopGuard::permissionExists($permission_id);
if (!$permission_exists) {
$modules = sfPlop::getSafePluginModules();
if ($request->isXmlHttpRequest() && !isset($modules[$permission_id])) {
return sfView::ERROR;
} elseif (!isset($modules[$permission_id])) {
$this->redirect('@sf_plop_dashboard_permissions');
} else {
$module = $modules[$permission_id];
}
$permission = new sfGuardPermission();
$permission->setName($permission_id);
$permission->setDescription($module['name']);
$permission->save();
$permission_id = $permission->getId();
$this->getResponse()->setStatusCode(201);
} else {
$permission_id = sfPlopGuard::getPermission($permission_id)->getId();
}
} else {
$permission_exists = sfPlopGuard::permissionExists($permission_id);
if (!$permission_exists && $request->isXmlHttpRequest()) {
return sfView::ERROR;
} else {
if (!$permission_exists) {
$this->redirect('@sf_plop_dashboard_permissions');
}
}
}
if (isset($user_exists)) {
$user_permission = sfGuardUserPermissionPeer::retrieveByPK($user_id, $permission_id);
if ($user_permission) {
$user_permission->delete();
} else {
$user_permission = new sfGuardUserPermission();
$user_permission->setUserId($user_id);
$user_permission->setPermissionId($permission_id);
$user_permission->save();
//.........这里部分代码省略.........
示例11: addComment
public function addComment($comment)
{
// Comment *should* have author_id filled in
// TERRIBLY f***ing hackish...no multiple inheritance...this seems to be the only way to overrride plugin behavior per-object
$commentable = new sfPropelActAsCommentableBehavior();
$comment['text'] = $comment['text'];
$commentable->addComment($this, $comment);
$author = sfGuardUserPeer::retrieveByPK($comment['author_id'])->getProfile();
if ($author == null) {
$name = "anonymous";
} else {
$name = $author->getFullName();
}
$this->addHistoryEvent('A new comment for project ' . $this->getTitle(), 'A new comment has been added to the project ' . $this->getTitle() . ' by ' . $name);
}
示例12: validateReset
public function validateReset()
{
$this->id = $this->getUser()->getAttribute('Reset', false, 'sfApplyPlugin', false);
if (!$this->id) {
// No need to be polite, this is probably a hack attempt
$this->forward404();
}
if ($this->getRequest()->getMethod() == sfRequest::POST) {
$password = $this->getRequestParameter('password');
$password2 = $this->getRequestParameter('password2');
if ($password !== $password2) {
$this->getRequest()->setError('password', "Passwords do not match.");
return false;
}
$this->sfGuardUser = sfGuardUserPeer::retrieveByPK($this->id);
if (!$this->sfGuardUser) {
// No need to be polite, this is probably a hack attempt
$this->forward404();
}
}
return true;
}
示例13: executeUpdate
/**
* Save client profile content
* @param web request $request
*/
public function executeUpdate($request)
{
/**login user infomation**/
$sf_user = $this->getUser();
$sf_guard_user = $sf_user->getGuardUser();
$sf_user_profile = $sf_guard_user->getProfile();
$sf_user_id = $sf_guard_user->getId();
$branch_id = $sf_user->getUserBranch()->getId();
$company_id = $sf_user->getUserCompany()->getId();
$this->marketing_options = '';
$this->cop_record_updated = '';
$client_user_id = NULL;
// if($sf_ser->isBranchOwner($sf_user_id) && $sf_user->hasAttribute('branch_id'))
if ($sf_user->isBranchOwner($sf_user_id)) {
// $client_user_id = $this->getRequestParameter('id');
$client_profile_id = $this->getRequestParameter('id');
if (!empty($client_profile_id)) {
$client_user = ProfilePeer::retrieveByPK($client_profile_id);
$client_user_id = $client_user->getUserId();
}
/*
* available in case branch owner is handling more than branch
* if the client is new that it need branch_id from url
*/
if ($this->getRequestParameter('branch_id')) {
$branch_id = $this->getRequestParameter('branch_id');
} elseif ($client_user_id) {
$client_branch = new Criteria();
$client_branch->add(BranchUsersPeer::USER_ID, $client_user_id);
$client_branch->setDistinct();
$branchId = BranchUsersPeer::doSelect($client_branch);
$branch_id = $branchId[0]->getBranchId();
}
$company_id = BranchPeer::getCompanyId($branch_id);
}
$parent = $request->getParameter('opportunity_parent_exist', 0);
$this->logindetails = array();
$this->logindetails['username'] = '';
$this->logindetails['password'] = '';
$this->logindetails['confirm_password'] = '';
$this->logindetails['budget'] = '';
$this->logindetails['expected_close_date'] = '';
$this->getSignedContractDate = '';
$this->another_contact_list = '';
$this->another_contact_form = new anotherContactPersonForm();
$this->client_leads = ClientLeadPeer::getClientLeadsList($branch_id);
$login_details = $request->getParameter('logindetail');
$branch_service = new BranchService($branch_id, $sf_user_id);
$this->marketing_options = $branch_service->getMarketingOptionList();
$this->is_showlead = $branch_service->isShowLead();
$this->sub_opportunity_exist = null;
if ($login_details) {
$this->logindetails = $login_details;
if ($this->logindetails['expected_close_date']) {
$this->logindetails['expected_close_date'] = date('Y-m-d', strtotime($this->logindetails['expected_close_date'])) . ' ' . date('H:i:s');
}
}
$this->getSignedContractDate = $this->logindetails['signed_contract_date'];
/*
* get current branch branch office staff list (any one of these should be the sales person)
*/
$tempsale = array();
$tempsale[$sf_user_id] = $sf_user->getProfile()->getFullname();
$sales = ProfilePeer::getBranchUsers($branch_id, sfGuardGroupPeer::BRANCH_OFFICE_STAFF);
foreach ($sales as $salesid) {
$tempsale[$salesid->getUserId()] = $salesid->getFullname();
}
$this->sales_persons = $tempsale;
$this->default_sales = $sf_user_id;
$client_profile = '';
$this->client_profile = '';
$client_id = $request->getParameter('id');
if ($client_id) {
$client_profile = ProfilePeer::retrieveByPK($client_id);
$client_user_id = $client_profile->getUserId();
$this->client_ranks = clientRankPeer::getClientOpportunityList($branch_id);
$this->default_rank = 0;
$this->default_sub_rank = null;
$this->default_lead = 0;
if (!empty($client_profile)) {
$this->default_rank = $client_profile->getRank() ? $client_profile->getRank() : 0;
$this->default_sub_rank = $client_profile->getSubOpportunity() ? $client_profile->getSubOpportunity() : null;
}
$this->client_profile = $client_profile;
if ($client_profile->getOther2() == '') {
$ref = $this->genRandomString();
$client_profile->setOther2($ref);
}
$this->form = new ClientQuickForm($client_profile);
$client_login = sfGuardUserPeer::retrieveByPK($client_user_id);
$this->client_login = $client_login;
$c = new Criteria();
$c->add(anotherContactPersonPeer::USER_ID, $client_user_id, Criteria::EQUAL);
$this->another_contact_list = anotherContactPersonPeer::doSelect($c);
} else {
$ref = $this->genRandomString();
//.........这里部分代码省略.........
示例14: getsfGuardUserRelatedByRecipientId
public function getsfGuardUserRelatedByRecipientId($con = null)
{
if ($this->asfGuardUserRelatedByRecipientId === null && $this->recipient_id !== null) {
include_once 'plugins/sfGuardPlugin/lib/model/om/BasesfGuardUserPeer.php';
$this->asfGuardUserRelatedByRecipientId = sfGuardUserPeer::retrieveByPK($this->recipient_id, $con);
}
return $this->asfGuardUserRelatedByRecipientId;
}
示例15: delete
/**
* Delete a person
* Also deletes the person user and photo
* @param PropelPDO $con
*/
public function delete(PropelPDO $con = null)
{
$photo_path = $this->getPhotoFullPath();
parent::delete($con);
if ($this->getUserId()) {
$user = sfGuardUserPeer::retrieveByPK($this->getUserId());
$user->delete($con);
}
$this->deletePhysicalImage($photo_path);
}