Пример #1
0
 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();
 }
 /**
  * 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
0
 /**
  * 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
0
 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
0
 public function deleteRole($id)
 {
     $model = new Role();
     $data = $model->delete($id);
     //$this->deleteRoleGroup($id);
     //$this->deleteRoleFilterResource($id);
 }