当前位置: 首页>>代码示例>>PHP>>正文


PHP Group_User::delete方法代码示例

本文整理汇总了PHP中Group_User::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Group_User::delete方法的具体用法?PHP Group_User::delete怎么用?PHP Group_User::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Group_User的用法示例。


在下文中一共展示了Group_User::delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: syncLdapGroups

 /**
  * Synchronise LDAP group of the user
  **/
 function syncLdapGroups()
 {
     global $DB;
     // input["_groups"] not set when update from user.form or preference
     if (isset($this->fields["authtype"]) && isset($this->input["_groups"]) && ($this->fields["authtype"] == Auth::LDAP || Auth::isAlternateAuth($this->fields['authtype']))) {
         if (isset($this->fields["id"]) && $this->fields["id"] > 0) {
             $authtype = Auth::getMethodsByID($this->fields["authtype"], $this->fields["auths_id"]);
             if (count($authtype)) {
                 // Clean groups
                 $this->input["_groups"] = array_unique($this->input["_groups"]);
                 // Delete not available groups like to LDAP
                 $query = "SELECT `glpi_groups_users`.`id`,\n                                `glpi_groups_users`.`groups_id`,\n                                `glpi_groups_users`.`is_dynamic`\n                         FROM `glpi_groups_users`\n                         LEFT JOIN `glpi_groups`\n                              ON (`glpi_groups`.`id` = `glpi_groups_users`.`groups_id`)\n                         WHERE `glpi_groups_users`.`users_id` = '" . $this->fields["id"] . "'";
                 $result = $DB->query($query);
                 $groupuser = new Group_User();
                 if ($DB->numrows($result) > 0) {
                     while ($data = $DB->fetch_assoc($result)) {
                         if (in_array($data["groups_id"], $this->input["_groups"])) {
                             // Delete found item in order not to add it again
                             unset($this->input["_groups"][array_search($data["groups_id"], $this->input["_groups"])]);
                         } else {
                             if ($data['is_dynamic']) {
                                 $groupuser->delete(array('id' => $data["id"]));
                             }
                         }
                     }
                 }
                 //If the user needs to be added to one group or more
                 if (count($this->input["_groups"]) > 0) {
                     foreach ($this->input["_groups"] as $group) {
                         $groupuser->add(array('users_id' => $this->fields["id"], 'groups_id' => $group, 'is_dynamic' => 1));
                     }
                     unset($this->input["_groups"]);
                 }
             }
         }
     }
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:40,代码来源:user.class.php

示例2: sprintf

     $user->update($_POST);
     Event::log($_POST['id'], "users", 5, "setup", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
     Html::back();
 } else {
     if (isset($_POST["addgroup"])) {
         $groupuser->check(-1, CREATE, $_POST);
         if ($groupuser->add($_POST)) {
             Event::log($_POST["users_id"], "users", 4, "setup", sprintf(__('%s adds a user to a group'), $_SESSION["glpiname"]));
         }
         Html::back();
     } else {
         if (isset($_POST["deletegroup"])) {
             if (count($_POST["item"])) {
                 foreach ($_POST["item"] as $key => $val) {
                     if ($groupuser->can($key, DELETE)) {
                         $groupuser->delete(array('id' => $key));
                     }
                 }
             }
             Event::log($_POST["users_id"], "users", 4, "setup", sprintf(__('%s deletes users from a group'), $_SESSION["glpiname"]));
             Html::back();
         } else {
             if (isset($_POST["change_auth_method"])) {
                 Session::checkRight('user', User::UPDATEAUTHENT);
                 if (isset($_POST["auths_id"])) {
                     User::changeAuthMethod(array($_POST["id"]), $_POST["authtype"], $_POST["auths_id"]);
                 }
                 Html::back();
             } else {
                 if (isset($_GET["ext_auth"])) {
                     Html::header(User::getTypeName(Session::getPluralNumber()), '', "admin", "user");
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:31,代码来源:user.form.php


注:本文中的Group_User::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。