|
@@ -192,6 +192,7 @@ foreach ($tables as $t) {
|
|
|
$cols[] = tableHasColumn($pdo, $t, 'title_reference') ? "title_reference" : "'' AS title_reference";
|
|
$cols[] = tableHasColumn($pdo, $t, 'title_reference') ? "title_reference" : "'' AS title_reference";
|
|
|
$cols[] = tableHasColumn($pdo, $t, 'document_url') ? "COALESCE(document_url,'') AS document_url" : "'' AS document_url";
|
|
$cols[] = tableHasColumn($pdo, $t, 'document_url') ? "COALESCE(document_url,'') AS document_url" : "'' AS document_url";
|
|
|
$cols[] = tableHasColumn($pdo, $t, 'local_document_url') ? "COALESCE(local_document_url,'') AS local_document_url" : "'' AS local_document_url";
|
|
$cols[] = tableHasColumn($pdo, $t, 'local_document_url') ? "COALESCE(local_document_url,'') AS local_document_url" : "'' AS local_document_url";
|
|
|
|
|
+ $cols[] = tableHasColumn($pdo, $t, 'documents_json') ? "documents_json" : "NULL AS documents_json";
|
|
|
|
|
|
|
|
validate_table_name($t);
|
|
validate_table_name($t);
|
|
|
$selects[] = "SELECT ".implode(", ", $cols)." FROM `{$t}`";
|
|
$selects[] = "SELECT ".implode(", ", $cols)." FROM `{$t}`";
|
|
@@ -327,6 +328,22 @@ $rows = $st->fetchAll();
|
|
|
$docLocal = trim((string)($r['local_document_url'] ?? ''));
|
|
$docLocal = trim((string)($r['local_document_url'] ?? ''));
|
|
|
$docWeb = trim((string)($r['document_url'] ?? ''));
|
|
$docWeb = trim((string)($r['document_url'] ?? ''));
|
|
|
$docHref = $docLocal !== '' ? $docLocal : $docWeb;
|
|
$docHref = $docLocal !== '' ? $docLocal : $docWeb;
|
|
|
|
|
+
|
|
|
|
|
+ // multi-document list (e.g. Launceston)
|
|
|
|
|
+ $docList = [];
|
|
|
|
|
+ $rawJson = $r['documents_json'] ?? '';
|
|
|
|
|
+ if ($rawJson !== '' && $rawJson !== null) {
|
|
|
|
|
+ $decoded = json_decode($rawJson, true);
|
|
|
|
|
+ if (is_array($decoded)) {
|
|
|
|
|
+ foreach ($decoded as $d) {
|
|
|
|
|
+ $href = trim((string)($d['local_url'] ?? ''));
|
|
|
|
|
+ if ($href === '') $href = trim((string)($d['url'] ?? ''));
|
|
|
|
|
+ $name = trim((string)($d['name'] ?? ''));
|
|
|
|
|
+ if ($name === '') $name = 'Document';
|
|
|
|
|
+ if ($href !== '') $docList[] = ['href' => $href, 'name' => $name];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
?>
|
|
?>
|
|
|
<div class="accordion-item">
|
|
<div class="accordion-item">
|
|
|
<h2 class="accordion-header" id="<?= $uid ?>-head">
|
|
<h2 class="accordion-header" id="<?= $uid ?>-head">
|
|
@@ -394,7 +411,13 @@ $rows = $st->fetchAll();
|
|
|
<input type="text" class="form-control form-control-sm" value="<?= is_null($days) ? '' : $days ?>" disabled readonly>
|
|
<input type="text" class="form-control form-control-sm" value="<?= is_null($days) ? '' : $days ?>" disabled readonly>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="col-12">
|
|
<div class="col-12">
|
|
|
- <?php if ($docHref !== ''): ?>
|
|
|
|
|
|
|
+ <?php if (!empty($docList)): ?>
|
|
|
|
|
+ <div class="d-flex flex-wrap gap-2">
|
|
|
|
|
+ <?php foreach ($docList as $doc): ?>
|
|
|
|
|
+ <a class="btn btn-sm btn-outline-secondary" href="<?= h($doc['href']) ?>" target="_blank" rel="noopener"><?= h($doc['name']) ?></a>
|
|
|
|
|
+ <?php endforeach; ?>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <?php elseif ($docHref !== ''): ?>
|
|
|
<a class="btn btn-outline-secondary" href="<?= h($docHref) ?>" target="_blank" rel="noopener">Open document</a>
|
|
<a class="btn btn-outline-secondary" href="<?= h($docHref) ?>" target="_blank" rel="noopener">Open document</a>
|
|
|
<?php else: ?>
|
|
<?php else: ?>
|
|
|
<span class="text-muted">No document link</span>
|
|
<span class="text-muted">No document link</span>
|