[Added] admin template and controller

This commit is contained in:
MaxBuhe01 2024-10-23 20:18:20 +02:00
parent 5701246e9c
commit 199e63e64b
3 changed files with 106 additions and 4 deletions

View File

@ -0,0 +1,54 @@
<?php
declare(strict_types=1);
namespace D3\ManufacturerInformation\Application\Controller\Admin;
use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
class ManufacturerInfoLongdesc extends AdminDetailsController
{
public function render()
{
parent::render();
$this->_aViewData['edit'] = $oManufacturer = oxNew(\OxidEsales\Eshop\Application\Model\Manufacturer::class);
$soxId = $this->_aViewData["oxid"] = $this->getEditObjectId();
if (isset($soxId) && $soxId != "-1") {
// load object
$d3manufacturerlang = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("d3manufacturerlang");
if (!isset($d3manufacturerlang)) {
$d3manufacturerlang = $this->_iEditLang;
}
$this->_aViewData["d3manufacturerlang"] = $d3manufacturerlang;
$oManufacturer->loadInLang($d3manufacturerlang, $soxId);
//Disable editing for derived items
if ($oManufacturer->isDerived()) {
$this->_aViewData['readonly'] = true;
}
foreach (\OxidEsales\Eshop\Core\Registry::getLang()->getLanguageNames() as $id => $language) {
$oLang = new \stdClass();
$oLang->sLangDesc = $language;
$oLang->selected = ($id == $this->_iEditLang);
$this->_aViewData["otherlang"][$id] = clone $oLang;
}
}
$this->_aViewData["editor"] = $this->generateTextEditor("100%", 280, $oManufacturer, "D3DESCRIPTION", "list.tpl.css");
return "d3manufacturerlongdesc.tpl";
}
public function save()
{
parent::save();
}
}

View File

@ -0,0 +1,46 @@
[{include file="headitem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}]
<script type="text/javascript">
<!--
function loadLang(obj)
{
var langvar = document.getElementById("catlang");
if (langvar != null )
langvar.value = obj.value;
document.myedit.submit();
}
//-->
</script>
[{if $readonly}]
[{assign var="readonly" value="readonly disabled"}]
[{else}]
[{assign var="readonly" value=""}]
[{/if}]
<form name="transfer" id="transfer" action="[{$oViewConf->getSelfLink()}]" method="post">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="oxid" value="[{$oxid}]">
<input type="hidden" name="cl" value="d3manufacturerinfolongdesc">
<input type="hidden" name="editlanguage" value="[{$editlanguage}]">
</form>
<form name="myedit" id="myedit" action="[{$oViewConf->getSelfLink()}]" method="post" onSubmit="copyLongDesc( 'oxmanufacturers__D3DESCRIPTION' );" style="padding: 0px;margin: 0px;height:0px;">
[{$oViewConf->getHiddenSid()}]
<input type="hidden" name="cl" value="d3manufacturerinfolongdesc">
<input type="hidden" name="fnc" value="">
<input type="hidden" name="oxid" value="[{$oxid}]">
<input type="hidden" name="voxid" value="[{$oxid}]">
<input type="hidden" name="editval[oxmanufacturers__oxid]" value="[{$oxid}]">
<input type="hidden" name="catlang" value="[{$catlang}]">
<input type="hidden" name="editval[oxmanufacturers__D3DESCRIPTION]" value="">
[{include file="include/category_text_editor.tpl"}]
<button type="submit" name="ok" [{$readonly}]>
<i class="fa fa-check-circle fa-inverse"></i>[{oxmultilang ident="D3_CFG_MOD_GENERAL_SAVE"}]
</button>
</form>
[{include file="bottomnaviitem.tpl"}]
[{include file="bottomitem.tpl"}]

View File

@ -12,8 +12,10 @@
*/ */
declare(strict_types=1); declare(strict_types=1);
$sMetadataVersion = '2.1'; use D3\ManufacturerInformation\Application\Controller\Admin\ManufacturerInfoLongdesc;
$sMetadataVersion = '2.1';
$sModuleId = 'd3manufacturerinformation'; $sModuleId = 'd3manufacturerinformation';
$logo = '<img src="https://logos.oxidmodule.com/d3logo.svg" alt="(D3)" style="height:1em;width:1em">'; $logo = '<img src="https://logos.oxidmodule.com/d3logo.svg" alt="(D3)" style="height:1em;width:1em">';
@ -34,7 +36,7 @@ $aModule = [
'email' => 'support@shopmodule.com', 'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/', 'url' => 'https://www.oxidmodule.com/',
'controllers' => [ 'controllers' => [
// 'd3ControllerAlias' => D3\ThisModule\Application\Controller\Admin\d3Controller::class, "d3manufacturerinfolongdesc" => ManufacturerInfoLongdesc::class
], ],
'extend' => [ 'extend' => [
// \OxidEsales\Eshop\Core\ShopControl::class => \D3\ThisModule\Modules\Core\ShopControl_MyModule::class // \OxidEsales\Eshop\Core\ShopControl::class => \D3\ThisModule\Modules\Core\ShopControl_MyModule::class
@ -44,7 +46,7 @@ $aModule = [
// 'onDeactivate' => '\D3\ThisModule\Setup\Events::onDeactivate', // 'onDeactivate' => '\D3\ThisModule\Setup\Events::onDeactivate',
], ],
'templates' => [ 'templates' => [
// 'd3TemplateAlias.tpl' => 'd3/thismodule/Application/views/admin/tpl/d3Template.tpl', 'd3manufacturerlongdesc.tpl' => 'd3/manufacturerinformation/Application/views/admin/tpl/d3manufacturer_longdesc.tpl',
// 'flow_theme' => [ // 'flow_theme' => [
// 'd3FlowTemplateAlias.tpl' => 'd3/thismodule/Application/views/tpl/d3FlowTheme.tpl', // 'd3FlowTemplateAlias.tpl' => 'd3/thismodule/Application/views/tpl/d3FlowTheme.tpl',
// ], // ],