PerchAdminListing class provides a convenient way to produce data listings as a multi-column table.
To create a listing, you first instantiate a new
PerchAdminListing, define your columns and then render it using your data.
$Listing = new PerchAdminListing($CurrentUser, $HTML, $Lang, $Paging); $Listing->add_col([ /* ... */ ]); $Listing->add_col([ /* ... */ ]); $Listing->add_col([ /* ... */ ]); echo $Listing->render($my_data);
The constructor requires instances of the following:
PerchAuthenticatedUser, which is normally available as
$Listing = new PerchAdminListing($CurrentUser, $HTML, $Lang, $Paging);
The class exposes a number of methods.
Adds a column to the listing.
The column definition is an associative array consisting of the following
|title||The column heading|
|sort||The ID of the data field to sort by if the column is sortable|
|value||The ID of the data field to display as the value, or a callable returning the value|
|edit_link||If the column has a link, the path to link to|
|gravatar||ID of the email field to use for displaying a Gravatar|
|icon||ID of the icon to use|
Adds a delete action button.
|inline||If true, displays a confirmation modal dialog rather than linking through to the delete page|
|path||Path to the delete page|
|message||Text to display in the confirmation dialog|
Enables checkboxes against each list item to enable bulk deletion. This will likely be enhanced in future versions to be able to specify different bulk actions, at which point the first argument will become an array. The current behaviour will be maintained.
Posts to the deletion page with an array of item IDs as GET options (
Templates the listing using the data provided. The data should be an array of instances of the
PerchAPI_Base class, like those returned by the