mirror of
https://github.com/Karaka-Management/oms-Knowledgebase.git
synced 2026-01-11 01:18:40 +00:00
fix templates
This commit is contained in:
parent
bd08642f7d
commit
b275724809
|
|
@ -85,18 +85,14 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Knowledgebase/Theme/Backend/wiki-dashboard');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005901001, $request, $response);
|
||||
|
||||
/** @var \Modules\Knowledgebase\Models\WikiCategory[] $categories */
|
||||
$categories = WikiCategoryMapper::getAll()
|
||||
$view->data['categories'] = WikiCategoryMapper::getAll()
|
||||
->with('name')
|
||||
->where('parent', null)
|
||||
->where('app', $app)
|
||||
->where('name/language', $response->header->l11n->language)
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['categories'] = $categories;
|
||||
|
||||
/** @var \Modules\Knowledgebase\Models\WikiDoc[] $documents */
|
||||
$documents = WikiDocMapper::getAll()
|
||||
$view->data['docs'] = WikiDocMapper::getAll()
|
||||
->with('tags')
|
||||
->with('tags/title')
|
||||
->where('app', $app)
|
||||
|
|
@ -106,11 +102,9 @@ final class BackendController extends Controller
|
|||
->sort('createdAt', OrderType::DESC)
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['docs'] = $documents;
|
||||
|
||||
/** @var \Modules\Knowledgebase\Models\WikiApp[] $apps */
|
||||
$apps = WikiAppMapper::getAll()->executeGetArray();
|
||||
$view->data['apps'] = $apps;
|
||||
$view->data['apps'] = WikiAppMapper::getAll()
|
||||
->where('unit', [$this->app->unitId, null])
|
||||
->executeGetArray();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
@ -134,9 +128,9 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Knowledgebase/Theme/Backend/wiki-app-list');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005901001, $request, $response);
|
||||
|
||||
/** @var \Modules\Knowledgebase\Models\WikiApp[] $list */
|
||||
$list = WikiAppMapper::getAll()->executeGetArray();
|
||||
$view->data['apps'] = $list;
|
||||
$view->data['apps'] = WikiAppMapper::getAll()
|
||||
->where('unit', [$this->app->unitId, null])
|
||||
->executeGetArray();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
@ -160,9 +154,9 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Knowledgebase/Theme/Backend/wiki-app-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005901001, $request, $response);
|
||||
|
||||
/** @var \Modules\Knowledgebase\Models\WikiApp $app */
|
||||
$app = WikiAppMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
$view->data['app'] = $app;
|
||||
$view->data['app'] = WikiAppMapper::get()
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->execute();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
@ -185,8 +179,6 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Knowledgebase/Theme/Backend/wiki-app-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005901001, $request, $response);
|
||||
|
||||
$view->data['app'] = new NullWikiApp();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
@ -209,17 +201,14 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Knowledgebase/Theme/Backend/wiki-category-list');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005901001, $request, $response);
|
||||
|
||||
/** @var \Modules\Knowledgebase\Models\WikiCategory[] $list */
|
||||
$list = WikiCategoryMapper::getAll()
|
||||
$view->data['categories'] = WikiCategoryMapper::getAll()
|
||||
->with('name')
|
||||
->where('name/language', $response->header->l11n->language)
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['categories'] = $list;
|
||||
|
||||
/** @var \Modules\Knowledgebase\Models\WikiApp[] $apps */
|
||||
$apps = WikiAppMapper::getAll()->executeGetArray();
|
||||
$view->data['apps'] = $apps;
|
||||
$view->data['apps'] = WikiAppMapper::getAll()
|
||||
->where('unit', [$this->app->unitId, null])
|
||||
->executeGetArray();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
@ -243,30 +232,29 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Knowledgebase/Theme/Backend/wiki-category-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005901001, $request, $response);
|
||||
|
||||
/** @var \Modules\Knowledgebase\Models\WikiCategory $category */
|
||||
$category = WikiCategoryMapper::get()
|
||||
$view->data['category'] = WikiCategoryMapper::get()
|
||||
->with('name')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->where('name/language', $response->header->l11n->language)
|
||||
->execute();
|
||||
|
||||
$view->data['category'] = $category;
|
||||
|
||||
$view->data['l11nView'] = new \Web\Backend\Views\L11nView($this->app->l11nManager, $request, $response);
|
||||
|
||||
/** @var \phpOMS\Localization\BaseStringL11n[] $l11nValues */
|
||||
$l11nValues = WikiCategoryL11nMapper::getAll()
|
||||
->where('ref', $category->id)
|
||||
$view->data['l11nValues'] = WikiCategoryL11nMapper::getAll()
|
||||
->where('ref', $view->data['category']->id)
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['l11nValues'] = $l11nValues;
|
||||
|
||||
$view->data['apps'] = WikiAppMapper::getAll()
|
||||
->where('unit', [$this->app->unitId, null])
|
||||
->executeGetArray();
|
||||
|
||||
$appIds = \array_map(function (WikiApp $app) { return $app->id;
|
||||
}, $view->data['apps']);
|
||||
$appIds = \array_map(
|
||||
function (WikiApp $app) {
|
||||
return $app->id;
|
||||
},
|
||||
$view->data['apps']
|
||||
);
|
||||
|
||||
$appIds = \array_unique($appIds);
|
||||
|
||||
$view->data['parents'] = WikiCategoryMapper::getAll()
|
||||
|
|
@ -302,8 +290,13 @@ final class BackendController extends Controller
|
|||
->where('unit', [$this->app->unitId, null])
|
||||
->executeGetArray();
|
||||
|
||||
$appIds = \array_map(function (WikiApp $app) { return $app->id;
|
||||
}, $view->data['apps']);
|
||||
$appIds = \array_map(
|
||||
function (WikiApp $app) {
|
||||
return $app->id;
|
||||
},
|
||||
$view->data['apps']
|
||||
);
|
||||
|
||||
$appIds = \array_unique($appIds);
|
||||
|
||||
$view->data['parents'] = WikiCategoryMapper::getAll()
|
||||
|
|
@ -337,22 +330,18 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/Knowledgebase/Theme/Backend/wiki-doc-list');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1005901001, $request, $response);
|
||||
|
||||
/** @var \Modules\Knowledgebase\Models\WikiCategory[] $categories */
|
||||
$categories = WikiCategoryMapper::getAll()
|
||||
$view->data['categories'] = WikiCategoryMapper::getAll()
|
||||
->with('name')
|
||||
->where('app', $wikiId)
|
||||
->where('parent', $categoryId === 0 ? null : $categoryId)
|
||||
->where('name/language', $response->header->l11n->language)
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['categories'] = $categories;
|
||||
|
||||
$view->data['category'] = WikiCategoryMapper::get()
|
||||
->where('id', $categoryId === 0 ? null : $categoryId)
|
||||
->execute();
|
||||
|
||||
/** @var \Modules\Knowledgebase\Models\WikiDoc[] $documents */
|
||||
$documents = WikiDocMapper::getAll()
|
||||
$view->data['docs'] = WikiDocMapper::getAll()
|
||||
->with('tags')
|
||||
->with('tags/title')
|
||||
->where('app', $wikiId)
|
||||
|
|
@ -362,11 +351,9 @@ final class BackendController extends Controller
|
|||
->sort('createdAt', OrderType::DESC)
|
||||
->executeGetArray();
|
||||
|
||||
$view->data['docs'] = $documents;
|
||||
|
||||
/** @var \Modules\Knowledgebase\Models\WikiApp[] $apps */
|
||||
$apps = WikiAppMapper::getAll()->executeGetArray();
|
||||
$view->data['apps'] = $apps;
|
||||
$view->data['apps'] = WikiAppMapper::getAll()
|
||||
->where('unit', [$this->app->unitId, null])
|
||||
->executeGetArray();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\Knowledgebase
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
$app = $this->data['app'];
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
echo $this->data['nav']->render();
|
||||
|
|
@ -12,7 +12,40 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
$apps = $this->data['apps'];
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
echo $this->data['nav']->render();
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head">
|
||||
<?= $this->getHtml('Apps'); ?>
|
||||
<i class="g-icon download btn end-xs">download</i>
|
||||
<a class="button end-xs save" href="<?= UriFactory::build('{/base}/wiki/app/create'); ?>"><?= $this->getHtml('New', '0', '0'); ?></a>
|
||||
</div>
|
||||
<div class="slider">
|
||||
<table class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('ID', '0', '0'); ?>
|
||||
<td class="wf-100"><?= $this->getHtml('Title'); ?>
|
||||
<tbody>
|
||||
<?php $c = 0;
|
||||
foreach ($apps as $key => $value) : ++$c;
|
||||
$url = \phpOMS\Uri\UriFactory::build('{/base}/wiki/app/view?{?}&id=' . $value->id); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($c === 0) : ?>
|
||||
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,39 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
$app = $this->data['app'];
|
||||
use Modules\Knowledgebase\Models\NullWikiApp;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
$app = $this->data['app'] ?? new NullWikiApp();
|
||||
$isNew = $app->id === 0;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
echo $this->data['nav']->render();
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<section class="portlet">
|
||||
<form method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}wiki/app?csrf={$CSRF}'); ?>">
|
||||
<div class="portlet-head"><?= $this->getHtml('App'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
|
||||
<input type="text" name="id" id="iId" value="<?= $app->id; ?>" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iName"><?= $this->getHtml('Name'); ?></label>
|
||||
<input type="text" name="Name" id="iName" value="<?= $this->printHtml($app->name); ?>" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<?php if ($isNew) : ?>
|
||||
<input id="iCreateSubmit" type="Submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
|
||||
<?php else : ?>
|
||||
<input id="iSaveSubmit" type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ echo $this->data['nav']->render();
|
|||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head">
|
||||
<?= $this->getHtml('Categories'); ?>
|
||||
<i class="g-icon download btn end-xs">download</i>
|
||||
|
|
@ -56,6 +56,6 @@ echo $this->data['nav']->render();
|
|||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user