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


PHP User::getUsername方法代码示例

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


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

示例1: createInwicastUserIfNotExists

 public function createInwicastUserIfNotExists(User $user, $token, Mediacenter $mediacenter)
 {
     $connection = $this->connectionFactory->createConnection($mediacenter->getDatabaseParameters());
     $qb = $connection->createQueryBuilder();
     $qb->select('usr.username, usr.token')->from('mdcr_inwicast_user_tokens', 'usr')->where('usr.username = :username')->andWhere('usr.tokenapp = :platform')->setParameter("username", $user->getUsername())->setParameter("platform", $this->platformName);
     $result = $qb->execute()->fetch();
     if (!$result) {
         //$qb_insert = $connection->createQueryBuilder();
         $sql = "INSERT INTO mdcr_inwicast_user_tokens" . " (`username`, `firstname`, `lastname`, `email`, `userrole`, `token`, `tokendate`, `tokenapp`)" . " VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
         $query = $connection->prepare($sql);
         $query->bindValue(1, $user->getUsername());
         $query->bindValue(2, $user->getFirstName());
         $query->bindValue(3, $user->getLastName());
         $query->bindValue(4, $user->getMail());
         $query->bindValue(5, $user->getPlatformRole()->getName());
         $query->bindValue(6, $token);
         $query->bindValue(7, date('Y-m-d H:i:s'));
         $query->bindValue(8, $this->platformName);
         $query->execute();
     } else {
         $qb_update = $connection->createQueryBuilder();
         $qb_update->update('mdcr_inwicast_user_tokens')->set('token', '?')->set('tokendate', '?')->set('tokenapp', '?')->where('username = ?')->setParameter(0, $token)->setParameter(1, date('Y-m-d H:i:s'))->setParameter(2, $this->platformName)->setParameter(3, $user->getUsername());
         $qb_update->execute();
     }
     return true;
 }
开发者ID:inwicast,项目名称:claroline-plugin-bundle,代码行数:26,代码来源:MediacenterUserRepository.php

示例2: request

 public function request($method, $uri, User $user = null, array $parameters = [])
 {
     if (!$this->client instanceof Client) {
         throw new \Exception('This method requires a client property of type ' . 'Symfony\\Component\\BrowserKit\\Client');
     }
     $server = $user ? ['PHP_AUTH_USER' => $user->getUsername(), 'PHP_AUTH_PW' => $user->getPlainPassword()] : [];
     return $this->client->request($method, $uri, $parameters, [], $server);
 }
开发者ID:claroline,项目名称:distribution,代码行数:8,代码来源:RequestTrait.php

示例3: __construct

 public function __construct(Cursus $cursus, User $user)
 {
     $details = [];
     $details['username'] = $user->getUsername();
     $details['firsName'] = $user->getFirstName();
     $details['lastName'] = $user->getLastName();
     $details['cursusId'] = $cursus->getId();
     $details['cursusTitle'] = $cursus->getTitle();
     $details['cursusCode'] = $cursus->getCode();
     parent::__construct(self::ACTION, $details, $user);
 }
开发者ID:claroline,项目名称:distribution,代码行数:11,代码来源:LogCursusUserRegistrationEvent.php

示例4: workspaceUser

 /**
  * @param Workspace $workspace
  * @param User      $user
  *
  * @return User
  */
 public function workspaceUser(Workspace $workspace, User $user)
 {
     $role = new Role();
     $role->setName("ROLE_WS_{$workspace->getName()}_{$user->getUsername()}");
     $role->setTranslationKey($role->getName());
     $role->setWorkspace($workspace);
     $user->addRole($role);
     $this->om->persist($role);
     $this->om->persist($user);
     return $user;
 }
开发者ID:claroline,项目名称:distribution,代码行数:17,代码来源:Persister.php

示例5: __construct

 public function __construct(CourseSession $session, User $user)
 {
     $course = $session->getCourse();
     $details = array();
     $details['username'] = $user->getUsername();
     $details['firsName'] = $user->getFirstName();
     $details['lastName'] = $user->getLastName();
     $details['sessionId'] = $session->getId();
     $details['sessionName'] = $session->getName();
     $details['sessionCreationDate'] = $session->getCreationDate()->format('d/m/Y H:i:s');
     $details['courseId'] = $course->getId();
     $details['courseTitle'] = $course->getTitle();
     $details['courseCode'] = $course->getCode();
     parent::__construct(self::ACTION, $details, $user);
 }
开发者ID:Gatomlo,项目名称:CursusBundle,代码行数:15,代码来源:LogCourseSessionUserRegistrationEvent.php

示例6: __construct

 public function __construct(SessionEvent $sessionEvent, User $user)
 {
     $session = $sessionEvent->getSession();
     $course = $session->getCourse();
     $details = [];
     $details['username'] = $user->getUsername();
     $details['firsName'] = $user->getFirstName();
     $details['lastName'] = $user->getLastName();
     $details['sessionEventId'] = $sessionEvent->getId();
     $details['sessionEventName'] = $sessionEvent->getName();
     $details['sessionId'] = $session->getId();
     $details['sessionName'] = $session->getName();
     $details['courseId'] = $course->getId();
     $details['courseTitle'] = $course->getTitle();
     $details['courseCode'] = $course->getCode();
     parent::__construct(self::ACTION, $details, $user);
 }
开发者ID:claroline,项目名称:distribution,代码行数:17,代码来源:LogSessionEventUserRegistrationEvent.php

示例7: getBaseName

 function getBaseName(User $user)
 {
     $BaseName = $user->getUsername() . $user->getId() . "/";
     return $BaseName;
 }
开发者ID:algorgeous,项目名称:Assistant-Samo-Trace-Me,代码行数:5,代码来源:KtbsConfig.php

示例8: findUserRoleByUser

 /**
  * Returns user-type role of an user.
  *
  * @param User $user
  * @param boolean $executeQuery
  *
  * @return array[Role]|query
  */
 public function findUserRoleByUser(User $user, $executeQuery = true)
 {
     $username = $user->getUsername();
     $roleName = 'ROLE_USER_' . strtoupper($username);
     $dql = '
         SELECT r
         FROM Claroline\\CoreBundle\\Entity\\Role r
         WHERE r.type = :type
         AND r.name = :name
         AND r.translationKey = :key
     ';
     $query = $this->_em->createQuery($dql);
     $query->setParameter('type', Role::USER_ROLE);
     $query->setParameter('name', $roleName);
     $query->setParameter('key', $username);
     return $executeQuery ? $query->getOneOrNullResult() : $query;
 }
开发者ID:ngydat,项目名称:CoreBundle,代码行数:25,代码来源:RoleRepository.php

示例9: userInfosRequestAction

 /**
  * @EXT\Route(
  *     "user/{user}/infos/request",
  *     name="claro_user_infos_request",
  *     options = {"expose"=true}
  * )
  */
 public function userInfosRequestAction(User $user)
 {
     $datas = array('id' => $user->getId(), 'firstName' => $user->getFirstName(), 'lastName' => $user->getLastName(), 'username' => $user->getUsername(), 'mail' => $user->getMail(), 'phone' => $user->getPhone(), 'picture' => $user->getPicture());
     return new JsonResponse($datas, 200);
 }
开发者ID:claroline,项目名称:distribution,代码行数:12,代码来源:UserController.php

示例10: createRemoteUser

 public function createRemoteUser(User $user)
 {
     $url = 'api/users.json';
     $tmppw = uniqid();
     $payload = array('profile_form_creation[username]' => $user->getUsername(), 'profile_form_creation[firstName]' => $user->getFirstName(), 'profile_form_creation[lastName]' => $user->getLastName(), 'profile_form_creation[mail]' => $user->getMail(), 'profile_form_creation[administrativeCode]' => $user->getUsername(), 'profile_form_creation[plainPassword][first]' => $tmppw, 'profile_form_creation[plainPassword][second]' => $tmppw);
     $serverOutput = $this->apiManager->url($this->targetFriend, $url, $payload, 'POST');
     $datas = json_decode($serverOutput, true);
     return $datas;
 }
开发者ID:kitan1982,项目名称:InvoiceBundle,代码行数:9,代码来源:SharedWorkspaceManager.php

示例11: initializePassword

 public function initializePassword(User $user)
 {
     $user->setHashTime(time());
     $password = sha1(rand(1000, 10000) . $user->getUsername() . $user->getSalt());
     $user->setResetPasswordHash($password);
     $this->objectManager->persist($user);
     $this->objectManager->flush();
 }
开发者ID:ngydat,项目名称:CoreBundle,代码行数:8,代码来源:UserManager.php

示例12: checkAccess

 public function checkAccess(Message $message, User $user)
 {
     if ($message->getSenderUsername() === $user->getUsername()) {
         return true;
     }
     $userMessage = $this->messageManager->getOneUserMessageByUserAndMessage($user, $message);
     if (!is_null($userMessage)) {
         return true;
     }
     $receiverString = $message->getTo();
     $names = explode(';', $receiverString);
     $usernames = [];
     $groupNames = [];
     $workspaceCodes = [];
     foreach ($names as $name) {
         if (substr($name, 0, 1) === '{') {
             $groupNames[] = trim($name, '{}');
         } elseif (substr($name, 0, 1) === '[') {
             $workspaceCodes[] = trim($name, '[]');
         } else {
             $usernames[] = trim($name);
         }
     }
     if (in_array($user->getUsername(), $usernames)) {
         return true;
     }
     foreach ($user->getGroups() as $group) {
         if (in_array($group->getName(), $groupNames)) {
             return true;
         }
     }
     foreach ($this->workspaceManager->getWorkspacesByUser($user) as $workspace) {
         if (in_array($workspace->getCode(), $workspaceCodes)) {
             return true;
         }
     }
     throw new AccessDeniedException();
 }
开发者ID:claroline,项目名称:distribution,代码行数:38,代码来源:MessageController.php

示例13: importUser

 public function importUser(User $user, Client $client = null)
 {
     $hasCreatedClient = false;
     if (!$client) {
         $host = $this->configHandler->getParameter('chat_xmpp_host');
         $client = $this->getClient($host);
         $hasCreatedClient = true;
     }
     $this->log("Adding chat user for {$user->getUsername()}");
     $this->createChatUser($user, $user->getUsername(), $user->getGuid());
     $register = new Register($this->configHandler->getParameter('chat_ssl'));
     $register->setUser($user);
     $client->send($register);
     if ($hasCreatedClient) {
         $client->disconnect();
     }
 }
开发者ID:claroline,项目名称:distribution,代码行数:17,代码来源:ChatManager.php

示例14: sendCreationMessage

 /**
  * @param User $user
  *
  * @return bool
  */
 public function sendCreationMessage(User $user)
 {
     $locale = $user->getLocale();
     $content = $this->contentManager->getTranslatedContent(['type' => 'claro_mail_registration']);
     $displayedLocale = isset($content[$locale]) ? $locale : $this->ch->getParameter('locale_language');
     $body = $content[$displayedLocale]['content'];
     $subject = $content[$displayedLocale]['title'];
     $url = $this->router->generate('claro_security_validate_email', ['hash' => $user->getEmailValidationHash()], true);
     $validationLink = $this->translator->trans('email_validation_url_display', ['%url%' => $url], 'platform');
     $body = str_replace('%first_name%', $user->getFirstName(), $body);
     $body = str_replace('%last_name%', $user->getLastName(), $body);
     $body = str_replace('%username%', $user->getUsername(), $body);
     $body = str_replace('%password%', $user->getPlainPassword(), $body);
     $body = str_replace('%validation_mail%', $validationLink, $body);
     $subject = str_replace('%platform_name%', $this->ch->getParameter('name'), $subject);
     return $this->send($subject, $body, [$user], null, [], true);
 }
开发者ID:claroline,项目名称:distribution,代码行数:22,代码来源:MailManager.php

示例15: getPublicUserAction

 /**
  * @ApiDoc(
  *     description="Returns a user",
  *     views = {"user"}
  * )
  * @Get("/user/{user}/public", name="get_public_user", options={ "method_prefix" = false })
  */
 public function getPublicUserAction(User $user)
 {
     $settingsProfile = $this->facetManager->getVisiblePublicPreference();
     $publicUser = [];
     foreach ($settingsProfile as $property => $isViewable) {
         if ($isViewable || $user === $this->container->get('security.token_storage')->getToken()->getUser()) {
             switch ($property) {
                 case 'baseData':
                     $publicUser['lastName'] = $user->getLastName();
                     $publicUser['firstName'] = $user->getFirstName();
                     $publicUser['username'] = $user->getUsername();
                     $publicUser['picture'] = $user->getPicture();
                     $publicUser['description'] = $user->getAdministrativeCode();
                     break;
                 case 'email':
                     $publicUser['mail'] = $user->getMail();
                     break;
                 case 'phone':
                     $publicUser['phone'] = $user->getPhone();
                     break;
                 case 'sendMail':
                     $publicUser['mail'] = $user->getMail();
                     $publicUser['allowSendMail'] = true;
                     break;
                 case 'sendMessage':
                     $publicUser['allowSendMessage'] = true;
                     $publicUser['id'] = $user->getId();
                     break;
             }
         }
     }
     return $publicUser;
 }
开发者ID:claroline,项目名称:distribution,代码行数:40,代码来源:UserController.php


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