GroupController extends SimpleController
Controller class for group-related requests, including listing groups, CRUD for groups, etc.
Basic controller class, that imports the entire DI container for easy access to services. Your controller classes may extend this controller class.
Tags
Table of Contents
$ci | ContainerInterface | |
---|---|---|
create() | Processes the request to create a new group. | mixed |
delete() | Processes the request to delete an existing group. | mixed |
getInfo() | Returns info for a single group. | mixed |
getList() | Returns a list of Groups. | mixed |
getModalConfirmDelete() | Get deletetion confirmation modal. | mixed |
getModalCreate() | Renders the modal form for creating a new group. | mixed |
getModalEdit() | Renders the modal form for editing an existing group. | mixed |
getUsers() | Users List API. | mixed |
pageInfo() | Renders a page displaying a group's information, in read-only mode. | mixed |
pageList() | Renders the group listing page. | mixed |
updateInfo() | Processes the request to update an existing group's details. | mixed |
getGroupFromParams() | Get group from params. | Group |
__construct() | Constructor. | mixed |
Properties
$ci
protected
ContainerInterface
$ci
Methods
create()
Processes the request to create a new group.
public
create(
$request :
ServerRequestInterface
, $response :
ResponseInterface
, $args :
array
)
: mixed
Processes the request from the group creation form, checking that:
- The group name and slug are not already in use;
- The user has permission to create a new group;
- The submitted data is valid. This route requires authentication (and should generally be limited to admins or the root user).
Request type: POST
Parameters
- $request : ServerRequestInterface
- $response : ResponseInterface
- $args : array
Tags
Return values
mixeddelete()
Processes the request to delete an existing group.
public
delete(
$request :
ServerRequestInterface
, $response :
ResponseInterface
, $args :
array
)
: mixed
Deletes the specified group. Before doing so, checks that:
- The user has permission to delete this group;
- The group is not currently set as the default for new users;
- The group is empty (does not have any users);
- The submitted data is valid. This route requires authentication (and should generally be limited to admins or the root user).
Request type: DELETE
Parameters
- $request : ServerRequestInterface
- $response : ResponseInterface
- $args : array
Tags
Return values
mixedgetInfo()
Returns info for a single group.
public
getInfo(
$request :
ServerRequestInterface
, $response :
ResponseInterface
, $args :
array
)
: mixed
This page requires authentication.
Request type: GET
Parameters
- $request : ServerRequestInterface
- $response : ResponseInterface
- $args : array
Tags
Return values
mixedgetList()
Returns a list of Groups.
public
getList(
$request :
ServerRequestInterface
, $response :
ResponseInterface
, $args :
array
)
: mixed
Generates a list of groups, optionally paginated, sorted and/or filtered. This page requires authentication.
Request type: GET
Parameters
- $request : ServerRequestInterface
- $response : ResponseInterface
- $args : array
Tags
Return values
mixedgetModalConfirmDelete()
Get deletetion confirmation modal.
public
getModalConfirmDelete(
$request :
ServerRequestInterface
, $response :
ResponseInterface
, $args :
array
)
: mixed
Parameters
- $request : ServerRequestInterface
- $response : ResponseInterface
- $args : array
Tags
Return values
mixedgetModalCreate()
Renders the modal form for creating a new group.
public
getModalCreate(
$request :
ServerRequestInterface
, $response :
ResponseInterface
, $args :
array
)
: mixed
This does NOT render a complete page. Instead, it renders the HTML for the modal, which can be embedded in other pages. This page requires authentication.
Request type: GET
Parameters
- $request : ServerRequestInterface
- $response : ResponseInterface
- $args : array
Tags
Return values
mixedgetModalEdit()
Renders the modal form for editing an existing group.
public
getModalEdit(
$request :
ServerRequestInterface
, $response :
ResponseInterface
, $args :
array
)
: mixed
This does NOT render a complete page. Instead, it renders the HTML for the modal, which can be embedded in other pages. This page requires authentication.
Request type: GET
Parameters
- $request : ServerRequestInterface
- $response : ResponseInterface
- $args : array
Tags
Return values
mixedgetUsers()
Users List API.
public
getUsers(
$request :
ServerRequestInterface
, $response :
ResponseInterface
, $args :
array
)
: mixed
Parameters
- $request : ServerRequestInterface
- $response : ResponseInterface
- $args : array
Tags
Return values
mixedpageInfo()
Renders a page displaying a group's information, in read-only mode.
public
pageInfo(
$request :
ServerRequestInterface
, $response :
ResponseInterface
, $args :
array
)
: mixed
This checks that the currently logged-in user has permission to view the requested group's info. It checks each field individually, showing only those that you have permission to view. This will also try to show buttons for deleting, and editing the group. This page requires authentication.
Request type: GET
Parameters
- $request : ServerRequestInterface
- $response : ResponseInterface
- $args : array
Tags
Return values
mixedpageList()
Renders the group listing page.
public
pageList(
$request :
ServerRequestInterface
, $response :
ResponseInterface
, $args :
array
)
: mixed
This page renders a table of groups, with dropdown menus for admin actions for each group. Actions typically include: edit group, delete group. This page requires authentication.
Request type: GET
Parameters
- $request : ServerRequestInterface
- $response : ResponseInterface
- $args : array
Tags
Return values
mixedupdateInfo()
Processes the request to update an existing group's details.
public
updateInfo(
$request :
ServerRequestInterface
, $response :
ResponseInterface
, $args :
array
)
: mixed
Processes the request from the group update form, checking that:
- The group name/slug are not already in use;
- The user has the necessary permissions to update the posted field(s);
- The submitted data is valid. This route requires authentication (and should generally be limited to admins or the root user).
Request type: PUT
Parameters
- $request : ServerRequestInterface
- $response : ResponseInterface
- $args : array
Tags
Return values
mixedgetGroupFromParams()
Get group from params.
protected
getGroupFromParams(
$params :
array
)
: Group
Parameters
- $params : array
Tags
Return values
Group__construct()
Constructor.
public
__construct(
$ci :
ContainerInterface
)
: mixed
Parameters
- $ci : ContainerInterface
The global container object, which holds all your services.