mirror of
https://github.com/Karaka-Management/oms-Knowledgebase.git
synced 2026-01-11 09:28:40 +00:00
Kowledgebase draft
This commit is contained in:
commit
4a82abe27c
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\Knowledgebase\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\Knowledgebase\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": 1005901001,
|
||||
"pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd",
|
||||
"type": 2,
|
||||
"subtype": 1,
|
||||
"name": "Wiki",
|
||||
"uri": "/{/lang}/backend/knowledgebase/dashboard?{?}",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 50,
|
||||
"from": "Knowledgebase",
|
||||
"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\Knowledgebase\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);
|
||||
}
|
||||
}
|
||||
111
Admin/Installer.php
Normal file
111
Admin/Installer.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\Knowledgebase\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 . 'wiki_category` (
|
||||
`wiki_category_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`wiki_category_name` varchar(255) NOT NULL,
|
||||
`wiki_category_parent` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`wiki_category_id`),
|
||||
KEY `wiki_category_parent` (`wiki_category_parent`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'wiki_category`
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'wiki_category_ibfk_1` FOREIGN KEY (`wiki_category_parent`) REFERENCES `' . $dbPool->get('core')->prefix . 'wiki_category` (`wiki_category_id`)'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'wiki_badge` (
|
||||
`wiki_badge_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`wiki_badge_name` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`wiki_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 . 'wiki_article` (
|
||||
`wiki_article_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`wiki_article_status` int(11) NOT NULL,
|
||||
`wiki_article_title` varchar(255) NOT NULL,
|
||||
`wiki_article_language` varchar(3) NOT NULL,
|
||||
`wiki_article_doc` text NOT NULL,
|
||||
`wiki_article_created_by` int(11) NOT NULL,
|
||||
`wiki_article_created_at` datetime NOT NULL,
|
||||
`wiki_article_category` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`wiki_article_id`),
|
||||
KEY `wiki_article_created_by` (`wiki_article_created_by`),
|
||||
KEY `wiki_article_category` (`wiki_article_category`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'wiki_article`
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'wiki_article_ibfk_1` FOREIGN KEY (`wiki_article_created_by`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`),
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'wiki_article_ibfk_2` FOREIGN KEY (`wiki_article_category`) REFERENCES `' . $dbPool->get('core')->prefix . 'wiki_category` (`wiki_category_id`);'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'wiki_article_badge` (
|
||||
`wiki_article_badge_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`wiki_article_badge_article` varchar(255) NOT NULL,
|
||||
`wiki_article_badge_badge` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`wiki_category_id`),
|
||||
KEY `wiki_article_badge_article` (`wiki_article_badge_article`),
|
||||
KEY `wiki_article_badge_badge` (`wiki_article_badge_badge`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'wiki_article_badge`
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'wiki_article_badge_ibfk_1` FOREIGN KEY (`wiki_article_badge_article`) REFERENCES `' . $dbPool->get('core')->prefix . 'wiki_article` (`wiki_article_id`),
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'wiki_article_badge_ibfk_2` FOREIGN KEY (`wiki_article_badge_badge`) REFERENCES `' . $dbPool->get('core')->prefix . 'wiki_badge` (`wiki_badge_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/wiki/dashboard.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Knowledgebase\Controller:viewKnowledgebaseDashboard',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'^.*/backend/wiki/category.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Knowledgebase\Controller:viewKnowledgebaseCategory',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'^.*/backend/wiki/doc.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Knowledgebase\Controller:viewKnowledgebaseDoc',
|
||||
'verb' => RouteVerb::GET,
|
||||
],
|
||||
],
|
||||
'^.*/backend/wiki/create.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\Knowledgebase\Controller:viewKnowledgebaseCreate',
|
||||
'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\Knowledgebase\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\Knowledgebase;
|
||||
|
||||
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\Knowledgebase
|
||||
* @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 = 'Knowledgebase';
|
||||
|
||||
/**
|
||||
* Providing.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $providing = [];
|
||||
|
||||
/**
|
||||
* Dependencies.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $dependencies = [
|
||||
];
|
||||
|
||||
}
|
||||
60
Models/WikiBadge.php
Normal file
60
Models/WikiBadge.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?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\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 WikiBadge implements \JsonSerializable
|
||||
{
|
||||
private $id = 0;
|
||||
|
||||
private $name = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->createdAt = new \DateTime('now');
|
||||
}
|
||||
|
||||
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/WikiBadgeMapper.php
Normal file
111
Models/WikiBadgeMapper.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\Knowledgebase\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 Knowledgebase
|
||||
* @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 WikiBadgeMapper extends DataMapperAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $columns = [
|
||||
'wiki_badge_id' => ['name' => 'wiki_badge_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'wiki_badge_name' => ['name' => 'wiki_badge_name', 'type' => 'string', 'internal' => 'name'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $table = 'wiki_badge';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $primaryField = 'wiki_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);
|
||||
}
|
||||
}
|
||||
72
Models/WikiCategory.php
Normal file
72
Models/WikiCategory.php
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?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\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 WikiCategory implements \JsonSerializable
|
||||
{
|
||||
private $id = 0;
|
||||
|
||||
private $name = '';
|
||||
|
||||
private $parent = 0;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->createdAt = new \DateTime('now');
|
||||
}
|
||||
|
||||
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/WikiCategoryMapper.php
Normal file
112
Models/WikiCategoryMapper.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\Knowledgebase\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 WikiCategoryMapper extends DataMapperAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $columns = [
|
||||
'wiki_category_id' => ['name' => 'wiki_category_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'wiki_category_name' => ['name' => 'wiki_category_name', 'type' => 'string', 'internal' => 'name'],
|
||||
'wiki_category_parent' => ['name' => 'wiki_category_parent', 'type' => 'int', 'internal' => 'parent'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $table = 'wiki_category';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $primaryField = 'wiki_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);
|
||||
}
|
||||
}
|
||||
139
Models/WikiDoc.php
Normal file
139
Models/WikiDoc.php
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
<?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\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 WikiDoc implements \JsonSerializable
|
||||
{
|
||||
private $id = 0;
|
||||
|
||||
private $name = '';
|
||||
|
||||
private $status = WikiStatus::ACTIVE;
|
||||
|
||||
private $doc = '';
|
||||
|
||||
private $category = 0;
|
||||
|
||||
private $language = '';
|
||||
|
||||
private $createdBy = 0;
|
||||
|
||||
private $createdAt = null;
|
||||
|
||||
private $badges = [];
|
||||
|
||||
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 getDoc() : string
|
||||
{
|
||||
return $this->doc;
|
||||
}
|
||||
|
||||
public function setDoc(string $doc) /* : void */
|
||||
{
|
||||
$this->doc = $doc;
|
||||
}
|
||||
|
||||
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 jsonSerialize() : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
173
Models/WikiDocMapper.php
Normal file
173
Models/WikiDocMapper.php
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
<?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\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 WikiDocMapper extends DataMapperAbstract
|
||||
{
|
||||
|
||||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $columns = [
|
||||
'wiki_article_id' => ['name' => 'wiki_article_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'wiki_article_title' => ['name' => 'wiki_article_title', 'type' => 'string', 'internal' => 'name'],
|
||||
'wiki_article_language' => ['name' => 'wiki_article_language', 'type' => 'string', 'internal' => 'language'],
|
||||
'wiki_article_doc' => ['name' => 'wiki_article_doc', 'type' => 'string', 'internal' => 'doc'],
|
||||
'wiki_article_status' => ['name' => 'wiki_article_status', 'type' => 'int', 'internal' => 'status'],
|
||||
'wiki_article_category' => ['name' => 'wiki_article_category', 'type' => 'int', 'internal' => 'category'],
|
||||
'wiki_article_created_by' => ['name' => 'wiki_article_created_by', 'type' => 'int', 'internal' => 'createdBy'],
|
||||
'wiki_article_created_at' => ['name' => 'wiki_article_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Has many relation.
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $hasMany = [
|
||||
'badges' => [
|
||||
'mapper' => WikiBadgeMapper::class,
|
||||
'table' => 'wiki_article_badge',
|
||||
'dst' => 'wiki_article_badge_badge',
|
||||
'src' => 'wiki_article_badge_article',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Has many relation.
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $ownsOne = [
|
||||
'category' => [
|
||||
'mapper' => WikiCategoryMapper::class,
|
||||
'dst' => 'wiki_article_category',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $table = 'wiki_article';
|
||||
|
||||
/**
|
||||
* Created at.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $createdAt = 'wiki_article_created_at';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $primaryField = 'wiki_article_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);
|
||||
}
|
||||
}
|
||||
39
Models/WikiStatus.php
Normal file
39
Models/WikiStatus.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?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\Models;
|
||||
|
||||
use phpOMS\Datatypes\Enum;
|
||||
|
||||
/**
|
||||
* Task status enum.
|
||||
*
|
||||
* @category Knowledgebase
|
||||
* @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 WikiStauts extends Enum
|
||||
{
|
||||
/* public */ const ACTIVE = 1;
|
||||
|
||||
/* public */ const INACTIVE = 2;
|
||||
|
||||
/* public */ const DRAFT = 3;
|
||||
}
|
||||
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' => [
|
||||
'Wiki' => 'Wiki',
|
||||
]];
|
||||
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' => [
|
||||
'Wiki' => 'Wiki',
|
||||
]];
|
||||
0
Theme/Backend/wiki-dashboard.tpl.php
Normal file
0
Theme/Backend/wiki-dashboard.tpl.php
Normal file
47
info.json
Normal file
47
info.json
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"name": {
|
||||
"id": 1005900000,
|
||||
"internal": "Knowledgebase",
|
||||
"external": "Knowledgebase"
|
||||
},
|
||||
"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": "Knowledgebase module.",
|
||||
"directory": "Knowledgebase",
|
||||
"dependencies": {
|
||||
"Admin" : "1.0.0",
|
||||
"Tasks" : "1.0.0",
|
||||
"Calendar" : "1.0.0"
|
||||
},
|
||||
"providing": {
|
||||
"Navigation": "*"
|
||||
},
|
||||
"load": [
|
||||
{
|
||||
"pid": [
|
||||
"7322d5765c8b18b14c20d406e89c628fd0998688"
|
||||
],
|
||||
"type": 4,
|
||||
"for": 0,
|
||||
"from": "Knowledgebase",
|
||||
"file": "Knowledgebase"
|
||||
},
|
||||
{
|
||||
"pid": [
|
||||
"754a08ddf8bcb1cf22f310f09206dd783d42f7dd"
|
||||
],
|
||||
"type": 5,
|
||||
"from": "Knowledgebase",
|
||||
"for": "Navigation",
|
||||
"file": "Navigation"
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user