Cleans up HTML

main
Yasen Pramatarov 2024-07-25 15:13:12 +03:00
parent 54678bc329
commit fa581f8fb7
5 changed files with 90 additions and 71 deletions

View File

@ -109,7 +109,7 @@ try {
echo "\t<table class=\"table table-striped table-hover table-bordered\">\n";
echo "\t\t<thead class=\"thead-dark\">\n";
echo "\t\t<thead class=\"table-secondary\">\n";
echo "\t\t\t<tr>\n";
// table headers
@ -141,7 +141,7 @@ try {
echo "\t</table>\n";
} else {
echo '<p>No matching Jitsi component events found.</p>';
echo '<p class="m-3">No matching Jitsi component events found.</p>';
}
echo "\n</div>\n";

View File

@ -99,22 +99,27 @@ if (isset($conference_id)) {
echo "</div>\n\n";
// results table
echo "<div class=\"results\">\n";
echo "<div class=\"mb-5\">\n";
if (!empty($conferences['records'])) {
echo "\t<table>\n";
echo "\t\t<tr>\n";
echo "\t<table class=\"table table-striped table-hover table-bordered\">\n";
echo "\t\t<thead class=\"table-secondary\">\n";
echo "\t\t\t<tr>\n";
// table headers
foreach (array_keys($conferences['records'][0]) as $header) {
echo "\t\t\t<th>" . htmlspecialchars($header) . "</th>\n";
echo "\t\t\t\t<th scope=\"col\">" . htmlspecialchars($header) . "</th>\n";
}
echo "\t\t</tr>\n";
echo "\t\t\t</tr>\n";
echo "\t\t</thead>\n";
echo "\t\t<tbody>\n";
//table rows
foreach ($conferences['records'] as $row) {
echo "\t\t<tr>\n";
echo "\t\t\t<tr>\n";
$stats_id = false;
$participant_ip = false;
if ($row['event'] === 'stats_id') $stats_id = true;
@ -122,24 +127,25 @@ if (isset($conference_id)) {
// sometimes $column is empty, we make it '' then
foreach ($row as $key => $column) {
if ($key === 'conference ID' && $column === $conference_id) {
echo "\t\t\t<td><strong>" . htmlspecialchars($column ?? '') . "</strong></td>\n";
echo "\t\t\t\t<td><strong>" . htmlspecialchars($column ?? '') . "</strong></td>\n";
} elseif ($key === 'conference name') {
echo "\t\t\t<td><a href=\"$app_root?page=conferences&name=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
echo "\t\t\t\t<td><a href=\"$app_root?page=conferences&name=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
} elseif ($stats_id && $key === 'parameter') {
echo "\t\t\t<td><a href=\"$app_root?page=participants&name=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
echo "\t\t\t\t<td><a href=\"$app_root?page=participants&name=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
} elseif ($participant_ip && $key === 'parameter') {
echo "\t\t\t<td><a href=\"$app_root?page=participants&ip=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
echo "\t\t\t\t<td><a href=\"$app_root?page=participants&ip=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
} else {
echo "\t\t\t<td>" . htmlspecialchars($column ?? '') . "</td>\n";
echo "\t\t\t\t<td>" . htmlspecialchars($column ?? '') . "</td>\n";
}
}
echo "\t\t</tr>\n";
echo "\t\t\t</tr>\n";
}
echo "\t\t</tbody>\n";
echo "\t</table>\n";
} else {
echo '<p>No matching conferences found.</p>';
echo '<p class="m-3">No matching conferences found.</p>';
}
echo "\n</div>\n";
@ -195,22 +201,27 @@ if (isset($conference_id)) {
echo "</div>\n\n";
// results table
echo "<div class=\"results\">\n";
echo "<div class=\"mb-5\">\n";
if (!empty($conferences['records'])) {
echo "\t<table>\n";
echo "\t\t<tr>\n";
echo "\t<table class=\"table table-striped table-hover table-bordered\">\n";
echo "\t\t<thead class=\"table-secondary\">\n";
echo "\t\t\t<tr>\n";
// table headers
foreach (array_keys($conferences['records'][0]) as $header) {
echo "\t\t\t<th>" . htmlspecialchars($header) . "</th>\n";
echo "\t\t\t\t<th scope=\"col\">" . htmlspecialchars($header) . "</th>\n";
}
echo "\t\t</tr>\n";
echo "\t\t\t</tr>\n";
echo "\t\t</thead>\n";
echo "\t\t<tbody>\n";
//table rows
foreach ($conferences['records'] as $row) {
echo "\t\t<tr>\n";
echo "\t\t\t<tr>\n";
$stats_id = false;
$participant_ip = false;
if ($row['event'] === 'stats_id') $stats_id = true;
@ -218,26 +229,27 @@ if (isset($conference_id)) {
// sometimes $column is empty, we make it '' then
foreach ($row as $key => $column) {
if ($key === 'conference name' && $column === $conference_name) {
echo "\t\t\t<td><strong>" . htmlspecialchars($column ?? '') . "</strong></td>\n";
echo "\t\t\t\t<td><strong>" . htmlspecialchars($column ?? '') . "</strong></td>\n";
} elseif ($key === 'conference ID') {
echo "\t\t\t<td><a href=\"$app_root?page=conferences&id=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
echo "\t\t\t\t<td><a href=\"$app_root?page=conferences&id=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
} elseif ($key === 'participant ID') {
echo "\t\t\t<td><a href=\"$app_root?page=participants&id=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
echo "\t\t\t\t<td><a href=\"$app_root?page=participants&id=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
} elseif ($stats_id && $key === 'parameter') {
echo "\t\t\t<td><a href=\"$app_root?page=participants&name=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
echo "\t\t\t\t<td><a href=\"$app_root?page=participants&name=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
} elseif ($participant_ip && $key === 'parameter') {
echo "\t\t\t<td><a href=\"$app_root?page=participants&ip=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
echo "\t\t\t\t<td><a href=\"$app_root?page=participants&ip=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
} else {
echo "\t\t\t<td>" . htmlspecialchars($column ?? '') . "</td>\n";
echo "\t\t\t\t<td>" . htmlspecialchars($column ?? '') . "</td>\n";
}
}
echo "\t\t</tr>\n";
echo "\t\t\t</tr>\n";
}
echo "\t\t</tbody>\n";
echo "\t</table>\n";
} else {
echo '<p>No matching conferences found.</p>';
echo '<p class="m-3">No matching conferences found.</p>';
}
echo "\n</div>\n";
@ -300,39 +312,45 @@ if (isset($conference_id)) {
echo "</div>\n\n";
// results table
echo "<div class=\"results\">\n";
echo "<div class=\"mb-5\">\n";
if (!empty($conferences['records'])) {
echo "\t<table>\n";
echo "\t\t<tr>\n";
echo "\t<table class=\"table table-striped table-hover table-bordered\">\n";
echo "\t\t<thead class=\"table-secondary\">\n";
echo "\t\t\t<tr>\n";
// table headers
foreach (array_keys($conferences['records'][0]) as $header) {
echo "\t\t\t<th>" . htmlspecialchars($header) . "</th>\n";
echo "\t\t\t\t<th scope=\"col\">" . htmlspecialchars($header) . "</th>\n";
}
echo "\t\t</tr>\n";
echo "\t\t\t</tr>\n";
echo "\t\t</thead>\n";
echo "\t\t<tbody>\n";
//table rows
foreach ($conferences['records'] as $row) {
echo "\t\t<tr>\n";
echo "\t\t\t<tr>\n";
// sometimes $column is empty, we make it '' then
foreach ($row as $key => $column) {
if ($key === 'conference ID') {
echo "\t\t\t<td><a href=\"$app_root?page=conferences&id=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
echo "\t\t\t\t<td><a href=\"$app_root?page=conferences&id=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
} elseif ($key === 'conference name') {
echo "\t\t\t<td><a href=\"$app_root?page=conferences&name=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
echo "\t\t\t\t<td><a href=\"$app_root?page=conferences&name=" . htmlspecialchars($column ?? '') . "\">" . htmlspecialchars($column ?? '') . "</a></td>\n";
} else {
echo "\t\t\t<td>" . htmlspecialchars($column ?? '') . "</td>\n";
echo "\t\t\t\t<td>" . htmlspecialchars($column ?? '') . "</td>\n";
}
}
echo "\t\t</tr>\n";
echo "\t\t\t</tr>\n";
}
echo "\t\t</tbody>\n";
echo "\t</table>\n";
} else {
echo '<p>No matching conferences found.</p>';
echo '<p class="m-3">No matching conferences found.</p>';
}
echo "\n</div>\n";

View File

@ -203,7 +203,7 @@ if (!empty($conferences['records'])) {
echo "\t<table class=\"table table-striped table-hover table-bordered\">\n";
echo "\t\t<thead class=\"thead-dark\">\n";
echo "\t\t<thead class=\"table-secondary\">\n";
echo "\t\t\t<tr>\n";
// table headers

View File

@ -109,7 +109,7 @@ if (isset($participant_id)) {
echo "\t<table class=\"table table-striped table-hover table-bordered\">\n";
echo "\t\t<thead class=\"thead-dark\">\n";
echo "\t\t<thead class=\"table-secondary\">\n";
echo "\t\t\t<tr>\n";
// table headers
@ -151,7 +151,7 @@ if (isset($participant_id)) {
echo "\t</table>\n";
} else {
echo '<p>No matching conferences found.</p>';
echo '<p class="m-3">No matching conferences found.</p>';
}
echo "\n</div>\n";
@ -213,7 +213,7 @@ if (isset($participant_id)) {
echo "\t<table class=\"table table-striped table-hover table-bordered\">\n";
echo "\t\t<thead class=\"thead-dark\">\n";
echo "\t\t<thead class=\"table-secondary\">\n";
echo "\t\t\t<tr>\n";
// table headers
@ -249,7 +249,7 @@ if (isset($participant_id)) {
echo "\t</table>\n";
} else {
echo '<p>No matching conferences found.</p>';
echo '<p class="m-3">No matching conferences found.</p>';
}
echo "\n</div>\n";
@ -311,7 +311,7 @@ if (isset($participant_id)) {
echo "\t<table class=\"table table-striped table-hover table-bordered\">\n";
echo "\t\t<thead class=\"thead-dark\">\n";
echo "\t\t<thead class=\"table-secondary\">\n";
echo "\t\t\t<tr>\n";
// table headers
@ -347,7 +347,7 @@ if (isset($participant_id)) {
echo "\t</table>\n";
} else {
echo '<p>No matching conferences found.</p>';
echo '<p class="m-3">No matching conferences found.</p>';
}
echo "\n</div>\n";
@ -403,7 +403,7 @@ if (isset($participant_id)) {
echo "\t<table class=\"table table-striped table-hover table-bordered\">\n";
echo "\t\t<thead class=\"thead-dark\">\n";
echo "\t\t<thead class=\"table-secondary\">\n";
echo "\t\t\t<tr>\n";
// table headers
@ -435,7 +435,7 @@ if (isset($participant_id)) {
echo "\t</table>\n";
} else {
echo '<p>No matching participants found.</p>';
echo '<p class="m-3">No matching participants found.</p>';
}
echo "\n</div>\n";

View File

@ -78,29 +78,30 @@
color: white;
}
//.results {
// margin-bottom: 50px;
//}
//.results table {
// width: 100%;
// border-collapse: collapse;
// margin: 20px 0;
//}
//.results table, th, td {
// border: 1px solid #ddd;
//}
//.results th, td {
// padding: 8px;
// text-align: left;
//}
//.results th {
// background-color: #f2f2f2;
//}
//.results p {
// text-align: center;
//}
/*
.results {
margin-bottom: 50px;
}
.results table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
}
.results table, th, td {
border: 1px solid #ddd;
}
.results th, td {
padding: 8px;
text-align: left;
}
.results th {
background-color: #f2f2f2;
}
.results p {
text-align: center;
}
*/
.results-header {
display: flex;