From 7d32ebca46d6cad8c91ceee79a83927b1bb04316 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Wed, 31 Jan 2024 19:45:00 +0100 Subject: [PATCH] introducing data session option page --- includes/dashboard.php | 128 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 includes/dashboard.php diff --git a/includes/dashboard.php b/includes/dashboard.php new file mode 100644 index 0000000..4756552 --- /dev/null +++ b/includes/dashboard.php @@ -0,0 +1,128 @@ +Deligraph"; + echo "

Deligraph is a tool that helps you to manage your social media.

"; + echo "

For more information, please visit www.deligraph.com.

"; +} + + +function myprefix_register_options_page() +{ + add_menu_page( + 'Session Datas', + 'Session Datas', + 'manage_options', + 'session-datas-options', + 'my_options_page_html', + 'dashicons-chart-area' + + ); +} +add_action('admin_menu', 'myprefix_register_options_page'); + +/** + * The "My Options" page html. + */ +function my_options_page_html() +{ + if (!current_user_can('manage_options')) { + return; + } + + if (isset($_GET['settings-updated'])) { + add_settings_error( + 'my_options_mesages', + 'my_options_message', + esc_html__('Settings Saved', 'text_domain'), + 'updated' + ); + } + + settings_errors('my_options_mesages'); + +?> + get_results(" + SELECT user_locale, COUNT(user_locale) as count + FROM $table_name + GROUP BY user_locale +"); + + $users_countries = $wpdb->get_results(" + SELECT user_country, COUNT(user_country) as count + FROM $table_name + GROUP BY user_country +"); + + $notes_repartition = $wpdb->get_results(" + SELECT level_score, COUNT(level_score) as count + FROM $table_name + GROUP BY level_score + "); + + write_log($users_countries); + + $average_level_score = $wpdb->get_var(" + SELECT AVG(level_score) as average + FROM $table_name + "); + + ?> +
+

+
+

Données de jeu

+
+

Score moyen

+ + +

+ + +
+ +
+

Répartition des notes

+
    + +
  • level_score ?> : count ?>
  • + +
+
+ +
+ + +
+

Langue et Géographie

+
+

Répartition des langues

+
    + +
  • user_locale ?> : count ?>
  • + +
+
+
+

Répartition des pays

+
    + +
  • user_country ?> : count ?>
  • + +
+
+
+ +
+