当前位置: 首页>>代码示例>>PHP>>正文


PHP sfGuardUser::getId方法代码示例

本文整理汇总了PHP中sfGuardUser::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP sfGuardUser::getId方法的具体用法?PHP sfGuardUser::getId怎么用?PHP sfGuardUser::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfGuardUser的用法示例。


在下文中一共展示了sfGuardUser::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: queryByUser

 public function queryByUser(sfGuardUser $user)
 {
     if ($user->hasPermission(myUser::CREDENTIAL_ADMIN)) {
         return $this->queryAll()->innerJoin('w.Petition p')->innerJoin('p.Campaign c')->where('p.status != ? AND c.status = ?', array(Petition::STATUS_DELETED, CampaignTable::STATUS_ACTIVE));
     }
     return $this->queryAll()->innerJoin('w.Petition p')->leftJoin('p.PetitionRights pr ON p.id = pr.petition_id and pr.user_id = ?', $user->getId())->innerJoin('p.Campaign c')->leftJoin('c.CampaignRights cr ON c.id = cr.campaign_id and cr.user_id = ?', $user->getId())->where('p.status != ? AND c.status = ?', array(Petition::STATUS_DELETED, CampaignTable::STATUS_ACTIVE))->andWhere('w.user_id = ? OR (cr.user_id = ? AND pr.user_id = ? AND cr.active = 1 AND pr.active = 1 AND (pr.admin = 1 OR pr.member = 1) AND (cr.admin = 1 OR cr.member = 1))', array($user->getId(), $user->getId(), $user->getId()));
 }
开发者ID:uniteddiversity,项目名称:policat,代码行数:7,代码来源:WidgetTable.class.php

示例2: queryByMember

 /**
  *
  * @param sfGuardUser $user
  * @return Doctrine_Query
  */
 public function queryByMember(sfGuardUser $user, $is_member = true, $deleted_too = false)
 {
     if ($user->hasPermission(myUser::CREDENTIAL_ADMIN)) {
         return $this->queryAll($deleted_too);
     }
     if ($is_member) {
         return $this->queryAll($deleted_too)->innerJoin('c.CampaignRights cr')->andWhere('cr.user_id = ? AND cr.active = ?', array($user->getId(), 1));
     } else {
         return $this->queryAll($deleted_too)->andWhere('c.id NOT IN (SELECT cr.campaign_id FROM CampaignRights cr WHERE cr.user_id = ? AND cr.active = ?)', array($user->getId(), 1));
     }
 }
开发者ID:uniteddiversity,项目名称:policat,代码行数:16,代码来源:CampaignTable.class.php

示例3: doClean

 /**
  * @see sfValidatorBase
  */
 protected function doClean($values)
 {
     // only validate if username and password are both present
     if (isset($values[$this->getOption('username_field')]) && isset($values[$this->getOption('password_field')])) {
         $username = $values[$this->getOption('username_field')];
         $password = $values[$this->getOption('password_field')];
         // user exists?
         if ($user = sfGuardUserPeer::retrieveByUsername($username)) {
             // password is ok?
             if ($user->getIsActive()) {
                 if (Configuration::get('ldap_enabled', false)) {
                     if (authLDAP::checkPassword($username, $password)) {
                         return array_merge($values, array('user' => $user));
                     }
                 } elseif ($user->checkPassword($password)) {
                     return array_merge($values, array('user' => $user));
                 }
             }
         } elseif (Configuration::get('ldap_enabled', false) && Configuration::get('ldap_create_user', false) && authLDAP::checkPassword($username, $password)) {
             $user = new sfGuardUser();
             $user->setUsername($username);
             $user->save();
             $profile = new Profile();
             $profile->setSfGuardUserId($user->getId());
             $profile->save();
             return array_merge($values, array('user' => $user));
         }
         if ($this->getOption('throw_global_error')) {
             throw new sfValidatorError($this, 'invalid');
         }
         throw new sfValidatorErrorSchema($this, array($this->getOption('username_field') => new sfValidatorError($this, 'invalid')));
     }
     // assume a required error has already been thrown, skip validation
     return $values;
 }
开发者ID:xfifix,项目名称:Jenkins-Khan,代码行数:38,代码来源:ValidatorUser.class.php

示例4: getUsersInTeamIDs

 /**
  * @param sfGuardUser $user
  * @return array
  */
 public function getUsersInTeamIDs(sfGuardUser $user)
 {
     $ids = array();
     $ids[] = $user->getId();
     $q = $this->createQuery('u')->leftJoin('u.TeamMember tm')->where('tm.manager_id = ?', $user->getId());
     $team_manager = $this->userTeamManager($user);
     if ($team_manager) {
         $ids[] = $team_manager;
         $q->orWhere('tm.manager_id = ?', $team_manager);
     }
     $users = $q->execute();
     foreach ($users as $user) {
         $ids[] = $user->getId();
     }
     return array_unique($ids);
 }
开发者ID:sensorsix,项目名称:app,代码行数:20,代码来源:sfGuardUserTable.class.php

示例5: isSelfUser

 /**
  *
  * @param sfGuardUser $user or User ID
  * @return boolean
  * @throws Exception
  */
 public function isSelfUser($user)
 {
     if ($user instanceof sfGuardUser) {
         return $this->getGuardUser()->getId() == $user->getId();
     } elseif (is_numeric($user)) {
         return $user == $this->getGuardUser()->getId();
     }
     throw new Exception('wrong argument');
 }
开发者ID:uniteddiversity,项目名称:policat,代码行数:15,代码来源:policatActions.class.php

示例6: checkIfImInList

 public static final function checkIfImInList(sfGuardUser $me, Doctrine_Collection $usersCollection)
 {
     foreach ($usersCollection as $user) {
         if ($user->getId() === $me->getId()) {
             return true;
         }
     }
     return false;
 }
开发者ID:vik0803,项目名称:helpdesk,代码行数:9,代码来源:Helpdesk.class.php

示例7: doSave

 public function doSave($con = null)
 {
     $user = new sfGuardUser();
     $user->setUsername($this->getValue('username'));
     $user->setPassword($this->getValue('password'));
     // They must confirm their account first
     $user->setIsActive(false);
     $user->save();
     $this->userId = $user->getId();
     return parent::doSave($con);
 }
开发者ID:verenate,项目名称:IA2P,代码行数:11,代码来源:sfApplyApplyForm.class.php

示例8: createUser

 public function createUser(array $guard_tab, $ei_user_tab)
 {
     $new_guard = new sfGuardUser();
     $new_guard->setId($guard_tab['id']);
     $new_guard->setUsername($guard_tab['username']);
     $new_guard->setFirstName($guard_tab['first_name']);
     $new_guard->setLastName($guard_tab['last_name']);
     $new_guard->setEmailAddress($guard_tab['email_address']);
     $new_guard->setPassword($guard_tab['password']);
     $new_guard->save();
     /* Création du EiUser */
     EiUserTable::createUser($ei_user_tab, $new_guard->getId());
     return $new_guard;
 }
开发者ID:lendji4000,项目名称:compose,代码行数:14,代码来源:sfGuardUserTable.class.php

示例9: execute

 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $databaseManager = new sfDatabaseManager($this->configuration);
     $user = new sfGuardUser();
     $user->setUsername($arguments['username']);
     $user->setPassword($arguments['password']);
     $user->save();
     $profile = new Profile();
     $profile->setNickname($arguments['nickname']);
     $profile->setEmail($arguments['email']);
     $profile->setSfGuardUserId($user->getId());
     $profile->save();
     $this->logSection('crew', sprintf('Create user "%s"', $arguments['username']));
 }
开发者ID:ratibus,项目名称:Crew,代码行数:17,代码来源:createUserTask.class.php

示例10: doSave

 public function doSave($con = null)
 {
     if ($this->isNew) {
         $user = new sfGuardUser();
         $user->setUsername($this->getValue('username'));
         $user->setPassword($this->getValue('password'));
         $user->setEmailAddress($this->getValue('email'));
         $user->addGroupByName(sfConfig::get('app_user_default_group'));
         // They must confirm their account first
         $user->setIsActive(false);
         $user->save();
         $this->getObject()->setUserId($user->getId());
     }
     return parent::doSave($con);
 }
开发者ID:hielh,项目名称:abjihproject,代码行数:15,代码来源:sfGuardUserProfileForm.class.php

示例11: createItem

 public function createItem(EiScenario $ei_scenario, EiDelivery $ei_delivery, EiTicket $ei_ticket, sfGuardUser $guard_user, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     $stmt = $conn->prepare("INSERT INTO ei_package_scenario_conflict (ei_scenario_id,delivery_id,package_id, package_ref,resolved_date,resolved_author,created_at,updated_at) " . "VALUES (:ei_scenario_id,:delivery_id,:package_id, :package_ref,:resolved_date,:resolved_author,:created_at,:updated_at) " . "ON DUPLICATE KEY UPDATE ei_scenario_id=ei_scenario_id, delivery_id=delivery_id, package_id=:package_id,package_ref=:package_ref");
     $stmt->bindValue("ei_scenario_id", $ei_scenario->getId());
     $stmt->bindValue("delivery_id", $ei_delivery->getId());
     $stmt->bindValue("package_id", $ei_ticket->getTicketId());
     $stmt->bindValue("package_ref", $ei_ticket->getTicketRef());
     $stmt->bindValue("resolved_date", date('Y-m-d H:i:s'));
     $stmt->bindValue("resolved_author", $guard_user->getId());
     $stmt->bindValue("created_at", date('Y-m-d H:i:s'));
     $stmt->bindValue("updated_at", date('Y-m-d H:i:s'));
     $stmt->execute(array());
 }
开发者ID:lendji4000,项目名称:compose,代码行数:16,代码来源:EiPackageScenarioConflictTable.class.php

示例12: create_sf_user

 protected function create_sf_user($fbProfile)
 {
     try {
         //die('creating');
         //doctrine, create record in sf_guard_user
         $NewFacebookUser = new sfGuardUser();
         $NewFacebookUser->first_name = $fbProfile['first_name'];
         $NewFacebookUser->last_name = $fbProfile['last_name'];
         $NewFacebookUser->email_address = $fbProfile['email'];
         $NewFacebookUser->username = $fbProfile['email'];
         $NewFacebookUser->save();
         $NewFacebookUser->setPassword('test');
         $NewFacebookUser->save();
         //get id
         $id = $NewFacebookUser->getId();
         //this part has been replace with a mysql trigger
         /*
                     //ensure id isn't already used, autoincremenet problem
                     $q = Doctrine_Query::create()
                     ->select("*")
                     ->from("RidAccounts")
                     //->where("email = ?", $this->user->getEmailAddress())
                     ->where("id = ?", $id)    
                     ->setHydrationMode(Doctrine::HYDRATE_ARRAY);
         
                     $results = $q->execute();
         
                     if(count($results) > 0) { die('id already used' . __LINE__ . __FILE__); }
                     
                     
                     //doctrine, create record in RidAccounts
                     $NewFacebookUserAccount = new RidAccounts();
                     $NewFacebookUserAccount->id = $id;
                     $NewFacebookUserAccount->first_name = $fbProfile['first_name'];
                     $NewFacebookUserAccount->last_name = $fbProfile['last_name'];
                     $NewFacebookUserAccount->email = $fbProfile['email'];
                     $NewFacebookUserAccount->save();
         */
         return $id;
     } catch (Exception $e) {
         echo $e->getType() . "<br />";
         echo $e->getMessage() . "<br />";
         sfContext::getInstance()->getLogger()->debug($e->getType());
         sfContext::getInstance()->getLogger()->debug($e->getMessage());
         die(__FILE__ . __LINE__);
     }
 }
开发者ID:nathandrewsire,项目名称:facebookconnect,代码行数:47,代码来源:Facebook_1.php

示例13: executeApply

 public function executeApply()
 {
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         $username = $this->getRequestParameter('username');
         $password = $this->getRequestParameter('password');
         $sfGuardUser = new sfGuardUser();
         $sfGuardUser->setUsername($username);
         $sfGuardUser->setPassword($password);
         // Not until confirmed
         $sfGuardUser->setIsActive(false);
         $profile = $sfGuardUser->getProfile();
         $this->populateProfileSettings($profile);
         $sfGuardUser->save();
         $profile->save();
         $this->setFlash('sfApplyPlugin_id', $sfGuardUser->getId(), false);
         $this->sendEmail('sfApply', 'sendValidate');
         return 'After';
     }
 }
开发者ID:EQ4,项目名称:smint,代码行数:19,代码来源:BasesfApplyActions.class.php

示例14: save

 /**
  * Serialize the form into the database.
  **/
 public function save($con = null)
 {
     if (!is_null($this->getValue("photographer_id"))) {
         $p = $this->getObject();
     } else {
         $sfUser = new sfGuardUser();
         $sfUser->setUsername($this->getValue("email"));
         $sfUser->setPassword($this->getValue("password"));
         $sfUser->save();
         if (strpos($this->getValue("name"), " ") !== false) {
             list($firstName, $lastName) = explode(" ", $this->getValue("name"));
         } else {
             $firstName = "";
             $lastName = "";
         }
         $sfProfile = new sfGuardUserProfile();
         $sfProfile->setUserTypeId(sfConfig::get("app_user_type_photographer"));
         $sfProfile->setUserId($sfUser->getId());
         $sfProfile->setEmail($this->getValue("email"));
         $sfProfile->setFirstName($firstName);
         $sfProfile->setLastName($lastName);
         $sfProfile->save();
         $p = new Photographer();
         $p->setUserId($sfProfile->getId());
     }
     $p->setName($this->getValue("name"));
     $p->setEmail($this->getValue("email"));
     $p->setPhone($this->getValue("phone"));
     $p->setAffiliation($this->getValue("affiliation"));
     $p->setWebsite($this->getValue("website"));
     $p->setDescription($this->getValue("description"));
     $p->setBillingAddress($this->getValue("billing_info"));
     $p->save();
     if ($this->getValue("reset_password")) {
         $user = $p->getsfGuardUserProfile()->getsfGuardUser();
         $user->setPassword($this->getValue("password"));
         $user->save();
     }
 }
开发者ID:adatta02,项目名称:comp190-code,代码行数:42,代码来源:InfoPhotographerForm.class.php

示例15: processForm

 protected function processForm(sfWebRequest $request, sfForm $form)
 {
     $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
     if ($form->isValid()) {
         $peticion = $form->save();
         $newUser = new sfGuardUser();
         $newUser->setUsername($form->getObject()->getUsername());
         $newUser->setFirstName($form->getObject()->getFirstName());
         $newUser->setLastName($form->getObject()->getLastName());
         $newUser->setSexo($form->getObject()->getSexo());
         $newUser->setDireccion($form->getObject()->getDireccion());
         $newUser->setTelefono($form->getObject()->getTelefono());
         $newUser->setTelefonoMovil($form->getObject()->getTelefonoMovil());
         $newUser->setEmailAddress($form->getObject()->getEmailAddress());
         $newUser->setPassword($form->getObject()->getPassword());
         try {
             $newUser->save();
             $peticion->delete();
             $this->redirect('sfGuardUser/editagregar?id=' . $newUser->getId());
         } catch (Exception $e) {
             $this->redirect('peticion/edit?id=' . $peticion->getId());
         }
     }
 }
开发者ID:edulima1989,项目名称:Sistema-Radiotaxi,代码行数:24,代码来源:actions.class.php


注:本文中的sfGuardUser::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。