當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。