Menu

## ActionScheduler_ListTable extends ActionScheduler_Abstract_ListTable
in package

ActionScheduler_ListTable.php : 7

Implements the admin view of the actions.

##### Tags

codeCoverageIgnore

### Table of Contents

$admin_notices : array<string|int, mixed>
$bulk_actions : array<string|int, mixed>
  Bulk actions. The key of the array is the method name of the implementation:
$columns : array<string|int, mixed>
  Columns to show (name => label).
$did_notification : bool
  Flag variable to render our notifications, if any, once.
$filter_by : mixed
$ID : mixed
  The Primary key of our table
$items_per_page : mixed
  How many items do we render per page?
$logger : ActionScheduler_Logger
  A logger to use for getting action logs to display
$package : string
  The package name.
$row_actions : array<string|int, mixed>
  Actions (name => label).
$runner : ActionScheduler_QueueRunner
  A ActionScheduler_QueueRunner runner instance (or child class)
$search_by : mixed
  Enables search in this table listing. If this array is empty it means the listing is not searchable.
$sort_by : mixed
  Enables sorting, it expects an array of columns (the column names are the values)
$status_counts : array<string|int, mixed>
$store : ActionScheduler_Store
  The active data stores
$table_header : string
$table_name : mixed
  The table name
$time_periods : array<string|int, mixed>
  Array of seconds for common time periods, like week or month, alongside an internationalised string representation, i.e. "Day" or "Days"
__construct() : mixed
  Sets the current data store object into `store->action` and initialises the object.
column_args() : string
  Serializes the argument of an action to render it in a human friendly format.
column_cb() : mixed
  Renders the checkbox for each row, this is the first column and it is named ID regardless of how the primary key is named (to keep the code simpler). The bulk actions will do the proper name transformation though using `$this->ID`.
column_default() : mixed
  Default column formatting, it will escape everythig for security.
column_log_entries() : string
  Prints the logs entries inline. We do so to avoid loading Javascript and other hacks to show it in a modal.
column_schedule() : string
  Prints the scheduled date in a human friendly format.
display_admin_notices() : mixed
  Renders admin notifications
display_page() : mixed
  Render the list table page, including header, notices, status filters and table.
extra_tablenav() : mixed
get_columns() : mixed
  Returns the columns names for rendering. It adds a checkbox for selecting everything as the first column
get_sortable_columns() : mixed
  Reads $this->sort_by and returns the columns name in a format that WP_Table_List expects
prepare_items() : mixed
  Prepares the data to feed WP_Table_List.
bulk_delete() : mixed
  Bulk delete
display_filter_by_status() : mixed
  Prints the available statuses so the user can click to filter.
display_header() : mixed
  Display the table heading and search query, if any
display_table() : mixed
  Renders the table list, we override the original class to render the table inside a form and to render any needed HTML (like the search box). By doing so the callee of a function can simple forget about any extra HTML.
get_bulk_actions() : mixed
  Reads `$this->bulk_actions` and returns an array that WP_List_Table understands. It also validates that the bulk method handler exists. It throws an exception because this is a library meant for developers and missing a bulk method is a development-time error.
get_items_offset() : int
  Returns the number of items to offset/skip for this current view.
get_items_query_filters() : mixed
  Prepares the SQL to filter rows by the options defined at `$this->filter_by`. Before trusting any data sent by the user it validates that it is a valid option.
get_items_query_limit() : string
  Get prepared LIMIT clause for items query
get_items_query_offset() : string
  Get prepared OFFSET clause for items query
get_items_query_order() : mixed
  Prepares the ORDER BY sql statement. It uses `$this->sort_by` to know which columns are sortable. This requests validates the orderby $_GET parameter is a valid column and sortable. It will also use order (ASC|DESC) using DESC by default.
get_items_query_search() : string
  Check if the current request is doing a "full text" search. If that is the case prepares the SQL to search texts using LIKE.
get_log_entry_html() : string
  Prints the logs entries inline. We do so to avoid loading Javascript and other hacks to show it in a modal.
get_recurrence() : string
  Returns the recurrence of an action or 'Non-repeating'. The output is human readable.
get_request_order() : string
  Return the sortable column order specified for this request.
get_request_orderby() : string
  Return the sortable column specified for this request to order the results by, if any.
get_request_search_query() : string
  Return the search filter for this request, if any.
get_request_status() : string
  Return the status filter for this request, if any.
get_schedule_display_string() : string
  Get the scheduled date in a human friendly format.
get_search_box_button_text() : mixed
  Get the text to display in the search box on the list table.
get_search_box_placeholder() : mixed
  Get the text to display in the search box on the list table.
get_table_columns() : array<string|int, mixed>
  Process and return the columns name. This is meant for using with SQL, this means it always includes the primary key.
maybe_render_actions() : string
  Only display row actions for pending actions.
prepare_column_headers() : mixed
  Prepares the _column_headers property which is used by WP_Table_List at rendering.
process_bulk_action() : mixed
  Checks if the current request has a bulk action. If that is the case it will validate and will execute the bulk method handler. Regardless if the action is valid or not it will redirect to the previous page removing the current arguments that makes this request a bulk action.
process_row_action() : mixed
  Implements the logic behind processing an action once an action link is clicked on the list table.
process_row_actions() : mixed
row_action_cancel() : mixed
  Implements the logic behind running an action. ActionScheduler_Abstract_ListTable validates the request and their parameters are valid.
row_action_run() : mixed
  Implements the logic behind running an action. ActionScheduler_Abstract_ListTable validates the request and their parameters are valid.
set_items() : mixed
  Set the data for displaying. It will attempt to unserialize (There is a chance that some columns are serialized). This can be override in child classes for futher data transformation.
translate() : mixed
  Makes translation easier, it basically just wraps `_x` with some default (the package name)
human_interval() : string
  Convert an interval of seconds into a two part human friendly string.

### Properties

#### $admin_notices

ActionScheduler_Abstract_ListTable.php : 85
`protected array<string|int, mixed> $admin_notices = array()`

#### $bulk_actions

ActionScheduler_ListTable.php : 60

Bulk actions. The key of the array is the method name of the implementation:

`protected array<string|int, mixed> $bulk_actions = array()`

bulk_(array $ids, string $sql_in).

See the comments in the parent class for further details

#### $columns

ActionScheduler_ListTable.php : 21

Columns to show (name => label).

`protected array<string|int, mixed> $columns = array()`

#### $did_notification

ActionScheduler_ListTable.php : 67

Flag variable to render our notifications, if any, once.

`protected static bool $did_notification = alse`

#### $filter_by

ActionScheduler_Abstract_ListTable.php : 75
`protected mixed $filter_by = array()`

#### $ID

ActionScheduler_Abstract_ListTable.php : 67

The Primary key of our table

`protected mixed $ID = 'ID'`

#### $items_per_page

ActionScheduler_Abstract_ListTable.php : 39

How many items do we render per page?

`protected mixed $items_per_page = 10`

#### $logger

ActionScheduler_ListTable.php : 42

A logger to use for getting action logs to display

`protected ActionScheduler_Logger $logger`

#### $package

ActionScheduler_ListTable.php : 14

The package name.

`protected string $package = 'action-scheduler'`

#### $row_actions

ActionScheduler_ListTable.php : 28

Actions (name => label).

`protected array<string|int, mixed> $row_actions = array()`

#### $runner

ActionScheduler_ListTable.php : 49

A ActionScheduler_QueueRunner runner instance (or child class)

`protected ActionScheduler_QueueRunner $runner`

#### $search_by

ActionScheduler_Abstract_ListTable.php : 45

Enables search in this table listing. If this array is empty it means the listing is not searchable.

`protected mixed $search_by = array()`

#### $sort_by

ActionScheduler_Abstract_ListTable.php : 73

Enables sorting, it expects an array of columns (the column names are the values)

`protected mixed $sort_by = array()`

#### $status_counts

ActionScheduler_Abstract_ListTable.php : 80
`protected array<string|int, mixed> $status_counts = array()`

#### $store

ActionScheduler_ListTable.php : 35

The active data stores

`protected ActionScheduler_Store $store`

#### $table_header

ActionScheduler_Abstract_ListTable.php : 90
`protected string $table_header`

#### $table_name

ActionScheduler_Abstract_ListTable.php : 29

The table name

`protected mixed $table_name`

#### $time_periods

ActionScheduler_ListTable.php : 74

Array of seconds for common time periods, like week or month, alongside an internationalised string representation, i.e. "Day" or "Days"

`private static array<string|int, mixed> $time_periods`

### Methods

#### __construct()

ActionScheduler_ListTable.php : 83

Sets the current data store object into `store->action` and initialises the object.

`public __construct(ActionScheduler_Store $store, ActionScheduler_Logger $logger, ActionScheduler_QueueRunner $runner) : mixed`

##### Parameters

$store : ActionScheduler_Store
$logger : ActionScheduler_Logger
$runner : ActionScheduler_QueueRunner

##### Return values

mixed —

#### column_args()

ActionScheduler_ListTable.php : 245

Serializes the argument of an action to render it in a human friendly format.

`public column_args(array<string|int, mixed> $row) : string`

##### Parameters

$row : array<string|int, mixed>

  The array representation of the current row of the table

##### Return values

string —

#### column_cb()

ActionScheduler_Abstract_ListTable.php : 485

Renders the checkbox for each row, this is the first column and it is named ID regardless of how the primary key is named (to keep the code simpler). The bulk actions will do the proper name transformation though using `$this->ID`.

`public column_cb(mixed $row) : mixed`

##### Parameters

$row : mixed

##### Return values

mixed —

#### column_default()

ActionScheduler_Abstract_ListTable.php : 552

Default column formatting, it will escape everythig for security.

`public column_default(mixed $item, mixed $column_name) : mixed`

##### Parameters

$item : mixed
$column_name : mixed

##### Return values

mixed —

#### column_log_entries()

ActionScheduler_ListTable.php : 265

Prints the logs entries inline. We do so to avoid loading Javascript and other hacks to show it in a modal.

`public column_log_entries(array<string|int, mixed> $row) : string`

##### Parameters

$row : array<string|int, mixed>

  Action array.

##### Return values

string —

#### column_schedule()

ActionScheduler_ListTable.php : 368

Prints the scheduled date in a human friendly format.

`public column_schedule(array<string|int, mixed> $row) : string`

##### Parameters

$row : array<string|int, mixed>

  The array representation of the current row of the table

##### Return values

string —

#### display_admin_notices()

ActionScheduler_ListTable.php : 316

Renders admin notifications

`public display_admin_notices() : mixed`

Notifications:

1. When the maximum number of tasks are being executed simultaneously
2. Notifications when a task us manually executed

##### Return values

mixed —

#### display_page()

ActionScheduler_Abstract_ListTable.php : 639

Render the list table page, including header, notices, status filters and table.

`public display_page() : mixed`

##### Return values

mixed —

#### extra_tablenav()

ActionScheduler_Abstract_ListTable.php : 441
`public extra_tablenav(mixed $which) : mixed`

##### Parameters

$which : mixed

##### Return values

mixed —

#### get_columns()

ActionScheduler_Abstract_ListTable.php : 199

Returns the columns names for rendering. It adds a checkbox for selecting everything as the first column

`public get_columns() : mixed`

##### Return values

mixed —

#### get_sortable_columns()

ActionScheduler_Abstract_ListTable.php : 187

Reads $this->sort_by and returns the columns name in a format that WP_Table_List expects

`public get_sortable_columns() : mixed`

##### Return values

mixed —

#### prepare_items()

ActionScheduler_ListTable.php : 464

Prepares the data to feed WP_Table_List.

`public prepare_items() : mixed`

##### Return values

mixed —

#### bulk_delete()

ActionScheduler_ListTable.php : 409

Bulk delete

`protected bulk_delete(array<string|int, mixed> $ids, string $ids_sql) : mixed`

Deletes actions based on their ID. This is the handler for the bulk delete. It assumes the data properly validated by the callee and it will delete the actions without any extra validation.

##### Parameters

$ids : array<string|int, mixed>
$ids_sql : string

  Inherited and unused

##### Return values

mixed —

#### display_filter_by_status()

ActionScheduler_ListTable.php : 522

Prints the available statuses so the user can click to filter.

`protected display_filter_by_status() : mixed`

##### Return values

mixed —

#### display_header()

ActionScheduler_Abstract_ListTable.php : 561

Display the table heading and search query, if any

`protected display_header() : mixed`

##### Return values

mixed —

#### display_table()

ActionScheduler_Abstract_ListTable.php : 621

Renders the table list, we override the original class to render the table inside a form and to render any needed HTML (like the search box). By doing so the callee of a function can simple forget about any extra HTML.

`protected display_table() : mixed`

##### Return values

mixed —

#### get_bulk_actions()

ActionScheduler_Abstract_ListTable.php : 118

Reads `$this->bulk_actions` and returns an array that WP_List_Table understands. It also validates that the bulk method handler exists. It throws an exception because this is a library meant for developers and missing a bulk method is a development-time error.

`protected get_bulk_actions() : mixed`

##### Return values

mixed —

#### get_items_offset()

ActionScheduler_Abstract_ListTable.php : 227

Returns the number of items to offset/skip for this current view.

`protected get_items_offset() : int`

##### Return values

int —

#### get_items_query_filters()

ActionScheduler_Abstract_ListTable.php : 367

Prepares the SQL to filter rows by the options defined at `$this->filter_by`. Before trusting any data sent by the user it validates that it is a valid option.

`protected get_items_query_filters() : mixed`

##### Return values

mixed —

#### get_items_query_limit()

ActionScheduler_Abstract_ListTable.php : 215

Get prepared LIMIT clause for items query

`protected get_items_query_limit() : string`

##### Tags

global

  wpdb $wpdb

##### Return values

string —

Prepared LIMIT clause for items query.

#### get_items_query_offset()

ActionScheduler_Abstract_ListTable.php : 246

Get prepared OFFSET clause for items query

`protected get_items_query_offset() : string`

##### Tags

global

  wpdb $wpdb

##### Return values

string —

Prepared OFFSET clause for items query.

#### get_items_query_order()

ActionScheduler_Abstract_ListTable.php : 257

Prepares the ORDER BY sql statement. It uses `$this->sort_by` to know which columns are sortable. This requests validates the orderby $_GET parameter is a valid column and sortable. It will also use order (ASC|DESC) using DESC by default.

`protected get_items_query_order() : mixed`

##### Return values

mixed —

#### get_items_query_search()

ActionScheduler_Abstract_ListTable.php : 349

Check if the current request is doing a "full text" search. If that is the case prepares the SQL to search texts using LIKE.

`protected get_items_query_search() : string`

If the current request does not have any search or if this list table does not support that feature it will return an empty string.

TODO:

- Improve search doing LIKE by word rather than by phrases.

##### Return values

string —

#### get_log_entry_html()

ActionScheduler_ListTable.php : 287

Prints the logs entries inline. We do so to avoid loading Javascript and other hacks to show it in a modal.

`protected get_log_entry_html(ActionScheduler_LogEntry $log_entry, DateTimezone $timezone) : string`

##### Parameters

$log_entry : ActionScheduler_LogEntry
$timezone : DateTimezone

##### Return values

string —

#### get_recurrence()

ActionScheduler_ListTable.php : 223

Returns the recurrence of an action or 'Non-repeating'. The output is human readable.

`protected get_recurrence(ActionScheduler_Action $action) : string`

##### Parameters

$action : ActionScheduler_Action

##### Return values

string —

#### get_request_order()

ActionScheduler_Abstract_ListTable.php : 291

Return the sortable column order specified for this request.

`protected get_request_order() : string`

##### Return values

string —

#### get_request_orderby()

ActionScheduler_Abstract_ListTable.php : 273

Return the sortable column specified for this request to order the results by, if any.

`protected get_request_orderby() : string`

##### Return values

string —

#### get_request_search_query()

ActionScheduler_Abstract_ListTable.php : 317

Return the search filter for this request, if any.

`protected get_request_search_query() : string`

##### Return values

string —

#### get_request_status()

ActionScheduler_Abstract_ListTable.php : 307

Return the status filter for this request, if any.

`protected get_request_status() : string`

##### Return values

string —

#### get_schedule_display_string()

ActionScheduler_ListTable.php : 378

Get the scheduled date in a human friendly format.

`protected get_schedule_display_string(ActionScheduler_Schedule $schedule) : string`

##### Parameters

$schedule : ActionScheduler_Schedule

##### Return values

string —

#### get_search_box_button_text()

ActionScheduler_ListTable.php : 530

Get the text to display in the search box on the list table.

`protected get_search_box_button_text() : mixed`

##### Return values

mixed —

#### get_search_box_placeholder()

ActionScheduler_Abstract_ListTable.php : 653

Get the text to display in the search box on the list table.

`protected get_search_box_placeholder() : mixed`

##### Return values

mixed —

#### get_table_columns()

ActionScheduler_Abstract_ListTable.php : 328

Process and return the columns name. This is meant for using with SQL, this means it always includes the primary key.

`protected get_table_columns() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

#### maybe_render_actions()

ActionScheduler_ListTable.php : 301

Only display row actions for pending actions.

`protected maybe_render_actions(array<string|int, mixed> $row, string $column_name) : string`

##### Parameters

$row : array<string|int, mixed>

  Row to render

$column_name : string

  Current row

##### Return values

string —

#### prepare_column_headers()

ActionScheduler_Abstract_ListTable.php : 175

Prepares the _column_headers property which is used by WP_Table_List at rendering.

`protected prepare_column_headers() : mixed`

It merges the columns and the sortable columns.

##### Return values

mixed —

#### process_bulk_action()

ActionScheduler_Abstract_ListTable.php : 137

Checks if the current request has a bulk action. If that is the case it will validate and will execute the bulk method handler. Regardless if the action is valid or not it will redirect to the previous page removing the current arguments that makes this request a bulk action.

`protected process_bulk_action() : mixed`

##### Return values

mixed —

#### process_row_action()

ActionScheduler_ListTable.php : 441

Implements the logic behind processing an action once an action link is clicked on the list table.

`protected process_row_action(int $action_id, string $row_action_type) : mixed`

##### Parameters

$action_id : int
$row_action_type : string

  The type of action to perform on the action.

##### Return values

mixed —

#### process_row_actions()

ActionScheduler_Abstract_ListTable.php : 528
`protected process_row_actions() : mixed`

##### Return values

mixed —

#### row_action_cancel()

ActionScheduler_ListTable.php : 421

Implements the logic behind running an action. ActionScheduler_Abstract_ListTable validates the request and their parameters are valid.

`protected row_action_cancel(int $action_id) : mixed`

##### Parameters

$action_id : int

##### Return values

mixed —

#### row_action_run()

ActionScheduler_ListTable.php : 431

Implements the logic behind running an action. ActionScheduler_Abstract_ListTable validates the request and their parameters are valid.

`protected row_action_run(int $action_id) : mixed`

##### Parameters

$action_id : int

##### Return values

mixed —

#### set_items()

ActionScheduler_Abstract_ListTable.php : 473

Set the data for displaying. It will attempt to unserialize (There is a chance that some columns are serialized). This can be override in child classes for futher data transformation.

`protected set_items(array<string|int, mixed> $items) : mixed`

##### Parameters

$items : array<string|int, mixed>

##### Return values

mixed —

#### translate()

ActionScheduler_Abstract_ListTable.php : 109

Makes translation easier, it basically just wraps `_x` with some default (the package name)

`protected translate(mixed $text[, mixed $context = '' ]) : mixed`

##### Parameters

$text : mixed
$context : mixed = ''

##### Return values

mixed —

#### human_interval()

ActionScheduler_ListTable.php : 191

Convert an interval of seconds into a two part human friendly string.

`private static human_interval(int $interval[, int $periods_to_include = 2 ]) : string`

The WordPress human_time_diff() function only calculates the time difference to one degree, meaning even if an action is 1 day and 11 hours away, it will display "1 day". This function goes one step further to display two degrees of accuracy.

Inspired by the Crontrol::interval() function by Edward Dale: https://wordpress.org/plugins/wp-crontrol/

##### Parameters

$interval : int

  A interval in seconds.

$periods_to_include : int = 2

  Depth of time periods to include, e.g. for an interval of 70, and $periods_to_include of 2, both minutes and seconds would be included. With a value of 1, only minutes would be included.

##### Return values

string —

A human friendly string representation of the interval.

## Search results