diff --git a/app/pages/dashboard.php b/app/pages/dashboard.php index a9fe4d5..680f3e3 100644 --- a/app/pages/dashboard.php +++ b/app/pages/dashboard.php @@ -2,7 +2,7 @@ /** * Main dashboard file for displaying conference statistics. - * + * * This file connects to the database and displays various widgets: * 1. Monthly statistics for the past year. * 2. Conferences from the last 2 days. @@ -14,22 +14,20 @@ require '../app/classes/participant.php'; // connect to database $response = connectDB($config, 'jilo', $platformDetails[0]['jilo_database'], $platform_id); + +// if DB connection has error, display it and stop here if ($response['db'] === null) { $error = $response['error']; include '../app/templates/block-message.php'; + +// otherwise if DB connection is OK, go on } else { $db = $response['db']; - // - // dashboard widget listings - // - - - //// - // monthly usage $conferenceObject = new Conference($db); $participantObject = new Participant($db); + /** * Monthly usage statistics for the last year. * @@ -95,9 +93,6 @@ if ($response['db'] === null) { include '../app/templates/widget-monthly.php'; - //// - // conferences in last 2 days - /** * Conferences in the last 2 days. * @@ -160,9 +155,6 @@ if ($response['db'] === null) { include '../app/templates/widget.php'; - //// - // last 10 conferences - /** * Last 10 conferences. *