eof;
}
?>
{$category['description']}
eof;
}
//当前目录的readme详细介绍
if (!empty($viewData['htmlCateReadme'])) {
echo <<{$viewData['htmlCateReadme']}
eof;
}
if (!empty($category['directories'])) { //两级目录支持
$playBtnCls = '';
$playBtn = '';
//如果已经是二级目录了,则当三级目录为视频目录,打开播放网页
if (!empty($selectedId) && count($breadcrumbs) >= 2) {
$playBtnCls = ' video-js vjs-big-play-centered';
$playBtn = <<
Play Video
eof;
}
foreach($category['directories'] as $dir) {
$playUrl = !empty($playBtn) ? "/view/?id={$dir['id']}" : $dir['path'];
$openInBlank = !empty($playBtn) ? ' target="_blank"' : '';
echo <<
eof;
if (!empty($dir['snapshot'])) {
echo <<
eof;
}else if (!empty($dir['files'])) {
$first_img = array_shift($dir['files']);
if (!in_array($first_img['extension'], $imgExts)) {
foreach($dir['files'] as $file) {
if (in_array($file['extension'], $imgExts)) {
$first_img = $file;
break;
}
}
}
if (in_array($first_img['extension'], $imgExts)) {
echo <<
eof;
}else {
echo <<
eof;
}
}
if (!empty($dir['duration'])) {
echo <<{$dir['duration']}
eof;
}
$title = !empty($dir['title']) ? $dir['title'] : $dir['directory'];
echo <<
{$title}
eof;
}
}
if (!empty($category['files'])) { //一级目录支持,目录下直接存放视频文件
$first_img = '';
foreach($category['files'] as $file) {
if (!in_array($file['extension'], $videoExts)) {
//如果是最后一层视频目录,取第一张图片做封面
if (empty($first_img) && empty($category['snapshot']) && in_array($file['extension'], $imgExts)) {
$first_img = $file;
}
continue;
}
$duration = !empty($category['duration']) ? $category['duration'] : '';
$snapshot = !empty($file['snapshot']) ? $file['snapshot'] : (!empty($category['snapshot']) ? $category['snapshot'] :
(!empty($first_img['path']) ? $first_img['path'] : '/img/default.png')
);
$title = !empty($category['title']) ? $category['title'] : $file['filename'];
echo <<
{$duration}
{$title}
eof;
}
}
?>