本文整理匯總了PHP中Groups::addUser方法的典型用法代碼示例。如果您正苦於以下問題:PHP Groups::addUser方法的具體用法?PHP Groups::addUser怎麽用?PHP Groups::addUser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Groups
的用法示例。
在下文中一共展示了Groups::addUser方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
public function __construct()
{
$groups = new Groups();
$doc = new Documents();
/**
* Wenn gepostet wurde
*/
if ($_POST) {
// Gruppe wird erstellt
if (isset($_POST["group_name"])) {
$groups->saveGroup($this->saveInputs($_POST["group_name"]), $this->saveInputs($_POST["group_description"]), get_current_user_id());
}
// User wird hinzugefügt
if (isset($_POST["userToAdd"])) {
$groups->addUser($this->saveInputs($_POST["group_id"]), $this->saveInputs($_POST["userToAdd"]));
}
if (isset($_POST["userToDelete"])) {
$groups->deleteUser($this->saveInputs($_POST["group_id"]), $this->saveInputs($_POST["userToDelete"]));
}
}
// Bestimmte ID wird abgefragt
if (isset($_GET["id"])) {
$user = wp_get_current_user();
$detailGroup = $groups->getGroupAndUsers($this->saveInputs($_GET["id"]));
$detailGroup->userToAdd = array();
if ($user->roles[0] == "dokuAdmin" || $user->roles[0] == "administrator") {
$detailGroup->userToAdd = $groups->getUserNotInGroup($this->saveInputs($_GET["id"]));
}
$documentsInGroup = $doc->getDocumentsInGroup($this->saveInputs($_GET["id"]));
echo $this->detailView($detailGroup, $documentsInGroup);
} else {
$arGroups = $groups->getAuthGroups();
echo $this->groupView($arGroups);
}
}
示例2: addUserToGroupAction
/**
* Add user to group.
* @ParamConverter("user", class="MiwClubPadelBundle:Users",options={"mapping"={"userid"="id"}})
* @ParamConverter("group", class="MiwClubPadelBundle:Groups",options={"mapping"={"groupid"="id"}})
*/
public function addUserToGroupAction(Users $user, Groups $group)
{
$em = $this->getDoctrine()->getManager();
$em->getRepository('MiwClubPadelBundle:Users');
$group->addUser($user);
$user->addGroup($group);
$em->flush();
return $user;
}