Translate module id.

@param $oldModuleId
@return
@throws ModuleNotFoundByNameException
497306
protected function translateModuleId($oldModuleId)
    {
        $module = Module::where('name',StudyModule::findOrFail($oldModuleId)->name)->first();
        if ( $module != null ) {
            return $module->id;
        }
        throw new ModuleNotFoundByNameException();
    }
43460
public function handleOnModuleDeactivation(ModuleSetting $moduleSetting, string $moduleId, int $shopId)
    {
        if (!$this->canHandle($moduleSetting)) {
            throw new WrongModuleSettingException($moduleSetting, self::class);
        }

        $this->templateBlockExtensionDao->deleteExtensions($moduleId, $shopId);
    }
286712
private function applyModuleGroupNameTranslateFunction($moduleStateMap)
    {
        $moduleGroupNameTranslateFilterFunction = $this->moduleGroupNameTranslateFunction;

        if (!$moduleGroupNameTranslateFilterFunction) {
            return $moduleStateMap;
        }

        $translatedModuleStateMap = [];

        foreach ($this->iterateThroughModuleStateMapByGroup($moduleStateMap) as list($groupId, $modules)) {
            $groupName = $moduleGroupNameTranslateFilterFunction($groupId);
            $translatedModuleStateMap[$groupName] = $modules;
        }

        return $translatedModuleStateMap;
    }
1182216
protected function getNewAppId($oldAppId)
    {
        if (empty($oldAppId)) {
            return null;
        }

        $apps = $this->package->getResourceFromZip('system/app.json');
        $appName = null;
        foreach ($apps as $app) {
            if ($oldAppId === $app['id']) {
                $appName = $app['name'];
                break;
            }
        }

        if (!empty($appName)) {
            $newApp = App::whereName($appName)->first(['id']);
            if (!empty($newApp)) {
                return $newApp->id;
            }
        } else {
            $existingApp = App::find($oldAppId);
            if (!empty($existingApp)) {
                $appName = $existingApp->name;

                if (in_array($appName, ['admin', 'api_docs', 'file_manager'])) {
                    // If app is one of the pre-defined system apps
                    // then new id is most likely the same as the old id.
                    return $oldAppId;
                }
            }
        }

        return null;
    }
804239
public function getModuleItems($nodeId)
    {
        if (isset($this->_nodeItems[$nodeId])) {
            return $this->_nodeItems[$nodeId];
        }
        
        $data = $this->getNodeData($nodeId);
        
        if (isset($data['groups'])) {
            foreach ($data['groups'] as $groupName => $groupItem) {
                // translate the group names
                try {
                    $data['groups'][$groupName]['name'] = Yii::t($data['moduleId'], $groupItem['name'], [], Yii::$app->language);
                } catch (\Exception $e) {
                    // do nothing and keep the current name inside the array
                }
                foreach ($groupItem['items'] as $groupItemKey => $groupItemEntry) {
                    if ($groupItemEntry['permissionIsRoute']) {
                        if (!Yii::$app->auth->matchRoute($this->getUserId(), $groupItemEntry['route'])) {
                            unset($data['groups'][$groupName]['items'][$groupItemKey]);
                            continue;
                        }
                    } elseif ($groupItemEntry['permissionIsApi']) {
                        if (!Yii::$app->auth->matchApi($this->getUserId(), $groupItemEntry['permissionApiEndpoint'])) {
                            unset($data['groups'][$groupName]['items'][$groupItemKey]);
                            continue;
                        }
                    } else {
                        throw new Exception('Menu item detected without permission entry');
                    }
                    try {
                        $alias = Yii::t($data['moduleId'], $data['groups'][$groupName]['items'][$groupItemKey]['alias'], [], Yii::$app->language);
                    } catch (\Exception $err) {
                        $alias = $data['groups'][$groupName]['items'][$groupItemKey]['alias'];
                    }
                    
                    // if a pool is available, the route will be modified by appending the pool param
                    $pool = AdminMenuBuilder::getOptionValue($groupItemEntry, 'pool', null);
                    if ($pool) {
                        $data['groups'][$groupName]['items'][$groupItemKey]['route'] = $data['groups'][$groupName]['items'][$groupItemKey]['route'] . '?pool='.$pool;
                    }

                    $data['groups'][$groupName]['items'][$groupItemKey]['hiddenInMenu'] = AdminMenuBuilder::getOptionValue($groupItemEntry, 'hiddenInMenu', false);
                    $data['groups'][$groupName]['items'][$groupItemKey]['pool'] = AdminMenuBuilder::getOptionValue($groupItemEntry, 'pool', null);
                    $data['groups'][$groupName]['items'][$groupItemKey]['alias'] = $alias;
                }
                
                // if there are no items for this group, unset the group from the data array
                if (count($data['groups'][$groupName]['items']) == 0) {
                    unset($data['groups'][$groupName]);
                }
            }
            
            // if there are no groups reset the array to an empty array
            if (empty($data['groups'])) {
                $data = [];
            }
        } else {
            // as we want to catch all groups and the items of the groups, if the group has no items reset the array to an empty arrray
            $data = [];
        }

        $this->_nodeItems[$nodeId] = $data;

        return $data;
    }
674545
public static function registeredModuleName($moduleUid)
    {
        if (!empty(static::$_dynModulesCache[$moduleUid]['name'])) {
            $name = static::$_dynModulesCache[$moduleUid]['name'];
            return $name;
        }
        return false;
    }
1341927
public T modifyModule(final String moduleName, final String slot, final byte[] existingHash, final byte[] newHash) {
        final ContentItem item = createModuleItem(moduleName, slot, newHash);
        addContentModification(createContentModification(item, ModificationType.MODIFY, existingHash));
        return returnThis();
    }
38530
static function ModuleTranslationsFile(ModuleBase $module, $lang)
    {
        $folder = self::ModuleTranslationsFolder($module);
        $file = Path::Combine($folder, $lang);
        return Path::AddExtension($file, 'php');
    }
336253
public static function getModuleUidByClassname($moduleClassName, $moduleContainer = null)
    {
        if ($moduleContainer == null) {
            $moduleContainer = Yii::$app; // start from ancestor-container
        }
        if ($moduleContainer instanceof YiiBaseModule) {
             if ($moduleContainer::className() == $moduleClassName) {
                 return $moduleContainer->uniqueId;
             }
             $subModules = $moduleContainer->getModules($loadedOnly = false);
             foreach ($subModules as $subModule) {
                 $uid = static::getModuleUidByClassname($moduleClassName, $subModule);
                 if ($uid) return $uid;
             }
        }
        return false;
    }
668329
function _getModule (moduleElement) {
    var id = moduleElement.getAttribute('id');
    var dir = moduleElement.getAttribute('dir');
    var name = moduleElement.getAttribute('name');
    var fileSets = domutils.getChild(moduleElement, 'desc', 'fileSets');
    var modules = domutils.getChild(moduleElement, 'desc', 'modules');
    var module = { id: id, dir: dir, name: name, fileSets: [], modules: [] };
    if (fileSets !== undefined) {
      var fileSetElements = domutils.selectMatchingXPath('desc:fileSet', fileSets);
      var numFileSets = fileSetElements.length;
      for (var fsIdx = 0; fsIdx < numFileSets; fsIdx++) {
        module.fileSets.push(_getFileSet(fileSetElements[fsIdx]));
      }
    }
    if (modules !== undefined) {
      var moduleElements = domutils.selectMatchingXPath('desc:module', modules);
      var numModules = moduleElements.length;
      for (var mIdx = 0; mIdx < numModules; mIdx++) {
        module.modules.push(_getModule(moduleElements[mIdx]));
      }
    }
    return module;
  }
1015980
public Set<ModuleIdentifier> getAllRevisionIds(String scriptModuleId) {
        Objects.requireNonNull(scriptModuleId, "scriptModuleId");
        Set<ModuleIdentifier> revisionIds = new LinkedHashSet<ModuleIdentifier>();
        for (ModuleIdentifier revisionId : moduleSpecs.keySet()) {
            if (revisionId.getName().equals(scriptModuleId)) {
                revisionIds.add(revisionId);
            }
        }
        return Collections.unmodifiableSet(revisionIds);
    }
182098
public function handleOnModuleActivation(ModuleSetting $moduleSetting, string $moduleId, int $shopId)
    {
        if (!$this->canHandle($moduleSetting)) {
            throw new WrongModuleSettingException($moduleSetting, self::class);
        }

        $shopConfigurationSetting = $this->getShopConfigurationSetting($shopId);

        $shopSettingValue = array_merge(
            $shopConfigurationSetting->getValue(),
            [
                $moduleId => $moduleSetting->getValue(),
            ]
        );

        $shopConfigurationSetting->setValue($shopSettingValue);

        $this->shopConfigurationSettingDao->save($shopConfigurationSetting);
    }
500153
public function translate( $sCode, $blUseModulePrefix = true )
    {
        if ( $blUseModulePrefix ) {
            $sCode = 'PAYMORROW_' . $sCode;
        }

        return oxRegistry::getLang()->translateString( $sCode, oxRegistry::getLang()->getBaseLanguage(), false );
    }
389454
public TreeNode getModuleTree(final String moduleId) {
        final ModuleHandler moduleHandler = new ModuleHandler(repoHandler);
        final DbModule module = moduleHandler.getModule(moduleId);

        final TreeNode tree = new TreeNode();
        tree.setName(module.getName());

        // Add submodules
        for (final DbModule submodule : module.getSubmodules()) {
            addModuleToTree(submodule, tree);
        }

        return tree;
    }
1022620
private ModuleInfo loadModuleInfo(ModuleIdentifier modID, File modJsonFile) {
    return new ModuleInfo(modID, new ModuleFields(loadModuleConfig(modID, modJsonFile)));
  }
114622
public function bindModuleUrl($modulename, $xsl="", $lang="")
	{
		$queryStart = strpos($modulename, "?");
		$queryString = "";

		if ($queryStart!==false)
		{
			$queryString = "&" . substr($modulename, $queryStart+1);
			$modulename = substr($modulename, 0, $queryStart);
		}

		if (strpos($modulename, "module:") !== false)
		{
			$modulename = substr($modulename, 7);
		}

		if(empty($xsl))
		{
			if ($this->getXsl()=="index")
			{
				$xsl = 	$this->get("xmlnuke.DEFAULTPAGE");

			}
			else
			{
				$xsl = $this->getXsl();
			}
		}

		if(empty($lang))
			$lang = strtolower($this->Language()->getName());


		$fullLink = $this->get("xmlnuke.USEFULLPARAMETER");
		if (!$fullLink)
		{
			if ($xsl == $this->get("xmlnuke.DEFAULTPAGE"))
			{
				$xsl = "";
			}
			$array = array_keys($this->LanguagesAvailable());
			if ($lang == $array[0])
			{
				$lang = "";
			}
		}

		$url = $this->UrlModule()."?module=".$modulename;
		$url .= $queryString;
		if ($xsl != "")
		{
			$url .= "&xsl=".$xsl;
		}
		if ($lang != "")
		{
			$url .= "&lang=".$lang;
		}

		return $url;
	}
425147
public function getModuleById($id)
    {
        $modules = \JModuleHelper::getModules(null);

        $total = count($modules);

        for ($i = 0; $i < $total; $i++)
        {
            if ($modules[$i]->id == $id)
            {
                return $modules[$i];
            }
        }

        return null;
    }