mirror of
https://github.com/Karaka-Management/oms-Help.git
synced 2026-01-11 12:58:41 +00:00
Improve module listing and implement help doc draft for tests
This commit is contained in:
parent
b9298cc624
commit
97c4484c0b
|
|
@ -23,6 +23,7 @@ use phpOMS\Utils\Parser\Markdown\Markdown;
|
|||
use phpOMS\Module\ModuleAbstract;
|
||||
use phpOMS\Module\WebInterface;
|
||||
use phpOMS\Views\View;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
|
||||
/**
|
||||
* Help class.
|
||||
|
|
@ -152,8 +153,30 @@ final class Controller extends ModuleAbstract implements WebInterface
|
|||
*/
|
||||
public function viewHelpModule(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
|
||||
{
|
||||
$active = $this->app->moduleManager->getActiveModules();
|
||||
|
||||
if ($request->getData('id') === null || !isset($active[$request->getData('id')])) {
|
||||
return $this->viewHelpModuleList();
|
||||
}
|
||||
|
||||
$view = new View($this->app, $request, $response);
|
||||
|
||||
if ($request->getData('page') === 'table-of-contencts' || $request->getData('page') === null) {
|
||||
$path = \realpath(__DIR__ . '/../' . $request->getData('id') . '/Docs/Help/en/table_of_contents.md');
|
||||
} else {
|
||||
$path = \realpath(__DIR__ . '/../' . $request->getData('id') . '/Docs/Help/en/' . $request->getData('page') . '.md');
|
||||
}
|
||||
|
||||
if ($path === false) {
|
||||
$view->setTemplate('/Web/Backend/Error/403_inline');
|
||||
$response->getHeader()->setStatusCode(RequestStatusCode::R_403);
|
||||
return $view;
|
||||
}
|
||||
|
||||
$markdown = Markdown::parse(\file_get_contents($path));
|
||||
|
||||
$view->setTemplate('/Modules/Help/Theme/Backend/help-module');
|
||||
$view->setData('content', $markdown);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
|
|||
16
Theme/Backend/Lang/en.lang.php
Normal file
16
Theme/Backend/Lang/en.lang.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.2
|
||||
*
|
||||
* @package TBD
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link http://website.orange-management.de
|
||||
*/
|
||||
return ['Help' => [
|
||||
'Modules' => 'Modules',
|
||||
'Name' => 'Name',
|
||||
]];
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.2
|
||||
*
|
||||
* @package Modules\Admin\Template\Backend
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link http://website.orange-management.de
|
||||
*/
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
*/
|
||||
|
||||
$modules = $this->app->moduleManager->getInstalledModules();
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box wf-100">
|
||||
<table class="table red">
|
||||
<caption><?= $this->getHtml('Modules') ?></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="wf-100"><?= $this->getHtml('Name') ?>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td>
|
||||
<tbody>
|
||||
<?php $count = 0; foreach ($modules as $key => $module) :
|
||||
if ((\realpath(__DIR__ . '/../../../' . $module['directory'] . '/Docs/Help/en/table_of_contents.md')) === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$count++;
|
||||
$url = \phpOMS\Uri\UriFactory::build(
|
||||
'/{/lang}/backend/help/module/single?id={$module}',
|
||||
['$module' => $module['name']['internal']]
|
||||
); ?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td data-label="<?= $this->getHtml('Name') ?>"><a href="<?= $url; ?>"><?= $this->printHtml($module['name']['external']); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td class="empty"><?= $this->getHtml('Empty', 0, 0); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<section class="box wf-100">
|
||||
<div class="inner">
|
||||
<article>
|
||||
<?= $this->getData('markdown'); ?>
|
||||
<?= $this->getData('content'); ?>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user