Documentation

Reports
in package
implements ActionInterface Uses 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  : object
$table_count  : int
$tables  : array<string|int, mixed>
$backcompat  : array<string|int, mixed>

Methods

boardPermissionsReport()  : void
Backward compatibility wrapper for the board_perms sub-action.
boardPerms()  : void
Generate a report on the current permissions by board and membergroup.
boardReport()  : void
Backward compatibility wrapper for the boards sub-action.
boards()  : void
Standard report about what settings the boards have.
call()  : void
Convenience method to load() and execute() an instance of this class.
execute()  : void
Dispatcher to whichever sub-action method is necessary.
exportStatic()  : void
Provides a way to export a class's public static properties and methods to global namespace.
groupPermissionsReport()  : void
Backward compatibility wrapper for the group_perms sub-action.
groupPerms()  : void
Show the large variety of group permissions assigned to each membergroup.
load()  : object
Static wrapper for constructor.
memberGroups()  : void
Show what the membergroups are made of.
memberGroupsReport()  : void
Backward compatibility wrapper for the member_groups sub-action.
staff()  : void
Report for showing all the forum staff members - quite a feat!
staffReport()  : void
Backward compatibility wrapper for the staff sub-action.
__construct()  : mixed
Constructor. Protected to force instantiation via self::load().
addData()  : void
Adds an array of data into an existing table.
addSeparator()  : mixed
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()  : mixed
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_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 object $obj

An instance of this class. This is used by the load() method to prevent mulitple 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.

$backcompat

private static array<string|int, mixed> $backcompat = ['func_names' => ['call' => 'ReportsMain', 'boardReport' => 'BoardReport', 'boardPermissionsReport' => 'BoardPermissionsReport', 'memberGroupsReport' => 'MemberGroupsReport', 'groupPermissionsReport' => 'GroupPermissionsReport', 'staffReport' => 'StaffReport']]

BackwardCompatibility settings for this class.

Methods

boardPermissionsReport()

Backward compatibility wrapper for the board_perms sub-action.

public static boardPermissionsReport() : void

boardPerms()

Generate a report on the current permissions by board and membergroup.

public boardPerms() : void

boardReport()

Backward compatibility wrapper for the boards sub-action.

public static boardReport() : 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

execute()

Dispatcher to whichever sub-action method is necessary.

public execute() : void

exportStatic()

Provides a way to export a class's public static properties and methods to global namespace.

public static exportStatic() : void

To do so:

  1. Use this trait in the class.
  2. At the END of the class's file, call its exportStatic() method.

Although it might not seem that way at first glance, this approach conforms to section 2.3 of PSR 1, since executing this method is simply a dynamic means of declaring functions when the file is included; it has no other side effects.

Regarding the $backcompat items:

A class's static properties are not exported to global variables unless explicitly included in $backcompat['prop_names']. Likewise, a class's static methods are not exported as global functions unless explicitly included in $backcompat['func_names'].

$backcompat['prop_names'] is a simple array where the keys are the names of one or more of a class's static properties, and the values are the names of global variables. In each case, the global variable will be set to a reference to the static property. Static properties that are not named in this array will not be exported.

$backcompat['func_names'] is a simple array where the keys are the names of one or more of a class's static methods, and the values are the names that should be used for global functions that will encapsulate those methods. Methods that are not named in this array will not be exported.

Adding non-static properties or methods to the $backcompat arrays will produce runtime errors. It is the responsibility of the developer to make sure not to do this.

groupPermissionsReport()

Backward compatibility wrapper for the group_perms sub-action.

public static groupPermissionsReport() : void

groupPerms()

Show the large variety of group permissions assigned to each membergroup.

public groupPerms() : void

load()

Static wrapper for constructor.

public static load() : object
Return values
object

An instance of this class.

memberGroups()

Show what the membergroups are made of.

public memberGroups() : void

memberGroupsReport()

Backward compatibility wrapper for the member_groups sub-action.

public static memberGroupsReport() : void

staff()

Report for showing all the forum staff members - quite a feat!

public staff() : void

staffReport()

Backward compatibility wrapper for the staff sub-action.

public static staffReport() : void

__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 ]) : mixed
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' ]) : mixed

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


        
On this page

Search results