Reports
in package
implements
ActionInterface
uses
ActionTrait, BackwardCompatibility
This class is exclusively for generating reports to help assist forum administrators keep track of their forum configuration and state.
Table of Contents
Interfaces
- ActionInterface
- Interface for all action classes.
Properties
- $report_types : array<string|int, mixed>
- $reportTemplates : array<string|int, mixed>
- $sub_template : string
- $subaction : string
- $subactions : array<string|int, mixed>
- $current_table : int
- $key_method : string
- $keys : array<string|int, mixed>
- $obj : static
- $table_count : int
- $tables : array<string|int, mixed>
Methods
- boardAccess() : void
- Standard report about who can access which board.
- boardPerms() : void
- Generate a report on the current permissions by board and membergroup.
- boards() : void
- Standard report about what settings the boards have.
- 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.
- groupPerms() : void
- Show the large variety of group permissions assigned to each membergroup.
- 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.
- load() : self
- Static wrapper for constructor.
- memberGroups() : void
- Show what the membergroups are made of.
- staff() : void
- Report for showing all the forum staff members - quite a feat!
- 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().
- addData() : void
- Adds an array of data into an existing table.
- addSeparator() : void
- Add a separator row, only really used when adding data by rows.
- finishTables() : void
- This does the necessary count of table data before displaying them.
- newTable() : void
- This function creates a new table of data, most functions will only use it once.
- setKeys() : void
- Set the keys in use by the tables - these ensure entries MUST exist if the data isn't sent.
Properties
$report_types
public
array<string|int, mixed>
$report_types
= []
Info about the different types of reports we can generate.
$reportTemplates
public
array<string|int, mixed>
$reportTemplates
= ['main' => ['layers' => null], 'print' => ['layers' => ['print']]]
What are valid templates for showing reports?
$sub_template
public
string
$sub_template
= 'main'
The sub-template to use.
$subaction
public
string
$subaction
= ''
The requested sub-action (i.e. the report type). This should be set by the constructor.
$subactions
public
static array<string|int, mixed>
$subactions
= ['boards' => 'boards', 'board_access' => 'boardAccess', 'board_perms' => 'boardPerms', 'member_groups' => 'memberGroups', 'group_perms' => 'groupPerms', 'staff' => 'staff']
Available sub-actions.
$current_table
protected
int
$current_table
= 0
The table currently being worked upon.
$key_method
protected
string
$key_method
Indicates what the keys of the current table array signify. Can be either 'rows' or 'cols'.
$keys
protected
array<string|int, mixed>
$keys
= []
The keys of the array that represents the current table.
$obj
protected
static static
$obj
An instance of this class. This is used by the load() method to prevent multiple instantiations.
$table_count
protected
int
$table_count
= 0
The number of tables that comprise this report.
$tables
protected
array<string|int, mixed>
$tables
= []
The tables that comprise this report.
Methods
boardAccess()
Standard report about who can access which board.
public
boardAccess() : void
boardPerms()
Generate a report on the current permissions by board and membergroup.
public
boardPerms() : void
boards()
Standard report about what settings the boards have.
public
boards() : void
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
boolcanShowDebuggingInfo()
Determines whether debugging info should be shown.
public
canShowDebuggingInfo() : bool
Return values
boolcanShowInMaintenanceMode()
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
getOutputType()
Gets the output type for this action.
public
getOutputType() : OutputTypeInterface
Return values
OutputTypeInterfacegroupPerms()
Show the large variety of group permissions assigned to each membergroup.
public
groupPerms() : void
isAgreementAction()
Determines whether this action can be accessed without accepting the registration agreement and privacy policy.
public
isAgreementAction() : bool
Return values
boolisRestrictedGuestAccessAllowed()
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
boolload()
Static wrapper for constructor.
public
static load() : self
Return values
self —An instance of this class.
memberGroups()
Show what the membergroups are made of.
public
memberGroups() : void
staff()
Report for showing all the forum staff members - quite a feat!
public
staff() : 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
addData()
Adds an array of data into an existing table.
protected
addData(array<string|int, mixed> $inc_data[, null|string $custom_table = null ]) : void
if there are no existing tables, will create one with default attributes. if custom_table isn't specified, it will use the last table created, if it is specified and doesn't exist the function will return false. if a set of keys have been specified, the function will check each required key is present in the incoming data. If this data is missing the current tables default value will be used. if any key in the incoming data begins with '#sep#', the function will add a separator across the table at this point. once the incoming data has been sanitized, it is added to the table.
Parameters
- $inc_data : array<string|int, mixed>
-
The data to include
- $custom_table : null|string = null
-
= null The ID of a custom table to put the data in
addSeparator()
Add a separator row, only really used when adding data by rows.
protected
addSeparator([string $title = '' ][, null|string $custom_table = null ]) : void
Parameters
- $title : string = ''
-
The title of the separator
- $custom_table : null|string = null
-
The ID of the custom table
finishTables()
This does the necessary count of table data before displaying them.
protected
finishTables() : void
is (unfortunately) required to create some useful variables for templates. foreach data table created, it will count the number of rows and columns in the table. will also create a max_width variable for the table, to give an estimate width for the whole table * * if it can.
newTable()
This function creates a new table of data, most functions will only use it once.
protected
newTable([string $title = '' ][, string $default_value = '' ][, string $shading = 'all' ][, string $width_normal = 'auto' ][, string $align_normal = 'center' ][, string $width_shaded = 'auto' ][, string $align_shaded = 'auto' ]) : void
The core of this file, it creates a new, but empty, table of data in context, ready for filling using $this->addData(). Fills the context variable current_table with the ID of the table created. Keeps track of the current table count using context variable table_count.
Parameters
- $title : string = ''
-
Title to be displayed with this data table.
- $default_value : string = ''
-
Value to be displayed if a key is missing from a row.
- $shading : string = 'all'
-
Should the left, top or both (all) parts of the table beshaded?
- $width_normal : string = 'auto'
-
The width of an unshaded column (auto means not defined).
- $align_normal : string = 'center'
-
The alignment of data in an unshaded column.
- $width_shaded : string = 'auto'
-
The width of a shaded column (auto means not defined).
- $align_shaded : string = 'auto'
-
The alignment of data in a shaded column.
setKeys()
Set the keys in use by the tables - these ensure entries MUST exist if the data isn't sent.
protected
setKeys([string $method = 'rows' ][, array<string|int, mixed> $keys = [] ][, bool $reverse = false ]) : void
sets the current set of "keys" expected in each data array passed to $this->addData. It also sets the way we are adding data to the data table. method specifies whether the data passed to $this->addData represents a new column, or a new row. keys is an array whose keys are the keys for data being passed to $this->addData(). if reverse is set to true, then the values of the variable "keys" are used as opposed to the keys(!
Parameters
- $method : string = 'rows'
-
The method. Can be 'rows' or 'columns'
- $keys : array<string|int, mixed> = []
-
The keys
- $reverse : bool = false
-
Whether we want to use the values as the keys