本文整理汇总了PHP中Role::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Role::delete方法的具体用法?PHP Role::delete怎么用?PHP Role::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Role
的用法示例。
在下文中一共展示了Role::delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display()
{
$rolelist = new Template();
$rolelist->load("role_list");
$actions = ActionList::get("rolelist");
if (isset($_POST['insert'])) {
$role = new Role();
$role->name = $_POST['insert'];
$role->insert();
}
if (isset($_GET['delete'])) {
$role = new Role();
$role->ID = $_GET['delete'];
$role->delete();
}
$table = new Table();
$id = new TableColumn("id", Language::DirectTranslate("ID"));
$id->autoWidth = true;
$name = new TableColumn("name", Language::DirectTranslate("NAME"));
$table->columns->add($id);
$table->columns->add($name);
$table->name = "{'dbprefix'}roles";
$table->actions = "rolelist";
$table->orderBy = "name";
$table->cacheName = "rolelist";
$rolelist->assign_var("TABLE", $table->getCode());
$rolelist->output();
}
示例2: delete
/**
* Drop role
*
* @param void
* @return null
*/
function delete()
{
if ($this->active_role->isNew()) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
if ($this->request->isSubmitted()) {
$delete = $this->active_role->delete();
if ($delete && !is_error($delete)) {
clean_permissions_cache();
flash_success("Role ':name' has been deleted", array('name' => $this->active_role->getName()));
} else {
flash_error("Failed to delete role ':name'", array('name' => $this->active_role->getName()));
}
// if
$this->redirectTo('admin_roles');
} else {
$this->httpError(HTTP_ERR_BAD_REQUEST);
}
// if
}
示例3: delete_role
/**
* Delete Role
* Deletes a role from the database
*
* @param mixed $name
* @return bool
*/
public function delete_role($name)
{
$r = new Role();
$r->get_by_name($name);
if ($r->exists()) {
return $r->delete();
}
}
示例4: __actionEdit
public function __actionEdit()
{
if (array_key_exists('save', $_POST['action'])) {
$this->__save(Role::load((int) $this->_context[1]));
} elseif (array_key_exists('delete', $_POST['action'])) {
try {
Role::delete((int) $this->_context[1]);
redirect(ADMIN_URL . '/extension/aac/roles/');
} catch (RoleException $e) {
$this->alerts()->append($e->getMessage(), AlertStack::ERROR, $this->errors);
} catch (Exception $e) {
$this->alerts()->append(__('An unknown error has occurred. <a class="more">Show trace information.</a>'), AlertStack::ERROR, $e);
}
}
}
示例5: deleteRole
public function deleteRole($id)
{
$model = new Role();
$data = $model->delete($id);
//$this->deleteRoleGroup($id);
//$this->deleteRoleFilterResource($id);
}