/** *@desc Generate page, processing yours childs using the parent. *@return DOMDocument */ public function makeDomObject() { $xmlDoc = XmlUtil::CreateXmlDocument(); $root = XmlUtil::CreateChild($xmlDoc, "root"); // Process ALL XmlnukeDocumentObject existing in Collection. //---------------------------------------------------------- parent::generatePage($root); //---------------------------------------------------------- return $xmlDoc; }
/** *@param XMLFilenameProcessor $xmlfilename *@param string $path *@param string $strfilename *@return void *@desc *PageXml Constructor. Empty page. and PageXml Constructor. Create from XML. *PageXml Constructor. Create from file name and path. Do not use with XmlnukeDB repository. */ public function __construct($xmlfilename = null, $path = null, $strfilename = null) { if ($xmlfilename == null && $path == null && $strfilename == null) { $auxStr = "<page>\r\n" . "<meta>\r\n" . "<title/>\r\n" . "<abstract/>\r\n" . "<created>" . date("D M j Y G:i:s") . "</created>\r\n" . "<modified>" . date("D M j Y G:i:s") . "</modified>\r\n" . "<keyword>XMLSite ByJG</keyword>\r\n" . "<groupkeyword/>\r\n" . "</meta>\r\n" . "<group>\r\n" . "<id>__DEFAULT__</id>\r\n" . "<title/>\r\n" . "<keyword>all</keyword>\r\n" . "</group>\r\n" . "</page>"; $this->_xmlDoc = XmlUtil::CreateXmlDocumentFromStr($auxStr); $xpath = new DOMXPath($this->_xmlDoc); $this->_nodePage = $this->_xmlDoc->getElementsByTagName("page")->item(0); $this->_nodeGroup = $xpath->query("/page/group")->item(0); } else { if ($xmlfilename != null && $path == null && $strfilename == null) { $this->_xmlDoc = $xmlfilename->getContext()->getXMLDataBase()->getDocument($xmlfilename->FullQualifiedName()); } else { if ($xmlfilename == null && $path != null && $strfilename != null) { $xmlDoc = XmlUtil::CreateXmlDocument(); $xmlDoc->Load(FileUtil::AdjustSlashes($path . FileUtil::Slash() . $strfilename)); } } } }
/** *@desc Generate page, processing yours childs using the parent. *@return DOMDocument */ public function makeDomObject() { $xmlDoc = XmlUtil::CreateXmlDocument(); // Create the First first NODE ELEMENT! $nodePage = $xmlDoc->createElement($this->_rootNode); $xmlDoc->appendChild($nodePage); // Process ALL XmlnukeDocumentObject existing in Collection. //---------------------------------------------------------- parent::generatePage($nodePage); //---------------------------------------------------------- /* // Finalize the Create Page Execution XmlUtil::CreateChild($nodeMeta, "created", $created); XmlUtil::CreateChild($nodeMeta, "modified", date("d/M/y h:m:s")); $elapsed = microtime(true)-$createdTimeStamp; XmlUtil::CreateChild($nodeMeta, "timeelapsed", intval($elapsed/3600) . ":" . intval($elapsed/60)%60 . ":" . $elapsed%60 . "." . substr(intval((($elapsed - intval($elapsed))*1000))/1000, 2) ); XmlUtil::CreateChild($nodeMeta, "timeelapsedsec", $elapsed ); */ return $xmlDoc; }
/** *@desc Generate page, processing yours childs using the parent. *@return DOMDocument */ public function makeDomObject() { $created = date("d/M/y h:m:s"); $createdTimeStamp = microtime(true); $xmlDoc = XmlUtil::CreateXmlDocument(); // Create the First first NODE ELEMENT! $nodePage = $xmlDoc->createElement("page"); $xmlDoc->appendChild($nodePage); // Create the META node $nodeMeta = XmlUtil::CreateChild($nodePage, "meta", ""); XmlUtil::CreateChild($nodeMeta, "title", $this->_pageTitle); XmlUtil::CreateChild($nodeMeta, "abstract", $this->_abstract); XmlUtil::CreateChild($nodeMeta, "keyword", $this->_keyword); XmlUtil::CreateChild($nodeMeta, "groupkeyword", $this->_groupKeyword); foreach ($this->_metaTag as $key => $value) { XmlUtil::CreateChild($nodeMeta, $key, $value); } // Create MENU (if exists some elements in menu). foreach ($this->_menuGroup as $key => $menuGroup) { if (sizeof($menuGroup->menus) > 0) { $nodeGroup = XmlUtil::CreateChild($nodePage, "group", ""); XmlUtil::CreateChild($nodeGroup, "id", $key); XmlUtil::CreateChild($nodeGroup, "title", $menuGroup->menuTitle); XmlUtil::CreateChild($nodeGroup, "keyword", "all"); foreach ($menuGroup->menus as $item) { $nodeWorking = XmlUtil::CreateChild($nodeGroup, "page", ""); XmlUtil::CreateChild($nodeWorking, "id", $item->id); XmlUtil::CreateChild($nodeWorking, "title", $item->title); XmlUtil::CreateChild($nodeWorking, "summary", $item->summary); if ($item->icon != "") { XmlUtil::CreateChild($nodeWorking, "icon", $item->icon); } } } } // Add Custom JS if (!$this->_disableButtonsOnSubmit) { $this->addJavaScriptSource("var XMLNUKE_DISABLEBUTTON = false;\n", false); } if ($this->_waitLoading) { $this->addJavaScriptSource("var XMLNUKE_WAITLOADING = true;\n", false); } // Generate Scripts if (!is_null($this->_scripts)) { foreach ($this->_scripts as $script) { $nodeWorking = XmlUtil::CreateChild($nodePage, "script", ""); XmlUtil::AddAttribute($nodeWorking, "language", "javascript"); if (!is_null($script->source)) { XmlUtil::AddTextNode($nodeWorking, $script->source, true); } if (!is_null($script->file)) { XmlUtil::AddAttribute($nodeWorking, "src", $script->file); } XmlUtil::AddAttribute($nodeWorking, "location", $script->location); } } // Process ALL XmlnukeDocumentObject existing in Collection. //---------------------------------------------------------- parent::generatePage($nodePage); //---------------------------------------------------------- // Finalize the Create Page Execution XmlUtil::CreateChild($nodeMeta, "created", $created); XmlUtil::CreateChild($nodeMeta, "modified", date("d/M/y h:m:s")); $elapsed = microtime(true) - $createdTimeStamp; XmlUtil::CreateChild($nodeMeta, "timeelapsed", intval($elapsed / 3600) . ":" . intval($elapsed / 60) % 60 . ":" . $elapsed % 60 . "." . substr(intval(($elapsed - intval($elapsed)) * 1000) / 1000, 2)); XmlUtil::CreateChild($nodeMeta, "timeelapsedsec", $elapsed); return $xmlDoc; }