ActionScheduler_wcSystemStatus::get_template()protectedWC 1.0

Get oldest or newest scheduled date for a given status.

Метод класса: ActionScheduler_wcSystemStatus{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_template( $status_labels, $action_counts, $oldest_and_newest );
$status_labels(массив) (обязательный)
Set of statuses to find oldest & newest action for.
$action_counts(массив) (обязательный)
Number of actions grouped by status.
$oldest_and_newest(массив) (обязательный)
Date of the oldest and newest action with each status.

Код ActionScheduler_wcSystemStatus::get_template() WC 8.7.0

<?php
protected function get_template( $status_labels, $action_counts, $oldest_and_newest ) {
	$as_version   = ActionScheduler_Versions::instance()->latest_version();
	$as_datastore = get_class( ActionScheduler_Store::instance() );
	?>

	<table class="wc_status_table widefat" cellspacing="0">
		<thead>
			<tr>
				<th colspan="5" data-export-label="Action Scheduler"><h2><?php esc_html_e( 'Action Scheduler', 'woocommerce' ); ?><?php echo wc_help_tip( esc_html__( 'This section shows details of Action Scheduler.', 'woocommerce' ) ); ?></h2></th>
			</tr>
			<tr>
				<td colspan="2" data-export-label="Version"><?php esc_html_e( 'Version:', 'woocommerce' ); ?></td>
				<td colspan="3"><?php echo esc_html( $as_version ); ?></td>
			</tr>
			<tr>
				<td colspan="2" data-export-label="Data store"><?php esc_html_e( 'Data store:', 'woocommerce' ); ?></td>
				<td colspan="3"><?php echo esc_html( $as_datastore ); ?></td>
			</tr>
			<tr>
				<td><strong><?php esc_html_e( 'Action Status', 'woocommerce' ); ?></strong></td>
				<td class="help">&nbsp;</td>
				<td><strong><?php esc_html_e( 'Count', 'woocommerce' ); ?></strong></td>
				<td><strong><?php esc_html_e( 'Oldest Scheduled Date', 'woocommerce' ); ?></strong></td>
				<td><strong><?php esc_html_e( 'Newest Scheduled Date', 'woocommerce' ); ?></strong></td>
			</tr>
		</thead>
		<tbody>
			<?php
			foreach ( $action_counts as $status => $count ) {
				// WC uses the 3rd column for export, so we need to display more data in that (hidden when viewed as part of the table) and add an empty 2nd column.
				printf(
					'<tr><td>%1$s</td><td>&nbsp;</td><td>%2$s<span style="display: none;">, Oldest: %3$s, Newest: %4$s</span></td><td>%3$s</td><td>%4$s</td></tr>',
					esc_html( $status_labels[ $status ] ),
					esc_html( number_format_i18n( $count ) ),
					esc_html( $oldest_and_newest[ $status ]['oldest'] ),
					esc_html( $oldest_and_newest[ $status ]['newest'] )
				);
			}
			?>
		</tbody>
	</table>

	<?php
}