當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Group::delete方法代碼示例

本文整理匯總了PHP中Group::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP Group::delete方法的具體用法?PHP Group::delete怎麽用?PHP Group::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Group的用法示例。


在下文中一共展示了Group::delete方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: delete_groups

 public static function delete_groups()
 {
     if (Auth::check()) {
         $id = $_POST['id'];
         if (isset($id)) {
             $strpos = strpos($id, ",");
             if ($strpos === false) {
                 $ob = new Group($id);
                 $ob->delete();
                 echo "ok";
             } else {
                 $array_id = explode(",", $id);
                 $ob = null;
                 foreach ($array_id as $value) {
                     $ob = new Group($value);
                     $ob->delete();
                 }
                 echo "ok";
             }
         } else {
             echo "Error while contacting server, please try again";
         }
     } else {
         $redirection = Config::get('app.base_url') . Config::get('panel.route') . "/users";
         header("Location: {$redirection}");
     }
 }
開發者ID:ar-framework-labs,項目名稱:panel,代碼行數:27,代碼來源:groups.php

示例2: testDelete

 /**
  * @todo Implement testDelete().
  */
 public function testDelete()
 {
     $this->object->setName('testgroup');
     $this->object->save();
     $this->object->delete();
     $this->assertEquals(new Group(), new Group($this->object->getId()));
 }
開發者ID:swat30,項目名稱:safeballot,代碼行數:10,代碼來源:GroupTest.php

示例3: delete

 public function delete()
 {
     $Group = new Group($this->data->id);
     $Group->delete();
     $go = '>auth/Group/formFind';
     $this->renderPrompt('information', "Group [{$this->data->idGroup}] removido.", $go);
 }
開發者ID:elymatos,項目名稱:expressive_fnbr,代碼行數:7,代碼來源:GroupController.php

示例4: destroy

 public static function destroy($group_id)
 {
     self::checkLoggedIn();
     self::verifyRightsforDeletingOrEditingGroup($group_id);
     Group::delete($group_id);
     Redirect::to('/', array('message' => 'Ryhmä poistettu onnistuneesti'));
 }
開發者ID:glvv,項目名稱:Keskustelufoorumi,代碼行數:7,代碼來源:group_controller.php

示例5: delete

 function delete($id = FALSE)
 {
     if ($id) {
         $group = new Group($id);
         $group->delete();
         set_notify('success', lang('delete_data_complete'));
     }
     redirect('groups/admin/groups');
 }
開發者ID:unisexx,項目名稱:thaigcd2015,代碼行數:9,代碼來源:groups.php

示例6: delete_group

 public function delete_group($group_id = NULL)
 {
     if (is_null($group_id)) {
         add_error_flash_message('Skupina sa nenašla.');
         redirect(site_url('groups'));
     }
     $this->db->trans_begin();
     $group = new Group();
     $persons_count = $group->person;
     $persons_count->select_func('COUNT', array('@id'), 'persons_count');
     $persons_count->where_related_group('id', '${parent}.id');
     $group->select_subquery($persons_count, 'persons_count');
     $group->select('*');
     $group->get_by_id((int) $group_id);
     if (!$group->exists()) {
         $this->db->trans_rollback();
         add_error_flash_message('Skupina sa nenašla.');
         redirect(site_url('groups'));
     }
     if ((int) $group->persons_count > 0) {
         $this->db->trans_rollback();
         add_error_flash_message('Nie je možné vymazať skupinu, ktorá má členov.');
         redirect(site_url('groups'));
     }
     $success_message = 'Skupina <strong>' . $group->title . '</strong> s ID <strong>' . $group->id . '</strong> bola vymazaná úspešne.';
     $error_message = 'Skupinu <strong>' . $group->title . '</strong> s ID <strong>' . $group->id . '</strong> sa nepodarilo vymazať.';
     if ($group->delete() && $this->db->trans_status()) {
         $this->db->trans_commit();
         add_success_flash_message($success_message);
     } else {
         $this->db->trans_rollback();
         add_error_flash_message($error_message);
     }
     redirect(site_url('groups'));
 }
開發者ID:andrejjursa,項目名稱:lstme-ledcoin,代碼行數:35,代碼來源:groups.php

示例7: sprintf

    if ($newID = $group->add($_POST)) {
        Event::log($newID, "groups", 4, "setup", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($group->getFormURL() . "?id=" . $newID);
        }
    }
    Html::back();
} else {
    if (isset($_POST["purge"])) {
        $group->check($_POST["id"], PURGE);
        if ($group->isUsed() && empty($_POST["forcepurge"])) {
            Html::header($group->getTypeName(1), $_SERVER['PHP_SELF'], "admin", "group", str_replace('glpi_', '', $group->getTable()));
            $group->showDeleteConfirmForm($_SERVER['PHP_SELF']);
            Html::footer();
        } else {
            $group->delete($_POST, 1);
            Event::log($_POST["id"], "groups", 4, "setup", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
            $group->redirectToList();
        }
    } else {
        if (isset($_POST["update"])) {
            $group->check($_POST["id"], UPDATE);
            $group->update($_POST);
            Event::log($_POST["id"], "groups", 4, "setup", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
            Html::back();
        } else {
            if (isset($_GET['_in_modal'])) {
                Html::popHeader(Group::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF']);
                $group->showForm($_GET["id"]);
                Html::popFooter();
            } else {
開發者ID:jose-martins,項目名稱:glpi,代碼行數:31,代碼來源:group.form.php

示例8: array

	define('ROOT', '../..');
	include ROOT . '/lib/includeForAjax.php';

	requireStrictRoute();

	$response = array();
	$response['error'] = 0;
	$response['message'] = '';
	
	$id = $_POST['id'];

	if(empty($id)) {
			$response['error'] = -1;
			$response['message'] = _t('잘못된 접근입니다.');
	} else {
		if (!isAdmin()) {
			$response['error'] = 1;
			$response['message'] = _t('관리자만이 이 기능을 사용할 수 있습니다.');
		} else {
			requireComponent('Bloglounge.Data.Groups');
			if(!Group::delete($id)) {
				$response['error'] = 2;
				$response['message'] = _t('그룹삭제를 실패하였습니다.');
			} else {
				$response['message'] = $name;
			}
		}
	}

	func::printRespond($response);
?>
開發者ID:ncloud,項目名稱:bloglounge,代碼行數:31,代碼來源:groupDelete.php

示例9: header

    $stype = '';
    $ltype = 'group';
    $title = _T("Delete group", "dyngroup");
    $popup = _T("Are you sure you want to delete group <b>%s</b>?<br/> (it can be used in an other group).", "dyngroup");
    $delete = _T("Delete group", "dyngroup");
}
if (quickGet('valid')) {
    if ($type == 1) {
        // Imaging group
        if (in_array("imaging", $_SESSION["modulesList"])) {
            // Get Current Location
            include 'modules/imaging/includes/xmlrpc.inc.php';
            $location = xmlrpc_getProfileLocation($id);
        }
    }
    $group->delete();
    if ($type == 1) {
        // Imaging group
        if (in_array("imaging", $_SESSION["modulesList"])) {
            // Synchro Location
            xmlrpc_synchroLocation($location);
        }
        header("Location: " . urlStrRedirect("imaging/manage/list{$stype}"));
        new NotifyWidgetSuccess(sprintf(_T("Imaging group %s was successfully deleted", "imaging"), $group->getName()));
    } else {
        // simple group
        header("Location: " . urlStrRedirect("base/computers/list{$stype}"));
        new NotifyWidgetSuccess(sprintf(_T("Group %s was successfully deleted", "imaging"), $group->getName()));
    }
    exit;
}
開發者ID:sebastiendu,項目名稱:mmc,代碼行數:31,代碼來源:delete_group.php

示例10: removeGroup

function removeGroup()
{
    global $tool, $propertyForm;
    $groupID = $_POST['groupID'];
    $delSuccess;
    $curGroup = new Group($groupID);
    if ($curGroup->delete()) {
        $delSuccess = true;
    } else {
        $delSuccess = false;
        $error = $curGroupr->get_error();
        break;
    }
    if ($delSuccess) {
        $status = "success";
        echo "<script language='javascript'>LoadPage(\"configurations.php?action=groupManage&mode=edit&delete=" . $status . "\", 'settingsInfo');</script>";
    } else {
        $propertyForm->error("Warning: Failed to remove group. Reason: " . $error, $_GET['ID']);
    }
}
開發者ID:precurse,項目名稱:netharbour,代碼行數:20,代碼來源:configurations.php

示例11: getAdminInterface

 /**
  * Build and return admin interface
  *
  * Any module providing an admin interface is required to have this function, which
  * returns a string containing the (x)html of it's admin interface.
  * @return string
  */
 function getAdminInterface()
 {
     $this->template = 'admin/user.tpl';
     $this->addJS('/modules/User/js/admin.js');
     if (!$this->user->hasPerm('viewusermodule')) {
         return false;
     }
     switch (@$_REQUEST['section']) {
         case 'deleteUser':
             $user = new User($_REQUEST['id']);
             $user->delete();
             $this->setupMainList();
             $this->template = 'admin/user.tpl';
             break;
         case 'deleteGroup':
             $group = new Group($_REQUEST['id']);
             $group->delete();
             $groups = Group::getGroups();
             $this->smarty->assign('groups', $groups);
             return $this->smarty->fetch('admin/groups.tpl');
             break;
         case 'groups':
             $this->template = 'admin/groups.tpl';
             $groups = Group::getGroups();
             $this->smarty->assign('groups', $groups);
             break;
         case 'groupsaddedit':
             $form = Group::getAddEditForm();
             if ($form->validate() && $form->isSubmitted() && isset($_REQUEST['submit'])) {
                 $groups = Group::getGroups();
                 $this->smarty->assign('groups', $groups);
                 return $this->smarty->fetch('admin/groups.tpl');
             } else {
                 return $form->display();
             }
             break;
         case 'permissions':
             if (isset($_REQUEST['perm']) && isset($_REQUEST['group'])) {
                 $group = new Group($_REQUEST['group']);
                 $group->togglePerm($_REQUEST['perm']);
             }
             if (is_numeric(@$_REQUEST['group_view'])) {
                 $groups = array();
                 $groups[] = new Group($_REQUEST['group_view']);
                 $groupsView = Group::getGroups();
                 $this->smarty->assign('selectedGroup', $_REQUEST['group_view']);
             } else {
                 $groups = Group::getGroups();
                 $groupsView = $groups;
                 $this->smarty->assign('selectedGroup', null);
             }
             $this->template = 'admin/permissions.tpl';
             $permissions = Permission::getPermissions();
             $this->smarty->assign('permissions', $permissions);
             $this->smarty->assign('groups', $groups);
             $this->smarty->assign('groupsView', $groupsView);
             break;
         case 'userTable':
             $this->setupMainList();
             $this->template = 'admin/user_table.tpl';
             break;
         case 'addedit':
             $form = $this->getUserAddEditForm('/admin/User', true);
             if ($form->validate() && $form->isSubmitted() && (isset($_REQUEST['a_submit']) || isset($_REQUEST['a_cancel']))) {
                 $this->setupMainList();
                 return $this->smarty->fetch('admin/user.tpl');
             } else {
                 return $form->display();
             }
             break;
         default:
             $this->setupMainList();
             break;
     }
     return $this->smarty->fetch($this->template);
 }
開發者ID:swat30,項目名稱:safeballot,代碼行數:83,代碼來源:User.php

示例12: testAccessingUsersGroupsAfterGroupIsDeleted

 public function testAccessingUsersGroupsAfterGroupIsDeleted()
 {
     $user = UserTestHelper::createBasicUser('Dood1');
     $group = new Group();
     $group->name = 'Doods';
     $group->users->add($user);
     $this->assertTrue($group->save());
     $this->assertEquals(1, count($user->groups));
     $this->assertEquals('Doods', $user->groups[0]->name);
     $group->delete();
     unset($group);
     // The user object in memory doesn't
     // know yet that the group was deleted.
     $this->assertEquals(1, count($user->groups));
     // But in using the app it would be a later
     // request that would be getting the user
     // object anew.
     $user->forget();
     unset($user);
     $user = User::getByUsername('dood1');
     // Which shows the group having been deleted.
     $this->assertEquals(0, count($user->groups));
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:23,代碼來源:GroupTest.php

示例13: remove_role_from_group

 /**
  * Remove Role From Group
  * Removes a role from a group
  * 
  * @param mixed $group_id
  * @param mixed $role_id
  */
 public function remove_role_from_group($group_id, $role_id)
 {
     $g = new Group($group_id);
     $r = new Role($role_id);
     if ($g->exists() and $r->exists()) {
         $g->delete($r);
     }
 }
開發者ID:Moro3,項目名稱:duc,代碼行數:15,代碼來源:Auth_simpleauth.php

示例14: deleteGroup

 /**
  * delete group from system with all it's users and all related data
  * 
  * @param integer $id the group needed to be deleted
  */
 public function deleteGroup($id)
 {
     $group = new Group($id);
     $group->delete();
     redirect('users_editor');
 }
開發者ID:kabircse,項目名稱:Codeigniter-Egypt,代碼行數:11,代碼來源:users_editor.php

示例15: array

fAuthorization::requireLoggedIn();
fRequest::overrideAction();
$action = fRequest::getValid('action', array('list', 'add', 'edit', 'delete'));
$breadcrumbs[] = array('name' => 'Groups', 'url' => Group::makeURL('list'), 'active' => true);
$group_id = fRequest::get('group_id', 'integer');
if ('delete' == $action) {
    if ($group_id == $GLOBALS['DEFAULT_GROUP_ID']) {
        fURL::redirect(Group::makeUrl('list'));
    } else {
        $class_name = 'Group';
        try {
            $obj = new Group($group_id);
            $delete_text = 'Are you sure you want to delete the group : <strong>' . $obj->getName() . '</strong>?';
            if (fRequest::isPost()) {
                fRequest::validateCSRFToken(fRequest::get('token'));
                $obj->delete();
                fMessaging::create('success', "/" . Group::makeUrl('list'), 'The group "' . $obj->getName() . '" was successfully deleted');
                fURL::redirect(Group::makeUrl('list'));
            }
        } catch (fNotFoundException $e) {
            fMessaging::create('error', "/" . Group::makeUrl('list'), 'The group requested could not be found');
            fURL::redirect(Group::makeUrl('list'));
        } catch (fExpectedException $e) {
            fMessaging::create('error', fURL::get(), $e->getMessage());
        }
        include VIEW_PATH . '/delete.php';
    }
    // --------------------------------- //
} elseif ('edit' == $action) {
    if ($group_id == $GLOBALS['DEFAULT_GROUP_ID']) {
        fURL::redirect(Group::makeUrl('list'));
開發者ID:nagyist,項目名稱:Tattle,代碼行數:31,代碼來源:groups.php


注:本文中的Group::delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。