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


PHP User::getPublicUrl方法代码示例

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


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

示例1: editPublicUrlAction

 /**
  * @EXT\Route(
  *     "/publicurl/edit",
  *      name="claro_user_public_url_edit"
  * )
  * @SEC\Secure(roles="ROLE_USER")
  * @EXT\Template()
  * @EXT\ParamConverter("loggedUser", options={"authenticatedUser" = true})
  */
 public function editPublicUrlAction(User $loggedUser)
 {
     $currentPublicUrl = $loggedUser->getPublicUrl();
     $form = $this->createForm(new UserPublicProfileUrlType(), $loggedUser);
     $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');
         try {
             /** @var \Claroline\CoreBundle\Entity\User $user */
             $user = $form->getData();
             $user->setHasTunedPublicUrl(true);
             $entityManager = $this->get('doctrine.orm.entity_manager');
             $entityManager->persist($user);
             $entityManager->flush();
             $sessionFlashBag->add('success', $translator->trans('tune_public_url_success', array(), 'platform'));
         } catch (\Exception $exception) {
             $sessionFlashBag->add('error', $translator->trans('tune_public_url_error', array(), 'platform'));
         }
         return $this->redirect($this->generateUrl('claro_profile_view'));
     }
     return array('form' => $form->createView(), 'user' => $loggedUser, 'currentPublicUrl' => $currentPublicUrl);
 }
开发者ID:ngydat,项目名称:CoreBundle,代码行数:34,代码来源:ProfileController.php

示例2: sendAction

 /**
  * @EXT\Route(
  *     "/send/{userId}",
  *     name="claro_mail_send"
  * )
  * @EXT\ParamConverter(
  *      "user",
  *      class="ClarolineCoreBundle:User",
  *      options={"id" = "userId", "strictId" = true}
  * )
  * @EXT\Template("ClarolineCoreBundle:Mail:form.html.twig")
  *
  * Handles the mail form submission (sends a mail).
  *
  * @param User $user
  *
  * @return Response
  */
 public function sendAction(User $user)
 {
     $mailType = new SendMailType();
     $form = $this->formFactory->create($mailType);
     $form->handleRequest($this->request);
     $sender = $this->tokenStorage->getToken()->getUser();
     if ($form->isValid()) {
         $data = $form->getData();
         $body = $data['content'];
         $this->mailManager->send($data['object'], $body, array($user), $sender);
     }
     return new RedirectResponse($this->router->generate('claro_public_profile_view', array('publicUrl' => $user->getPublicUrl())));
 }
开发者ID:claroline,项目名称:distribution,代码行数:31,代码来源:MailController.php


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