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


PHP User::getId方法代码示例

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


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

示例1: regenerateRssUrlAction

 /**
  * @Route("/regenerate_rss", name="icap_notification_regenerate_rss_url")
  * @Template("IcapNotificationBundle:Parameters:config.html.twig")
  * @ParamConverter("user", options={"authenticatedUser" = true})
  */
 public function regenerateRssUrlAction(User $user)
 {
     $parametersManager = $this->getParametersManager();
     $parameters = $parametersManager->regenerateRssId($user->getId());
     $types = $parametersManager->allTypesList($parameters);
     return array('types' => $types, 'rssId' => $parameters->getRssId());
 }
开发者ID:claroline,项目名称:distribution,代码行数:12,代码来源:NotificationUserParametersController.php

示例2: registerUserToCursusHierarchy

 public function registerUserToCursusHierarchy($platformName, User $user, $cursusId)
 {
     $targetPlatformUrl = $this->friendRepo->findOneByName($platformName);
     $url = 'clarolinecursusbundle/api/users/' . $user->getId() . '/tos/' . $cursusId . '/cursus/hierarchy/add.json';
     $serverOutput = $this->apiManager->url($targetPlatformUrl, $url);
     return json_decode($serverOutput, true);
 }
开发者ID:claroline,项目名称:distribution,代码行数:7,代码来源:CursusApiManager.php

示例3: findAncestors

 /**
  * Returns the ancestors of a message (the message itself is also returned).
  *
  * @param Message $message
  *
  * @return array[Message]
  */
 public function findAncestors(Message $message, User $user)
 {
     $dql = "\n            SELECT m\n            FROM Claroline\\MessageBundle\\Entity\\Message m\n            JOIN m.userMessages um\n            JOIN um.user u\n            WHERE m.lft BETWEEN m.lft AND m.rgt\n            AND m.root = {$message->getRoot()}\n            AND m.lvl <= {$message->getLvl()}\n            AND (\n                u.id = :userid\n                OR m.user = :userid\n            )\n        ";
     $query = $this->_em->createQuery($dql);
     $query->setParameter('userid', $user->getId());
     return $query->getResult();
 }
开发者ID:claroline,项目名称:distribution,代码行数:14,代码来源:MessageRepository.php

示例4: findByUserWithAccessToken

 /**
  * @param User $user
  * @param bool $executeQuery
  *
  * @return Query|array
  */
 public function findByUserWithAccessToken(User $user, $executeQuery = true)
 {
     $query = $this->getEntityManager()->createQuery('SELECT c, at
             FROM ClarolineCoreBundle:Oauth\\Client c
             JOIN c.accessTokens at
             WHERE at.user = :userId')->setParameter('userId', $user->getId());
     return $executeQuery ? $query->getResult() : $query;
 }
开发者ID:claroline,项目名称:distribution,代码行数:14,代码来源:ClientRepository.php

示例5: getUserKey

 private function getUserKey(User $user)
 {
     if ($user === null) {
         return 'anonymous';
     } else {
         return $user->getId();
     }
 }
开发者ID:ngodfraind,项目名称:DropZoneBundle,代码行数:8,代码来源:TemporaryAccessResourceManager.php

示例6: adminOrNot

 /**
  *  Admin or not
  *
  * @param User $user
  * @return boolean
  */
 public function adminOrNot(User $user)
 {
     $adminInnova = false;
     // TODO : change service to @security.authorization_checker
     if ($this->securityContext->isGranted('ROLE_ADMIN' === true) && $this->get('security.context')->getToken()->getUser()->getId() == $user->getId()) {
         $adminInnova = true;
     }
     return $adminInnova;
 }
开发者ID:arnaudbey,项目名称:CollecticielBundle,代码行数:15,代码来源:CollecticielManager.php

示例7: findByUser

 /**
  * @param User $user
  * @param bool $getQuery
  *
  * @return Query|array
  */
 public function findByUser(User $user, $getQuery = false)
 {
     $query = $this->getEntityManager()->createQuery('SELECT bc, b, bt
             FROM IcapBadgeBundle:BadgeClaim bc
             JOIN bc.badge b
             JOIN b.translations bt
             WHERE bc.user = :userId')->setParameter('userId', $user->getId());
     return $getQuery ? $query : $query->getResult();
 }
开发者ID:claroline,项目名称:distribution,代码行数:15,代码来源:BadgeClaimRepository.php

示例8: findByUser

 /**
  * @param User $user
  * @param bool $executeQuery
  *
  * @return Query|array
  */
 public function findByUser(User $user, $executeQuery = true)
 {
     $query = $this->getEntityManager()->createQuery('SELECT b, ub, bt
             FROM IcapBadgeBundle:Badge b
             JOIN b.userBadges ub
             JOIN b.translations bt
             WHERE ub.user = :userId')->setParameter('userId', $user->getId());
     return $executeQuery ? $query->getResult() : $query;
 }
开发者ID:claroline,项目名称:distribution,代码行数:15,代码来源:BadgeRepository.php

示例9: findByUser

 /**
  * @param User $user
  * @param bool $executeQuery
  *
  * @return Query|array
  */
 public function findByUser(User $user, $executeQuery = true)
 {
     $query = $this->getEntityManager()->createQuery('SELECT badgeCollection, userBadges
             FROM IcapBadgeBundle:BadgeCollection badgeCollection
             LEFT JOIN badgeCollection.userBadges userBadges
             WHERE badgeCollection.user = :userId
             ORDER BY badgeCollection.name ASC')->setParameter('userId', $user->getId());
     return $executeQuery ? $query->getResult() : $query;
 }
开发者ID:claroline,项目名称:distribution,代码行数:15,代码来源:BadgeCollectionRepository.php

示例10: testPutOrganizationActionIsProtected

 public function testPutOrganizationActionIsProtected()
 {
     $orga = $this->persister->organization('orga');
     $this->persister->flush();
     $this->logIn($this->john);
     $fields = array('name' => 'rename', 'email' => 'toto@toto.net', 'administrators' => $this->admin->getId());
     $form = array('organization_form' => $fields);
     $this->client->request('PUT', "/api/organizations/{$orga->getId()}.json", $form);
     $this->assertEquals(403, $this->client->getResponse()->getStatusCode());
 }
开发者ID:ngydat,项目名称:CoreBundle,代码行数:10,代码来源:OrganizationControllerTest.php

示例11: buildSectionTree

 /**
  * @param Wiki $wiki
  * @param bool $isAdmin
  * @param User $user
  *
  * @return Tree $tree
  */
 public function buildSectionTree(Wiki $wiki, $isAdmin, User $user = null)
 {
     $queryBuilder = $this->createQueryBuilder('section')->join('section.activeContribution', 'contribution')->select('section, contribution')->andWhere('section.root = :rootId')->orderBy('section.root, section.left', 'ASC')->setParameter('rootId', $wiki->getRoot()->getId());
     $queryBuilder->andWhere($queryBuilder->expr()->orX('section.deleted = :deleted', $queryBuilder->expr()->isNull('section.deleted')))->setParameter('deleted', false);
     if ($isAdmin === false) {
         $queryBuilder->andWhere($queryBuilder->expr()->orX('section.visible = :visible', 'section.author = :userId'))->setParameter('visible', true)->setParameter('userId', $user->getId());
     }
     $options = ['decorate' => false];
     $tree = $this->buildTree($queryBuilder->getQuery()->getArrayResult(), $options);
     return $tree;
 }
开发者ID:claroline,项目名称:distribution,代码行数:18,代码来源:SectionRepository.php

示例12: findByWorkspaceAndUser

 public function findByWorkspaceAndUser(Workspace $workspace, User $user)
 {
     $dql = '
         SELECT rwt, t
         FROM Claroline\\CoreBundle\\Entity\\Workspace\\RelWorkspaceTag rwt
         JOIN rwt.workspace w
         JOIN rwt.tag t
         JOIN t.user u
         WHERE u.id = :userId
         AND w.id = :workspaceId
     ';
     $query = $this->_em->createQuery($dql);
     $query->setParameter('userId', $user->getId());
     $query->setParameter('workspaceId', $workspace->getId());
     return $query->getResult();
 }
开发者ID:ngydat,项目名称:CoreBundle,代码行数:16,代码来源:RelWorkspaceTagRepository.php

示例13: jsonSerialize

 public function jsonSerialize()
 {
     return array('id' => $this->id, 'userId' => $this->user->getId(), 'stepId' => $this->step->getId(), 'status' => $this->status, 'authorized' => $this->authorized);
 }
开发者ID:CPASimUSante,项目名称:PathBundle,代码行数:4,代码来源:UserProgression.php

示例14: findByMessages

 /**
  * Finds UserMessage received or sent by a user, filtered by specific messages.
  *
  * @param User           $user
  * @param array[Message] $messages
  *
  * @return array[UserMessage]
  */
 public function findByMessages(User $user, array $messages)
 {
     $messageIds = array();
     foreach ($messages as $message) {
         $messageIds[] = $message->getId();
     }
     $dql = '
         SELECT um
         FROM Claroline\\MessageBundle\\Entity\\UserMessage um
         JOIN um.user u
         JOIN um.message m
         WHERE m.id IN (:messageIds)
         AND u.id = :userId
         ORDER BY m.date DESC
     ';
     $query = $this->_em->createQuery($dql);
     $query->setParameter('messageIds', $messageIds);
     $query->setParameter('userId', $user->getId());
     return $query->getResult();
 }
开发者ID:claroline,项目名称:distribution,代码行数:28,代码来源:UserMessageRepository.php

示例15: editPasswordAction

 /**
  * @EXT\Route(
  *     "/password/edit/{user}",
  *      name="claro_user_password_edit"
  * )
  * @EXT\ParamConverter("loggedUser", options={"authenticatedUser" = true})
  * @EXT\Template()
  */
 public function editPasswordAction(User $user, User $loggedUser)
 {
     $isAdmin = $this->get('security.authorization_checker')->isGranted('ROLE_ADMIN');
     $isGrantedUserAdmin = $this->get('security.authorization_checker')->isGranted('OPEN', $this->toolManager->getAdminToolByName('user_management'));
     $selfEdit = $user->getId() === $loggedUser->getId() ? true : false;
     if (!$selfEdit && !$isAdmin && !$isGrantedUserAdmin) {
         throw new AccessDeniedException();
     }
     $form = $this->createForm(new ResetPasswordType($selfEdit));
     $oldPassword = $user->getPassword();
     $form->handleRequest($this->request);
     if ($form->isValid()) {
         /** @var \Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface $sessionFlashBag */
         $sessionFlashBag = $this->get('session')->getFlashBag();
         /** @var \Symfony\Component\Translation\TranslatorInterface $translator */
         $translator = $this->get('translator');
         $continue = !$selfEdit;
         if ($selfEdit) {
             $user->setPlainPassword($form['password']->getData());
         }
         if ($selfEdit && $this->encodePassword($user) === $oldPassword) {
             $continue = true;
         }
         if ($continue) {
             $user->setPlainPassword($form['plainPassword']->getData());
             $user->setPassword($this->encodePassword($user));
             $entityManager = $this->get('doctrine.orm.entity_manager');
             $entityManager->persist($user);
             $entityManager->flush();
             $sessionFlashBag->add('success', $translator->trans('edit_password_success', array(), 'platform'));
         } else {
             $sessionFlashBag->add('error', $translator->trans('edit_password_error_current', array(), 'platform'));
         }
         if ($selfEdit) {
             return $this->redirect($this->generateUrl('claro_profile_view'));
         } else {
             return $this->redirect($this->generateUrl('claro_admin_users_index'));
         }
     }
     return array('form' => $form->createView(), 'user' => $user);
 }
开发者ID:ngydat,项目名称:CoreBundle,代码行数:49,代码来源:ProfileController.php


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