Fix Path bugs after move

This commit is contained in:
Dennis Eichhorn 2018-09-21 23:09:54 +02:00
parent bfb785d358
commit 2b4e098ec2
2 changed files with 17 additions and 17 deletions

View File

@ -69,7 +69,7 @@ class BackendController extends Controller
$path = $this->getHelpGeneralPath($request); $path = $this->getHelpGeneralPath($request);
$content = Markdown::parse(\file_get_contents($path)); $content = Markdown::parse(\file_get_contents($path));
$navigation = Markdown::parse(\file_get_contents(__DIR__ . '/../../Documentation/SUMMARY.md')); $navigation = Markdown::parse(\file_get_contents(__DIR__ . '/../../../Documentation/SUMMARY.md'));
$view->setTemplate('/Modules/Help/Theme/Backend/help-general'); $view->setTemplate('/Modules/Help/Theme/Backend/help-general');
$view->setData('content', $content); $view->setData('content', $content);
@ -80,7 +80,7 @@ class BackendController extends Controller
/** /**
* Create markdown parsing path * Create markdown parsing path
* *
* @param RequestAbstract $request Request * @param RequestAbstract $request Request
* *
* @return string * @return string
@ -91,13 +91,13 @@ class BackendController extends Controller
private function getHelpGeneralPath(RequestAbstract $request) : string private function getHelpGeneralPath(RequestAbstract $request) : string
{ {
if ($request->getData('page') === 'README' || $request->getData('page') === null) { if ($request->getData('page') === 'README' || $request->getData('page') === null) {
$path = \realpath(__DIR__ . '/../../Documentation/README.md'); $path = \realpath(__DIR__ . '/../../../Documentation/README.md');
} else { } else {
$path = \realpath(__DIR__ . '/../../Documentation/' . $request->getData('page') . '.md'); $path = \realpath(__DIR__ . '/../../../Documentation/' . $request->getData('page') . '.md');
} }
if ($path === false) { if ($path === false) {
$path = \realpath(__DIR__ . '/../../Documentation/README.md'); $path = \realpath(__DIR__ . '/../../../Documentation/README.md');
} }
return $path; return $path;
@ -143,7 +143,7 @@ class BackendController extends Controller
$path = $this->getHelpModulePath($request); $path = $this->getHelpModulePath($request);
$content = Markdown::parse(\file_get_contents($path)); $content = Markdown::parse(\file_get_contents($path));
$navigation = Markdown::parse(\file_get_contents(\realpath(__DIR__ . '/../' . $request->getData('id') . '/Docs/Help/en/SUMMARY.md'))); $navigation = Markdown::parse(\file_get_contents(\realpath(__DIR__ . '/../../' . $request->getData('id') . '/Docs/Help/en/SUMMARY.md')));
$view->setTemplate('/Modules/Help/Theme/Backend/help-module'); $view->setTemplate('/Modules/Help/Theme/Backend/help-module');
$view->setData('content', $content); $view->setData('content', $content);
@ -154,7 +154,7 @@ class BackendController extends Controller
/** /**
* Create markdown parsing path * Create markdown parsing path
* *
* @param RequestAbstract $request Request * @param RequestAbstract $request Request
* *
* @return string * @return string
@ -165,13 +165,13 @@ class BackendController extends Controller
private function getHelpModulePath(RequestAbstract $request) : string private function getHelpModulePath(RequestAbstract $request) : string
{ {
if ($request->getData('page') === 'table-of-contencts' || $request->getData('page') === null) { if ($request->getData('page') === 'table-of-contencts' || $request->getData('page') === null) {
$path = \realpath(__DIR__ . '/../' . $request->getData('id') . '/Docs/introduction.md'); $path = \realpath(__DIR__ . '/../../' . $request->getData('id') . '/Docs/introduction.md');
} else { } else {
$path = \realpath(__DIR__ . '/../' . $request->getData('id') . '/Docs/Help/en/' . $request->getData('page') . '.md'); $path = \realpath(__DIR__ . '/../../' . $request->getData('id') . '/Docs/Help/en/' . $request->getData('page') . '.md');
} }
if ($path === false) { if ($path === false) {
$path = \realpath(__DIR__ . '/../' . $request->getData('id') . '/Docs/introduction.md'); $path = \realpath(__DIR__ . '/../../' . $request->getData('id') . '/Docs/introduction.md');
} }
return $path; return $path;
@ -193,7 +193,7 @@ class BackendController extends Controller
$path = $this->getHelpDeveloperPath($request); $path = $this->getHelpDeveloperPath($request);
$content = Markdown::parse(\file_get_contents($path)); $content = Markdown::parse(\file_get_contents($path));
$navigation = Markdown::parse(\file_get_contents(__DIR__ . '/../../Developer-Guide/SUMMARY.md')); $navigation = Markdown::parse(\file_get_contents(__DIR__ . '/../../../Developer-Guide/SUMMARY.md'));
$view->setTemplate('/Modules/Help/Theme/Backend/help-developer'); $view->setTemplate('/Modules/Help/Theme/Backend/help-developer');
$view->setData('content', $content); $view->setData('content', $content);
@ -204,7 +204,7 @@ class BackendController extends Controller
/** /**
* Create markdown parsing path * Create markdown parsing path
* *
* @param RequestAbstract $request Request * @param RequestAbstract $request Request
* *
* @return string * @return string
@ -215,13 +215,13 @@ class BackendController extends Controller
private function getHelpDeveloperPath(RequestAbstract $request) : string private function getHelpDeveloperPath(RequestAbstract $request) : string
{ {
if ($request->getData('page') === 'README' || $request->getData('page') === null) { if ($request->getData('page') === 'README' || $request->getData('page') === null) {
$path = \realpath(__DIR__ . '/../../Developer-Guide/README.md'); $path = \realpath(__DIR__ . '/../../../Developer-Guide/README.md');
} else { } else {
$path = \realpath(__DIR__ . '/../../Developer-Guide/' . $request->getData('page') . '.md'); $path = \realpath(__DIR__ . '/../../../Developer-Guide/' . $request->getData('page') . '.md');
} }
if ($path === false) { if ($path === false) {
$path = \realpath(__DIR__ . '/../../Developer-Guide/README.md'); $path = \realpath(__DIR__ . '/../../../Developer-Guide/README.md');
} }
return $path; return $path;

View File

@ -30,14 +30,14 @@ $modules = $this->app->moduleManager->getInstalledModules();
<tr> <tr>
<td> <td>
<tbody> <tbody>
<?php $count = 0; foreach ($modules as $key => $module) : <?php $count = 0; foreach ($modules as $key => $module) :
if ((\realpath(__DIR__ . '/../../../' . $module['directory'] . '/Docs/Help/en/SUMMARY.md')) === false) { if ((\realpath(__DIR__ . '/../../../' . $module['directory'] . '/Docs/Help/en/SUMMARY.md')) === false) {
continue; continue;
} }
$count++; $count++;
$url = \phpOMS\Uri\UriFactory::build( $url = \phpOMS\Uri\UriFactory::build(
'/{/lang}/backend/help/module/single?id={$module}', '/{/lang}/backend/help/module/single?id={$module}',
['$module' => $module['name']['internal']] ['$module' => $module['name']['internal']]
); ?> ); ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">