<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}
require_once COMMENTING_BLOCK_DIR . 'admin/classes/class-commenting-block-settings-report-table.php';
$multicollab_report_list_table = new Multicollab_List_Table_Report();

$multicollab_activity_source = new Commenting_Block_Activities();
$multicollab_report_data     = $multicollab_activity_source->multicollab_get_cpt_activity_report();

// Check if month filter is active
$multicollab_m_report_filter   = filter_input( INPUT_GET, 'm_report', FILTER_SANITIZE_SPECIAL_CHARS );
$multicollab_has_month_filter = ! empty( $multicollab_m_report_filter ) && '0' !== $multicollab_m_report_filter;

// If no posts found AND no month filter is active, show "getting started" file
// If no posts found BUT month filter is active, show table with "no items found" message
if ( 0 === $multicollab_report_data['found_posts'] && ! $multicollab_has_month_filter ) {
	require_once COMMENTING_BLOCK_DIR . 'admin/partials/commenting-block-reports-no-results.php';
} else {
	echo '<div class="cf-reports-panel">';
		$multicollab_report_list_table->prepare_items( $multicollab_report_data );
		$multicollab_report_list_table->display();
	echo '</div>';
}

