From b68aa42f1dc037c69556234d28871d0ed9094922 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 17 Jul 2017 20:06:20 +0200 Subject: [PATCH] QA badges lists --- Admin/Install/Navigation.install.json | 15 +++++++ Admin/Routes/Web/Backend.php | 10 ++++- Controller.php | 45 +++++++++++++++++++++ Theme/Backend/Lang/Navigation.en.lang.php | 1 + Theme/Backend/qa-tag-edit.tpl.php | 29 ++++++++++++++ Theme/Backend/qa-tag-list.tpl.php | 49 +++++++++++++++++++++++ 6 files changed, 147 insertions(+), 2 deletions(-) create mode 100644 Theme/Backend/qa-tag-edit.tpl.php create mode 100644 Theme/Backend/qa-tag-list.tpl.php diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json index 0ac6bf8..826a46d 100644 --- a/Admin/Install/Navigation.install.json +++ b/Admin/Install/Navigation.install.json @@ -42,6 +42,21 @@ "permission": null, "parent": 1006001001, "children": [] + }, + { + "id": 1006004001, + "pid": "c3ebc146eec492fbcf5ed5d9d43ca6d0cc253583", + "type": 3, + "subtype": 1, + "name": "Badges", + "uri": "{/base}/{/lang}/backend/qa/badge/list?{?}", + "target": "self", + "icon": null, + "order": 10, + "from": "QA", + "permission": null, + "parent": 1006001001, + "children": [] } ] } diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php index 23b9807..a6de24f 100644 --- a/Admin/Routes/Web/Backend.php +++ b/Admin/Routes/Web/Backend.php @@ -15,9 +15,15 @@ return [ 'verb' => RouteVerb::GET, ], ], - '^.*/backend/qa/category.*$' => [ + '^.*/backend/qa/badge/list.*$' => [ [ - 'dest' => '\Modules\QA\Controller:viewQACategory', + 'dest' => '\Modules\QA\Controller:viewQABadgeList', + 'verb' => RouteVerb::GET, + ], + ], + '^.*/backend/qa/badge/single.*$' => [ + [ + 'dest' => '\Modules\QA\Controller:viewQABadgeEdit', 'verb' => RouteVerb::GET, ], ], diff --git a/Controller.php b/Controller.php index f13fb8d..9318128 100644 --- a/Controller.php +++ b/Controller.php @@ -24,6 +24,7 @@ use phpOMS\Views\View; use phpOMS\Asset\AssetType; use Modules\QA\Models\QAQuestionMapper; +use Modules\QA\Models\QABadgeMapper; /** * Task class. @@ -108,6 +109,50 @@ class Controller extends ModuleAbstract implements WebInterface return $view; } + /** + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return \Serializable + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function viewQABadgeList(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable + { + $view = new View($this->app, $request, $response); + $view->setTemplate('/Modules/QA/Theme/Backend/qa-tag-list'); + $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response)); + + $list = QABadgeMapper::getAll(); + $view->setData('tags', $list); + + return $view; + } + + /** + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return \Serializable + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function viewQABadgeEdit(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable + { + $view = new View($this->app, $request, $response); + $view->setTemplate('/Modules/QA/Theme/Backend/qa-tag-edit'); + $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1006001001, $request, $response)); + + $tag = QABadgeMapper::get((int) $request->getData('id')); + $view->setData('tag', $tag); + + return $view; + } + public function viewQADoc(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable { $view = new View($this->app, $request, $response); diff --git a/Theme/Backend/Lang/Navigation.en.lang.php b/Theme/Backend/Lang/Navigation.en.lang.php index 576f2a7..9a0126c 100644 --- a/Theme/Backend/Lang/Navigation.en.lang.php +++ b/Theme/Backend/Lang/Navigation.en.lang.php @@ -15,4 +15,5 @@ */ return ['Navigation' => [ 'QA' => 'QA', + 'Badges' => 'Badges', ]]; diff --git a/Theme/Backend/qa-tag-edit.tpl.php b/Theme/Backend/qa-tag-edit.tpl.php new file mode 100644 index 0000000..ff1b56d --- /dev/null +++ b/Theme/Backend/qa-tag-edit.tpl.php @@ -0,0 +1,29 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ + +$tag = $this->getData('tag'); + +/** + * @var \phpOMS\Views\View $this + */ +echo $this->getData('nav')->render(); +?> + +
+
+ +
+
\ No newline at end of file diff --git a/Theme/Backend/qa-tag-list.tpl.php b/Theme/Backend/qa-tag-list.tpl.php new file mode 100644 index 0000000..a2c4435 --- /dev/null +++ b/Theme/Backend/qa-tag-list.tpl.php @@ -0,0 +1,49 @@ + + * @author Dennis Eichhorn + * @copyright Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ + +$tags = $this->getData('tags'); + +/** + * @var \phpOMS\Views\View $this + */ +echo $this->getData('nav')->render(); +?> + +
+
+
+ + + + + + + getData('tags') as $key => $value) : $c++; + $url = \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/backend/admin/account/settings?{?}&id=' . $value->getId()); ?> + +
getText('Groups'); ?>
getText('ID', 0, 0); ?> + getText('Name'); ?> +
+
getId(); ?> + getName(); ?> + + +
getText('Empty', 0, 0); ?> + +
+
+
+
\ No newline at end of file