本文整理汇总了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);
}
示例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())));
}