commit 8680d2b550b93aab99fbf7d60306203a26aea8b2 Author: Dennis Eichhorn Date: Sun Nov 29 21:57:18 2015 +0100 Init diff --git a/Admin/Install/Navigation.php b/Admin/Install/Navigation.php new file mode 100644 index 0000000..54839be --- /dev/null +++ b/Admin/Install/Navigation.php @@ -0,0 +1,38 @@ + + * @author Dennis Eichhorn + * @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 + * @author Dennis Eichhorn + * @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); + } +} diff --git a/Admin/Install/nav.install.json b/Admin/Install/nav.install.json new file mode 100644 index 0000000..4e32517 --- /dev/null +++ b/Admin/Install/nav.install.json @@ -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": [] + } + ] + } + ] + } +] diff --git a/Admin/Installer.php b/Admin/Installer.php new file mode 100644 index 0000000..6c2ddea --- /dev/null +++ b/Admin/Installer.php @@ -0,0 +1,98 @@ + + * @author Dennis Eichhorn + * @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 + * @author Dennis Eichhorn + * @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; + } + } +} diff --git a/Controller.php b/Controller.php new file mode 100644 index 0000000..cae32c7 --- /dev/null +++ b/Controller.php @@ -0,0 +1,190 @@ + + * @author Dennis Eichhorn + * @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 + * @author Dennis Eichhorn + * @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 + */ + 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 + */ + 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 + */ + 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 + */ + 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 + */ + 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; + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..5570222 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Production # diff --git a/Theme/backend/process-create.tpl.php b/Theme/backend/process-create.tpl.php new file mode 100644 index 0000000..7c5f999 --- /dev/null +++ b/Theme/backend/process-create.tpl.php @@ -0,0 +1,19 @@ + + * @author Dennis Eichhorn + * @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); diff --git a/Theme/backend/process-list.tpl.php b/Theme/backend/process-list.tpl.php new file mode 100644 index 0000000..7c5f999 --- /dev/null +++ b/Theme/backend/process-list.tpl.php @@ -0,0 +1,19 @@ + + * @author Dennis Eichhorn + * @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); diff --git a/Theme/backend/process-single.tpl.php b/Theme/backend/process-single.tpl.php new file mode 100644 index 0000000..7c5f999 --- /dev/null +++ b/Theme/backend/process-single.tpl.php @@ -0,0 +1,19 @@ + + * @author Dennis Eichhorn + * @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); diff --git a/Theme/backend/production-create.tpl.php b/Theme/backend/production-create.tpl.php new file mode 100644 index 0000000..7c5f999 --- /dev/null +++ b/Theme/backend/production-create.tpl.php @@ -0,0 +1,19 @@ + + * @author Dennis Eichhorn + * @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); diff --git a/Theme/backend/production-list.tpl.php b/Theme/backend/production-list.tpl.php new file mode 100644 index 0000000..33c8dc3 --- /dev/null +++ b/Theme/backend/production-list.tpl.php @@ -0,0 +1,58 @@ + + * @author Dennis Eichhorn + * @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(); ?> + +
+ + + + + + + $value) : $c++; + $url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/business/department/profile?id=' . $value->getId()); ?> + + +
l11n->lang['Production']['Productions']; ?>
l11n->lang['Production']['Status']; ?> + l11n->lang[0]['ID']; ?> + l11n->lang[0]['ID']; ?> + l11n->lang['Production']['Article']; ?> + l11n->lang['Production']['Quantity']; ?> + l11n->lang['Production']['Start']; ?> + l11n->lang['Production']['Due']; ?> + l11n->lang['Production']['Done']; ?> +
render(); ?> +
getId(); ?> + getName(); ?> + getParent(); ?> + getUnit(); ?> + + +
l11n->lang[0]['Empty']; ?> + +
+
diff --git a/Theme/lang/api.en.lang.php b/Theme/lang/api.en.lang.php new file mode 100644 index 0000000..eea62f6 --- /dev/null +++ b/Theme/lang/api.en.lang.php @@ -0,0 +1,17 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +$MODLANG[1] = [ +]; diff --git a/Theme/lang/backend.en.lang.php b/Theme/lang/backend.en.lang.php new file mode 100644 index 0000000..5519bab --- /dev/null +++ b/Theme/lang/backend.en.lang.php @@ -0,0 +1,30 @@ + + * @author Dennis Eichhorn + * @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', +]; diff --git a/Theme/lang/nav.backend.en.lang.php b/Theme/lang/nav.backend.en.lang.php new file mode 100644 index 0000000..544c085 --- /dev/null +++ b/Theme/lang/nav.backend.en.lang.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @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', +]; diff --git a/img/module_teaser_small.png b/img/module_teaser_small.png new file mode 100644 index 0000000..f56e6ff Binary files /dev/null and b/img/module_teaser_small.png differ diff --git a/info.json b/info.json new file mode 100644 index 0000000..84fc38e --- /dev/null +++ b/info.json @@ -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" + } + ] +}