path . '/' . $resource->lastVersionPath;
$path = '';
$webPath = 'Modules/OnlineResourceWatcher/Files/' . $resource->path . '/' . $resource->lastVersionPath;
if (\is_file($basePath . '/index.jpg')) {
$type = 'img';
$path = $basePath . '/index.jpg';
$webPath .= '/index.jpg';
} else {
$files = \scandir($basePath);
if ($files !== false) {
foreach ($files as $file) {
if ($file === '.' || $files === '..') {
continue;
}
$path = $basePath . '/' . $file;
$webPath .= '/' . $file;
if (\stripos($file, '.jpg') !== false
|| \stripos($file, '.jpeg') !== false
|| \stripos($file, '.png') !== false
|| \stripos($file, '.gif') !== false
) {
$type = 'img';
break;
} elseif (\stripos($file, '.pdf') !== false) {
$type = 'pdf';
break;
}
}
}
}
?>
status !== ReportStatus::DOWNLOAD_ERROR) : ?>