GoogleAnalytics4/Application/Model/ManagerHandler.php

55 lignes
1.4 KiB
PHP
Brut Vue normale Historique

<?php
namespace D3\GoogleAnalytics4\Application\Model;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\ViewConfig;
class ManagerHandler
{
/**
2024-05-29 12:05:32 +02:00
* Gets current chosen Manager
*
* @return string
*/
public function getCurrManager() :string
{
/** @var ManagerTypes $oManagerTypes */
$oManagerTypes = oxNew(ManagerTypes::class);
/** @var ViewConfig $oViewConfig */
$oViewConfig = oxNew(ViewConfig::class);
$aManagerList = $oManagerTypes->getManagerList();
foreach ($aManagerList as $managerName){
if ($oViewConfig->isModuleActive($managerName)){
return $managerName;
}
}
return $this->getExplicitManager();
}
/**
* @return string
*/
public function getModuleSettingExplicitManagerSelectValue() :string
{
2024-05-29 11:59:38 +02:00
return Registry::get(ViewConfig::class)->d3GetModuleConfigParam('_HAS_STD_MANAGER');
}
/**
* @return string
*/
public function getExplicitManager() :string
{
$sPotentialManagerName = $this->getModuleSettingExplicitManagerSelectValue();
/** @var ManagerTypes $oManagerTypes */
$oManagerTypes = oxNew(ManagerTypes::class);
return $oManagerTypes->isManagerInList($sPotentialManagerName)
? $sPotentialManagerName
: "NONE";
}
}