mirror of
https://github.com/Karaka-Management/oms-QA.git
synced 2026-01-10 15:18:41 +00:00
fix templates
This commit is contained in:
parent
f5353aec2d
commit
b7e469f5e6
|
|
@ -23,6 +23,7 @@ use Modules\QA\Models\QAQuestion;
|
|||
use Modules\QA\Models\QAQuestionMapper;
|
||||
use phpOMS\Asset\AssetType;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Views\View;
|
||||
|
|
@ -75,7 +76,7 @@ final class BackendController extends Controller
|
|||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response);
|
||||
|
||||
/** @var \Modules\QA\Models\QAQuestion[] $list */
|
||||
$list = QAQuestionMapper::getAll()
|
||||
$view->data['questions'] = QAQuestionMapper::getAll()
|
||||
->with('createdBy')
|
||||
->with('createdBy/account')
|
||||
->with('createdBy/image')
|
||||
|
|
@ -88,11 +89,10 @@ final class BackendController extends Controller
|
|||
->where('language', $response->header->l11n->language)
|
||||
->limit(50)->executeGetArray();
|
||||
|
||||
$view->data['questions'] = $list;
|
||||
|
||||
/** @var \Modules\QA\Models\QAApp[] $apps */
|
||||
$apps = QAAppMapper::getAll()->executeGetArray();
|
||||
$view->data['apps'] = $apps;
|
||||
$view->data['apps'] = QAAppMapper::getAll()
|
||||
->where('unit', [$this->app->unitId, null])
|
||||
->executeGetArray();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
@ -112,11 +112,18 @@ final class BackendController extends Controller
|
|||
public function viewQADoc(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
if (!$request->hasData('id')) {
|
||||
$response->header->status = RequestStatusCode::R_404;
|
||||
$view->setTemplate('/Web/Backend/Error/404');
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
$view->setTemplate('/Modules/QA/Theme/Backend/qa-question');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response);
|
||||
|
||||
/** @var \Modules\QA\Models\QAQuestion $question */
|
||||
$question = QAQuestionMapper::get()
|
||||
$view->data['question'] = QAQuestionMapper::get()
|
||||
->with('answers')
|
||||
->with('answers/createdBy')
|
||||
->with('answers/createdBy/image')
|
||||
|
|
@ -133,10 +140,7 @@ final class BackendController extends Controller
|
|||
->where('tags/title/language', $response->header->l11n->language)
|
||||
->execute();
|
||||
|
||||
$view->data['question'] = $question;
|
||||
|
||||
$scores = QAHelperMapper::getAccountScore($question->getAccounts());
|
||||
$view->data['scores'] = $scores;
|
||||
$view->data['scores'] = QAHelperMapper::getAccountScore($question->getAccounts());
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
@ -173,8 +177,8 @@ final class BackendController extends Controller
|
|||
->execute();
|
||||
}
|
||||
|
||||
$scores = QAHelperMapper::getAccountScore($question->getAccounts());
|
||||
$view->data['scores'] = $scores;
|
||||
$view->data['scores'] = QAHelperMapper::getAccountScore($question->getAccounts());
|
||||
|
||||
$view->data['question'] = $question;
|
||||
|
||||
return $view;
|
||||
|
|
@ -199,12 +203,13 @@ final class BackendController extends Controller
|
|||
$id = $request->getDataString('id') ?? '';
|
||||
|
||||
/** @var \Model\Setting[] $settings */
|
||||
$settings = SettingMapper::getAll()->where('module', $id)->executeGetArray();
|
||||
$view->data['settings'] = $settings;
|
||||
$view->data['settings'] = SettingMapper::getAll()
|
||||
->where('module', $id)
|
||||
->executeGetArray();
|
||||
|
||||
/** @var \Modules\QA\Models\QAApp[] $apps */
|
||||
$apps = QAAppMapper::getAll()->executeGetArray();
|
||||
$view->data['apps'] = $apps;
|
||||
$view->data['apps'] = QAAppMapper::getAll()
|
||||
->where('unit', [$this->app->unitId, null])
|
||||
->executeGetArray();
|
||||
|
||||
$view->setTemplate('/Modules/' . static::NAME . '/Admin/Settings/Theme/Backend/settings');
|
||||
|
||||
|
|
@ -228,7 +233,82 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/' . static::NAME . '/Admin/Settings/Theme/Backend/settings-app');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1000105001, $request, $response);
|
||||
|
||||
$view->data['app'] = QAAppMapper::get()->where('id', (int) $request->getData('app'))->execute();
|
||||
$view->data['app'] = QAAppMapper::get()
|
||||
->where('id', (int) $request->getData('app'))
|
||||
->execute();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewQAAppCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/QA/Theme/Backend/qa-app-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewQAAppList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$view->setTemplate('/Modules/QA/Theme/Backend/qa-app-list');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response);
|
||||
|
||||
$view->data['apps'] = QAAppMapper::getAll()
|
||||
->where('unit', [$this->app->unitId, null])
|
||||
->executeGetArray();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewQAApp(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$view->setTemplate('/Modules/QA/Theme/Backend/qa-app-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response);
|
||||
|
||||
$view->data['app'] = QAAppMapper::get()
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->execute();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,4 +21,6 @@ return ['QA' => [
|
|||
'Badges' => 'Abzeichen',
|
||||
'Title' => 'Titel',
|
||||
'Name' => 'Name',
|
||||
'App' => 'App',
|
||||
'Apps' => 'Apps',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -21,4 +21,6 @@ return ['QA' => [
|
|||
'Badges' => 'Badges',
|
||||
'Title' => 'Title',
|
||||
'Name' => 'Name',
|
||||
'App' => 'App',
|
||||
'Apps' => 'Apps',
|
||||
]];
|
||||
|
|
|
|||
51
Theme/Backend/qa-app-list.tpl.php
Normal file
51
Theme/Backend/qa-app-list.tpl.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\QA
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
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">
|
||||
<div 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}/qa/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}/qa/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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
50
Theme/Backend/qa-app-view.tpl.php
Normal file
50
Theme/Backend/qa-app-view.tpl.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.2
|
||||
*
|
||||
* @package Modules\QA
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\QA\Models\NullQAApp;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
$app = $this->data['app'] ?? new NullQAApp();
|
||||
$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>
|
||||
Loading…
Reference in New Issue
Block a user