$wpdb->prefix . 'aiwest_goals']; if (class_exists('AIWEST_Goals')) { AIWEST_Goals::ensure_tables(); } $intent = AIWEST_Security::post_key('aiwest_goal_intent'); if (AIWEST_Security::is_post_request() && $intent) { check_admin_referer('aiwest_goal_action'); if ($intent === 'add') { $result = AIWEST_Goals::add( AIWEST_Security::post_text('goal_title'), AIWEST_Security::post_textarea('goal_description'), AIWEST_Security::post_key('priority', 'normal') ); if (is_wp_error($result)) { echo '

' . esc_html(__('The goal was not saved:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

'; } else { echo '

' . esc_html(__('Goal added and saved. Goal ID:', 'ai-webmaster-studio')) . ' ' . intval($result) . '

'; } } if ($intent === 'update') { $result = AIWEST_Goals::update( AIWEST_Security::post_int('goal_id'), AIWEST_Security::post_text('goal_title'), AIWEST_Security::post_textarea('goal_description'), AIWEST_Security::post_key('priority', 'normal'), AIWEST_Security::post_key('status', 'active') ); if (is_wp_error($result)) { echo '

' . esc_html(__('The goal was not updated:', 'ai-webmaster-studio')) . ' ' . esc_html($result->get_error_message()) . '

'; } else { echo '

' . esc_html(__('Goal updated.', 'ai-webmaster-studio')) . '

'; } } if ($intent === 'delete') { AIWEST_Goals::delete(AIWEST_Security::post_int('goal_id')); echo '

' . esc_html(__('Goal deleted.', 'ai-webmaster-studio')) . '

'; } if ($intent === 'rebuild') { AIWEST_Goals::ensure_tables(); update_option('aiwest_db_version', AIWEST_VERSION); echo '

' . esc_html(__('AI Webmaster Studio tables were checked and repaired if necessary.', 'ai-webmaster-studio')) . '

'; } } $edit_goal = null; $edit_goal_id = absint(AIWEST_Security::get_text('edit_goal')); if ($edit_goal_id) { $edit_goal = AIWEST_Goals::get($edit_goal_id); } $goals = AIWEST_Goals::all(); $table_ok = !empty($t['goals']) && AIWEST_Goals::table_exists($t['goals']); ?>

ID
id); ?> goal_title); ?> goal_description)): ?>
goal_description); ?>
priority); ?> status)); ?> updated_at); ?>