|
@@ -32,10 +32,10 @@ $counts = [
|
|
|
'deleted' => countRecords($pdo, 'soil_records', $userId, 3),
|
|
'deleted' => countRecords($pdo, 'soil_records', $userId, 3),
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
-function fetchHistory(\PDO $pdo, string $table, int $userId): array {
|
|
|
|
|
|
|
+function fetchHistory(\PDO $pdo, string $table, int $userId, string $select = 'id, rand, lab_no, sample_id, site_id, crop_type, date_sampled'): array {
|
|
|
$stmt = $pdo->prepare(
|
|
$stmt = $pdo->prepare(
|
|
|
- "SELECT id, rand, lab_no, sample_id, site_id, crop, date_sampled
|
|
|
|
|
- FROM `$table`
|
|
|
|
|
|
|
+ "SELECT {$select}
|
|
|
|
|
+ FROM `{$table}`
|
|
|
WHERE modx_user_id = ? AND status = 0
|
|
WHERE modx_user_id = ? AND status = 0
|
|
|
ORDER BY id DESC LIMIT 100"
|
|
ORDER BY id DESC LIMIT 100"
|
|
|
);
|
|
);
|
|
@@ -45,8 +45,8 @@ function fetchHistory(\PDO $pdo, string $table, int $userId): array {
|
|
|
|
|
|
|
|
$soilRows = fetchHistory($pdo, 'soil_records', $userId);
|
|
$soilRows = fetchHistory($pdo, 'soil_records', $userId);
|
|
|
$plantRows = fetchHistory($pdo, 'plant_records', $userId);
|
|
$plantRows = fetchHistory($pdo, 'plant_records', $userId);
|
|
|
-$waterRows = fetchHistory($pdo, 'water_records', $userId);
|
|
|
|
|
-$animalRows = fetchHistory($pdo, 'animal_records', $userId);
|
|
|
|
|
|
|
+$waterRows = fetchHistory($pdo, 'water_records', $userId, 'id, rand, lab_no, sample_id, site_id, date_sampled');
|
|
|
|
|
+$animalRows = fetchHistory($pdo, 'animal_records', $userId, 'id, rand, lab_no, sample_id, NULL AS site_id, date_sampled');
|
|
|
|
|
|
|
|
$h = fn($v) => htmlspecialchars((string) $v, ENT_QUOTES, 'UTF-8');
|
|
$h = fn($v) => htmlspecialchars((string) $v, ENT_QUOTES, 'UTF-8');
|
|
|
|
|
|
|
@@ -146,7 +146,7 @@ include __DIR__ . '/../layouts/navbar.php';
|
|
|
<td><?= $h($r['lab_no']) ?></td>
|
|
<td><?= $h($r['lab_no']) ?></td>
|
|
|
<td><?= $h($r['sample_id']) ?></td>
|
|
<td><?= $h($r['sample_id']) ?></td>
|
|
|
<td><?= $h($r['site_id']) ?></td>
|
|
<td><?= $h($r['site_id']) ?></td>
|
|
|
- <td><?= $h($r['crop']) ?></td>
|
|
|
|
|
|
|
+ <td><?= $h($r['crop_type']) ?></td>
|
|
|
<td><?= $h($r['date_sampled']) ?></td>
|
|
<td><?= $h($r['date_sampled']) ?></td>
|
|
|
<td class="text-end">
|
|
<td class="text-end">
|
|
|
<a href="/dashboard/crop-analysis/soil-test-data/soil-analysis.php?rid=<?= (int)$r['id'] ?>&rand=<?= (float)$r['rand'] ?>"
|
|
<a href="/dashboard/crop-analysis/soil-test-data/soil-analysis.php?rid=<?= (int)$r['id'] ?>&rand=<?= (float)$r['rand'] ?>"
|
|
@@ -176,7 +176,7 @@ include __DIR__ . '/../layouts/navbar.php';
|
|
|
<td><?= $h($r['lab_no']) ?></td>
|
|
<td><?= $h($r['lab_no']) ?></td>
|
|
|
<td><?= $h($r['sample_id']) ?></td>
|
|
<td><?= $h($r['sample_id']) ?></td>
|
|
|
<td><?= $h($r['site_id']) ?></td>
|
|
<td><?= $h($r['site_id']) ?></td>
|
|
|
- <td><?= $h($r['crop']) ?></td>
|
|
|
|
|
|
|
+ <td><?= $h($r['crop_type']) ?></td>
|
|
|
<td><?= $h($r['date_sampled']) ?></td>
|
|
<td><?= $h($r['date_sampled']) ?></td>
|
|
|
<td class="text-end">
|
|
<td class="text-end">
|
|
|
<a href="/dashboard/crop-analysis/plant-test-data/plant-analysis.php?rid=<?= (int)$r['id'] ?>&rand=<?= (float)$r['rand'] ?>"
|
|
<a href="/dashboard/crop-analysis/plant-test-data/plant-analysis.php?rid=<?= (int)$r['id'] ?>&rand=<?= (float)$r['rand'] ?>"
|