getNamespaces(true);
$ectd_ns = isset($namespaces['ectd']) ? $namespaces['ectd'] : 'urn:ectd-org:ectd';
$xml->registerXPathNamespace('ectd', $ectd_ns);
// Example of fetching a value, adjust xpath as per actual XML structure
$result = $xml->xpath('//product-name'); // Simplified xpath
if (empty($result)) {
// Try another common path
$result = $xml->xpath('//admin/product-name');
}
if (!empty($result)) {
$productName = (string)$result[0];
}
}
} else {
$status = 'Validation Failed';
}
} else {
$status = 'Missing index.xml';
}
$sequences[] = [
'id' => $item,
'product' => $productName,
'status' => $status,
'last_scanned' => date('Y-m-d H:i:s'),
];
}
}
return $sequences;
}
// Define the repository path and scan it.
$repositoryPath = __DIR__ . '/repository';
$sequences = scanRepository($repositoryPath);
function getStatusBadgeClass($status) {
switch ($status) {
case 'Validated':
return 'bg-success';
case 'Validation Failed':
return 'bg-danger';
case 'Missing index.xml':
case 'Invalid XML':
return 'bg-danger';
case 'Pending Validation':
return 'bg-warning text-dark';
default:
return 'bg-secondary';
}
}
?>
Submissions Dashboard
Success! The repository has been scanned and the dashboard is updated.
| Sequence ID |
Product |
Status |
Last Scanned |
Actions |
|
|
|
|
View
|