get_var("SELECT COUNT(*) FROM {$wpdb->prefix}igny8_tasks WHERE status IN ('pending', 'queued', 'new')"); $draft_tasks = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}igny8_tasks WHERE status IN ('draft', 'in_progress', 'review')"); $published_tasks = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}igny8_tasks WHERE status = 'completed'"); $total_tasks = $queued_tasks + $draft_tasks + $published_tasks; return [ 'view_tasks' => [ 'queued' => $queued_tasks, 'total' => $total_tasks, 'status' => $total_tasks > 0 ? 'completed' : 'pending' ], 'generate_drafts' => [ 'queued' => $queued_tasks, 'status' => $queued_tasks > 0 ? 'current' : ($draft_tasks > 0 ? 'completed' : 'pending') ], 'review_drafts' => [ 'drafts' => $draft_tasks, 'status' => $draft_tasks > 0 ? 'current' : ($published_tasks > 0 ? 'completed' : 'pending') ], 'publish' => [ 'published' => $published_tasks, 'drafts' => $draft_tasks, 'status' => $published_tasks > 0 ? 'completed' : ($draft_tasks > 0 ? 'current' : 'pending') ] ]; } // Handle URL parameters for subpages $subpage = $_GET['sm'] ?? 'home'; $GLOBALS['current_submodule'] = $subpage; $GLOBALS['current_module'] = 'writer'; // Start output buffering ob_start(); switch ($subpage) { case 'tasks': include plugin_dir_path(__FILE__) . 'tasks.php'; break; case 'drafts': include plugin_dir_path(__FILE__) . 'drafts.php'; break; case 'published': include plugin_dir_path(__FILE__) . 'published.php'; break; case 'home': default: // Home dashboard content // Load KPI data for dashboard calculations if (!defined('IGNY8_INCLUDE_CONFIG')) { define('IGNY8_INCLUDE_CONFIG', true); } $kpi_config = $GLOBALS['igny8_kpi_config'] ?? []; // Loaded globally in igny8.php $kpi_data = igny8_get_kpi_data_safe('writer_home', $kpi_config['writer_home'] ?? []); // Calculate dashboard metrics - Updated queries for correct status global $wpdb; // Queued tasks - tasks that are pending/not started $queued_tasks = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}igny8_tasks WHERE status IN ('pending', 'queued', 'new')"); // Draft tasks - content generated and saved as draft, awaiting review/publish $draft_tasks = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}igny8_tasks WHERE status IN ('draft', 'in_progress', 'review')"); // Published tasks - status is 'completed' in tasks table $published_tasks = $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->prefix}igny8_tasks WHERE status = 'completed'"); $total_tasks = $queued_tasks + $draft_tasks + $published_tasks; // Calculate percentages for progress bars $queued_pct = $total_tasks > 0 ? round(($queued_tasks / $total_tasks) * 100) : 0; $draft_pct = $total_tasks > 0 ? round(($draft_tasks / $total_tasks) * 100) : 0; $published_pct = $total_tasks > 0 ? round(($published_tasks / $total_tasks) * 100) : 0; // Home page content ?>
Track your content creation progress
Workflow Status & AI Settings
Workflow Status & AI Settings
Content distribution analysis
No published content found yet
View TasksContent publishing timeline
Content distribution analysis
Action items requiring attention