This commit is contained in:
Dennis Eichhorn 2015-11-29 21:57:18 +01:00
commit 8680d2b550
15 changed files with 658 additions and 0 deletions

View File

@ -0,0 +1,38 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Production\Admin\Install;
/**
* 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 Navigation
{
public static function install($dbPool)
{
$navData = json_decode(file_get_contents(__DIR__ . '/nav.install.json'), true);
$class = '\\Modules\\Navigation\\Admin\\Installer';
$class::installExternal($dbPool, $navData);
}
}

View File

@ -0,0 +1,79 @@
[
{
"id": 1004301001,
"pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd",
"type": 2,
"subtype": 0,
"name": "Production",
"uri": "/{/lang}/backend/production/dashboard",
"target": "self",
"icon": "fa fa-fire",
"order": 70,
"from": 1004300000,
"permission": null,
"parent": 1000201001,
"children": [
{
"id": 1004302001,
"pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd",
"type": 2,
"subtype": 1,
"name": "Articles",
"uri": "/{/lang}/backend/production/item/list",
"target": "self",
"icon": null,
"order": 1,
"from": 1004300000,
"permission": null,
"parent": 1004301001,
"children": []
},
{
"id": 1004303001,
"pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd",
"type": 2,
"subtype": 1,
"name": "Production",
"uri": "/{/lang}/backend/production/list",
"target": "self",
"icon": null,
"order": 5,
"from": 1004300000,
"permission": null,
"parent": 1004301001,
"children": [
{
"id": 1004303101,
"pid": "8bcf3571d1d43ecefeeb78a999f83418ccfd4f71",
"type": 3,
"subtype": 1,
"name": "List",
"uri": "/{/lang}/backend/production/list",
"target": "self",
"icon": null,
"order": 5,
"from": 1004300000,
"permission": null,
"parent": 1004303001,
"children": []
},
{
"id": 1004303201,
"pid": "8bcf3571d1d43ecefeeb78a999f83418ccfd4f71",
"type": 3,
"subtype": 1,
"name": "Create",
"uri": "/{/lang}/backend/production/create",
"target": "self",
"icon": null,
"order": 5,
"from": 1004300000,
"permission": null,
"parent": 1004303001,
"children": []
}
]
}
]
}
]

98
Admin/Installer.php Normal file
View File

@ -0,0 +1,98 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Production\Admin;
use phpOMS\DataStorage\Database\DatabaseType;
use phpOMS\DataStorage\Database\Pool;
use phpOMS\Module\InstallerAbstract;
/**
* Production install class.
*
* @category Modules
* @package Modules\Production
* @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(Pool $dbPool, array $info)
{
parent::install($dbPool, $info);
switch ($dbPool->get('core')->getType()) {
case DatabaseType::MYSQL:
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'production_process` (
`ProcessID` int(11) NOT NULL AUTO_INCREMENT,
`product` int(11) NOT NULL,
`status` tinyint(2) NOT NULL,
`quantity` int(11) NOT NULL,
`for` int(11) NULL,
`orderer` int(11) NULL,
`ordered` datetime DEFAULT NULL,
`due` datetime DEFAULT NULL,
`planned` datetime DEFAULT NULL,
`started` datetime DEFAULT NULL,
`done` datetime DEFAULT NULL,
PRIMARY KEY (`ProcessID`),
KEY `product` (`product`),
KEY `for` (`for`),
KEY `orderer` (`orderer`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
)->execute();
/*$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'production_process`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'production_process_ibfk_1` FOREIGN KEY (`creator`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
)->execute();*/
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'production_guideline` (
`ProductionGuidelineID` int(11) NOT NULL AUTO_INCREMENT,
`product` int(11) NOT NULL,
PRIMARY KEY (`ProductionGuidelineID`),
KEY `product` (`product`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
)->execute();
$dbPool->get('core')->con->prepare(
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'production_guideline_step` (
`ProductionStepID` int(11) NOT NULL AUTO_INCREMENT,
`guideline` int(11) NOT NULL,
`title` varchar(50) NOT NULL,
`text` text NOT NULL,
`order` tinyint(3) NOT NULL,
PRIMARY KEY (`ProductionStepID`),
KEY `guideline` (`guideline`)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
)->execute();
$dbPool->get('core')->con->prepare(
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'production_guideline_step`
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'production_guideline_step_ibfk_1` FOREIGN KEY (`guideline`) REFERENCES `' . $dbPool->get('core')->prefix . 'production_guideline` (`ProductionGuidelineID`);'
)->execute();
break;
}
}
}

190
Controller.php Normal file
View File

@ -0,0 +1,190 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace Modules\Production;
use Modules\Navigation\Models\Navigation;
use Modules\Navigation\Views\NavigationView;
use phpOMS\Contract\RenderableInterface;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\RequestDestination;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Module\ModuleAbstract;
use phpOMS\Module\WebInterface;
use phpOMS\Views\View;
use phpOMS\Views\ViewLayout;
/**
* Production class.
*
* @category Modules
* @package Modules\Production
* @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 name.
*
* @var \string
* @since 1.0.0
*/
protected static $module = 'Production';
/**
* Localization files.
*
* @var \string
* @since 1.0.0
*/
protected static $localization = [
RequestDestination::BACKEND => ['backend'],
];
/**
* Providing.
*
* @var \string
* @since 1.0.0
*/
protected static $providing = [
'Content',
];
/**
* Dependencies.
*
* @var \string
* @since 1.0.0
*/
protected static $dependencies = [];
/**
* Routing elements.
*
* @var array
* @since 1.0.0
*/
protected static $routes = [
'^.*/backend/production/list.*$' => [['dest' => '\Modules\Production\Controller:viewProductionList', 'method' => 'GET', 'type' => ViewLayout::MAIN],],
'^.*/backend/production/create.*$' => [['dest' => '\Modules\Production\Controller:viewProductionCreate', 'method' => 'GET', 'type' => ViewLayout::MAIN],],
'^.*/backend/production/process/list.*$' => [['dest' => '\Modules\Production\Controller:viewProductionProcessList', 'method' => 'GET', 'type' => ViewLayout::MAIN],],
'^.*/backend/production/process/create.*$' => [['dest' => '\Modules\Production\Controller:viewProductionProcessCreate', 'method' => 'GET', 'type' => ViewLayout::MAIN],],
];
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewProductionList(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Production/Theme/backend/production-list');
$view->addData('nav', $this->createNavigation(1004303001, $request, $response));
return $view;
}
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewProductionCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Production/Theme/backend/production-create');
$view->addData('nav', $this->createNavigation(1004303001, $request, $response));
return $view;
}
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewProductionProcessList(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Production/Theme/backend/process-list');
$view->addData('nav', $this->createNavigation(1003001001, $request, $response));
return $view;
}
/**
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public function viewProductionProcessCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app, $request, $response);
$view->setTemplate('/Modules/Production/Theme/backend/process-create');
$view->addData('nav', $this->createNavigation(1003001001, $request, $response));
return $view;
}
/**
* @param int $pageId Page/parent Id for navigation
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
*
* @return RenderableInterface
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
private function createNavigation(\int $pageId, RequestAbstract $request, ResponseAbstract $response)
{
$nav = Navigation::getInstance($request, $this->app->dbPool);
$navView = new NavigationView($this->app, $request, $response);
$navView->setTemplate('/Modules/Navigation/Theme/backend/mid');
$navView->setNav($nav->getNav());
$navView->setLanguage($request->getL11n()->language);
$navView->setParent($pageId);
return $navView;
}
}

1
README.md Normal file
View File

@ -0,0 +1 @@
# Production #

View File

@ -0,0 +1,19 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
/**
* @var \phpOMS\Views\View $this
*/
$task = new \Modules\Tasks\Models\Task(null);

View File

@ -0,0 +1,19 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
/**
* @var \phpOMS\Views\View $this
*/
$task = new \Modules\Tasks\Models\Task(null);

View File

@ -0,0 +1,19 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
/**
* @var \phpOMS\Views\View $this
*/
$task = new \Modules\Tasks\Models\Task(null);

View File

@ -0,0 +1,19 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
/**
* @var \phpOMS\Views\View $this
*/
$task = new \Modules\Tasks\Models\Task(null);

View File

@ -0,0 +1,58 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
/**
* @var \phpOMS\Views\View $this
*/
$footerView = new \Web\Views\Lists\PaginationView($this->app, $this->request, $this->response);
$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig');
$footerView->setPages(1 / 25);
$footerView->setPage(1);
$footerView->setResults(1);
echo $this->getData('nav')->render(); ?>
<section class="box w-100">
<table class="table">
<caption><?= $this->l11n->lang['Production']['Productions']; ?></caption>
<thead>
<tr>
<td><?= $this->l11n->lang['Production']['Status']; ?>
<td><?= $this->l11n->lang[0]['ID']; ?>
<td><?= $this->l11n->lang[0]['ID']; ?>
<td class="wf-100"><?= $this->l11n->lang['Production']['Article']; ?>
<td><?= $this->l11n->lang['Production']['Quantity']; ?>
<td><?= $this->l11n->lang['Production']['Start']; ?>
<td><?= $this->l11n->lang['Production']['Due']; ?>
<td><?= $this->l11n->lang['Production']['Done']; ?>
<tfoot>
<tr><td colspan="8"><?= $footerView->render(); ?>
<tbody>
<?php $c = 0; foreach ([] as $key => $value) : $c++;
$url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/business/department/profile?id=' . $value->getId()); ?>
<tr>
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->getName(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->getParent(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->getUnit(); ?></a>
<?php endforeach; ?>
<?php if($c === 0) : ?>
<tr>
<td colspan="8" class="empty"><?= $this->l11n->lang[0]['Empty']; ?>
<?php endif; ?>
</table>
</section>

View File

@ -0,0 +1,17 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
$MODLANG[1] = [
];

View File

@ -0,0 +1,30 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
$MODLANG['Production'] = [
'Article' => 'Article',
'Done' => 'Done',
'Due' => 'Due',
'For' => 'For',
'Name' => 'Name',
'Orderer' => 'Orderer',
'Ordered' => 'Ordered',
'Process' => 'Process',
'Product' => 'Product',
'Productions' => 'Productions',
'Quantity' => 'Quantity',
'Start' => 'Start',
'Status' => 'Status',
];

View File

@ -0,0 +1,20 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
$MODLANG['Navigation'] = [
'Articles' => 'Articles',
'Production' => 'Production',
'Process' => 'Process',
];

BIN
img/module_teaser_small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

51
info.json Normal file
View File

@ -0,0 +1,51 @@
{
"name": {
"id": 1004300000,
"internal": "Production",
"external": "OMS Production"
},
"version": "1.0.0",
"requirements": {
"phpOMS": "1.0.0",
"phpOMS-db": "1.0.0"
},
"creator": {
"name": "Orange Management",
"website": "www.spl1nes.com"
},
"description": "Production module.",
"directory": "Production",
"dependencies": {},
"providing": {
"Navigation": "*"
},
"load": [
{
"pid": [
"8bcf3571d1d43ecefeeb78a999f83418ccfd4f71"
],
"type": 4,
"for": 0,
"from": "Production",
"file": "Production"
},
{
"pid": [
"754a08ddf8bcb1cf22f310f09206dd783d42f7dd"
],
"type": 5,
"from": "Production",
"for": "Navigation",
"file": "nav.backend"
},
{
"pid": [
"8bcf3571d1d43ecefeeb78a999f83418ccfd4f71"
],
"type": 5,
"for": "Content",
"file": "backend",
"from": "Production"
}
]
}