本文整理汇总了PHP中OC_User::getDisplayNames方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_User::getDisplayNames方法的具体用法?PHP OC_User::getDisplayNames怎么用?PHP OC_User::getDisplayNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_User
的用法示例。
在下文中一共展示了OC_User::getDisplayNames方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
OC_Util::checkAdminUser();
OCP\Util::addScript('files_external', 'settings');
OCP\Util::addscript('3rdparty', 'chosen/chosen.jquery.min');
OCP\Util::addStyle('files_external', 'settings');
OCP\Util::addStyle('3rdparty', 'chosen/chosen');
$backends = OC_Mount_Config::getBackends();
$personal_backends = array();
$enabled_backends = explode(',', OCP\Config::getAppValue('files_external', 'user_mounting_backends', ''));
foreach ($backends as $class => $backend) {
if ($class != '\\OC\\Files\\Storage\\Local') {
$personal_backends[$class] = array('backend' => $backend['backend'], 'enabled' => in_array($class, $enabled_backends));
}
}
$tmpl = new OCP\Template('files_external', 'settings');
$tmpl->assign('isAdminPage', true);
$tmpl->assign('mounts', OC_Mount_Config::getSystemMountPoints());
$tmpl->assign('backends', $backends);
$tmpl->assign('personal_backends', $personal_backends);
$tmpl->assign('groups', OC_Group::getGroups());
$tmpl->assign('users', OCP\User::getUsers());
$tmpl->assign('userDisplayNames', OC_User::getDisplayNames());
$tmpl->assign('dependencies', OC_Mount_Config::checkDependencies());
$tmpl->assign('allowUserMounting', OCP\Config::getAppValue('files_external', 'allow_user_mounting', 'yes'));
return $tmpl->fetchPage();
示例2: array
$shareWith = array();
$groups = OC_Group::getGroups((string) $_GET['search']);
if ($shareWithinGroupOnly) {
$usergroups = OC_Group::getUserGroups(OC_User::getUser());
$groups = array_intersect($groups, $usergroups);
}
$count = 0;
$users = array();
$limit = 0;
$offset = 0;
while ($count < 15 && count($users) == $limit) {
$limit = 15 - $count;
if ($shareWithinGroupOnly) {
$users = OC_Group::DisplayNamesInGroups($usergroups, (string) $_GET['search'], $limit, $offset);
} else {
$users = OC_User::getDisplayNames((string) $_GET['search'], $limit, $offset);
}
$offset += $limit;
foreach ($users as $uid => $displayName) {
if ((!isset($_GET['itemShares']) || !is_array((string) $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER]) || !in_array($uid, (string) $_GET['itemShares'][OCP\Share::SHARE_TYPE_USER])) && $uid != OC_User::getUser()) {
$shareWith[] = array('label' => $displayName, 'value' => array('shareType' => OCP\Share::SHARE_TYPE_USER, 'shareWith' => $uid));
$count++;
}
}
}
$count = 0;
// enable l10n support
$l = \OC::$server->getL10N('core');
foreach ($groups as $group) {
if ($count < 15) {
if (!isset($_GET['itemShares']) || !isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !is_array((string) $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP]) || !in_array($group, (string) $_GET['itemShares'][OCP\Share::SHARE_TYPE_GROUP])) {
示例3: getDisplayNames
/**
* Get a list of all display names and user ids.
* @param string $search search pattern
* @param int|null $limit
* @param int|null $offset
* @return array an array of all display names (value) and the correspondig uids (key)
*/
public static function getDisplayNames($search = '', $limit = null, $offset = null)
{
return \OC_User::getDisplayNames($search, $limit, $offset);
}
示例4: array
}
} else {
$gid = false;
}
if (isset($_GET['pattern']) && !empty($_GET['pattern'])) {
$pattern = $_GET['pattern'];
} else {
$pattern = '';
}
$users = array();
$userManager = \OC_User::getManager();
if (OC_User::isAdminUser(OC_User::getUser())) {
if ($gid !== false) {
$batch = OC_Group::displayNamesInGroup($gid, $pattern, $limit, $offset);
} else {
$batch = OC_User::getDisplayNames($pattern, $limit, $offset);
}
foreach ($batch as $uid => $displayname) {
$user = $userManager->get($uid);
$users[] = array('name' => $uid, 'displayname' => $displayname, 'groups' => join(', ', OC_Group::getUserGroups($uid)), 'subadmin' => join(', ', OC_SubAdmin::getSubAdminsGroups($uid)), 'quota' => OC_Preferences::getValue($uid, 'files', 'quota', 'default'), 'storageLocation' => $user->getHome(), 'lastLogin' => $user->getLastLogin());
}
} else {
$groups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser());
if ($gid !== false && in_array($gid, $groups)) {
$groups = array($gid);
} elseif ($gid !== false) {
//don't you try to investigate loops you must not know about
$groups = array();
}
$batch = OC_Group::usersInGroups($groups, $pattern, $limit, $offset);
foreach ($batch as $uid) {
示例5: array
OC_Util::checkSubAdminUser();
OC_App::loadApps();
// We have some javascript foo!
OC_Util::addScript('settings', 'users');
OC_Util::addScript('core', 'multiselect');
OC_Util::addScript('core', 'singleselect');
OC_Util::addScript('core', 'jquery.inview');
OC_Util::addStyle('settings', 'settings');
OC_App::setActiveNavigationEntry('core_users');
$users = array();
$groups = array();
$isadmin = OC_User::isAdminUser(OC_User::getUser());
$recoveryAdminEnabled = OC_App::isEnabled('files_encryption') && OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled');
if ($isadmin) {
$accessiblegroups = OC_Group::getGroups();
$accessibleusers = OC_User::getDisplayNames('', 30);
$subadmins = OC_SubAdmin::getAllSubAdmins();
} else {
$accessiblegroups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser());
$accessibleusers = OC_Group::displayNamesInGroups($accessiblegroups, '', 30);
$subadmins = false;
}
// load preset quotas
$quotaPreset = OC_Appconfig::getValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB');
$quotaPreset = explode(',', $quotaPreset);
foreach ($quotaPreset as &$preset) {
$preset = trim($preset);
}
$quotaPreset = array_diff($quotaPreset, array('default', 'none'));
$defaultQuota = OC_Appconfig::getValue('files', 'default_quota', 'none');
$defaultQuotaIsUserDefined = array_search($defaultQuota, $quotaPreset) === false && array_search($defaultQuota, array('none', 'default')) === false;
示例6: array
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
OC_JSON::callCheck();
OC_JSON::checkSubAdminUser();
if (isset($_GET['offset'])) {
$offset = $_GET['offset'];
} else {
$offset = 0;
}
if (isset($_GET['limit'])) {
$limit = $_GET['limit'];
} else {
$limit = 10;
}
$users = array();
if (OC_User::isAdminUser(OC_User::getUser())) {
$batch = OC_User::getDisplayNames('', $limit, $offset);
foreach ($batch as $user => $displayname) {
$users[] = array('name' => $user, 'displayname' => $displayname, 'groups' => join(', ', OC_Group::getUserGroups($user)), 'subadmin' => join(', ', OC_SubAdmin::getSubAdminsGroups($user)), 'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default'));
}
} else {
$groups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser());
$batch = OC_Group::usersInGroups($groups, '', $limit, $offset);
foreach ($batch as $user) {
$users[] = array('name' => $user, 'displayname' => OC_User::getDisplayName($user), 'groups' => join(', ', OC_Group::getUserGroups($user)), 'quota' => OC_Preferences::getValue($user, 'files', 'quota', 'default'));
}
}
OC_JSON::success(array('data' => $users));
示例7: array
OC_Util::addScript('settings', 'users/groups');
OC_Util::addScript('core', 'multiselect');
OC_Util::addScript('core', 'singleselect');
OC_Util::addScript('core', 'jquery.inview');
OC_Util::addStyle('settings', 'settings');
OC_App::setActiveNavigationEntry('core_users');
$users = array();
$userManager = \OC_User::getManager();
$groupManager = \OC_Group::getManager();
$isAdmin = OC_User::isAdminUser(OC_User::getUser());
$groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), $isAdmin, $groupManager);
$groupsInfo->setSorting($groupsInfo::SORT_USERCOUNT);
list($adminGroup, $groups) = $groupsInfo->get();
$recoveryAdminEnabled = OC_App::isEnabled('files_encryption') && OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled');
if ($isAdmin) {
$accessibleUsers = OC_User::getDisplayNames('', 50);
$subadmins = OC_SubAdmin::getAllSubAdmins();
} else {
/* Retrieve group IDs from $groups array, so we can pass that information into OC_Group::displayNamesInGroups() */
$gids = array();
foreach ($groups as $group) {
if (isset($group['id'])) {
$gids[] = $group['id'];
}
}
$accessibleUsers = OC_Group::displayNamesInGroups($gids, '', 50);
$subadmins = false;
}
// load preset quotas
$quotaPreset = OC_Appconfig::getValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB');
$quotaPreset = explode(',', $quotaPreset);