/** * reads the xml file dbproperties.xml and puts the data in several Arrays[] * this class can have several database connections * if another database connection is needed, you can put these data in the dbproperties.xml * and create new function like get_postgresconn(), offcourse there must be a class postgres_db * constructor * @return ctrl_db * @access public */ function CtrlDb() { #create a new instance of xml_reader $xml = new XmlReader('dbproperties.xml'); #select the nodes which you want to read out => dbproperties $root = $xml->selectNodes('dbproperties'); for ($i = 0; $i < count($root); $i++) { #select all the childrens of the "dbproperties" node $db = $xml->getChildren($root[$i]); for ($j = 0; $j < count($db); $j++) { #select all the childrens of $db #get all the children nodes values and put it in arrays[] $data = $xml->getChildren($db[$j]); $this->dbname[$j] = $xml->getValue($data[0]); $this->user[$j] = $xml->getValue($data[1]); $this->pass[$j] = $xml->getValue($data[2]); $this->host[$j] = $xml->getValue($data[3]); $this->port[$j] = $xml->getValue($data[4]); } } }
function AdminPageObjectInfo() { $xml = new XmlReader(CMS_XML_PATH . 'pages.xml'); $page_node = $xml->selectNodes('page'); $cPrimaryPage = 0; $cSecondaryPage = 0; for ($i = 0; $i < count($page_node); $i++) { $child = $xml->getChildren($page_node[$i]); $pageName = $xml->getValue($child[0]); $pageTemplate = $xml->getValue($child[1]); $pageTitle = $xml->getValue($child[2]); $pageOrder = $xml->getValue($child[3]); $shortName = $xml->getValue($child[4]); $mainBlock = $xml->getValue($child[5]); if ($pageOrder == 1) { $this->_primaryPage = $pageName; $cPrimaryPage++; } if ($pageOrder == 2) { $this->_secondaryPage = $pageName; $cSecondaryPage++; } $page = new AdminPageObject($pageName, $pageTemplate, $pageTitle, $shortName, $mainBlock); $this->_pagesArray[$i][0] = $pageName; $this->_pagesArray[$i][1] = $page; } }
function AdminLayoutObjectInfo() { $xml = new XmlReader(CMS_XML_PATH . 'layout.xml'); $layout_node = $xml->selectNodes('layout'); $cDefault = 0; for ($i = 0; $i < count($layout_node); $i++) { $child = $xml->getChildren($layout_node[$i]); $name = $xml->getValue($child[0]); $template = $xml->getValue($child[1]); $output_name = $xml->getValue($child[2]); $css_name = $xml->getValue($child[3]); $css_file = $xml->getValue($child[4]); $default = $xml->getValue($child[5]); if ($default == 1) { $this->_layoutObject = new AdminLayoutObject($name, $template, $output_name, $css_name, $css_file); $cDefault++; } } if ($cDefault > 1) { new ErrorHandler(get_class($this), "constructor", "", "DEFAULT LAYOUT", "There is mor than ONE default layout set!"); } if ($cDefault == 0) { new ErrorHandler(get_class($this), "constructor", "", "DEFAULT LAYOUT", "There is NO default layout set!"); } $this->setFrames($xml, $this->_layoutObject->getName()); }