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


PHP User::getFirstName方法代码示例

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


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

示例1: createInwicastUserIfNotExists

 public function createInwicastUserIfNotExists(User $user, $token, Mediacenter $mediacenter)
 {
     $connection = $this->connectionFactory->createConnection($mediacenter->getDatabaseParameters());
     $qb = $connection->createQueryBuilder();
     $qb->select('usr.username, usr.token')->from('mdcr_inwicast_user_tokens', 'usr')->where('usr.username = :username')->andWhere('usr.tokenapp = :platform')->setParameter("username", $user->getUsername())->setParameter("platform", $this->platformName);
     $result = $qb->execute()->fetch();
     if (!$result) {
         //$qb_insert = $connection->createQueryBuilder();
         $sql = "INSERT INTO mdcr_inwicast_user_tokens" . " (`username`, `firstname`, `lastname`, `email`, `userrole`, `token`, `tokendate`, `tokenapp`)" . " VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
         $query = $connection->prepare($sql);
         $query->bindValue(1, $user->getUsername());
         $query->bindValue(2, $user->getFirstName());
         $query->bindValue(3, $user->getLastName());
         $query->bindValue(4, $user->getMail());
         $query->bindValue(5, $user->getPlatformRole()->getName());
         $query->bindValue(6, $token);
         $query->bindValue(7, date('Y-m-d H:i:s'));
         $query->bindValue(8, $this->platformName);
         $query->execute();
     } else {
         $qb_update = $connection->createQueryBuilder();
         $qb_update->update('mdcr_inwicast_user_tokens')->set('token', '?')->set('tokendate', '?')->set('tokenapp', '?')->where('username = ?')->setParameter(0, $token)->setParameter(1, date('Y-m-d H:i:s'))->setParameter(2, $this->platformName)->setParameter(3, $user->getUsername());
         $qb_update->execute();
     }
     return true;
 }
开发者ID:inwicast,项目名称:claroline-plugin-bundle,代码行数:26,代码来源:MediacenterUserRepository.php

示例2: __construct

 public function __construct(Cursus $cursus, User $user)
 {
     $details = [];
     $details['username'] = $user->getUsername();
     $details['firsName'] = $user->getFirstName();
     $details['lastName'] = $user->getLastName();
     $details['cursusId'] = $cursus->getId();
     $details['cursusTitle'] = $cursus->getTitle();
     $details['cursusCode'] = $cursus->getCode();
     parent::__construct(self::ACTION, $details, $user);
 }
开发者ID:claroline,项目名称:distribution,代码行数:11,代码来源:LogCursusUserRegistrationEvent.php

示例3: __construct

 public function __construct(CourseSession $session, User $user)
 {
     $course = $session->getCourse();
     $details = array();
     $details['username'] = $user->getUsername();
     $details['firsName'] = $user->getFirstName();
     $details['lastName'] = $user->getLastName();
     $details['sessionId'] = $session->getId();
     $details['sessionName'] = $session->getName();
     $details['sessionCreationDate'] = $session->getCreationDate()->format('d/m/Y H:i:s');
     $details['courseId'] = $course->getId();
     $details['courseTitle'] = $course->getTitle();
     $details['courseCode'] = $course->getCode();
     parent::__construct(self::ACTION, $details, $user);
 }
开发者ID:Gatomlo,项目名称:CursusBundle,代码行数:15,代码来源:LogCourseSessionUserRegistrationEvent.php

示例4: __construct

 public function __construct(SessionEvent $sessionEvent, User $user)
 {
     $session = $sessionEvent->getSession();
     $course = $session->getCourse();
     $details = [];
     $details['username'] = $user->getUsername();
     $details['firsName'] = $user->getFirstName();
     $details['lastName'] = $user->getLastName();
     $details['sessionEventId'] = $sessionEvent->getId();
     $details['sessionEventName'] = $sessionEvent->getName();
     $details['sessionId'] = $session->getId();
     $details['sessionName'] = $session->getName();
     $details['courseId'] = $course->getId();
     $details['courseTitle'] = $course->getTitle();
     $details['courseCode'] = $course->getCode();
     parent::__construct(self::ACTION, $details, $user);
 }
开发者ID:claroline,项目名称:distribution,代码行数:17,代码来源:LogSessionEventUserRegistrationEvent.php

示例5: setUser

 /**
  * @param User $user
  */
 public function setUser(User $user)
 {
     $this->user = $user;
     $this->userName = $user->getFirstName() . ' ' . $user->getLastName();
 }
开发者ID:stefk,项目名称:CompetencyBundle,代码行数:8,代码来源:AbstractObjectiveProgress.php

示例6: userInfosRequestAction

 /**
  * @EXT\Route(
  *     "user/{user}/infos/request",
  *     name="claro_user_infos_request",
  *     options = {"expose"=true}
  * )
  */
 public function userInfosRequestAction(User $user)
 {
     $datas = array('id' => $user->getId(), 'firstName' => $user->getFirstName(), 'lastName' => $user->getLastName(), 'username' => $user->getUsername(), 'mail' => $user->getMail(), 'phone' => $user->getPhone(), 'picture' => $user->getPicture());
     return new JsonResponse($datas, 200);
 }
开发者ID:claroline,项目名称:distribution,代码行数:12,代码来源:UserController.php

示例7: createRemoteUser

 public function createRemoteUser(User $user)
 {
     $url = 'api/users.json';
     $tmppw = uniqid();
     $payload = array('profile_form_creation[username]' => $user->getUsername(), 'profile_form_creation[firstName]' => $user->getFirstName(), 'profile_form_creation[lastName]' => $user->getLastName(), 'profile_form_creation[mail]' => $user->getMail(), 'profile_form_creation[administrativeCode]' => $user->getUsername(), 'profile_form_creation[plainPassword][first]' => $tmppw, 'profile_form_creation[plainPassword][second]' => $tmppw);
     $serverOutput = $this->apiManager->url($this->targetFriend, $url, $payload, 'POST');
     $datas = json_decode($serverOutput, true);
     return $datas;
 }
开发者ID:kitan1982,项目名称:InvoiceBundle,代码行数:9,代码来源:SharedWorkspaceManager.php

示例8: generatePublicUrl

 /**
  * @param User $user
  * @param int  $try
  *
  * @return string
  */
 public function generatePublicUrl(User $user)
 {
     $publicUrl = $user->getFirstName() . '.' . $user->getLastName();
     $publicUrl = strtolower(str_replace(' ', '-', $publicUrl));
     $searchedUsers = $this->objectManager->getRepository('ClarolineCoreBundle:User')->findOneByPublicUrl($publicUrl);
     if (null !== $searchedUsers) {
         $publicUrl .= '_' . uniqid();
     }
     return $publicUrl;
 }
开发者ID:ngydat,项目名称:CoreBundle,代码行数:16,代码来源:UserManager.php

示例9: sendTicketMail

 public function sendTicketMail(User $user, Ticket $ticket, $type = '', Comment $comment = null)
 {
     $contactMail = null;
     $receivers = [];
     $extra = [];
     switch ($type) {
         case 'new_ticket':
             $contactIds = $this->getConfigurationContactsOption();
             $contactMail = $ticket->getContactMail();
             if (count($contactIds) > 0) {
                 $receivers = $this->userManager->getUsersByIds($contactIds);
                 $subject = '[' . $this->translator->trans('new_ticket', [], 'support') . '][' . $user->getFirstName() . ' ' . $user->getLastName() . '] ' . $ticket->getTitle();
                 $content = $ticket->getDescription() . '<br><br>' . $this->translator->trans('mail', [], 'platform') . ' : ' . $ticket->getContactMail() . '<br>' . $this->translator->trans('phone', [], 'platform') . ' : ' . $ticket->getContactPhone() . '<br><br>';
             }
             break;
         case 'ticket_edition':
             $contactIds = $this->getConfigurationContactsOption();
             $contactMail = $ticket->getContactMail();
             if (count($contactIds) > 0) {
                 $receivers = $this->userManager->getUsersByIds($contactIds);
                 $subject = '[' . $this->translator->trans('ticket_edition', [], 'support') . '][' . $user->getFirstName() . ' ' . $user->getLastName() . '] ' . $ticket->getTitle();
                 $content = $ticket->getDescription() . '<br><br>' . $this->translator->trans('mail', [], 'platform') . ' : ' . $ticket->getContactMail() . '<br>' . $this->translator->trans('phone', [], 'platform') . ' : ' . $ticket->getContactPhone() . '<br><br>';
             }
             break;
         case 'ticket_deletion':
             $contactIds = $this->getConfigurationContactsOption();
             if (count($contactIds) > 0) {
                 $receivers = $this->userManager->getUsersByIds($contactIds);
                 $subject = '[' . $this->translator->trans('ticket_deletion', [], 'support') . '][' . $user->getFirstName() . ' ' . $user->getLastName() . '] ' . $ticket->getTitle();
                 $content = $this->translator->trans('ticket_deletion', [], 'support') . '<br><br>';
             }
             break;
         case 'new_admin_comment':
             $extra['to'] = [$ticket->getContactMail()];
             if (!is_null($comment)) {
                 $subject = '[' . $this->translator->trans('new_comment', [], 'support') . '][' . $this->translator->trans('ticket', [], 'support') . ' #' . $ticket->getNum() . '] ' . $ticket->getTitle();
                 $content = $comment->getContent() . '<br><br>';
             }
             break;
         case 'new_comment':
             $contactIds = $this->getConfigurationContactsOption();
             $contactMail = $ticket->getContactMail();
             if (count($contactIds) > 0 && !is_null($comment)) {
                 $receivers = $this->userManager->getUsersByIds($contactIds);
                 $subject = '[' . $this->translator->trans('new_comment', [], 'support') . '][' . $user->getFirstName() . ' ' . $user->getLastName() . '] ' . $ticket->getTitle();
                 $content = $comment->getContent() . '<br><br>' . $this->translator->trans('mail', [], 'platform') . ' : ' . $ticket->getContactMail() . '<br>' . $this->translator->trans('phone', [], 'platform') . ' : ' . $ticket->getContactPhone() . '<br><br>';
             }
             break;
         default:
             break;
     }
     if (count($receivers) > 0 || count($extra) > 0) {
         $this->mailManager->send($subject, $content, $receivers, null, $extra, false, $contactMail);
     }
 }
开发者ID:claroline,项目名称:distribution,代码行数:55,代码来源:SupportManager.php

示例10: send

 /**
  * @param string $subject
  * @param string $body
  * @param User[] $users
  * @param User   $from
  * @param array  $extra
  * @param bool   $force
  * @param string $replyToMail
  *
  * @return bool
  */
 public function send($subject, $body, array $users, $from = null, array $extra = [], $force = false, $replyToMail = null)
 {
     if (count($users) === 0) {
         //obviously, if we're not going to send anything to anyone, it's better to stop
         return false;
     }
     if ($this->isMailerAvailable()) {
         $to = [];
         $layout = $this->contentManager->getTranslatedContent(['type' => 'claro_mail_layout']);
         $fromEmail = $this->getMailerFrom();
         $locale = count($users) === 1 ? $users[0]->getLocale() : $this->ch->getParameter('locale_language');
         if (!$locale) {
             $locale = $this->ch->getParameter('locale_language');
         }
         $usedLayout = $layout[$locale]['content'];
         $body = str_replace('%content%', $body, $usedLayout);
         $body = str_replace('%platform_name%', $this->ch->getParameter('name'), $body);
         if ($from) {
             $body = str_replace('%first_name%', $from->getFirstName(), $body);
             $body = str_replace('%last_name%', $from->getLastName(), $body);
         } else {
             $body = str_replace('%first_name%', $this->ch->getParameter('name'), $body);
             $body = str_replace('%last_name%', '', $body);
         }
         foreach ($users as $user) {
             $mail = $user->getMail();
             if ($user->isMailValidated() || $force) {
                 if (filter_var($mail, FILTER_VALIDATE_EMAIL)) {
                     $to[] = $mail;
                 }
             }
         }
         if (isset($extra['to'])) {
             foreach ($extra['to'] as $mail) {
                 if (filter_var($mail, FILTER_VALIDATE_EMAIL)) {
                     $to[] = $mail;
                 }
             }
         }
         $message = \Swift_Message::newInstance()->setSubject($subject)->setFrom($fromEmail)->setReplyTo($replyToMail)->setBody($body, 'text/html');
         if ($from !== null && filter_var($from->getMail(), FILTER_VALIDATE_EMAIL)) {
             $message->setReplyTo($from->getMail());
         }
         if (count($to) > 1) {
             $message->setBcc($to);
         } else {
             $message->setTo($to);
         }
         if (isset($extra['attachment'])) {
             $message->attach(\Swift_Attachment::fromPath($extra['attachment'], 'application/octet-stream'));
         }
         return $this->mailer->send($message) ? true : false;
     }
     return false;
 }
开发者ID:claroline,项目名称:distribution,代码行数:66,代码来源:MailManager.php

示例11: getPublicUserAction

 /**
  * @ApiDoc(
  *     description="Returns a user",
  *     views = {"user"}
  * )
  * @Get("/user/{user}/public", name="get_public_user", options={ "method_prefix" = false })
  */
 public function getPublicUserAction(User $user)
 {
     $settingsProfile = $this->facetManager->getVisiblePublicPreference();
     $publicUser = [];
     foreach ($settingsProfile as $property => $isViewable) {
         if ($isViewable || $user === $this->container->get('security.token_storage')->getToken()->getUser()) {
             switch ($property) {
                 case 'baseData':
                     $publicUser['lastName'] = $user->getLastName();
                     $publicUser['firstName'] = $user->getFirstName();
                     $publicUser['username'] = $user->getUsername();
                     $publicUser['picture'] = $user->getPicture();
                     $publicUser['description'] = $user->getAdministrativeCode();
                     break;
                 case 'email':
                     $publicUser['mail'] = $user->getMail();
                     break;
                 case 'phone':
                     $publicUser['phone'] = $user->getPhone();
                     break;
                 case 'sendMail':
                     $publicUser['mail'] = $user->getMail();
                     $publicUser['allowSendMail'] = true;
                     break;
                 case 'sendMessage':
                     $publicUser['allowSendMessage'] = true;
                     $publicUser['id'] = $user->getId();
                     break;
             }
         }
     }
     return $publicUser;
 }
开发者ID:claroline,项目名称:distribution,代码行数:40,代码来源:UserController.php

示例12: send

 /**
  * @param string $subject
  * @param string $body
  * @param User[] $users
  * @param User   $from
  *
  * @return boolean
  */
 public function send($subject, $body, array $users, $from = null, array $extra = array())
 {
     if ($this->isMailerAvailable()) {
         $to = [];
         $layout = $this->contentManager->getTranslatedContent(array('type' => 'claro_mail_layout'));
         $fromEmail = 'noreply@' . $this->ch->getParameter('domain_name');
         $locale = count($users) === 1 ? $users[0]->getLocale() : $this->ch->getParameter('locale_language');
         if (!$locale) {
             $locale = $this->ch->getParameter('locale_language');
         }
         $usedLayout = $layout[$locale]['content'];
         $body = str_replace('%content%', $body, $usedLayout);
         $body = str_replace('%platform_name%', $this->ch->getParameter('name'), $body);
         if ($from) {
             $body = str_replace('%first_name%', $from->getFirstName(), $body);
             $body = str_replace('%last_name%', $from->getLastName(), $body);
         } else {
             $body = str_replace('%first_name%', $this->ch->getParameter('name'), $body);
             $body = str_replace('%last_name%', '', $body);
         }
         foreach ($users as $user) {
             $mail = $user->getMail();
             if (filter_var($mail, FILTER_VALIDATE_EMAIL)) {
                 $to[] = $mail;
             }
         }
         if (isset($extra['to'])) {
             foreach ($extra['to'] as $mail) {
                 if (filter_var($mail, FILTER_VALIDATE_EMAIL)) {
                     $to[] = $mail;
                 }
             }
         }
         $message = \Swift_Message::newInstance()->setSubject($subject)->setFrom($fromEmail)->setBody($body, 'text/html');
         if (count($to) > 1) {
             $message->setBcc($to);
         } else {
             $message->setTo($to);
         }
         if (isset($extra['attachment'])) {
             $message->attach(\Swift_Attachment::fromPath($extra['attachment'], "application/octet-stream"));
         }
         return $this->mailer->send($message) ? true : false;
     }
     return false;
 }
开发者ID:ChMat,项目名称:CoreBundle,代码行数:54,代码来源:MailManager.php


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