diff --git a/themes/tajian/controller/SiteController.php b/themes/tajian/controller/SiteController.php index 173fa3e..19bae36 100644 --- a/themes/tajian/controller/SiteController.php +++ b/themes/tajian/controller/SiteController.php @@ -127,4 +127,49 @@ Class SiteController extends Controller { return $sorted_tags; } + //添加新视频 + public function actionNew() { + //获取数据 + $menus = array(); //菜单,一级目录 + $htmlReadme = ''; //Readme.md 内容,底部网站详细介绍 + $htmlCateReadme = ''; //当前目录下的Readme.md 内容 + $menus_sorted = array(); //Readme_sort.txt 说明文件内容,一级目录菜单从上到下的排序 + + $scanner = new DirScanner(); + $scanner->setWebRoot(FSC::$app['config']['content_directory']); + $dirTree = $scanner->scan(__DIR__ . '/../../../www/' . FSC::$app['config']['content_directory'], 4); + $scanResults = $scanner->getScanResults(); + + $titles = array(); + $htmlReadme = ''; + $readmeFile = $scanner->getDefaultReadme(); + if (!empty($readmeFile)) { + if (!empty($readmeFile['sort'])) { + $menus_sorted = explode("\n", $readmeFile['sort']); + } + + $titles = $scanner->getMDTitles($readmeFile['id']); + + $Parsedown = new Parsedown(); + $content = file_get_contents($readmeFile['realpath']); + $htmlReadme = $Parsedown->text($content); + $htmlReadme = $scanner->fixMDUrls($readmeFile['realpath'], $htmlReadme); + } + + //获取tags分类 + $tags = $this->getTags($dirTree); + + //排序 + if (!empty($menus_sorted) && !empty($tags)) { + $tags = $this->sortTags($menus_sorted, $tags); + } + + + $pageTitle = '添加视频收藏'; + $viewName = 'new'; + $params = compact('cateId', 'dirTree', 'scanResults', 'htmlReadme', 'tags'); + return $this->render($viewName, $params, $pageTitle); + } + + } diff --git a/themes/tajian/views/layout/main.php b/themes/tajian/views/layout/main.php index 9e67a3d..dc1aaaa 100644 --- a/themes/tajian/views/layout/main.php +++ b/themes/tajian/views/layout/main.php @@ -10,27 +10,61 @@ require_once __DIR__ . '/../../../../plugins/Html.php'; - - - - - - +
- -