本文整理匯總了PHP中Claroline\CoreBundle\Entity\User::getAdministrativeCode方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::getAdministrativeCode方法的具體用法?PHP User::getAdministrativeCode怎麽用?PHP User::getAdministrativeCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Claroline\CoreBundle\Entity\User
的用法示例。
在下文中一共展示了User::getAdministrativeCode方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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;
}