From ae5061d1de4fafd70cb0e571c0a3d35c7c394e4f Mon Sep 17 00:00:00 2001 From: fly Date: Wed, 17 May 2023 17:05:57 +0200 Subject: [PATCH] Account for tiles Signed-off-by: fly --- managment/www/progressinfo.php | 53 +++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/managment/www/progressinfo.php b/managment/www/progressinfo.php index c646055..4476b4f 100644 --- a/managment/www/progressinfo.php +++ b/managment/www/progressinfo.php @@ -54,6 +54,16 @@ { quit(); } + $sql = 'SELECT * FROM information_schema.tables WHERE table_name = "tile" AND table_schema = "' . $SQL_DATABASE . '"'; + $ret = $con->query($sql)->fetch_all(MYSQLI_ASSOC); + if (!empty($ret)) + { + $tilesAvail = true; + } + else + { + $tilesAvail = false; + } $stmt = $con->prepare("SELECT secondLevel.name AS name, status.color AS color FROM secondLevel JOIN status ON secondLevel.status_id = status.id WHERE secondLevel.parent_id = (SELECT id FROM topLevel WHERE name = ?)"); $stmt->bind_param("s", $tile); $stmt->execute(); @@ -90,16 +100,14 @@ $stmt->execute(); $result = $stmt->get_result(); $ret = $result->fetch_all(MYSQLI_ASSOC); - echo '
'; + echo '
Tile Name' . $tile . '
'; foreach ($ret as $row) { echo ''; } if (isset($_GET["minor"])) { - $sql = 'SELECT * FROM information_schema.tables WHERE table_name = "tile" AND table_schema = "' . $SQL_DATABASE . '"'; - $ret = $con->query($sql)->fetch_all(MYSQLI_ASSOC); - if (!empty($ret)) + if ($tilesAvail) { $stmt = $con->prepare("SELECT status.name AS status, COUNT(*) AS sCount, status.color AS color FROM tile JOIN status ON tile.status_id = status.id WHERE tile.parent_id = (SELECT id FROM secondLevel WHERE name = ?) GROUP BY status.id ORDER BY priority"); $stmt->bind_param("s", $_GET["minor"]); @@ -107,34 +115,31 @@ $result = $stmt->get_result(); $ret = $result->fetch_all(MYSQLI_ASSOC); echo '
Area Name' . $tile . '
' . $row["status"] . '' . $row["sCount"] . '
'; - echo ''; + echo '
Tile Name' . $_GET["minor"] . '
'; foreach ($ret as $row) { echo ''; } } echo '
Area Name' . $_GET["minor"] . '
' . $row["status"] . '' . $row["sCount"] . '
'; -// if (isset($_POST["form"])) -// { - echo '
- -
- - -
+ + + - -
'; -// } + } + echo ' + +
'; } echo '
'; }