當前位置: 首頁>>代碼示例>>PHP>>正文


PHP IUser::getDisplayName方法代碼示例

本文整理匯總了PHP中OCP\IUser::getDisplayName方法的典型用法代碼示例。如果您正苦於以下問題:PHP IUser::getDisplayName方法的具體用法?PHP IUser::getDisplayName怎麽用?PHP IUser::getDisplayName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OCP\IUser的用法示例。


在下文中一共展示了IUser::getDisplayName方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: updateCard

 /**
  * @param VCard $vCard
  * @param IUser $user
  * @return bool
  */
 public function updateCard(VCard $vCard, IUser $user)
 {
     $uid = $user->getUID();
     $displayName = $user->getDisplayName();
     $displayName = empty($displayName) ? $uid : $displayName;
     $emailAddress = $user->getEMailAddress();
     $cloudId = $user->getCloudId();
     $image = $user->getAvatarImage(-1);
     $updated = false;
     if ($this->propertyNeedsUpdate($vCard, 'FN', $displayName)) {
         $vCard->FN = new Text($vCard, 'FN', $displayName);
         unset($vCard->N);
         $vCard->add(new Text($vCard, 'N', $this->splitFullName($displayName)));
         $updated = true;
     }
     if ($this->propertyNeedsUpdate($vCard, 'EMAIL', $emailAddress)) {
         $vCard->EMAIL = new Text($vCard, 'EMAIL', $emailAddress);
         $updated = true;
     }
     if ($this->propertyNeedsUpdate($vCard, 'CLOUD', $cloudId)) {
         $vCard->CLOUD = new Text($vCard, 'CLOUD', $cloudId);
         $updated = true;
     }
     if ($this->propertyNeedsUpdate($vCard, 'PHOTO', $image)) {
         $vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]);
         $updated = true;
     }
     if (empty($emailAddress) && !is_null($vCard->EMAIL)) {
         unset($vCard->EMAIL);
         $updated = true;
     }
     if (empty($cloudId) && !is_null($vCard->CLOUD)) {
         unset($vCard->CLOUD);
         $updated = true;
     }
     if (empty($image) && !is_null($vCard->PHOTO)) {
         unset($vCard->PHOTO);
         $updated = true;
     }
     return $updated;
 }
開發者ID:evanjt,項目名稱:core,代碼行數:46,代碼來源:converter.php

示例2: formatUserForIndex

 /**
  * @param IUser $user
  * @param array $userGroups
  * @return array
  */
 private function formatUserForIndex(IUser $user, array $userGroups = null)
 {
     return array('name' => $user->getUID(), 'displayname' => $user->getDisplayName(), 'groups' => empty($userGroups) ? $this->groupManager->getUserGroupIds($user) : $userGroups, 'subadmin' => \OC_SubAdmin::getSubAdminsGroups($user->getUID()), 'quota' => $this->config->getUserValue($user->getUID(), 'files', 'quota', 'default'), 'storageLocation' => $user->getHome(), 'lastLogin' => $user->getLastLogin(), 'backend' => $user->getBackendClassName(), 'email' => $this->config->getUserValue($user->getUID(), 'settings', 'email', ''));
 }
開發者ID:riso,項目名稱:owncloud-core,代碼行數:9,代碼來源:userscontroller.php

示例3: formatUserForIndex

 /**
  * @param IUser $user
  * @param array $userGroups
  * @return array
  */
 private function formatUserForIndex(IUser $user, array $userGroups = null)
 {
     // TODO: eliminate this encryption specific code below and somehow
     // hook in additional user info from other apps
     // recovery isn't possible if admin or user has it disabled and encryption
     // is enabled - so we eliminate the else paths in the conditional tree
     // below
     $restorePossible = false;
     if ($this->isEncryptionAppEnabled) {
         if ($this->isRestoreEnabled) {
             // check for the users recovery setting
             $recoveryMode = $this->config->getUserValue($user->getUID(), 'encryption', 'recoveryEnabled', '0');
             // method call inside empty is possible with PHP 5.5+
             $recoveryModeEnabled = !empty($recoveryMode);
             if ($recoveryModeEnabled) {
                 // user also has recovery mode enabled
                 $restorePossible = true;
             }
         }
     } else {
         // recovery is possible if encryption is disabled (plain files are
         // available)
         $restorePossible = true;
     }
     return ['name' => $user->getUID(), 'displayname' => $user->getDisplayName(), 'groups' => empty($userGroups) ? $this->groupManager->getUserGroupIds($user) : $userGroups, 'subadmin' => $this->subAdminFactory->getSubAdminsOfGroups($user->getUID()), 'quota' => $this->config->getUserValue($user->getUID(), 'files', 'quota', 'default'), 'storageLocation' => $user->getHome(), 'lastLogin' => $user->getLastLogin() * 1000, 'backend' => $user->getBackendClassName(), 'email' => $this->config->getUserValue($user->getUID(), 'settings', 'email', ''), 'isRestoreDisabled' => !$restorePossible];
 }
開發者ID:jincreator,項目名稱:core,代碼行數:31,代碼來源:userscontroller.php

示例4: userToPrincipal

 /**
  * @param IUser $user
  * @return array
  */
 protected function userToPrincipal($user)
 {
     $userId = $user->getUID();
     $displayName = $user->getDisplayName();
     $principal = ['uri' => $this->principalPrefix . '/' . $userId, '{DAV:}displayname' => is_null($displayName) ? $userId : $displayName];
     $email = $user->getEMailAddress();
     if (!empty($email)) {
         $principal['{http://sabredav.org/ns}email-address'] = $email;
         return $principal;
     }
     return $principal;
 }
開發者ID:stweil,項目名稱:owncloud-core,代碼行數:16,代碼來源:principal.php

示例5: userToPrincipal

 /**
  * @param IUser $user
  * @return array
  */
 protected function userToPrincipal($user)
 {
     $principal = ['uri' => 'principals/users/' . $user->getUID(), '{DAV:}displayname' => $user->getDisplayName()];
     return $principal;
 }
開發者ID:rchicoli,項目名稱:owncloud-core,代碼行數:9,代碼來源:GroupPrincipalBackend.php

示例6: updateCard

 /**
  * @param VCard $vCard
  * @param IUser $user
  * @return bool
  */
 public function updateCard(VCard $vCard, IUser $user)
 {
     $uid = $user->getUID();
     $displayName = $user->getDisplayName();
     $displayName = empty($displayName) ? $uid : $displayName;
     $emailAddress = $user->getEMailAddress();
     $cloudId = $user->getCloudId();
     $image = $this->getAvatarImage($user);
     $groups = \OC::$server->getGroupManager()->getUserGroups($user);
     $updated = false;
     if ($this->propertyNeedsUpdate($vCard, 'FN', $displayName)) {
         $vCard->FN = new Text($vCard, 'FN', $displayName);
         unset($vCard->N);
         $vCard->add(new Text($vCard, 'N', $this->splitFullName($displayName)));
         $updated = true;
     }
     if ($this->propertyNeedsUpdate($vCard, 'EMAIL', $emailAddress)) {
         $vCard->EMAIL = new Text($vCard, 'EMAIL', $emailAddress);
         $updated = true;
     }
     if ($this->propertyNeedsUpdate($vCard, 'CLOUD', $cloudId)) {
         $vCard->CLOUD = new Text($vCard, 'CLOUD', $cloudId);
         $updated = true;
     }
     if ($this->propertyNeedsUpdate($vCard, 'PHOTO', $image)) {
         $vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType()]);
         $updated = true;
     }
     if (empty($emailAddress) && !is_null($vCard->EMAIL)) {
         unset($vCard->EMAIL);
         $updated = true;
     }
     if (empty($cloudId) && !is_null($vCard->CLOUD)) {
         unset($vCard->CLOUD);
         $updated = true;
     }
     if (empty($image) && !is_null($vCard->PHOTO)) {
         unset($vCard->PHOTO);
         $updated = true;
     }
     /**
      * Sabre\VObject\Property\Text $categories
      */
     $categoriesProperty = $vCard->CATEGORIES;
     if (method_exists($categoriesProperty, 'count')) {
         $categoriesCount = $categoriesProperty->count();
         $categories = [];
         for ($i = 0; $i < $categoriesCount; $i++) {
             $categories[] = $categoriesProperty->getValue();
             $categoriesProperty->getIterator()->next();
             $categoriesProperty = $categoriesProperty->getIterator()->current();
         }
         //            var_dump(array_keys($groups),$categories);
         //            var_dump(array_diff(array_keys($groups), $categories));
         //            exit;
         if (count(array_keys($groups)) != count($categories) || !empty(array_diff(array_keys($groups), $categories))) {
             unset($vCard->CATEGORIES);
             $updated = true;
         }
     } else {
         if ($groups) {
             $updated = true;
         }
     }
     return $updated;
 }
開發者ID:raceface2nd,項目名稱:owncollab,代碼行數:71,代碼來源:converteruser.php


注:本文中的OCP\IUser::getDisplayName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。