本文整理汇总了PHP中GroupManager::getFromName方法的典型用法代码示例。如果您正苦于以下问题:PHP GroupManager::getFromName方法的具体用法?PHP GroupManager::getFromName怎么用?PHP GroupManager::getFromName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GroupManager
的用法示例。
在下文中一共展示了GroupManager::getFromName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: realpath
<?php
include realpath(dirname(__DIR__) . "/private/class/UserManager.php");
include realpath(dirname(__DIR__) . "/private/class/GroupManager.php");
session_start();
$user = UserManager::getCurrent();
$_PAGETITLE = "Blockland Glass | Control Panel";
include realpath(dirname(__DIR__) . "/private/header.php");
include realpath(dirname(__DIR__) . "/private/navigationbar.php");
if (!GroupManager::getFromName("Administrator")) {
GroupManager::createDefaultGroups();
}
if (!$user || !$user->inGroup("Administrator")) {
header('Location: /login.php?redirect=' . urlencode("/admin/index.php"));
return;
} else {
$_adminAuthed = true;
}
?>
<div class="maincontainer">
<div class="tile" style="width: 185px; float: left;">
<ul class="sidenav">
<li><a href="?tab=board">Boards</a></li>
<li><a href="?tab=user">Users</a></li>
<li><a href="?tab=groups">Groups</a></li>
<li><a href="?tab=bans">Bans</a></li>
</ul>
</div>
<div class="tile" style="width: 685px; padding: 15px; float: right;">
<?php
示例2: dirname
<?php
require_once dirname(__DIR__) . '/private/class/GroupManager.php';
$group = GroupManager::getFromName("Beta");
if ($group === false) {
GroupManager::createGroupWithLeaderBLID("Beta", "Closed beta", "ff0000", "gear", 9789);
$group = GroupManager::getFromName("Beta");
}
if (isset($_POST['action'])) {
if ($_POST['action'] == "add") {
$res = GroupManager::addBLIDToGroupID($_POST['blid'], $group->getId());
if ($res) {
echo "Added " . $_POST['blid'] . "<hr />";
} else {
echo "Failed to add " . $_POST['blid'] . "<hr />";
}
}
}
$members = GroupManager::getMembersByID($group->getId());
foreach ($members as $mem) {
echo $mem . "<br />";
}
?>
<hr />
<form action="" method="post">
<input type="hidden" name="action" value="add" />
<input type="text" name="blid" />
<input type="submit" value="Add" />
</form>