Example #1
0
 /**
  * Gets a module DOM element from a module
  * @param zibo\library\xml\dom\Document $dom the document of the new element
  * @param zibo\admin\model\Module $module The module for the DOM element
  * @param string $elementName Name of the new module DOM element
  * @return DOMElement DOM element representing the provided module
  */
 private function getModuleElementFromModule(Document $dom, Module $module, $elementName)
 {
     $element = $dom->createElementNS(self::XML_NAMESPACE, $elementName);
     $element->setAttribute(self::ATTRIBUTE_NAMESPACE, $module->getNamespace());
     $element->setAttribute(self::ATTRIBUTE_NAME, $module->getName());
     $element->setAttribute(self::ATTRIBUTE_VERSION, $module->getVersion());
     $ziboVersion = $module->getZiboVersion();
     if (!empty($ziboVersion)) {
         $element->setAttribute(self::ATTRIBUTE_VERSION_ZIBO, $ziboVersion);
     }
     $path = $module->getPath();
     if (!empty($path)) {
         $element->setAttribute(self::ATTRIBUTE_PATH, $path->getPath());
     }
     $dependencies = $module->getDependencies();
     foreach ($dependencies as $dependency) {
         $dependencyElement = $this->getModuleElementFromModule($dom, $dependency, self::TAG_DEPENDENCY);
         $element->appendChild($dependencyElement);
     }
     return $element;
 }