Metadata
Teaching Content
@if(!empty($model->video_url))
Video
@endif
Quiz
@php
$hasVideoTab = !empty($model->video_url);
$hasQuizTab = ($quiz?->published_questions_count ?? 0) > 0;
$sectionsCount = count(array_filter(($model->content_sections ?? []), fn ($v) => is_string($v) && trim($v) !== ''));
@endphp
Metadata
{{ ucfirst($model->model_type) }}
•
{{ $model->species }}
•
{{ $model->programme }}
@if($hasVideoTab || $hasQuizTab || $sectionsCount > 0)
•
@if($sectionsCount > 0) {{ $sectionsCount }} {{ \Illuminate\Support\Str::plural('section', $sectionsCount) }} @endif
@if($hasVideoTab) · Video @endif
@if($hasQuizTab) · Quiz @endif
@endif
Teaching Content
@if($model->show_learning_levels)
@php
$sections = $model->content_sections ?? [];
$humanizeSectionKey = function ($key) {
$key = (string) $key;
if (preg_match('/^[a-z0-9_]+$/', $key)) {
return \Illuminate\Support\Str::title(str_replace('_', ' ', $key));
}
return $key;
};
$renderableSections = [];
foreach ($sections as $key => $body) {
if (! is_string($body) && ! is_numeric($body)) continue;
$body = trim((string) $body);
if ($body === '') continue;
$renderableSections[] = ['heading' => $humanizeSectionKey($key), 'body' => $body];
}
$totalWords = array_sum(array_map(fn ($s) => str_word_count($s['body']), $renderableSections));
$readingMinutes = max(1, (int) ceil($totalWords / 200));
@endphp
@if(!empty($renderableSections))
@foreach($renderableSections as $i => $section)
{{ str_pad((string) ($i + 1), 2, '0', STR_PAD_LEFT) }}
{{ $section['heading'] }}
@endforeach
@else
No teaching content generated yet.
@endif
@else
Teaching content is hidden for this model.
@endif
@if(!empty($model->video_url))
@php
$videoHost = parse_url($model->video_url, PHP_URL_HOST) ?? '';
$videoHost = strtolower(preg_replace('/^www\./', '', (string) $videoHost));
if ($model->is_video_direct) {
$providerLabel = strtoupper(pathinfo(parse_url($model->video_url, PHP_URL_PATH) ?? '', PATHINFO_EXTENSION) ?: 'File');
$providerClass = 'video-badge-file';
} elseif (str_contains($videoHost, 'youtu')) {
$providerLabel = 'YouTube';
$providerClass = 'video-badge-youtube';
} elseif (str_contains($videoHost, 'vimeo')) {
$providerLabel = 'Vimeo';
$providerClass = 'video-badge-vimeo';
} elseif (str_contains($videoHost, 'media.ed.ac.uk') || str_contains($videoHost, 'kaltura.com')) {
$providerLabel = 'Media Hopper';
$providerClass = 'video-badge-mediahopper';
} else {
$providerLabel = 'External';
$providerClass = 'video-badge-external';
}
@endphp
@if($model->is_video_direct)
Your browser cannot play this video. Open it in a new tab .
@elseif($model->video_embed_url)
@else
@endif
@if(!empty(trim((string) $model->video_comment)))
Notes
{{ $model->video_comment }}
@endif
@endif
@if(($quiz?->published_questions_count ?? 0) > 0)
@include('models._quiz_runner', ['quiz' => $quiz])
@else
Quiz
No published quiz questions available yet.
@endif
@endsection