diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php
index 55f3e76..5cac677 100755
--- a/Admin/Routes/Web/Backend.php
+++ b/Admin/Routes/Web/Backend.php
@@ -18,6 +18,28 @@ use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
return [
+ '^.*/admin/module/settings\?id=QA$' => [
+ [
+ 'dest' => '\Modules\QA\Controller\BackendController:viewModuleSettings',
+ 'verb' => RouteVerb::GET,
+ 'permission' => [
+ 'module' => BackendController::NAME,
+ 'type' => PermissionType::READ,
+ 'state' => \Modules\Admin\Models\PermissionState::MODULE,
+ ],
+ ],
+ ],
+ '^.*/admin/module/settings\?id=QA&app=.*?$' => [
+ [
+ 'dest' => '\Modules\QA\Controller\BackendController:viewAppSettings',
+ 'verb' => RouteVerb::GET,
+ 'permission' => [
+ 'module' => BackendController::NAME,
+ 'type' => PermissionType::READ,
+ 'state' => \Modules\Admin\Models\PermissionState::MODULE,
+ ],
+ ],
+ ],
'^.*/qa.*$' => [
[
'dest' => '\Modules\QA\Controller\BackendController:setUpBackend',
diff --git a/Admin/Settings/Theme/Backend/settings-app.tpl.php b/Admin/Settings/Theme/Backend/settings-app.tpl.php
new file mode 100644
index 0000000..e69de29
diff --git a/Admin/Settings/Theme/Backend/settings.tpl.php b/Admin/Settings/Theme/Backend/settings.tpl.php
new file mode 100644
index 0000000..51bac76
--- /dev/null
+++ b/Admin/Settings/Theme/Backend/settings.tpl.php
@@ -0,0 +1,72 @@
+getData('apps') ?? [];
+
+echo $this->getData('nav')->render(); ?>
+
+
+
+
+
= $this->getHtml('Apps'); ?>
+
+
+
+
diff --git a/Controller/BackendController.php b/Controller/BackendController.php
index fde5098..7d03380 100755
--- a/Controller/BackendController.php
+++ b/Controller/BackendController.php
@@ -14,6 +14,8 @@ declare(strict_types=1);
namespace Modules\QA\Controller;
+use Model\NullSetting;
+use Model\SettingMapper;
use Modules\QA\Models\QAAppMapper;
use Modules\QA\Models\QAHelperMapper;
use Modules\QA\Models\QAQuestionMapper;
@@ -129,4 +131,61 @@ final class BackendController extends Controller
return $view;
}
+
+ /**
+ * Method which generates the module settings view.
+ *
+ * @param RequestAbstract $request Request
+ * @param ResponseAbstract $response Response
+ * @param mixed $data Generic data
+ *
+ * @return RenderableInterface Response can be rendered
+ *
+ * @since 1.0.0
+ */
+ public function viewModuleSettings(RequestAbstract $request, ResponseAbstract $response, $data = null): RenderableInterface
+ {
+ $view = new View($this->app->l11nManager, $request, $response);
+ $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000105001, $request, $response));
+
+ $id = $request->getData('id') ?? '';
+
+ $settings = SettingMapper::getFor($id, 'module');
+ if (!($settings instanceof NullSetting)) {
+ $view->setData('settings', !\is_array($settings) ? [$settings] : $settings);
+ }
+
+ $apps = QAAppMapper::getAll();
+ $view->setData('apps', $apps);
+
+ if (\is_file(__DIR__ . '/../Admin/Settings/Theme/Backend/settings.tpl.php')) {
+ $view->setTemplate('/Modules/' . static::NAME . '/Admin/Settings/Theme/Backend/settings');
+ } else {
+ $view->setTemplate('/Modules/Admin/Theme/Backend/modules-settings');
+ }
+
+ return $view;
+ }
+
+ /**
+ * Method which generates a app settings view.
+ *
+ * @param RequestAbstract $request Request
+ * @param ResponseAbstract $response Response
+ * @param mixed $data Generic data
+ *
+ * @return RenderableInterface Response can be rendered
+ *
+ * @since 1.0.0
+ */
+ public function viewAppSettings(RequestAbstract $request, ResponseAbstract $response, $data = null): RenderableInterface
+ {
+ $view = new View($this->app->l11nManager, $request, $response);
+ $view->setTemplate('/Modules/' . static::NAME . '/Admin/Settings/Theme/Backend/settings-app');
+ $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000105001, $request, $response));
+
+ $view->addData('app', QAAppMapper::get((int) $request->getData('app')));
+
+ return $view;
+ }
}
diff --git a/Models/QAQuestion.php b/Models/QAQuestion.php
index 2e9ff92..f078825 100755
--- a/Models/QAQuestion.php
+++ b/Models/QAQuestion.php
@@ -141,7 +141,7 @@ class QAQuestion implements \JsonSerializable
{
$this->createdAt = new \DateTimeImmutable('now');
$this->createdBy = new NullProfile();
- $this->app = new QAApp();
+ $this->app = new NullQAApp(1);
}
/**
diff --git a/Theme/Backend/qa-question.tpl.php b/Theme/Backend/qa-question.tpl.php
index d5d1b03..ee12b3a 100755
--- a/Theme/Backend/qa-question.tpl.php
+++ b/Theme/Backend/qa-question.tpl.php
@@ -62,7 +62,7 @@ echo $this->getData('nav')->render();
- = $this->printHtml($question->createdBy->account->name2); ?>, = $this->printHtml($question->createdBy->account->name1); ?>
+ = $this->printHtml($question->createdBy->account->name2); ?> = $this->printHtml($question->createdBy->account->name1); ?>
Score: = $scores[$question->createdBy->account->getId()] ?? 0; ?>
diff --git a/Theme/Backend/styles.css b/Theme/Backend/styles.css
index c45da8c..469affa 100755
--- a/Theme/Backend/styles.css
+++ b/Theme/Backend/styles.css
@@ -15,6 +15,13 @@
min-width: 50px; }
.qa-question-view .counter-container + .counter-container {
margin-top: 10px; }
+ .qa-question-view .portlet {
+ display: flex;
+ flex-direction: column;
+ }
+ .qa-question-view .portlet-body {
+ height: 100%;
+ }
.qa .qa-accept {
font-size: 2rem;
diff --git a/Theme/Backend/styles.scss b/Theme/Backend/styles.scss
index 26d6cd4..c8b7aeb 100755
--- a/Theme/Backend/styles.scss
+++ b/Theme/Backend/styles.scss
@@ -25,6 +25,15 @@
min-width: 50px;
}
+ .portlet {
+ display: flex;
+ flex-direction: column;
+ }
+
+ .portlet-body {
+ height: 100%;
+ }
+
.counter-container+.counter-container {
margin-top: 10px;
}