commit 4dd25783c862201764363532a1b65d78ec1c4e07 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..28a3e3a --- /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\BudgetManagement\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..b3ee893 --- /dev/null +++ b/Admin/Install/nav.install.json @@ -0,0 +1,33 @@ +[ + { + "id": 1004601001, + "pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd", + "type": 2, + "subtype": 1, + "name": "Budgeting", + "uri": "/{/lang}/backend/controlling/budgeting/dashboard", + "target": "self", + "icon": null, + "order": 1, + "from": 1004600000, + "permission": null, + "parent": 1002801001, + "children": [ + { + "id": 1004602001, + "pid": "1179e5f06ef09c6ba4a87f656b41fe6145de9b5a", + "type": 3, + "subtype": 1, + "name": "Dashboard", + "uri": "/{/lang}/backend/controlling/budgeting/dashboard", + "target": "self", + "icon": null, + "order": 1, + "from": 1004600000, + "permission": null, + "parent": 1004601001, + "children": [] + } + ] + } +] diff --git a/Admin/Installer.php b/Admin/Installer.php new file mode 100644 index 0000000..6fb9895 --- /dev/null +++ b/Admin/Installer.php @@ -0,0 +1,49 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\BudgetManagement\Admin; + +use phpOMS\DataStorage\Database\DatabaseType; +use phpOMS\DataStorage\Database\Pool; +use phpOMS\Module\InstallerAbstract; + +/** + * Budgeting install class. + * + * @category Modules + * @package Modules\Budgeting + * @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: + + break; + } + } +} diff --git a/Controller.php b/Controller.php new file mode 100644 index 0000000..eadccf4 --- /dev/null +++ b/Controller.php @@ -0,0 +1,129 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\BudgetManagement; + +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; + +/** + * Budgeting controller class. + * + * @category Modules + * @package Modules\Budgeting + * @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 = 'BudgetManagement'; + + /** + * 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/controlling/budgeting/dashboard.*$' => [['dest' => '\Modules\BudgetManagement\Controller:viewBudgetingDashboard', '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 viewBudgetingDashboard(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + { + $view = new View($this->app, $request, $response); + $view->setTemplate('/Modules/BudgetManagement/Theme/backend/budgeting-dashboard'); + $view->addData('nav', $this->createNavigation(1004601001, $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..e69de29 diff --git a/Theme/backend/budgeting-dashboard.tpl.php b/Theme/backend/budgeting-dashboard.tpl.php new file mode 100644 index 0000000..ac22ab8 --- /dev/null +++ b/Theme/backend/budgeting-dashboard.tpl.php @@ -0,0 +1,16 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +echo $this->getData('nav')->render(); ?> diff --git a/Theme/lang/backend.en.lang.php b/Theme/lang/backend.en.lang.php new file mode 100644 index 0000000..7004f15 --- /dev/null +++ b/Theme/lang/backend.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['BudgetManagement'] = [ +]; diff --git a/Theme/lang/nav.backend.en.lang.php b/Theme/lang/nav.backend.en.lang.php new file mode 100644 index 0000000..b1470ef --- /dev/null +++ b/Theme/lang/nav.backend.en.lang.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 + */ +$MODLANG['Navigation'] = [ + 'Budgeting' => 'Budgeting', + 'Dashboard' => 'Dashboard', +]; diff --git a/info.json b/info.json new file mode 100644 index 0000000..47565e9 --- /dev/null +++ b/info.json @@ -0,0 +1,53 @@ +{ + "name": { + "id": 1004600000, + "internal": "BudgetManagement", + "external": "OMS Budget Management" + }, + "version": "1.0.0", + "requirements": { + "phpOMS": "1.0.0", + "phpOMS-db": "1.0.0" + }, + "creator": { + "name": "Orange Management", + "website": "www.spl1nes.com" + }, + "description": "Budget Management module.", + "directory": "BudgetManagement", + "dependencies": { + "Controlling": "*" + }, + "providing": { + "Navigation": "*" + }, + "load": [ + { + "pid": [ + "1179e5f06ef09c6ba4a87f656b41fe6145de9b5a" + ], + "type": 4, + "for": 0, + "from": "BudgetManagement", + "file": "BudgetManagement" + }, + { + "pid": [ + "754a08ddf8bcb1cf22f310f09206dd783d42f7dd" + ], + "type": 5, + "from": "BudgetManagement", + "for": "Navigation", + "file": "nav.backend" + }, + { + "pid": [ + "1179e5f06ef09c6ba4a87f656b41fe6145de9b5a" + ], + "type": 5, + "for": "Content", + "file": "backend", + "from": "BudgetManagement" + } + ] +}