Account for tiles
Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
parent
0256dc5292
commit
ae5061d1de
1 changed files with 29 additions and 24 deletions
|
@ -54,6 +54,16 @@
|
||||||
{
|
{
|
||||||
quit();
|
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 = $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->bind_param("s", $tile);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
@ -90,16 +100,14 @@
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
$ret = $result->fetch_all(MYSQLI_ASSOC);
|
$ret = $result->fetch_all(MYSQLI_ASSOC);
|
||||||
echo '<div id="tablecontainer"><table border="1"><tr><td>Tile Name</td><td>' . $tile . '</td></tr>';
|
echo '<div id="tablecontainer"><table border="1"><tr><td>Area Name</td><td>' . $tile . '</td></tr>';
|
||||||
foreach ($ret as $row)
|
foreach ($ret as $row)
|
||||||
{
|
{
|
||||||
echo '<tr style="background-color: ' . $row["color"] . '"><td>' . $row["status"] . '</td><td>' . $row["sCount"] . '</td></tr>';
|
echo '<tr style="background-color: ' . $row["color"] . '"><td>' . $row["status"] . '</td><td>' . $row["sCount"] . '</td></tr>';
|
||||||
}
|
}
|
||||||
if (isset($_GET["minor"]))
|
if (isset($_GET["minor"]))
|
||||||
{
|
{
|
||||||
$sql = 'SELECT * FROM information_schema.tables WHERE table_name = "tile" AND table_schema = "' . $SQL_DATABASE . '"';
|
if ($tilesAvail)
|
||||||
$ret = $con->query($sql)->fetch_all(MYSQLI_ASSOC);
|
|
||||||
if (!empty($ret))
|
|
||||||
{
|
{
|
||||||
$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 = $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"]);
|
$stmt->bind_param("s", $_GET["minor"]);
|
||||||
|
@ -107,34 +115,31 @@
|
||||||
$result = $stmt->get_result();
|
$result = $stmt->get_result();
|
||||||
$ret = $result->fetch_all(MYSQLI_ASSOC);
|
$ret = $result->fetch_all(MYSQLI_ASSOC);
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
echo '<table border="1"><tr><td>Tile Name</td><td>' . $_GET["minor"] . '</td></tr>';
|
echo '<table border="1"><tr><td>Area Name</td><td>' . $_GET["minor"] . '</td></tr>';
|
||||||
foreach ($ret as $row)
|
foreach ($ret as $row)
|
||||||
{
|
{
|
||||||
echo '<tr style="background-color: ' . $row["color"] . '"><td>' . $row["status"] . '</td><td>' . $row["sCount"] . '</td></tr>';
|
echo '<tr style="background-color: ' . $row["color"] . '"><td>' . $row["status"] . '</td><td>' . $row["sCount"] . '</td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
// if (isset($_POST["form"]))
|
echo '<form method="post" action="api.php" target="_blank">
|
||||||
// {
|
<label>Update Area ' . $_GET["minor"] . '</label>
|
||||||
echo '<form method="post" action="api.php" target="_blank">
|
<input type="text" name="auth" placeholder="Token"/><br/>
|
||||||
<label>Update Area</label>
|
<input type="hidden" name="action" value="set"/>
|
||||||
<input type="text" name="auth" placeholder="Token"/><br/>
|
<input type="hidden" name="area" value="' . $_GET["minor"] . '"/>
|
||||||
<input type="hidden" name="action" value="set"/>
|
<select name="status">';
|
||||||
<input type="hidden" name="area" value="' . $_GET["minor"] . '"/>
|
$sql = "SELECT name FROM status ORDER BY priority";
|
||||||
<select name="status">';
|
$ret = $con->query($sql)->fetch_all(MYSQLI_ASSOC);
|
||||||
$sql = "SELECT name FROM status ORDER BY priority";
|
if ($ret != False)
|
||||||
$ret = $con->query($sql)->fetch_all(MYSQLI_ASSOC);
|
{
|
||||||
if ($ret != False)
|
foreach($ret as $row)
|
||||||
{
|
{
|
||||||
foreach($ret as $row)
|
echo '<option value="' . $row["name"] . '">' . $row["name"] . '</option>';
|
||||||
{
|
|
||||||
echo '<option value="' . $row["name"] . '">' . $row["name"] . '</option>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
echo '</select>
|
}
|
||||||
<input type="submit" value="Update"/>
|
echo '</select>
|
||||||
</form>';
|
<input type="submit" value="Update"/>
|
||||||
// }
|
</form><br/>';
|
||||||
}
|
}
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue