get_last_and_previous_7_days_ranges(); $campaigns_data = $reports->get_all_campaigns( $date_ranges['recent_period'] ); $total_rows = array_reduce( $campaigns_data, function ( $count, $module ) { return $count + count( $module['campaigns'] ?? array() ); }, 0 ); /** * `merchant_all_campaigns_items_per_page` * * @since 2.0.0 */ $rows_per_page = apply_filters( 'merchant_all_campaigns_items_per_page', 25 ); $current_page = isset( $_GET['page'] ) ? max( 1, (int) $_GET['page'] ) : 1; // phpcs:ignore WordPress.Security.NonceVerification.Recommended $total_pages = ceil( $total_rows / $rows_per_page ); $start_row = ( $current_page - 1 ) * $rows_per_page + 1; $end_row = min( $current_page * $rows_per_page, $total_rows ); ?>
$module ) : $module_id = $module['module_id'] ?? ''; if ( empty( $module_id ) ) { continue; } foreach ( $module['campaigns'] as $campaign_index => $campaign ) : ++$count; $hide = $count > $rows_per_page; ?> style="display: none;" data-module-id="" data-campaign-key="" data-campaign-id="" data-row-count="">
$_id, 'type' => 'switcher', ), $campaign['status'] === 'active' ? 1 : 0, $module_id ); } else { echo '-'; } ?>
<?php echo esc_attr__( 'No campaign available', 'merchant' ); ?>
1 ) : ?>
1 ) : ?>
' . esc_html( $start_row ) . '', '' . esc_html( $end_row ) . '', '' . esc_html( $total_rows ) . '' ); ?>