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


PHP UserGroup::Delete方法代码示例

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


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

示例1: DeleteUser

 /**
  * Deletes a user
  *
  * @param int $id
  * @return unknown
  */
 function DeleteUser()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error('Token does not match', E_USER_ERROR);
     }
     $db =& $this->db;
     $user =& $this->user;
     $response = new ResponseManager();
     $userid = Kit::GetParam('userid', _POST, _INT, 0);
     $groupID = $user->getGroupFromID($userid, true);
     // Can we delete this user? Dont even try if we cant. Check tables that have this userid or this groupid
     if ($this->db->GetCountOfRows(sprintf('SELECT LayoutID FROM layout WHERE UserID = %d', $userid)) > 0) {
         trigger_error(__('Cannot delete this user, they have layouts'), E_USER_ERROR);
     }
     if ($this->db->GetCountOfRows(sprintf('SELECT MediaID FROM media WHERE UserID = %d', $userid)) > 0) {
         trigger_error(__('Cannot delete this user, they have media'), E_USER_ERROR);
     }
     if ($this->db->GetCountOfRows(sprintf('SELECT EventID FROM schedule WHERE UserID = %d', $userid)) > 0) {
         trigger_error(__('Cannot delete this user, they have scheduled layouts'), E_USER_ERROR);
     }
     if ($this->db->GetCountOfRows(sprintf('SELECT Schedule_DetailID FROM schedule_detail WHERE UserID = %d', $userid)) > 0) {
         trigger_error(__('Cannot delete this user, they have schedule detail records'), E_USER_ERROR);
     }
     if ($this->db->GetCountOfRows(sprintf('SELECT TemplateID FROM template WHERE UserID = %d', $userid)) > 0) {
         trigger_error(__('Cannot delete this user, they have templates'), E_USER_ERROR);
     }
     if ($this->db->GetCountOfRows(sprintf('SELECT osr_id FROM oauth_server_registry WHERE osr_usa_id_ref = %d', $userid)) > 0) {
         trigger_error(__('Cannot delete this user, they have applications'), E_USER_ERROR);
     }
     if ($this->db->GetCountOfRows(sprintf('SELECT GroupID FROM lkdatasetgroup WHERE GroupID = %d', $groupID)) > 0) {
         trigger_error(__('Cannot delete this user, they have permissions to data sets'), E_USER_ERROR);
     }
     if ($this->db->GetCountOfRows(sprintf('SELECT GroupID FROM lkdisplaygroupgroup WHERE GroupID = %d', $groupID)) > 0) {
         trigger_error(__('Cannot delete this user, they have permissions to display groups'), E_USER_ERROR);
     }
     if ($this->db->GetCountOfRows(sprintf('SELECT GroupID FROM lklayoutgroup WHERE GroupID = %d', $groupID)) > 0) {
         trigger_error(__('Cannot delete this user, they have permissions to layouts'), E_USER_ERROR);
     }
     if ($this->db->GetCountOfRows(sprintf('SELECT GroupID FROM lklayoutmediagroup WHERE GroupID = %d', $groupID)) > 0) {
         trigger_error(__('Cannot delete this user, they have permissions to media on layouts'), E_USER_ERROR);
     }
     if ($this->db->GetCountOfRows(sprintf('SELECT GroupID FROM lklayoutregiongroup WHERE GroupID = %d', $groupID)) > 0) {
         trigger_error(__('Cannot delete this user, they have permissions to regions on layouts'), E_USER_ERROR);
     }
     if ($this->db->GetCountOfRows(sprintf('SELECT GroupID FROM lkmediagroup WHERE GroupID = %d', $groupID)) > 0) {
         trigger_error(__('Cannot delete this user, they have permissions to media'), E_USER_ERROR);
     }
     if ($this->db->GetCountOfRows(sprintf('SELECT GroupID FROM lktemplategroup WHERE GroupID = %d', $groupID)) > 0) {
         trigger_error(__('Cannot delete this user, they have permissions to templates'), E_USER_ERROR);
     }
     // Firstly delete the group for this user
     $userGroupObject = new UserGroup($db);
     // Remove this user from all user groups (including their own)
     $userGroupObject->UnlinkAllGroups($userid);
     // Delete the user specific group
     if (!$userGroupObject->Delete($groupID)) {
         trigger_error($userGroupObject->GetErrorMessage(), E_USER_ERROR);
     }
     // Delete the user
     $sqldel = "DELETE FROM user";
     $sqldel .= " WHERE UserID = %d";
     if (!$db->query(sprintf($sqldel, $userid))) {
         trigger_error($db->error());
         trigger_error(__("This user has been active, you may only retire them."), E_USER_ERROR);
     }
     // We should delete this users sessions record.
     $SQL = "DELETE FROM session WHERE userID = %d ";
     if (!$db->query(sprintf($SQL, $userid))) {
         trigger_error($db->error());
         trigger_error(__("If logged in, this user will be deleted once they log out."), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('User Deleted.'));
     $response->Respond();
 }
开发者ID:abbeet,项目名称:server39,代码行数:81,代码来源:user.class.php

示例2: Delete

 /**
  * Deletes a Group
  * @return 
  */
 function Delete()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error('Token does not match', E_USER_ERROR);
     }
     $db =& $this->db;
     $groupid = Kit::GetParam('groupid', _POST, _INT);
     $userGroupObject = new UserGroup($db);
     if (!$userGroupObject->Delete($groupid)) {
         trigger_error($userGroupObject->GetErrorMessage(), E_USER_ERROR);
     }
     $response = new ResponseManager();
     $response->SetFormSubmitResponse(__('User Group Deleted'), false);
     $response->Respond();
 }
开发者ID:abbeet,项目名称:server39,代码行数:20,代码来源:group.class.php

示例3: DeleteUser

 /**
  * Deletes a user
  */
 function DeleteUser()
 {
     // Check the token
     if (!Kit::CheckToken()) {
         trigger_error(__('Sorry the form has expired. Please refresh.'), E_USER_ERROR);
     }
     $response = new ResponseManager();
     $deleteAllItems = Kit::GetParam('deleteAllItems', _POST, _CHECKBOX) == 1;
     $userId = Kit::GetParam('userid', _POST, _INT, 0);
     $groupId = $this->user->getGroupFromID($userId, true);
     $user = new Userdata();
     $user->userId = $userId;
     $userGroup = new UserGroup();
     if (!$deleteAllItems) {
         // Can we delete this user? Don't even try if we cant.
         $children = $user->getChildTypes();
         if (count($children) > 0) {
             trigger_error(sprintf(__('Cannot delete user, they own %s'), implode(', ', $children)), E_USER_ERROR);
         }
         // Can we delete this group?
         $children = $userGroup->getChildTypes($groupId);
         if (count($children) > 0) {
             trigger_error(sprintf(__('Cannot delete user, they own %s'), implode(', ', $children)), E_USER_ERROR);
         }
     }
     // Delete all items has been selected, so call delete on the group, then the user
     $userGroup->UnlinkAllGroups($userId);
     // Delete the user specific group
     if (!$userGroup->Delete($groupId)) {
         trigger_error($userGroup->GetErrorMessage(), E_USER_ERROR);
     }
     // Delete the user
     if (!$user->Delete()) {
         trigger_error($user->GetErrorMessage(), E_USER_ERROR);
     }
     $response->SetFormSubmitResponse(__('User Deleted.'));
     $response->Respond();
 }
开发者ID:fignew,项目名称:xibo-cms,代码行数:41,代码来源:user.class.php


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