本文整理汇总了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;
}