Documentation

Groups extends Groups
in package
uses ActionRouter, ActionTrait

Shows group info and allows certain privileged members to add/remove members.

Table of Contents

Properties

$subaction  : string
$subactions  : array<string|int, mixed>
$action_url  : string
$obj  : static

Methods

buildRoute()  : array<string|int, mixed>
Builds a routing path based on URL query parameters.
call()  : void
Convenience method to load() and execute() an instance of this class.
canBeLogged()  : bool
Determines whether this action can be logged in the online log.
canShowDebuggingInfo()  : bool
Determines whether debugging info should be shown.
canShowInMaintenanceMode()  : bool
Determines whether this action allows access in maintenance mode.
execute()  : void
Dispatcher to whichever sub-action method is necessary.
getOutputType()  : OutputTypeInterface
Gets the output type for this action.
index()  : void
This very simply lists the groups, nothing snazy.
isAgreementAction()  : bool
Determines whether this action can be accessed without accepting the registration agreement and privacy policy.
isRestrictedGuestAccessAllowed()  : bool
Determines whether this action allows access if guest access is restricted.
isSimpleAction()  : bool
Determines whether this is a simple action.
list_getGroupRequestCount()  : int
Callback function for SMF\ItemList().
list_getGroupRequests()  : array<string|int, mixed>
Callback function for SMF\ItemList().
list_getMembergroups()  : array<string|int, mixed>
Helper function to generate a list of membergroups for display
listMembergroupMembers_Href()  : bool
Gets the members of a supplied membergroup.
load()  : static
Static wrapper for constructor.
members()  : void
Display members of a group, and allow adding of members to a group.
parseRoute()  : array<string|int, mixed>
Parses a route to get URL query parameters.
requests()  : void
Show and manage all group requests.
subActionProvider()  : null|array<string|int, mixed>
Called by Subs-Compat.php BackwardCompatibility wrapper functions to provide subaction execution for existing mods
__construct()  : mixed
Constructor. Protected to force instantiation via self::load().
buildActionRoute()  : array<string|int, mixed>
Builds a routing path for an action based on URL query parameters.
parseActionRoute()  : array<string|int, mixed>
Parses a route for an action to get URL query parameters.

Properties

$subaction

public string $subaction = 'index'

The requested sub-action. This should be set by the constructor.

$subactions

public static array<string|int, mixed> $subactions = ['index' => 'index', 'members' => 'members', 'requests' => 'requests']

Available sub-actions.

$action_url

protected string $action_url = '?action=moderate;area=groups'

The action and area URL query to use in links to sub-actions.

$obj

protected static static $obj

An instance of this class. This is used by the load() method to prevent multiple instantiations.

Methods

buildRoute()

Builds a routing path based on URL query parameters.

public static buildRoute(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

URL query parameters.

Return values
array<string|int, mixed>

Contains two elements: ['route' => [], 'params' => []]. The 'route' element contains the routing path. The 'params' element contains any $params that weren't incorporated into the route.

call()

Convenience method to load() and execute() an instance of this class.

public static call() : void

canBeLogged()

Determines whether this action can be logged in the online log.

public canBeLogged() : bool
Return values
bool

canShowDebuggingInfo()

Determines whether debugging info should be shown.

public canShowDebuggingInfo() : bool
Return values
bool

canShowInMaintenanceMode()

Determines whether this action allows access in maintenance mode.

public canShowInMaintenanceMode() : bool
Return values
bool

True if access is allowed, false otherwise.

execute()

Dispatcher to whichever sub-action method is necessary.

public execute() : void

It allows moderators and users to access the group showing functions. It handles permission checks, and puts the moderation bar on as required.

index()

This very simply lists the groups, nothing snazy.

public index() : void

isAgreementAction()

Determines whether this action can be accessed without accepting the registration agreement and privacy policy.

public isAgreementAction() : bool
Return values
bool

isRestrictedGuestAccessAllowed()

Determines whether this action allows access if guest access is restricted.

public isRestrictedGuestAccessAllowed() : bool
Return values
bool

True if access is allowed, false otherwise.

isSimpleAction()

Determines whether this is a simple action.

public isSimpleAction() : bool
Return values
bool

list_getGroupRequestCount()

Callback function for SMF\ItemList().

public static list_getGroupRequestCount(string $where, array<string|int, mixed> $where_parameters) : int
Parameters
$where : string

The WHERE clause for the query

$where_parameters : array<string|int, mixed>

The parameters for the WHERE clause

Return values
int

The number of group requests

list_getGroupRequests()

Callback function for SMF\ItemList().

public static list_getGroupRequests(int $start, int $items_per_page, string $sort, string $where, array<string|int, mixed> $where_parameters) : array<string|int, mixed>
Parameters
$start : int

The result to start with.

$items_per_page : int

The number of items per page.

$sort : string

An SQL sort expression (column/direction).

$where : string

Data for the WHERE clause.

$where_parameters : array<string|int, mixed>

Parameter values to be inserted into the WHERE clause.

Return values
array<string|int, mixed>

An array of group requests. Each group request has: 'id' 'member_link' 'group_link' 'reason' 'time_submitted'

list_getMembergroups()

Helper function to generate a list of membergroups for display

public static list_getMembergroups(int $start, int $items_per_page, string $sort, string $membergroup_type) : array<string|int, mixed>
Parameters
$start : int

What item to start with (not used here)

$items_per_page : int

How many items to show on each page (not used here)

$sort : string

An SQL query indicating how to sort the results

$membergroup_type : string

Should be 'post_count' for post groups or anything else for regular groups

Return values
array<string|int, mixed>

An array of group member info for the list

listMembergroupMembers_Href()

Gets the members of a supplied membergroup.

public static listMembergroupMembers_Href(array<string|int, mixed> &$members, int $membergroup[, int $limit = null ]) : bool

Returns them as a link for display.

Parameters
$members : array<string|int, mixed>

The IDs of the members.

$membergroup : int

The ID of the group.

$limit : int = null

How many members to show (null for no limit).

Return values
bool

True if there are more members to display, false otherwise.

load()

Static wrapper for constructor.

public static load() : static
Return values
static

An instance of this class.

members()

Display members of a group, and allow adding of members to a group.

public members() : void

It can be called from ManageMembergroups if it needs templating within the admin environment. It shows a list of members that are part of a given membergroup. It is called by ?action=moderate;area=viewgroups;sa=members;group=x It requires the manage_membergroups permission. It allows to add and remove members from the selected membergroup. It allows sorting on several columns. It redirects to itself.

Tags
todo

use SMF\ItemList

parseRoute()

Parses a route to get URL query parameters.

public static parseRoute(array<string|int, mixed> $route[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$route : array<string|int, mixed>

Array of routing path components.

$params : array<string|int, mixed> = []

Any existing URL query parameters.

Return values
array<string|int, mixed>

URL query parameters

requests()

Show and manage all group requests.

public requests() : void

subActionProvider()

Called by Subs-Compat.php BackwardCompatibility wrapper functions to provide subaction execution for existing mods

public static subActionProvider([null|string $sa = null ][, bool $return_config = false ][, string|null $activity = null ]) : null|array<string|int, mixed>
Parameters
$sa : null|string = null
$return_config : bool = false
$activity : string|null = null
Return values
null|array<string|int, mixed>

__construct()

Constructor. Protected to force instantiation via self::load().

protected __construct() : mixed

buildActionRoute()

Builds a routing path for an action based on URL query parameters.

protected static buildActionRoute(array<string|int, mixed> &$params) : array<string|int, mixed>

The 'action', 'area', and 'sa' parameters will be mapped to route path components in that order. The 'action' parameter is required, whereas 'area' and 'sa' are optional and will be silently skipped if not set.

The parameters are passed by reference and parameters are removed from the array when recognized. This lets wrapper methods continue parsing the remainder of the parameters without worrying about duplicate elements.

Parameters
$params : array<string|int, mixed>

URL query parameters.

Return values
array<string|int, mixed>

The route path elements.

parseActionRoute()

Parses a route for an action to get URL query parameters.

protected static parseActionRoute(array<string|int, mixed> &$route) : array<string|int, mixed>

The first element of the route path is mapped to the 'action' parameter.

For the 'admin', 'moderate', and 'profile' actions, the second element of the route is mapped to the 'area' parameter and the third element is mapped to the 'sa' parameter.

For all other actions, the second element of the route path is mapped to the 'sa' parameter.

The route passed by reference and route path elements are removed from the route when recognized. This lets wrapper methods continue parsing the remainder of the route without worrying about duplicate elements.

Parameters
$route : array<string|int, mixed>

Array of routing path components.

Return values
array<string|int, mixed>

URL query parameters


        
On this page

Search results