mirror of
https://github.com/Karaka-Management/oms-Navigation.git
synced 2026-01-11 16:18:42 +00:00
Bulkl path fix reverse
This commit is contained in:
parent
d364fcec67
commit
d846a6ed58
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
|
||||
*/
|
||||
namespace Modules\Navigation\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
|
||||
*/
|
||||
namespace Modules\Navigation\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);
|
||||
}
|
||||
}
|
||||
132
Admin/Installer.php
Normal file
132
Admin/Installer.php
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
<?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
|
||||
*/
|
||||
namespace Modules\Navigation\Admin;
|
||||
|
||||
use phpOMS\DataStorage\Database\DatabaseType;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\Module\InfoManager;
|
||||
use phpOMS\Module\InstallerAbstract;
|
||||
|
||||
/**
|
||||
* Navigation class.
|
||||
*
|
||||
* @category Modules
|
||||
* @package Modules\Navigation
|
||||
* @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 . 'nav` (
|
||||
`nav_id` int(11) NOT NULL,
|
||||
`nav_pid` varchar(40) NOT NULL,
|
||||
`nav_name` varchar(40) NOT NULL,
|
||||
`nav_type` tinyint(1) NOT NULL,
|
||||
`nav_subtype` tinyint(1) NOT NULL,
|
||||
`nav_icon` varchar(40) DEFAULT NULL,
|
||||
`nav_uri` varchar(255) DEFAULT NULL,
|
||||
`nav_target` varchar(10) DEFAULT NULL,
|
||||
`nav_from` varchar(255) DEFAULT NULL,
|
||||
`nav_order` smallint(3) DEFAULT NULL,
|
||||
`nav_parent` int(11) DEFAULT NULL,
|
||||
`nav_permission` int(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`nav_id`)
|
||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
|
||||
)->execute();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Install data from providing modules.
|
||||
*
|
||||
* @param Pool $dbPool Database pool
|
||||
* @param array $data Module info
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function installExternal(DatabasePool $dbPool, array $data)
|
||||
{
|
||||
try {
|
||||
$dbPool->get('core')->con->query('select 1 from `' . $dbPool->get('core')->prefix . 'nav`');
|
||||
} catch (\Exception $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($data as $link) {
|
||||
self::installLink($dbPool, $link, $link['parent']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Install navigation element.
|
||||
*
|
||||
* @param Pool $dbPool Database instance
|
||||
* @param array $data Link info
|
||||
* @param int $parent Parent element (default is 0 for none)
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private static function installLink($dbPool, $data, $parent = 0)
|
||||
{
|
||||
$sth = $dbPool->get('core')->con->prepare(
|
||||
'INSERT INTO `' . $dbPool->get('core')->prefix . 'nav` (`nav_id`, `nav_pid`, `nav_name`, `nav_type`, `nav_subtype`, `nav_icon`, `nav_uri`, `nav_target`, `nav_from`, `nav_order`, `nav_parent`, `nav_permission`) VALUES
|
||||
(:id, :pid, :name, :type, :subtype, :icon, :uri, :target, :from, :order, :parent, :perm);'
|
||||
);
|
||||
|
||||
$sth->bindValue(':id', $data['id'] ?? 0, \PDO::PARAM_INT);
|
||||
$sth->bindValue(':pid', $data['pid'] ?? '', \PDO::PARAM_STR);
|
||||
$sth->bindValue(':name', $data['name'] ?? '', \PDO::PARAM_STR);
|
||||
$sth->bindValue(':type', $data['type'] ?? 1, \PDO::PARAM_INT);
|
||||
$sth->bindValue(':subtype', $data['subtype'] ?? 2, \PDO::PARAM_INT);
|
||||
$sth->bindValue(':icon', $data['icon'] ?? null, \PDO::PARAM_STR);
|
||||
$sth->bindValue(':uri', $data['uri'] ?? null, \PDO::PARAM_STR);
|
||||
$sth->bindValue(':target', $data['target'] ?? "self", \PDO::PARAM_STR);
|
||||
$sth->bindValue(':from', $data['from'] ?? 0, \PDO::PARAM_INT);
|
||||
$sth->bindValue(':order', $data['order'] ?? 1, \PDO::PARAM_INT);
|
||||
$sth->bindValue(':parent', $parent, \PDO::PARAM_INT);
|
||||
$sth->bindValue(':perm', $data['permission'] ?? 0, \PDO::PARAM_INT);
|
||||
|
||||
$sth->execute();
|
||||
|
||||
$lastInsertID = $dbPool->get('core')->con->lastInsertId();
|
||||
|
||||
foreach ($data['children'] as $link) {
|
||||
$parent = ($link['parent'] == null ? $lastInsertID : $link['parent']);
|
||||
self::installLink($dbPool, $link, $parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Admin/Routes/Web/Backend.php
Normal file
3
Admin/Routes/Web/Backend.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
return [];
|
||||
3
Admin/Routes/console.php
Normal file
3
Admin/Routes/console.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
$moduleRoutes = [];
|
||||
3
Admin/Routes/socket.php
Normal file
3
Admin/Routes/socket.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
$moduleRoutes = [];
|
||||
52
Admin/Uninstall.php
Normal file
52
Admin/Uninstall.php
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
<?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
|
||||
*/
|
||||
namespace Modules\Navigation\Admin;
|
||||
|
||||
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\DataStorage\Database\Schema\Builder;
|
||||
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);
|
||||
|
||||
$query = new Builder($dbPool->get());
|
||||
|
||||
$query->prefix($dbPool->get('core')->getPrefix())->drop(
|
||||
'nav'
|
||||
);
|
||||
|
||||
$dbPool->get()->con->prepare($query->toSql())->execute();
|
||||
}
|
||||
}
|
||||
46
Admin/Update.php
Normal file
46
Admin/Update.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?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
|
||||
*/
|
||||
namespace Modules\Navigation\Admin;
|
||||
|
||||
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
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, array $info)
|
||||
{
|
||||
Directory::deletePath(__DIR__ . '/Update');
|
||||
mkdir('Update');
|
||||
parent::update($dbPool, $info);
|
||||
}
|
||||
}
|
||||
132
Controller.js
Normal file
132
Controller.js
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
/**
|
||||
* Navigation controller.
|
||||
*
|
||||
* @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 * @since 1.0.0
|
||||
*/
|
||||
(function (jsOMS)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
/** @namespace jsOMS.Modules.Navigation.Models */
|
||||
jsOMS.Autoloader.defineNamespace('jsOMS.Modules.Navigation');
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
jsOMS.Modules.Navigation = function ()
|
||||
{
|
||||
this.navigation = {};
|
||||
this.rawNavData = JSON.parse(localStorage.getItem(jsOMS.Modules.Navigation.MODULE_NAME));
|
||||
this.rawNavData = this.rawNavData !== null ? this.rawNavData : {};
|
||||
};
|
||||
|
||||
/**
|
||||
* Module id
|
||||
*
|
||||
* @var {string}
|
||||
* @since 1.0.0
|
||||
*/
|
||||
jsOMS.Modules.Navigation.MODULE_NAME = '1000500001';
|
||||
|
||||
/**
|
||||
* Bind navigation
|
||||
*
|
||||
* @param {string} id Navigation to bind (optional)
|
||||
*
|
||||
* @return {void}
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
jsOMS.Modules.Navigation.prototype.bind = function (id)
|
||||
{
|
||||
let e = typeof id === 'undefined' ? document.getElementsByClassName('nav') : [document.getElementById(id)],
|
||||
length = e.length;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
this.bindElement(e[i]);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Bind navigation element
|
||||
*
|
||||
* @param {Element} e Element to bind
|
||||
*
|
||||
* @return {void}
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
jsOMS.Modules.Navigation.prototype.bindElement = function (e)
|
||||
{
|
||||
if (typeof e === 'undefined' || !e) {
|
||||
// todo: do logging here
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
let extend = e.querySelectorAll('li label'),
|
||||
self = this;
|
||||
|
||||
this.navigation[e.id] = new jsOMS.Modules.Navigation.Models.Navigation(this.rawNavData[e.id]);
|
||||
|
||||
// On load
|
||||
let open = this.navigation[e.id].getOpen();
|
||||
|
||||
for (let key in open) {
|
||||
if (open.hasOwnProperty(key)) {
|
||||
document.getElementById(key).checked = open[key];
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.navigation[e.id].isVisible()) {
|
||||
e.nextElementSibling.checked = false;
|
||||
}
|
||||
|
||||
e.scrollTop = this.navigation[e.id].getScrollPosition().y;
|
||||
e.scrollLeft = this.navigation[e.id].getScrollPosition().x;
|
||||
|
||||
// Bind minimize/maximize
|
||||
jsOMS.addEventListenerToAll(extend, 'click', function ()
|
||||
{
|
||||
let box = document.getElementById(this.getAttribute('for'));
|
||||
|
||||
if (!box.checked) {
|
||||
self.navigation[e.id].setOpen(box.id);
|
||||
} else {
|
||||
self.navigation[e.id].setClose(box.id);
|
||||
}
|
||||
|
||||
localStorage.setItem(jsOMS.Modules.Navigation.MODULE_NAME, JSON.stringify(self.navigation));
|
||||
});
|
||||
|
||||
// Bind show/hide
|
||||
e.nextElementSibling.addEventListener('change', function ()
|
||||
{
|
||||
self.navigation[e.id].setVisible(this.checked);
|
||||
localStorage.setItem(jsOMS.Modules.Navigation.MODULE_NAME, JSON.stringify(self.navigation));
|
||||
});
|
||||
|
||||
// Bind scroll
|
||||
e.addEventListener('scroll', function ()
|
||||
{
|
||||
self.navigation[e.id].setScrollPosition(this.scrollLeft, this.scrollTop);
|
||||
localStorage.setItem(jsOMS.Modules.Navigation.MODULE_NAME, JSON.stringify(self.navigation));
|
||||
});
|
||||
};
|
||||
}(window.jsOMS = window.jsOMS || {}));
|
||||
|
||||
jsOMS.ready(function ()
|
||||
{
|
||||
"use strict";
|
||||
|
||||
window.omsApp.moduleManager.get('Navigation').bind('nav-side');
|
||||
});
|
||||
173
Controller.php
Normal file
173
Controller.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
|
||||
*/
|
||||
namespace Modules\Navigation;
|
||||
|
||||
use Modules\Navigation\Models\Navigation;
|
||||
use Modules\Navigation\Models\NavigationType;
|
||||
use Modules\Navigation\Views\NavigationView;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Module\ModuleAbstract;
|
||||
use phpOMS\Module\WebInterface;
|
||||
|
||||
/**
|
||||
* Navigation class.
|
||||
*
|
||||
* @category Modules
|
||||
* @package Modules\Navigation
|
||||
* @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 = 'Navigation';
|
||||
|
||||
/**
|
||||
* Providing.
|
||||
*
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $providing = [
|
||||
];
|
||||
|
||||
/**
|
||||
* Dependencies.
|
||||
*
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static $dependencies = [
|
||||
];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Web\WebApplication $app Application
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function __construct($app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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>
|
||||
*/
|
||||
public function createNavigationMid(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()->getLanguage());
|
||||
$navView->setParent($pageId);
|
||||
|
||||
return $navView;
|
||||
}
|
||||
|
||||
public function getView(RequestAbstract $request, ResponseAbstract $response)
|
||||
{
|
||||
$navObj = \Modules\Navigation\Models\Navigation::getInstance($request, $this->app->dbPool);
|
||||
$nav = new \Modules\Navigation\Views\NavigationView($this->app, $request, $response);
|
||||
$nav->setNav($navObj->getNav());
|
||||
$nav->setLanguage($request->getL11n()->getLanguage());
|
||||
$unread = [];
|
||||
|
||||
foreach($this->receiving as $receiving) {
|
||||
$unread[$receiving] = $this->app->moduleManager->get($receiving)->openNav($request->getAccount());
|
||||
}
|
||||
|
||||
$nav->setData('unread', $unread);
|
||||
|
||||
return $nav;
|
||||
}
|
||||
|
||||
public function loadLanguage(RequestAbstract $request, ResponseAbstract $response) {
|
||||
$languages = $this->app->moduleManager->getLanguageFiles($request);
|
||||
|
||||
foreach ($languages as $path) {
|
||||
if ($path[strlen($path) - 1] === '/') {
|
||||
// Is not a navigation file
|
||||
continue;
|
||||
}
|
||||
|
||||
$path = __DIR__ . '/../..' . $path . '.' . $response->getL11n()->getLanguage() . '.lang.php';
|
||||
|
||||
/** @noinspection PhpIncludeInspection */
|
||||
$lang = include $path;
|
||||
$this->app->l11nManager->loadLanguage($response->getL11n()->getLanguage(), 'Navigation', $lang);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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>
|
||||
*/
|
||||
public function createNavigationSplash(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/splash');
|
||||
$navView->setNav($nav->getNav());
|
||||
$navView->setLanguage($request->getL11n()->getLanguage());
|
||||
$navView->setParent($pageId);
|
||||
|
||||
return $navView;
|
||||
}
|
||||
}
|
||||
36
Models/LinkType.php
Normal file
36
Models/LinkType.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?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
|
||||
*/
|
||||
namespace Modules\Navigation\Models;
|
||||
|
||||
use phpOMS\Datatypes\Enum;
|
||||
|
||||
/**
|
||||
* Link type enum.
|
||||
*
|
||||
* @category Modules
|
||||
* @package Framework
|
||||
* @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 LinkType extends Enum
|
||||
{
|
||||
/* public */ const CATEGORY = 0;
|
||||
|
||||
/* public */ const LINK = 1;
|
||||
}
|
||||
154
Models/Navigation.js
Normal file
154
Models/Navigation.js
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
/**
|
||||
* Navigation class.
|
||||
*
|
||||
* @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 * @since 1.0.0
|
||||
*/
|
||||
(function (jsOMS)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
/** @namespace jsOMS.Modules.Navigation.Models */
|
||||
jsOMS.Autoloader.defineNamespace('jsOMS.Modules.Navigation.Models');
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param {Object} data Initialization (optional)
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
jsOMS.Modules.Navigation.Models.Navigation = function (data)
|
||||
{
|
||||
if (typeof data === 'undefined') {
|
||||
this.scrollPosition = {x: 0, y: 0};
|
||||
this.activeLinks = {};
|
||||
this.visible = true;
|
||||
this.openCategories = {};
|
||||
} else {
|
||||
this.scrollPosition = typeof data.scrollPosition === 'undefined' ? {x: 0, y: 0} : data.scrollPosition;
|
||||
this.activeLinks = typeof data.activeLinks === 'undefined' ? {} : data.activeLinks;
|
||||
this.visible = typeof data.visible === 'undefined' ? true : data.visible;
|
||||
this.openCategories = typeof data.openCategories === 'undefined' ? {} : data.openCategories;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Set scroll position
|
||||
*
|
||||
* @param {int} x Horizontal position
|
||||
* @param {int} y Vertical position
|
||||
*
|
||||
* @return {void}
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
jsOMS.Modules.Navigation.Models.Navigation.prototype.setScrollPosition = function (x, y)
|
||||
{
|
||||
this.scrollPosition.x = x;
|
||||
this.scrollPosition.y = y;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get scroll position
|
||||
*
|
||||
* @return {Object}
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
jsOMS.Modules.Navigation.Models.Navigation.prototype.getScrollPosition = function ()
|
||||
{
|
||||
return this.scrollPosition;
|
||||
};
|
||||
|
||||
/**
|
||||
* Open navigation category
|
||||
*
|
||||
* @param {string} id Category id
|
||||
*
|
||||
* @return {void}
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
jsOMS.Modules.Navigation.Models.Navigation.prototype.setOpen = function (id)
|
||||
{
|
||||
this.openCategories[id] = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Close navigation category
|
||||
*
|
||||
* @param {string} id Category id
|
||||
*
|
||||
* @return {void}
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
jsOMS.Modules.Navigation.Models.Navigation.prototype.setClose = function (id)
|
||||
{
|
||||
delete this.openCategories[id];
|
||||
};
|
||||
|
||||
/**
|
||||
* Get open navigation elements
|
||||
*
|
||||
* @return {Object}
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
jsOMS.Modules.Navigation.Models.Navigation.prototype.getOpen = function ()
|
||||
{
|
||||
return this.openCategories;
|
||||
};
|
||||
|
||||
jsOMS.Modules.Navigation.Models.Navigation.prototype.active = function (id)
|
||||
{
|
||||
this.allInactive();
|
||||
};
|
||||
|
||||
jsOMS.Modules.Navigation.Models.Navigation.prototype.allInactive = function ()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
jsOMS.Modules.Navigation.Models.Navigation.prototype.inactive = function (id)
|
||||
{
|
||||
};
|
||||
|
||||
/**
|
||||
* Set navigation visibility
|
||||
*
|
||||
* @param {bool} visible Visibility
|
||||
*
|
||||
* @return {bool}
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
jsOMS.Modules.Navigation.Models.Navigation.prototype.setVisible = function (visible)
|
||||
{
|
||||
this.visible = visible;
|
||||
};
|
||||
|
||||
/**
|
||||
* Is navigation visible
|
||||
*
|
||||
* @return {bool}
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
jsOMS.Modules.Navigation.Models.Navigation.prototype.isVisible = function ()
|
||||
{
|
||||
return this.visible;
|
||||
};
|
||||
}(window.jsOMS = window.jsOMS || {}));
|
||||
156
Models/Navigation.php
Normal file
156
Models/Navigation.php
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
<?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
|
||||
*/
|
||||
namespace Modules\Navigation\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
|
||||
/**
|
||||
* Navigation class.
|
||||
*
|
||||
* @category Modules
|
||||
* @package Modules\Navigation
|
||||
* @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
|
||||
{
|
||||
|
||||
/**
|
||||
* Navigation array.
|
||||
*
|
||||
* Array of all navigation elements sorted by type->parent->id
|
||||
*
|
||||
* @var array
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $nav = [];
|
||||
|
||||
/**
|
||||
* Singleton instance.
|
||||
*
|
||||
* @var \Modules\Navigation\Models\Navigation
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Database pool.
|
||||
*
|
||||
* @var Pool
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private $dbPool = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param RequestAbstract $request Request hashes
|
||||
* @param Pool $dbPool Database pool
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function __construct(RequestAbstract $request, DatabasePool $dbPool = null)
|
||||
{
|
||||
$this->dbPool = $dbPool;
|
||||
$this->load($request->getHash());
|
||||
}
|
||||
|
||||
/**
|
||||
* Load navigation based on request.
|
||||
*
|
||||
* @param string[] $request Request hashes
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
private function load($request)
|
||||
{
|
||||
if (empty($this->nav)) {
|
||||
$this->nav = [];
|
||||
$uriPdo = '';
|
||||
|
||||
$i = 1;
|
||||
foreach ($request as $hash) {
|
||||
$uriPdo .= ':pid' . $i . ',';
|
||||
$i++;
|
||||
}
|
||||
|
||||
$uriPdo = rtrim($uriPdo, ',');
|
||||
$sth = $this->dbPool->get('core')->con->prepare('SELECT * FROM `' . $this->dbPool->get('core')->prefix . 'nav` WHERE `nav_pid` IN(' . $uriPdo . ') ORDER BY `nav_order` ASC');
|
||||
|
||||
$i = 1;
|
||||
foreach ($request as $hash) {
|
||||
$sth->bindValue(':pid' . $i, $hash, \PDO::PARAM_STR);
|
||||
$i++;
|
||||
}
|
||||
|
||||
$sth->execute();
|
||||
$tempNav = $sth->fetchAll();
|
||||
|
||||
foreach ($tempNav as $link) {
|
||||
$this->nav[$link['nav_type']][$link['nav_subtype']][$link['nav_id']] = $link;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get instance.
|
||||
*
|
||||
* @param RequestAbstract $request Request hashes
|
||||
* @param Pool $dbPool Database pool
|
||||
*
|
||||
* @return \Modules\Navigation\Models\Navigation
|
||||
*
|
||||
* @throws \Exception
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public static function getInstance(RequestAbstract $request = null, DatabasePool $dbPool = null)
|
||||
{
|
||||
if (!isset(self::$instance)) {
|
||||
if(!isset($request) || !isset($dbPool)) {
|
||||
throw new \Exception('Invalid parameters');
|
||||
}
|
||||
|
||||
self::$instance = new self($request, $dbPool);
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwriting clone in order to maintain singleton pattern.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function __clone()
|
||||
{
|
||||
}
|
||||
|
||||
public function getNav()
|
||||
{
|
||||
return $this->nav;
|
||||
}
|
||||
}
|
||||
44
Models/NavigationType.php
Normal file
44
Models/NavigationType.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
|
||||
*/
|
||||
namespace Modules\Navigation\Models;
|
||||
|
||||
use phpOMS\Datatypes\Enum;
|
||||
|
||||
/**
|
||||
* Navigation type enum.
|
||||
*
|
||||
* @category Modules
|
||||
* @package Framework
|
||||
* @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 NavigationType extends Enum
|
||||
{
|
||||
/* public */ const TOP = 1;
|
||||
|
||||
/* public */ const SIDE = 2;
|
||||
|
||||
/* public */ const CONTENT = 3;
|
||||
|
||||
/* public */ const TAB = 4;
|
||||
|
||||
/* public */ const CONTENT_SIDE = 5;
|
||||
|
||||
/* public */ const BOTTOM = 6;
|
||||
}
|
||||
16
Theme/Backend/Lang/en.lang.php
Normal file
16
Theme/Backend/Lang/en.lang.php
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?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' => []];
|
||||
40
Theme/Backend/mid-side.tpl.php
Normal file
40
Theme/Backend/mid-side.tpl.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?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
|
||||
*/
|
||||
/**
|
||||
* @var \Modules\Navigation\Views\NavigationView $this
|
||||
*/
|
||||
|
||||
/* Looping through all links */
|
||||
if (isset($this->nav[\Modules\Navigation\Models\NavigationType::CONTENT_SIDE])) {
|
||||
echo '<div class="b b-5 c3-2 c3" id="i3-2-5">'
|
||||
. '<h1>' . $this->getText('Navigation')
|
||||
. '<i class="fa fa-minus min"></i><i class="fa fa-plus max vh"></i>'
|
||||
. '</h1>'
|
||||
. '<div class="bc-1">'
|
||||
. '<ul id="ms-nav" role="navigation">';
|
||||
|
||||
foreach ($this->nav[\Modules\Navigation\Models\NavigationType::CONTENT_SIDE] as $key => $parent) {
|
||||
foreach ($parent as $link) {
|
||||
/** @var array $data */
|
||||
if ($link['nav_parent'] == $data[1]) {
|
||||
echo '<li><a href="' . \phpOMS\Uri\UriFactory::build($link['nav_uri']) . '">'
|
||||
. $this->getText(5, 'Backend', $link['nav_name']) . '</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '</ul></div></div>';
|
||||
}
|
||||
32
Theme/Backend/mid.tpl.php
Normal file
32
Theme/Backend/mid.tpl.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?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
|
||||
*/
|
||||
/**
|
||||
* @var \Modules\Navigation\Views\NavigationView $this
|
||||
*/
|
||||
if (isset($this->nav[\Modules\Navigation\Models\NavigationType::CONTENT])) {
|
||||
echo '<div class="row"><div class="col-xs-12"><ul class="nav-top" role="navigation">';
|
||||
|
||||
foreach ($this->nav[\Modules\Navigation\Models\NavigationType::CONTENT] as $key => $parent) {
|
||||
foreach ($parent as $link) {
|
||||
if ($link['nav_parent'] == $this->parent) {
|
||||
echo '<li><a href="' . \phpOMS\Uri\UriFactory::build($link['nav_uri']) . '">'
|
||||
. $this->getText($link['nav_name']) . '</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '</ul></div></div>';
|
||||
}
|
||||
53
Theme/Backend/side.tpl.php
Normal file
53
Theme/Backend/side.tpl.php
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<?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
|
||||
*/
|
||||
/**
|
||||
* @var \Modules\Navigation\Views\NavigationView $this
|
||||
*/
|
||||
if (isset($this->nav[\Modules\Navigation\Models\NavigationType::SIDE])) : ?>
|
||||
<ul id="nav-side" class="nav" role="navigation">
|
||||
<?php foreach ($this->nav[\Modules\Navigation\Models\NavigationType::SIDE][\Modules\Navigation\Models\LinkType::CATEGORY] as $key => $parent) : ?>
|
||||
<li><input id="nav-<?= $parent['nav_name']; ?>" type="checkbox">
|
||||
<ul>
|
||||
<li>
|
||||
<?php if (isset($parent['nav_icon'])) : ?>
|
||||
<span class="centerText" style="width: 20px; display: inline-block;"><i class="<?= $parent['nav_icon']; ?>"></i></span>
|
||||
<?php endif; ?>
|
||||
<?= $this->getText($parent['nav_name']); ?><label for="nav-<?= $parent['nav_name']; ?>"><i class="fa fa-chevron-down min"></i>
|
||||
<i class="fa fa-chevron-up max"></i></label>
|
||||
<?php foreach ($this->nav[\Modules\Navigation\Models\NavigationType::SIDE][\Modules\Navigation\Models\LinkType::LINK] as $key2 => $link) :
|
||||
if ($link['nav_parent'] === $parent['nav_id']) : ?>
|
||||
<li>
|
||||
<a href="<?= \phpOMS\Uri\UriFactory::build($link['nav_uri']); ?>"><?= $this->getText($link['nav_name']); ?></a>
|
||||
<?php endif;
|
||||
endforeach; ?>
|
||||
</ul>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?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
|
||||
*/ endif;
|
||||
31
Theme/Backend/splash.tpl.php
Normal file
31
Theme/Backend/splash.tpl.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?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
|
||||
*/
|
||||
/**
|
||||
* @var \Modules\Navigation\Views\NavigationView $this
|
||||
*/
|
||||
if (isset($this->nav[\Modules\Navigation\Models\NavigationType::CONTENT])) :
|
||||
foreach ($this->nav[\Modules\Navigation\Models\NavigationType::CONTENT] as $key => $parent) :
|
||||
foreach ($parent as $link) :
|
||||
if ($link['nav_parent'] == $this->parent) : ?>
|
||||
<section class="box w-33 floatLeft">
|
||||
<div class="inner centerText">
|
||||
<a href="<?= \phpOMS\Uri\UriFactory::build($link['nav_uri']); ?>">
|
||||
<p><i class="fa-5x <?= $link['nav_icon']; ?>"></i></p>
|
||||
<p><?= $this->getText($link['nav_name']) ?></p>
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; endforeach; endforeach; endif;
|
||||
36
Theme/Backend/top.tpl.php
Normal file
36
Theme/Backend/top.tpl.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?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
|
||||
*/
|
||||
/**
|
||||
* @var \Modules\Navigation\Views\NavigationView $this
|
||||
*/
|
||||
if (isset($this->nav[\Modules\Navigation\Models\NavigationType::TOP])): ?>
|
||||
<ul id="t-nav" role="navigation">
|
||||
|
||||
<?php $unread = $this->getData('unread');
|
||||
foreach ($this->nav[\Modules\Navigation\Models\NavigationType::TOP] as $key => $parent) :
|
||||
foreach ($parent as $link) : ?>
|
||||
<li><a href="<?= \phpOMS\Uri\UriFactory::build($link['nav_uri']); ?>">
|
||||
|
||||
<?php if (isset($link['nav_icon'])) : ?>
|
||||
<i class="<?= $link['nav_icon']; ?> infoIcon"><?php if(isset($unread[$link['nav_from']]) && $unread[$link['nav_from']] > 0) : ?><span class="badge"><?= $unread[$link['nav_from']]; ?></span><?php endif; ?></i>
|
||||
<?php endif; ?>
|
||||
|
||||
<?= $this->getText($link['nav_name']); ?></a>
|
||||
<?php endforeach;
|
||||
endforeach; ?>
|
||||
|
||||
</ul>
|
||||
<?php endif;
|
||||
0
Views/NavigationView.js
Normal file
0
Views/NavigationView.js
Normal file
176
Views/NavigationView.php
Normal file
176
Views/NavigationView.php
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
<?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
|
||||
*/
|
||||
namespace Modules\Navigation\Views;
|
||||
|
||||
use phpOMS\Views\View;
|
||||
|
||||
/**
|
||||
* Navigation view.
|
||||
*
|
||||
* @category Modules
|
||||
* @package Modules\Navigation
|
||||
* @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 NavigationView extends View
|
||||
{
|
||||
|
||||
/**
|
||||
* Navigation Id.
|
||||
*
|
||||
* This is getting used in order to identify which navigation elements should get rendered.
|
||||
* This usually is the parent navigation id
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $navId = null;
|
||||
|
||||
/**
|
||||
* Navigation.
|
||||
*
|
||||
* @var mixed[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $nav = [];
|
||||
|
||||
/**
|
||||
* Language used for the navigation.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $language = 'en';
|
||||
|
||||
/**
|
||||
* Parent element used for navigation.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $parent = 0;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct($app, $request, $response)
|
||||
{
|
||||
parent::__construct($app, $request, $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get navigation Id.
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getNavId() : int
|
||||
{
|
||||
return $this->navId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set navigation Id.
|
||||
*
|
||||
* @param int $navId Navigation id used for display
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setNavId(int $navId)
|
||||
{
|
||||
$this->navId = $navId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getNav() : array
|
||||
{
|
||||
return $this->nav;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $nav
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setNav(array $nav)
|
||||
{
|
||||
$this->nav = $nav;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getLanguage() : string
|
||||
{
|
||||
return $this->language;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $language
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setLanguage(string $language)
|
||||
{
|
||||
$this->language = $language;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function getParent() : int
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $parent
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||
*/
|
||||
public function setParent(int $parent)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
}
|
||||
}
|
||||
3
docs/guidelines.dev.md
Normal file
3
docs/guidelines.dev.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
## Installation
|
||||
|
||||
The order of link elements inside the `Navigation.install.json` file needs to be unique. In case the order is not unique it's possible that the link order can vary from page to page.
|
||||
11
docs/info.md
Normal file
11
docs/info.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Navigation levels
|
||||
|
||||
0. None
|
||||
1. Top bar
|
||||
2. Side bar
|
||||
3. Content bar
|
||||
4. Content Side
|
||||
5. Tabs
|
||||
6. Dashboard
|
||||
7. Content Footer
|
||||
8. Footer
|
||||
BIN
img/module_teaser_small.png
Normal file
BIN
img/module_teaser_small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
39
info.json
Normal file
39
info.json
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"name": {
|
||||
"id": 1000500000,
|
||||
"internal": "Navigation",
|
||||
"external": "OMS Navigation"
|
||||
},
|
||||
"version": "1.0.0",
|
||||
"requirements": {
|
||||
"phpOMS": "1.0.0",
|
||||
"phpOMS-db": "1.0.0"
|
||||
},
|
||||
"creator": {
|
||||
"name": "Orange Management",
|
||||
"website": "www.spl1nes.com"
|
||||
},
|
||||
"description": "The navigation module.",
|
||||
"directory": "Navigation",
|
||||
"dependencies": {
|
||||
"Admin" : "1.0.0"
|
||||
},
|
||||
"providing": {
|
||||
"Navigation": "*"
|
||||
},
|
||||
"load": [
|
||||
{
|
||||
"pid": [
|
||||
"754a08ddf8bcb1cf22f310f09206dd783d42f7dd",
|
||||
"40a630e157504605e40ba241f6b1f78ab1dd97b9"
|
||||
],
|
||||
"type": 4,
|
||||
"for": "Content",
|
||||
"file": "Navigation",
|
||||
"from": "Admin"
|
||||
}
|
||||
],
|
||||
"lang": false,
|
||||
"js": true,
|
||||
"css": false
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user