initial commit

This commit is contained in:
Thomas Dartsch 2019-08-07 14:50:54 +02:00
commit 360ad02dc6
5 changed files with 155 additions and 0 deletions

14
README.md Normal file
View File

@ -0,0 +1,14 @@
# DisableAdminElements
Hide unused menu items in the oxid eshop admin
## Features
* you can hide any element of the xml files (e.g. menu.xml) like navigation or tab elements
* you only need the id of the element node (e.g. 'tbclorder_downloads' or 'mxwrapping')
## Install
* Run this composer statement in your shop. Adjust this instruction if your installation requires it.
`composer require d3/disableadminelements --update-no-dev`

38
composer.json Normal file
View File

@ -0,0 +1,38 @@
{
"name": "d3/disableadminelements",
"description": "Ausblenden von Menuepunkten im Admin",
"type": "oxideshop-module",
"version": "1.0",
"keywords": [
"oxid",
"modules",
"eShop",
"d3"
],
"authors": [
{
"name": "D3 Data Development (Inh. Thomas Dartsch)",
"email": "info@shopmodule.com",
"homepage": "http://www.d3data.de",
"role": "Owner"
}
],
"homepage": "https://www.oxidmodule.com/",
"license": [
"GPL-3.0-or-later"
],
"extra": {
"oxideshop": {
"source-directory": "/src",
"target-directory": "d3/disableadminelements"
}
},
"require": {
"oxid-esales/oxideshop-metapackage-ce": "~6.0.0 || ~6.1.0"
},
"autoload": {
"psr-4": {
"D3\\DisableAdminElements\\": "../../../source/modules/d3/disableadminelements"
}
}
}

View File

@ -0,0 +1,10 @@
<?php
$sLangName = "Deutsch";
$aLang = array(
'charset' => 'UTF-8',
'SHOP_MODULE_GROUP_d3disableAdminElements_group' => 'Einstellungen',
'SHOP_MODULE_d3disableAdminElements_elemtentlist' => 'Trage hier alle Idents (id) der auszublendenen Menüpunkte aus der menu.xml ein. z.B. "tbclorder_downloads"',
);

View File

@ -0,0 +1,51 @@
<?php
/**
* Copyright © OXID eSales AG. All rights reserved.
* See LICENSE file for license details.
*/
/**
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Thomas Dartsch <support@shopmodule.com>
* @link http://www.oxidmodule.com
*/
namespace D3\DisableAdminElements\Modules\Application\Controller\Admin;
use OxidEsales\Eshop\Core\Registry;
use DOMXPath;
class NavigationTree extends NavigationTree_parent
{
/**
* clean empty nodes from tree
*
* @param object $dom dom object
* @param string $parentXPath parent xpath
* @param string $childXPath child xpath from parent
*/
protected function _cleanEmptyParents($dom, $parentXPath, $childXPath)
{
parent::_cleanEmptyParents($dom, $parentXPath, $childXPath);
$xPath = new DomXPath($dom);
$nodeList = $xPath->query($parentXPath);
foreach ($nodeList as $node) {
$id = $node->getAttribute('id');
$childList = $xPath->query("{$parentXPath}[@id='$id']/$childXPath");
$aListOfDisabledElements = Registry::getConfig()->getShopConfVar( 'd3disableAdminElements_elemtentlist');
foreach($childList as $id => $node) {
if (in_array($node->getAttribute('id'), $aListOfDisabledElements) ) {
$node->parentNode->removeChild($node);
}
}
}
}
}

42
src/metadata.php Normal file
View File

@ -0,0 +1,42 @@
<?php
use D3\DisableAdminElements\Modules\Application\Controller\Admin\NavigationTree as D3NavigationTree;
use OxidEsales\Eshop\Application\Controller\Admin\NavigationTree;
/**
* Metadata version
*/
$sMetadataVersion = '2.1';
/**
* Module information
*/
$aModule = array(
'id' => 'disableadminelements',
'title' =>
(class_exists(d3utils::class) ? d3utils::getInstance()->getD3Logo() : 'D&sup3;') . ' Ausblenden von ungenutzen Men&uuml;punkten im Admin',
'description' => array(
'de' => 'Tragen Sie in den Einstellungen die id der gew&uuml;nschten Elemente (Men&uuml;punkte, Tabs etc.) aus den menu.xml Dateien ein und das jeweilige Element wird f&uuml;r alle Adminbenutzer ausgeblendet.',
'en' => '',
),
'thumbnail' => 'picture.png',
'version' => '1.0',
'author' => 'D&sup3; Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'http://www.oxidmodule.com/',
'extend' => [
NavigationTree::class => D3NavigationTree::class,
],
'settings' => array(
array(
'group' => 'd3disableAdminElements_group',
'name' => 'd3disableAdminElements_elemtentlist',
'type' => 'arr',
'value' => array('tbclorder_downloads', 'tbclarticle_files'),
),
),
);