ActionScheduler_ListTable::__construct()publicWC 1.0

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

Method of the class: ActionScheduler_ListTable{}

No Hooks.

Return

null. Nothing (null).

Usage

$ActionScheduler_ListTable = new ActionScheduler_ListTable();
$ActionScheduler_ListTable->__construct( $store, $logger, $runner );
$store(ActionScheduler_Store) (required)
-
$logger(ActionScheduler_Logger) (required)
-
$runner(ActionScheduler_QueueRunner) (required)
-

ActionScheduler_ListTable::__construct() code WC 9.3.3

public function __construct( ActionScheduler_Store $store, ActionScheduler_Logger $logger, ActionScheduler_QueueRunner $runner ) {

	$this->store  = $store;
	$this->logger = $logger;
	$this->runner = $runner;

	$this->table_header = __( 'Scheduled Actions', 'woocommerce' );

	$this->bulk_actions = array(
		'delete' => __( 'Delete', 'woocommerce' ),
	);

	$this->columns = array(
		'hook'        => __( 'Hook', 'woocommerce' ),
		'status'      => __( 'Status', 'woocommerce' ),
		'args'        => __( 'Arguments', 'woocommerce' ),
		'group'       => __( 'Group', 'woocommerce' ),
		'recurrence'  => __( 'Recurrence', 'woocommerce' ),
		'schedule'    => __( 'Scheduled Date', 'woocommerce' ),
		'log_entries' => __( 'Log', 'woocommerce' ),
	);

	$this->sort_by = array(
		'schedule',
		'hook',
		'group',
	);

	$this->search_by = array(
		'hook',
		'args',
		'claim_id',
	);

	$request_status = $this->get_request_status();

	if ( empty( $request_status ) ) {
		$this->sort_by[] = 'status';
	} elseif ( in_array( $request_status, array( 'in-progress', 'failed' ) ) ) {
		$this->columns  += array( 'claim_id' => __( 'Claim ID', 'woocommerce' ) );
		$this->sort_by[] = 'claim_id';
	}

	$this->row_actions = array(
		'hook' => array(
			'run' => array(
				'name'  => __( 'Run', 'woocommerce' ),
				'desc'  => __( 'Process the action now as if it were run as part of a queue', 'woocommerce' ),
			),
			'cancel' => array(
				'name'  => __( 'Cancel', 'woocommerce' ),
				'desc'  => __( 'Cancel the action now to avoid it being run in future', 'woocommerce' ),
				'class' => 'cancel trash',
			),
		),
	);

	self::$time_periods = array(
		array(
			'seconds' => YEAR_IN_SECONDS,
			/* translators: %s: amount of time */
			'names'   => _n_noop( '%s year', '%s years', 'woocommerce' ),
		),
		array(
			'seconds' => MONTH_IN_SECONDS,
			/* translators: %s: amount of time */
			'names'   => _n_noop( '%s month', '%s months', 'woocommerce' ),
		),
		array(
			'seconds' => WEEK_IN_SECONDS,
			/* translators: %s: amount of time */
			'names'   => _n_noop( '%s week', '%s weeks', 'woocommerce' ),
		),
		array(
			'seconds' => DAY_IN_SECONDS,
			/* translators: %s: amount of time */
			'names'   => _n_noop( '%s day', '%s days', 'woocommerce' ),
		),
		array(
			'seconds' => HOUR_IN_SECONDS,
			/* translators: %s: amount of time */
			'names'   => _n_noop( '%s hour', '%s hours', 'woocommerce' ),
		),
		array(
			'seconds' => MINUTE_IN_SECONDS,
			/* translators: %s: amount of time */
			'names'   => _n_noop( '%s minute', '%s minutes', 'woocommerce' ),
		),
		array(
			'seconds' => 1,
			/* translators: %s: amount of time */
			'names'   => _n_noop( '%s second', '%s seconds', 'woocommerce' ),
		),
	);

	parent::__construct(
		array(
			'singular' => 'action-scheduler',
			'plural'   => 'action-scheduler',
			'ajax'     => false,
		)
	);

	add_screen_option(
		'per_page',
		array(
			'default' => $this->items_per_page,
		)
	);

	add_filter( 'set_screen_option_' . $this->get_per_page_option_name(), array( $this, 'set_items_per_page_option' ), 10, 3 );
	set_screen_options();
}