mirror of
https://github.com/Karaka-Management/oms-QA.git
synced 2026-02-16 15:58:41 +00:00
QA module draft
This commit is contained in:
commit
59a0ea27c5
44
Admin/Activate.php
Normal file
44
Admin/Activate.php
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\QA\Admin;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DatabasePool;
|
||||||
|
use phpOMS\Module\ActivateAbstract;
|
||||||
|
use phpOMS\Module\InfoManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigation class.
|
||||||
|
*
|
||||||
|
* @category Modules
|
||||||
|
* @package Modules\Admin
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class Activate extends ActivateAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public static function activate(DatabasePool $dbPool, InfoManager $info)
|
||||||
|
{
|
||||||
|
parent::activate($dbPool, $info);
|
||||||
|
}
|
||||||
|
}
|
||||||
44
Admin/Deactivate.php
Normal file
44
Admin/Deactivate.php
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\QA\Admin;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DatabasePool;
|
||||||
|
use phpOMS\Module\DeactivateAbstract;
|
||||||
|
use phpOMS\Module\InfoManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigation class.
|
||||||
|
*
|
||||||
|
* @category Modules
|
||||||
|
* @package Modules\Admin
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class Deactivate extends DeactivateAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public static function deactivate(DatabasePool $dbPool, InfoManager $info)
|
||||||
|
{
|
||||||
|
parent::deactivate($dbPool, $info);
|
||||||
|
}
|
||||||
|
}
|
||||||
18
Admin/Install/Navigation.install.json
Normal file
18
Admin/Install/Navigation.install.json
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1006001001,
|
||||||
|
"pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd",
|
||||||
|
"type": 2,
|
||||||
|
"subtype": 1,
|
||||||
|
"name": "QA",
|
||||||
|
"uri": "/{/lang}/backend/qa/dashboard?{?}",
|
||||||
|
"target": "self",
|
||||||
|
"icon": null,
|
||||||
|
"order": 50,
|
||||||
|
"from": "QA",
|
||||||
|
"permission": null,
|
||||||
|
"parent": 1003301001,
|
||||||
|
"children": [
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
41
Admin/Install/Navigation.php
Normal file
41
Admin/Install/Navigation.php
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\QA\Admin\Install;
|
||||||
|
use phpOMS\DataStorage\Database\DatabasePool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigation class.
|
||||||
|
*
|
||||||
|
* @category Modules
|
||||||
|
* @package Modules\Kanban
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class Navigation
|
||||||
|
{
|
||||||
|
public static function install(string $path, DatabasePool $dbPool)
|
||||||
|
{
|
||||||
|
$navData = json_decode(file_get_contents(__DIR__ . '/Navigation.install.json'), true);
|
||||||
|
|
||||||
|
$class = '\\Modules\\Navigation\\Admin\\Installer';
|
||||||
|
/** @var $class \Modules\Navigation\Admin\Installer */
|
||||||
|
$class::installExternal($dbPool, $navData);
|
||||||
|
}
|
||||||
|
}
|
||||||
131
Admin/Installer.php
Normal file
131
Admin/Installer.php
Normal file
|
|
@ -0,0 +1,131 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\QA\Admin;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DatabaseType;
|
||||||
|
use phpOMS\DataStorage\Database\DatabasePool;
|
||||||
|
use phpOMS\Module\InfoManager;
|
||||||
|
use phpOMS\Module\InstallerAbstract;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tasks install class.
|
||||||
|
*
|
||||||
|
* @category Modules
|
||||||
|
* @package Modules\Tasks
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class Installer extends InstallerAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public static function install(string $path, DatabasePool $dbPool, InfoManager $info)
|
||||||
|
{
|
||||||
|
parent::install($path, $dbPool, $info);
|
||||||
|
|
||||||
|
switch ($dbPool->get('core')->getType()) {
|
||||||
|
case DatabaseType::MYSQL:
|
||||||
|
$dbPool->get('core')->con->prepare(
|
||||||
|
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'qa_category` (
|
||||||
|
`qa_category_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`qa_category_name` varchar(255) NOT NULL,
|
||||||
|
`qa_category_parent` int(11) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`qa_category_id`),
|
||||||
|
KEY `qa_category_parent` (`qa_category_parent`)
|
||||||
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||||
|
)->execute();
|
||||||
|
|
||||||
|
$dbPool->get('core')->con->prepare(
|
||||||
|
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'qa_category`
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'qa_category_ibfk_1` FOREIGN KEY (`qa_category_parent`) REFERENCES `' . $dbPool->get('core')->prefix . 'qa_category` (`qa_category_id`)'
|
||||||
|
)->execute();
|
||||||
|
|
||||||
|
$dbPool->get('core')->con->prepare(
|
||||||
|
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'qa_badge` (
|
||||||
|
`qa_badge_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`qa_badge_name` varchar(255) NOT NULL,
|
||||||
|
PRIMARY KEY (`qa_category_id`)
|
||||||
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||||
|
)->execute();
|
||||||
|
|
||||||
|
$dbPool->get('core')->con->prepare(
|
||||||
|
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'qa_question` (
|
||||||
|
`qa_question_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`qa_question_status` int(11) NOT NULL,
|
||||||
|
`qa_question_title` varchar(255) NOT NULL,
|
||||||
|
`qa_question_language` varchar(3) NOT NULL,
|
||||||
|
`qa_question_question` text NOT NULL,
|
||||||
|
`qa_question_created_by` int(11) NOT NULL,
|
||||||
|
`qa_question_created_at` datetime NOT NULL,
|
||||||
|
`qa_question_category` int(11) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`qa_question_id`),
|
||||||
|
KEY `qa_question_created_by` (`qa_question_created_by`),
|
||||||
|
KEY `qa_question_category` (`qa_question_category`)
|
||||||
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||||
|
)->execute();
|
||||||
|
|
||||||
|
$dbPool->get('core')->con->prepare(
|
||||||
|
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'qa_question`
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'qa_question_ibfk_1` FOREIGN KEY (`qa_question_created_by`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`),
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'qa_question_ibfk_2` FOREIGN KEY (`qa_question_category`) REFERENCES `' . $dbPool->get('core')->prefix . 'qa_category` (`qa_category_id`);'
|
||||||
|
)->execute();
|
||||||
|
|
||||||
|
$dbPool->get('core')->con->prepare(
|
||||||
|
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'qa_question_badge` (
|
||||||
|
`qa_question_badge_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`qa_question_badge_question` varchar(255) NOT NULL,
|
||||||
|
`qa_question_badge_badge` int(11) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`qa_category_id`),
|
||||||
|
KEY `qa_question_badge_question` (`qa_question_badge_question`),
|
||||||
|
KEY `qa_question_badge_badge` (`qa_question_badge_badge`)
|
||||||
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||||
|
)->execute();
|
||||||
|
|
||||||
|
$dbPool->get('core')->con->prepare(
|
||||||
|
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'qa_question_badge`
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'qa_question_badge_ibfk_1` FOREIGN KEY (`qa_question_badge_question`) REFERENCES `' . $dbPool->get('core')->prefix . 'qa_question` (`qa_question_id`),
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'qa_question_badge_ibfk_2` FOREIGN KEY (`qa_question_badge_badge`) REFERENCES `' . $dbPool->get('core')->prefix . 'qa_badge` (`qa_badge_id`)'
|
||||||
|
)->execute();
|
||||||
|
|
||||||
|
$dbPool->get('core')->con->prepare(
|
||||||
|
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'qa_answer` (
|
||||||
|
`qa_answer_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`qa_answer_status` int(11) NOT NULL,
|
||||||
|
`qa_answer_answer` text NOT NULL,
|
||||||
|
`qa_answer_created_by` int(11) NOT NULL,
|
||||||
|
`qa_answer_created_at` datetime NOT NULL,
|
||||||
|
`qa_answer_question` int(11) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`qa_answer_id`),
|
||||||
|
KEY `qa_answer_created_by` (`qa_answer_created_by`),
|
||||||
|
KEY `qa_answer_question` (`qa_answer_question`)
|
||||||
|
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||||
|
)->execute();
|
||||||
|
|
||||||
|
$dbPool->get('core')->con->prepare(
|
||||||
|
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'qa_answer`
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'qa_answer_ibfk_1` FOREIGN KEY (`qa_answer_created_by`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`),
|
||||||
|
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'qa_answer_ibfk_2` FOREIGN KEY (`qa_answer_question`) REFERENCES `' . $dbPool->get('core')->prefix . 'qa_question` (`qa_question_id`);'
|
||||||
|
)->execute();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
Admin/Routes/Web/Backend.php
Normal file
30
Admin/Routes/Web/Backend.php
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use phpOMS\Router\RouteVerb;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'^.*/backend/qa/dashboard.*$' => [
|
||||||
|
[
|
||||||
|
'dest' => '\Modules\Knowledgebase\Controller:viewQADashboard',
|
||||||
|
'verb' => RouteVerb::GET,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'^.*/backend/qa/category.*$' => [
|
||||||
|
[
|
||||||
|
'dest' => '\Modules\QA\Controller:viewQACategory',
|
||||||
|
'verb' => RouteVerb::GET,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'^.*/backend/qa/question.*$' => [
|
||||||
|
[
|
||||||
|
'dest' => '\Modules\QA\Controller:viewQADoc',
|
||||||
|
'verb' => RouteVerb::GET,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'^.*/backend/qa/create.*$' => [
|
||||||
|
[
|
||||||
|
'dest' => '\Modules\QA\Controller:viewQACreate',
|
||||||
|
'verb' => RouteVerb::GET,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
];
|
||||||
45
Admin/Uninstall.php
Normal file
45
Admin/Uninstall.php
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\QA\Admin;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DatabasePool;
|
||||||
|
use phpOMS\DataStorage\Database\Schema\Builder;
|
||||||
|
use phpOMS\Module\InfoManager;
|
||||||
|
use phpOMS\Module\UninstallAbstract;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigation class.
|
||||||
|
*
|
||||||
|
* @category Modules
|
||||||
|
* @package Modules\Admin
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class Uninstall extends UninstallAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public static function uninstall(DatabasePool $dbPool, InfoManager $info)
|
||||||
|
{
|
||||||
|
parent::uninstall($dbPool, $info);
|
||||||
|
}
|
||||||
|
}
|
||||||
47
Admin/Update.php
Normal file
47
Admin/Update.php
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\Knowledgebase\Admin;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DatabasePool;
|
||||||
|
use phpOMS\Module\InfoManager;
|
||||||
|
use phpOMS\Module\UpdateAbstract;
|
||||||
|
use phpOMS\System\File\Directory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigation class.
|
||||||
|
*
|
||||||
|
* @category Modules
|
||||||
|
* @package Modules\Admin
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class Update extends UpdateAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public static function update(DatabasePool $dbPool, InfoManager $info)
|
||||||
|
{
|
||||||
|
Directory::deletePath(__DIR__ . '/Update');
|
||||||
|
mkdir('Update');
|
||||||
|
parent::update($dbPool, $info);
|
||||||
|
}
|
||||||
|
}
|
||||||
80
Controller.php
Normal file
80
Controller.php
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\QA;
|
||||||
|
|
||||||
|
use phpOMS\Message\RequestAbstract;
|
||||||
|
use phpOMS\Message\ResponseAbstract;
|
||||||
|
use phpOMS\Module\ModuleAbstract;
|
||||||
|
use phpOMS\Module\WebInterface;
|
||||||
|
use phpOMS\Views\View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Task class.
|
||||||
|
*
|
||||||
|
* @category Modules
|
||||||
|
* @package Modules\QA
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class Controller extends ModuleAbstract implements WebInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module path.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
/* public */ const MODULE_PATH = __DIR__;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module version.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
/* public */ const MODULE_VERSION = '1.0.0';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
/* public */ const MODULE_NAME = 'QA';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Providing.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $providing = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dependencies.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $dependencies = [
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
||||||
102
Models/QAAnswer.php
Normal file
102
Models/QAAnswer.php
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\QA\Models;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Task class.
|
||||||
|
*
|
||||||
|
* @category Kanban
|
||||||
|
* @package Modules
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class QAQuestion implements \JsonSerializable
|
||||||
|
{
|
||||||
|
private $id = 0;
|
||||||
|
|
||||||
|
private $status = QAStatus::ACTIVE;
|
||||||
|
|
||||||
|
private $answer = '';
|
||||||
|
|
||||||
|
private $question = 0;
|
||||||
|
|
||||||
|
private $createdBy = 0;
|
||||||
|
|
||||||
|
private $createdAt = null;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->createdAt = new \DateTime('now');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId() : int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAnswer() : string
|
||||||
|
{
|
||||||
|
return $this->answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setAnswer(string $answer) /* : void */
|
||||||
|
{
|
||||||
|
$this->answer = $answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getQuestion() : string
|
||||||
|
{
|
||||||
|
return $this->question;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setQuestion(int $question) /* : void */
|
||||||
|
{
|
||||||
|
$this->question = $question;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatus() : int
|
||||||
|
{
|
||||||
|
return $this->status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStatus(int $status) /* : void */
|
||||||
|
{
|
||||||
|
$this->status = $status;
|
||||||
|
}
|
||||||
|
public function getCreatedBy() : int
|
||||||
|
{
|
||||||
|
return $this->createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCreatedBy(int $id) /* : void */
|
||||||
|
{
|
||||||
|
$this->createdBy = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCreatedAt() : \DateTime
|
||||||
|
{
|
||||||
|
return $this->createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function jsonSerialize() : array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
143
Models/QAAnswerMapper.php
Normal file
143
Models/QAAnswerMapper.php
Normal file
|
|
@ -0,0 +1,143 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\QA\Models;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Column;
|
||||||
|
use phpOMS\DataStorage\Database\RelationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapper class.
|
||||||
|
*
|
||||||
|
* @category Tasks
|
||||||
|
* @package Modules
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class QAAnswerMapper extends DataMapperAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Columns.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $columns = [
|
||||||
|
'qa_answer_id' => ['name' => 'qa_answer_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
|
'qa_answer_answer' => ['name' => 'qa_answer_answer', 'type' => 'string', 'internal' => 'answer'],
|
||||||
|
'qa_answer_question' => ['name' => 'qa_answer_question', 'type' => 'int', 'internal' => 'question'],
|
||||||
|
'qa_answer_status' => ['name' => 'qa_answer_status', 'type' => 'int', 'internal' => 'status'],
|
||||||
|
'qa_answer_created_by' => ['name' => 'qa_answer_created_by', 'type' => 'int', 'internal' => 'createdBy'],
|
||||||
|
'qa_answer_created_at' => ['name' => 'qa_answer_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $table = 'qa_answer';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created at.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $createdAt = 'qa_answer_created_at';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary field name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $primaryField = 'qa_answer_id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create object.
|
||||||
|
*
|
||||||
|
* @param mixed $obj Object
|
||||||
|
* @param int $relations Behavior for relations creation
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function create($obj, int $relations = RelationType::ALL)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$objId = parent::create($obj, $relations);
|
||||||
|
|
||||||
|
if($objId === null || !is_scalar($objId)) {
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = new Builder(self::$db);
|
||||||
|
|
||||||
|
$query->prefix(self::$db->getPrefix())
|
||||||
|
->insert(
|
||||||
|
'account_permission_account',
|
||||||
|
'account_permission_from',
|
||||||
|
'account_permission_for',
|
||||||
|
'account_permission_id1',
|
||||||
|
'account_permission_id2',
|
||||||
|
'account_permission_r',
|
||||||
|
'account_permission_w',
|
||||||
|
'account_permission_m',
|
||||||
|
'account_permission_d',
|
||||||
|
'account_permission_p'
|
||||||
|
)
|
||||||
|
->into('account_permission')
|
||||||
|
->values($obj->getCreatedBy(), 'task', 'task', 1, $objId, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
self::$db->con->prepare($query->toSql())->execute();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find.
|
||||||
|
*
|
||||||
|
* @param array $columns Columns to select
|
||||||
|
*
|
||||||
|
* @return Builder
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function find(...$columns) : Builder
|
||||||
|
{
|
||||||
|
return parent::find(...$columns)->from('account_permission')
|
||||||
|
->where('account_permission.account_permission_for', '=', 'task')
|
||||||
|
->where('account_permission.account_permission_id1', '=', 1)
|
||||||
|
->where('task.task_id', '=', new Column('account_permission.account_permission_id2'))
|
||||||
|
->where('account_permission.account_permission_r', '=', 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
59
Models/QABadge.php
Normal file
59
Models/QABadge.php
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\Badge\Models;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Task class.
|
||||||
|
*
|
||||||
|
* @category Kanban
|
||||||
|
* @package Modules
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class QABadge implements \JsonSerializable
|
||||||
|
{
|
||||||
|
private $id = 0;
|
||||||
|
|
||||||
|
private $name = '';
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId() : int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName() : string
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName(string $name) /* : void */
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function jsonSerialize() : array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
111
Models/QABadgeMapper.php
Normal file
111
Models/QABadgeMapper.php
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\QA\Models;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Column;
|
||||||
|
use phpOMS\DataStorage\Database\RelationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapper class.
|
||||||
|
*
|
||||||
|
* @category QA
|
||||||
|
* @package Modules
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class QABadgeMapper extends DataMapperAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Columns.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $columns = [
|
||||||
|
'qa_badge_id' => ['name' => 'qa_badge_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
|
'qa_badge_name' => ['name' => 'qa_badge_name', 'type' => 'string', 'internal' => 'name'],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $table = 'qa_badge';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary field name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $primaryField = 'qa_badge_id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create object.
|
||||||
|
*
|
||||||
|
* @param mixed $obj Object
|
||||||
|
* @param int $relations Behavior for relations creation
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function create($obj, int $relations = RelationType::ALL)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$objId = parent::create($obj, $relations);
|
||||||
|
|
||||||
|
if($objId === null || !is_scalar($objId)) {
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find.
|
||||||
|
*
|
||||||
|
* @param array $columns Columns to select
|
||||||
|
*
|
||||||
|
* @return Builder
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function find(...$columns) : Builder
|
||||||
|
{
|
||||||
|
return parent::find(...$columns)->from('account_permission')
|
||||||
|
->where('account_permission.account_permission_for', '=', 'task')
|
||||||
|
->where('account_permission.account_permission_id1', '=', 1)
|
||||||
|
->where('task.task_id', '=', new Column('account_permission.account_permission_id2'))
|
||||||
|
->where('account_permission.account_permission_r', '=', 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
71
Models/QACategory.php
Normal file
71
Models/QACategory.php
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\QA\Models;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Task class.
|
||||||
|
*
|
||||||
|
* @category Kanban
|
||||||
|
* @package Modules
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class QACategory implements \JsonSerializable
|
||||||
|
{
|
||||||
|
private $id = 0;
|
||||||
|
|
||||||
|
private $name = '';
|
||||||
|
|
||||||
|
private $parent = 0;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId() : int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName() : string
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName(string $name) /* : void */
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getParent() : int
|
||||||
|
{
|
||||||
|
return $this->parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setParent(int $parent) /* : void */
|
||||||
|
{
|
||||||
|
$this->parent = $parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function jsonSerialize() : array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
112
Models/QACategoryMapper.php
Normal file
112
Models/QACategoryMapper.php
Normal file
|
|
@ -0,0 +1,112 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\QA\Models;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Column;
|
||||||
|
use phpOMS\DataStorage\Database\RelationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapper class.
|
||||||
|
*
|
||||||
|
* @category Tasks
|
||||||
|
* @package Modules
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class QACategoryMapper extends DataMapperAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Columns.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $columns = [
|
||||||
|
'qa_category_id' => ['name' => 'qa_category_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
|
'qa_category_name' => ['name' => 'qa_category_name', 'type' => 'string', 'internal' => 'name'],
|
||||||
|
'qa_category_parent' => ['name' => 'qa_category_parent', 'type' => 'int', 'internal' => 'parent'],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $table = 'qa_category';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary field name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $primaryField = 'qa_category_id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create object.
|
||||||
|
*
|
||||||
|
* @param mixed $obj Object
|
||||||
|
* @param int $relations Behavior for relations creation
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function create($obj, int $relations = RelationType::ALL)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$objId = parent::create($obj, $relations);
|
||||||
|
|
||||||
|
if($objId === null || !is_scalar($objId)) {
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find.
|
||||||
|
*
|
||||||
|
* @param array $columns Columns to select
|
||||||
|
*
|
||||||
|
* @return Builder
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function find(...$columns) : Builder
|
||||||
|
{
|
||||||
|
return parent::find(...$columns)->from('account_permission')
|
||||||
|
->where('account_permission.account_permission_for', '=', 'task')
|
||||||
|
->where('account_permission.account_permission_id1', '=', 1)
|
||||||
|
->where('task.task_id', '=', new Column('account_permission.account_permission_id2'))
|
||||||
|
->where('account_permission.account_permission_r', '=', 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
151
Models/QAQuestion.php
Normal file
151
Models/QAQuestion.php
Normal file
|
|
@ -0,0 +1,151 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\QA\Models;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Task class.
|
||||||
|
*
|
||||||
|
* @category Kanban
|
||||||
|
* @package Modules
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class QAQuestion implements \JsonSerializable
|
||||||
|
{
|
||||||
|
private $id = 0;
|
||||||
|
|
||||||
|
private $name = '';
|
||||||
|
|
||||||
|
private $status = QAStatus::ACTIVE;
|
||||||
|
|
||||||
|
private $question = '';
|
||||||
|
|
||||||
|
private $category = 0;
|
||||||
|
|
||||||
|
private $language = '';
|
||||||
|
|
||||||
|
private $createdBy = 0;
|
||||||
|
|
||||||
|
private $createdAt = null;
|
||||||
|
|
||||||
|
private $badges = [];
|
||||||
|
|
||||||
|
private $answers = [];
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->createdAt = new \DateTime('now');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getId() : int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLanguage() : string
|
||||||
|
{
|
||||||
|
return $this->language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setLanguage(string $language) /* : void */
|
||||||
|
{
|
||||||
|
$this->language = $language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName() : string
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setName(string $name) /* : void */
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getQuestion() : string
|
||||||
|
{
|
||||||
|
return $this->question;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setQuestion(string $question) /* : void */
|
||||||
|
{
|
||||||
|
$this->question = $question;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getStatus() : int
|
||||||
|
{
|
||||||
|
return $this->status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setStatus(int $status) /* : void */
|
||||||
|
{
|
||||||
|
$this->status = $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCategory() : int
|
||||||
|
{
|
||||||
|
return $this->category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCategory(int $category) /* : void */
|
||||||
|
{
|
||||||
|
$this->category = $category;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCreatedBy() : int
|
||||||
|
{
|
||||||
|
return $this->createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setCreatedBy(int $id) /* : void */
|
||||||
|
{
|
||||||
|
$this->createdBy = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCreatedAt() : \DateTime
|
||||||
|
{
|
||||||
|
return $this->createdAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getBadges() : array
|
||||||
|
{
|
||||||
|
return $this->badges;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addBadge($badge) /* : void */
|
||||||
|
{
|
||||||
|
$this->badges[] = $badge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getAnswers() : array
|
||||||
|
{
|
||||||
|
return $this->answers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addAnswer($answer) /* : void */
|
||||||
|
{
|
||||||
|
$this->answers[] = $answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function jsonSerialize() : array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
179
Models/QAQuestionMapper.php
Normal file
179
Models/QAQuestionMapper.php
Normal file
|
|
@ -0,0 +1,179 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\QA\Models;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
|
use phpOMS\DataStorage\Database\Query\Column;
|
||||||
|
use phpOMS\DataStorage\Database\RelationType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapper class.
|
||||||
|
*
|
||||||
|
* @category Tasks
|
||||||
|
* @package Modules
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
class QAQuestionMapper extends DataMapperAbstract
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Columns.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $columns = [
|
||||||
|
'qa_question_id' => ['name' => 'qa_question_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
|
'qa_question_title' => ['name' => 'qa_question_title', 'type' => 'string', 'internal' => 'name'],
|
||||||
|
'qa_question_language' => ['name' => 'qa_question_language', 'type' => 'string', 'internal' => 'language'],
|
||||||
|
'qa_question_question' => ['name' => 'qa_question_question', 'type' => 'string', 'internal' => 'question'],
|
||||||
|
'qa_question_status' => ['name' => 'qa_question_status', 'type' => 'int', 'internal' => 'status'],
|
||||||
|
'qa_question_category' => ['name' => 'qa_question_category', 'type' => 'int', 'internal' => 'category'],
|
||||||
|
'qa_question_created_by' => ['name' => 'qa_question_created_by', 'type' => 'int', 'internal' => 'createdBy'],
|
||||||
|
'qa_question_created_at' => ['name' => 'qa_question_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has many relation.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $hasMany = [
|
||||||
|
'badges' => [
|
||||||
|
'mapper' => QABadgeMapper::class,
|
||||||
|
'table' => 'qa_question_badge',
|
||||||
|
'dst' => 'qa_question_badge_badge',
|
||||||
|
'src' => 'qa_question_badge_question',
|
||||||
|
],
|
||||||
|
'badges' => [
|
||||||
|
'mapper' => QAAnswerMapper::class,
|
||||||
|
'table' => 'qa_answer',
|
||||||
|
'dst' => 'qa_answer_question',
|
||||||
|
'src' => null,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Has many relation.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $ownsOne = [
|
||||||
|
'category' => [
|
||||||
|
'mapper' => QACategoryMapper::class,
|
||||||
|
'dst' => 'qa_question_category',
|
||||||
|
],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $table = 'qa_question';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created at.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $createdAt = 'qa_question_created_at';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Primary field name.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $primaryField = 'qa_question_id';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create object.
|
||||||
|
*
|
||||||
|
* @param mixed $obj Object
|
||||||
|
* @param int $relations Behavior for relations creation
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function create($obj, int $relations = RelationType::ALL)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$objId = parent::create($obj, $relations);
|
||||||
|
|
||||||
|
if($objId === null || !is_scalar($objId)) {
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = new Builder(self::$db);
|
||||||
|
|
||||||
|
$query->prefix(self::$db->getPrefix())
|
||||||
|
->insert(
|
||||||
|
'account_permission_account',
|
||||||
|
'account_permission_from',
|
||||||
|
'account_permission_for',
|
||||||
|
'account_permission_id1',
|
||||||
|
'account_permission_id2',
|
||||||
|
'account_permission_r',
|
||||||
|
'account_permission_w',
|
||||||
|
'account_permission_m',
|
||||||
|
'account_permission_d',
|
||||||
|
'account_permission_p'
|
||||||
|
)
|
||||||
|
->into('account_permission')
|
||||||
|
->values($obj->getCreatedBy(), 'task', 'task', 1, $objId, 1, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
self::$db->con->prepare($query->toSql())->execute();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
var_dump($e->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $objId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find.
|
||||||
|
*
|
||||||
|
* @param array $columns Columns to select
|
||||||
|
*
|
||||||
|
* @return Builder
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function find(...$columns) : Builder
|
||||||
|
{
|
||||||
|
return parent::find(...$columns)->from('account_permission')
|
||||||
|
->where('account_permission.account_permission_for', '=', 'task')
|
||||||
|
->where('account_permission.account_permission_id1', '=', 1)
|
||||||
|
->where('task.task_id', '=', new Column('account_permission.account_permission_id2'))
|
||||||
|
->where('account_permission.account_permission_r', '=', 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
41
Models/QAStatus.php
Normal file
41
Models/QAStatus.php
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
namespace Modules\QA\Models;
|
||||||
|
|
||||||
|
use phpOMS\Datatypes\Enum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Task status enum.
|
||||||
|
*
|
||||||
|
* @category QA
|
||||||
|
* @package Modules
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
abstract class QAStauts extends Enum
|
||||||
|
{
|
||||||
|
/* public */ const ACTIVE = 1;
|
||||||
|
|
||||||
|
/* public */ const INACTIVE = 2;
|
||||||
|
|
||||||
|
/* public */ const DRAFT = 3;
|
||||||
|
|
||||||
|
/* public */ const BLOCKED = 4;
|
||||||
|
}
|
||||||
18
Theme/Backend/Lang/Navigation.en.lang.php
Normal file
18
Theme/Backend/Lang/Navigation.en.lang.php
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
return ['Navigation' => [
|
||||||
|
'QA' => 'QA',
|
||||||
|
]];
|
||||||
18
Theme/Backend/Lang/en.lang.php
Normal file
18
Theme/Backend/Lang/en.lang.php
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.1
|
||||||
|
*
|
||||||
|
* @category TBD
|
||||||
|
* @package TBD
|
||||||
|
* @author OMS Development Team <dev@oms.com>
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link http://orange-management.com
|
||||||
|
*/
|
||||||
|
return ['Knowledgebase' => [
|
||||||
|
'QA' => 'QA',
|
||||||
|
]];
|
||||||
0
Theme/Backend/qa-dashboard.tpl.php
Normal file
0
Theme/Backend/qa-dashboard.tpl.php
Normal file
47
info.json
Normal file
47
info.json
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"id": 1006000000,
|
||||||
|
"internal": "QA",
|
||||||
|
"external": "QA"
|
||||||
|
},
|
||||||
|
"category": "Tools",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"requirements": {
|
||||||
|
"phpOMS": "1.0.0",
|
||||||
|
"phpOMS-db": "1.0.0"
|
||||||
|
},
|
||||||
|
"creator": {
|
||||||
|
"name": "Orange Management",
|
||||||
|
"website": "www.spl1nes.com"
|
||||||
|
},
|
||||||
|
"description": "QA module.",
|
||||||
|
"directory": "QA",
|
||||||
|
"dependencies": {
|
||||||
|
"Admin" : "1.0.0",
|
||||||
|
"Tasks" : "1.0.0",
|
||||||
|
"Calendar" : "1.0.0"
|
||||||
|
},
|
||||||
|
"providing": {
|
||||||
|
"Navigation": "*"
|
||||||
|
},
|
||||||
|
"load": [
|
||||||
|
{
|
||||||
|
"pid": [
|
||||||
|
"7322d5765c8b18b14c20d406e89c628fd0998688"
|
||||||
|
],
|
||||||
|
"type": 4,
|
||||||
|
"for": 0,
|
||||||
|
"from": "QA",
|
||||||
|
"file": "QA"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pid": [
|
||||||
|
"754a08ddf8bcb1cf22f310f09206dd783d42f7dd"
|
||||||
|
],
|
||||||
|
"type": 5,
|
||||||
|
"from": "QA",
|
||||||
|
"for": "Navigation",
|
||||||
|
"file": "Navigation"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user