mirror of
https://github.com/Karaka-Management/oms-Navigation.git
synced 2026-02-15 16:28:39 +00:00
Init
This commit is contained in:
commit
aafab48773
131
Admin/Installer.php
Normal file
131
Admin/Installer.php
Normal file
|
|
@ -0,0 +1,131 @@
|
||||||
|
<?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\Navigation\Admin;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\DatabaseType;
|
||||||
|
use phpOMS\DataStorage\Database\Pool;
|
||||||
|
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(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 . '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($dbPool, $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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
34
Controller.js
Normal file
34
Controller.js
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
(function (skillet, undefined) {
|
||||||
|
//Private Property
|
||||||
|
var isHot = true;
|
||||||
|
|
||||||
|
//Public Property
|
||||||
|
skillet.ingredient = 'Bacon Strips';
|
||||||
|
|
||||||
|
//Public Method
|
||||||
|
skillet.fry = function () {
|
||||||
|
var oliveOil;
|
||||||
|
|
||||||
|
addItem('tn Butter nt');
|
||||||
|
addItem(oliveOil);
|
||||||
|
console.log('Frying ' + skillet.ingredient);
|
||||||
|
};
|
||||||
|
|
||||||
|
//Private Method
|
||||||
|
function addItem(item) {
|
||||||
|
if (item !== undefined) {
|
||||||
|
console.log('Adding ' + item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}(window.skillet = window.skillet || {}));
|
||||||
|
|
||||||
|
//Public Properties
|
||||||
|
console.log(skillet.ingredient); //Bacon Strips
|
||||||
|
|
||||||
|
//Public Methods
|
||||||
|
skillet.fry(); //Adding Butter & Fraying Bacon Strips
|
||||||
|
|
||||||
|
//Adding a Public Property
|
||||||
|
skillet.quantity = "12";
|
||||||
|
console.log(skillet.quantity); //12
|
||||||
193
Controller.php
Normal file
193
Controller.php
Normal file
|
|
@ -0,0 +1,193 @@
|
||||||
|
<?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\Navigation;
|
||||||
|
|
||||||
|
use Modules\Navigation\Models\NavigationType;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JavaScript files.
|
||||||
|
*
|
||||||
|
* @var \string[]
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public static $js = [
|
||||||
|
'backend',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CSS files.
|
||||||
|
*
|
||||||
|
* @var \string[]
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public static $css = [
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigation array.
|
||||||
|
*
|
||||||
|
* Array of all navigation elements sorted by type->parent->id
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public $nav = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Navigation array.
|
||||||
|
*
|
||||||
|
* Array of all navigation elements by id
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public $nid = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parent links of the current page.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public $nav_parents = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module name.
|
||||||
|
*
|
||||||
|
* @var \string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $module = 'Navigation';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Localization files.
|
||||||
|
*
|
||||||
|
* @var \string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
protected static $localization = [
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function call(RequestAbstract $request, ResponseAbstract $response, $data = null)
|
||||||
|
{
|
||||||
|
$modules = $this->app->moduleManager->getActiveModules();
|
||||||
|
$language = $this->app->accountManager->get($request->getAccount())->getL11n()->getLanguage();
|
||||||
|
|
||||||
|
foreach ($modules as $id => $module) {
|
||||||
|
$this->app->accountManager->get($request->getAccount())->getL11n()->loadLanguage($language, 'nav.backend', $module[0]['module_path']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->nav)) {
|
||||||
|
$this->nav = [];
|
||||||
|
|
||||||
|
$uri_hash = $request->getHash();
|
||||||
|
$uri_pdo = '';
|
||||||
|
$i = 1;
|
||||||
|
foreach ($uri_hash as $hash) {
|
||||||
|
$uri_pdo .= ':pid' . $i . ',';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$uri_pdo = rtrim($uri_pdo, ',');
|
||||||
|
|
||||||
|
$sth = $this->app->dbPool->get('core')->con->prepare('SELECT * FROM `' . $this->app->dbPool->get('core')->prefix . 'nav` WHERE `nav_pid` IN(' . $uri_pdo . ') ORDER BY `nav_order` ASC');
|
||||||
|
|
||||||
|
$i = 1;
|
||||||
|
foreach ($uri_hash as $hash) {
|
||||||
|
$sth->bindValue(':pid' . $i, $hash, \PDO::PARAM_STR);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sth->execute();
|
||||||
|
$temp_nav = $sth->fetchAll();
|
||||||
|
|
||||||
|
foreach ($temp_nav as $link) {
|
||||||
|
$this->nav[$link['nav_type']][$link['nav_subtype']][$link['nav_id']] = $link;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($data[0]) {
|
||||||
|
case NavigationType::TOP:
|
||||||
|
/** @noinspection PhpIncludeInspection */
|
||||||
|
require __DIR__ . '/Theme/' . $request->getType() . '/top.tpl.php';
|
||||||
|
break;
|
||||||
|
case NavigationType::SIDE:
|
||||||
|
/** @noinspection PhpIncludeInspection */
|
||||||
|
require __DIR__ . '/Theme/' . $request->getType() . '/side.tpl.php';
|
||||||
|
break;
|
||||||
|
case NavigationType::CONTENT:
|
||||||
|
/** @noinspection PhpIncludeInspection */
|
||||||
|
require __DIR__ . '/Theme/' . $request->getType() . '/mid.tpl.php';
|
||||||
|
break;
|
||||||
|
case NavigationType::CONTENT_SIDE:
|
||||||
|
/** @noinspection PhpIncludeInspection */
|
||||||
|
require __DIR__ . '/Theme/' . $request->getType() . '/mid-side.tpl.php';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
36
Models/LinkType.php
Normal file
36
Models/LinkType.php
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?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\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
|
||||||
|
{
|
||||||
|
const CATEGORY = 0;
|
||||||
|
|
||||||
|
const LINK = 1;
|
||||||
|
}
|
||||||
0
Models/Navigation.js
Normal file
0
Models/Navigation.js
Normal file
152
Models/Navigation.php
Normal file
152
Models/Navigation.php
Normal file
|
|
@ -0,0 +1,152 @@
|
||||||
|
<?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\Navigation\Models;
|
||||||
|
|
||||||
|
use phpOMS\DataStorage\Database\Pool;
|
||||||
|
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
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
private function __construct(RequestAbstract $request, Pool $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
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
||||||
|
*/
|
||||||
|
public static function getInstance(RequestAbstract $request = null, Pool $dbPool = null)
|
||||||
|
{
|
||||||
|
if (!isset(self::$instance)) {
|
||||||
|
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.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\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
|
||||||
|
{
|
||||||
|
const TOP = 1;
|
||||||
|
|
||||||
|
const SIDE = 2;
|
||||||
|
|
||||||
|
const CONTENT = 3;
|
||||||
|
|
||||||
|
const TAB = 4;
|
||||||
|
|
||||||
|
const CONTENT_SIDE = 5;
|
||||||
|
|
||||||
|
const BOTTOM = 6;
|
||||||
|
}
|
||||||
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.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 \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->l11n->lang[0]['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->l11n->lang[5][$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.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 \Modules\Navigation\Views\NavigationView $this
|
||||||
|
*/
|
||||||
|
if (isset($this->nav[\Modules\Navigation\Models\NavigationType::CONTENT])) {
|
||||||
|
echo '<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->l11n->lang['Navigation'][$link['nav_name']] . '</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</ul>';
|
||||||
|
}
|
||||||
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.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 \Modules\Navigation\Views\NavigationView $this
|
||||||
|
*/
|
||||||
|
if (isset($this->nav[\Modules\Navigation\Models\NavigationType::SIDE])) : ?>
|
||||||
|
<ul id="nav-side" 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->l11n->lang['Navigation'][$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->l11n->lang['Navigation'][$link['nav_name']]; ?></a>
|
||||||
|
<?php endif;
|
||||||
|
endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?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
|
||||||
|
*/ endif;
|
||||||
49
Theme/backend/top.tpl.php
Normal file
49
Theme/backend/top.tpl.php
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?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 \Modules\Navigation\Views\NavigationView $this
|
||||||
|
*/
|
||||||
|
if (isset($this->nav[\Modules\Navigation\Models\NavigationType::TOP])): ?>
|
||||||
|
<ul id="t-nav" role="navigation">
|
||||||
|
|
||||||
|
<?php 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']; ?>"></i>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?= $this->l11n->lang['Navigation'][$link['nav_name']]; ?></a>
|
||||||
|
<?php endforeach;
|
||||||
|
endforeach; ?>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<?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
|
||||||
|
*/ 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.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\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 `nav.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 |
37
info.json
Normal file
37
info.json
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
"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": {},
|
||||||
|
"providing": {
|
||||||
|
"Navigation": "*"
|
||||||
|
},
|
||||||
|
"load": [
|
||||||
|
{
|
||||||
|
"pid": [
|
||||||
|
"754a08ddf8bcb1cf22f310f09206dd783d42f7dd",
|
||||||
|
"40a630e157504605e40ba241f6b1f78ab1dd97b9"
|
||||||
|
],
|
||||||
|
"type": 4,
|
||||||
|
"for": "Content",
|
||||||
|
"file": "Navigation",
|
||||||
|
"from": "Admin"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lang": false,
|
||||||
|
"js": true,
|
||||||
|
"css": false
|
||||||
|
}
|
||||||
21
lang/en.lang.php
Normal file
21
lang/en.lang.php
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?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
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: spl1nes
|
||||||
|
* Date: 14.04.14
|
||||||
|
* Time: 22:52.
|
||||||
|
*/
|
||||||
93
module.js
Normal file
93
module.js
Normal file
|
|
@ -0,0 +1,93 @@
|
||||||
|
/* global supports_html5_storage, setCookie, getCookie */
|
||||||
|
$(document).ready(function () {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var sidebar = document.getElementById("s-nav"),
|
||||||
|
scrollPos = sidebar.scrollTop;
|
||||||
|
|
||||||
|
/* [BEGIN]: Load/Save old navigation status */
|
||||||
|
var $localStorage = supports_html5_storage();
|
||||||
|
var navigation = null;
|
||||||
|
|
||||||
|
if (!$localStorage) {
|
||||||
|
navigation = getCookie('1000500001');
|
||||||
|
} else {
|
||||||
|
navigation = localStorage['1000500001'];
|
||||||
|
}
|
||||||
|
|
||||||
|
var naviOBJ = null;
|
||||||
|
|
||||||
|
if (navigation !== null) {
|
||||||
|
naviOBJ = JSON.parse(navigation);
|
||||||
|
|
||||||
|
if ('1000500000' in naviOBJ) {
|
||||||
|
sidebar.hide();
|
||||||
|
$('#content').css('margin-left', 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var val = null;
|
||||||
|
for (var key in naviOBJ) {
|
||||||
|
//noinspection JSUnfilteredForInLoop
|
||||||
|
if (!isNaN(key)) {
|
||||||
|
val = naviOBJ[key];
|
||||||
|
sidebar.find('.' + val + ' li:not(:first-child)').hide();
|
||||||
|
sidebar.find('.' + val + ' .min').hide();
|
||||||
|
sidebar.find('.' + val + ' .max').show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sidebar.find('li .min').click(function () {
|
||||||
|
$(this).parent().parent().children('li:not(:first-child)').slideUp();
|
||||||
|
naviOBJ[$(this).parent().parent().attr('class')] = $(this).parent().parent().attr('class');
|
||||||
|
|
||||||
|
if (!$localStorage) {
|
||||||
|
setCookie('1000500000', JSON.stringify(naviOBJ), 365, window.location.host, '/');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
localStorage['1000500000'] = JSON.stringify(naviOBJ);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
sidebar.find('li .max').click(function () {
|
||||||
|
$(this).parent().parent().children('li:not(:first-child)').slideDown();
|
||||||
|
delete naviOBJ[$(this).parent().parent().attr('class')];
|
||||||
|
|
||||||
|
if (!$localStorage) {
|
||||||
|
setCookie('1000500000', JSON.stringify(naviOBJ), 365, window.location.host, '/');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
localStorage['1000500000'] = JSON.stringify(naviOBJ);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
sidebar.find('.hide').click(function () {
|
||||||
|
$(this).hide();
|
||||||
|
$('#content').css('margin-left', 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
/* [BEGIN]: Hide and Show sidenav */
|
||||||
|
$(document).keydown(function (e) {
|
||||||
|
if (e.ctrlKey && e.altKey && e.which === 78) {
|
||||||
|
if (!sidebar.hasClass('.hidden')) {
|
||||||
|
sidebar.show();
|
||||||
|
$('#content').css('margin-left', sidebar.width());
|
||||||
|
delete naviOBJ['1000500000'];
|
||||||
|
} else {
|
||||||
|
sidebar.hide();
|
||||||
|
$('#content').css('margin-left', 0);
|
||||||
|
naviOBJ['1000500000'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$localStorage) {
|
||||||
|
setCookie('1000500000', JSON.stringify(naviOBJ), 365, window.location.host, '/');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
localStorage['1000500000'] = JSON.stringify(naviOBJ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/* [END]: Hide and Show sidenav */
|
||||||
|
|
||||||
|
/* [END]: Load/Save old navigation status */
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user