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