function writeXMLFile($_strFileName, $_arrMenu) { $xml = new MiniXMLDoc(); $xmlRoot =& $xml->getRoot(); $menuBar =& $xmlRoot->createChild('menuBar'); for ($i = 0; $i < count($_arrMenu); $i++) { $menu =& $menuBar->createChild('menu'); $menuName =& $menu->createChild('name'); $menuName->text($_arrMenu[$i]['name']); for ($j = 0; $j < count($_arrMenu[$i]) - 2; $j++) { $option =& $menu->createChild('option'); $child =& $option->createChild('name'); $child->text($_arrMenu[$i][$j]['name']); $child =& $option->createChild('type'); $child->text('i'); $child =& $option->createChild('link'); $child->text($_arrMenu[$i][$j]['module_name']); $child =& $option->createChild('param'); $child->text($_arrMenu[$i][$j]['param']); } } $this->writeFileFromString($_strFileName, $xml->toString()); }
} } if ($mainNotEmpty) { // if the main category is not empty, append it to the xml-file $organization->appendChild($item); } } } // if there's need for metadata, put it in: //$metadata =& $organization->createChild('metadata'); //$schema =& $metadata->createChild('schema'); //$schema->text('ADL SCORM'); //$schemaversion =& $metadata->createChild('schemaversion'); //$schemaversion->text('1.2'); // echo $parsedDoc->toString(); exit; if (file_put_contents($exportdir . 'imsmanifest.xml', $parsedDoc->toString(MINIXML_NOWHITESPACES)) === false) { error("Writing imsmanifest.xml failed!"); exit; } $sourcefiles[] = $exportdir . "imsmanifest.xml"; // create directory for the zip-file: if (!($zipdir = make_upload_directory(export_file_area_name()))) { error(get_string("couldntcreatetempdir", "block_exabis_eportfolio")); exit; } // Delete everything inside remove_dir($zipdir, true); // Put a / on the end if (substr($zipdir, -1) != "/") { $zipdir .= "/"; }
<?php /** ensure this file is being included by a parent file */ defined('_JEXEC') or die('Restricted access'); require_once './minixml.inc.php'; $t1NumRows = 3; $t1NumCols = 3; $t2NumRows = 2; $t2NumCols = 2; $htmlDoc = new MiniXMLDoc(); $htmlArray = array('html' => array('head' => array('title' => 'XML::Mini Generated HTML page', 'style' => 'body,td,a,p,.harray(font-family:arial,sans-serif;) .qarray(text-decoration:none; color:#0000cc;)'), 'body' => array('bgcolor' => '#ffffff', 'link' => '#0000cc', 'vlink' => '#551a8b', 'h3' => 'This page was generated by XML::Mini!', 'p' => array(array('-content' => 'View the source of this page to take a look at', 'a' => array('href' => 'http://minixml.psychogenic.com', '-content' => 'XML::Mini')), array('font' => array('size' => '-1', 'color' => '#3333cc', '-content' => 'The table below was generated with php - hooray.')), array('align' => 'center', 'table' => array('cellpadding' => 5)), array('align' => 'left', '-content' => '============================', 'table' => array('width' => '75%', 'align' => 'center', 'tr' => array(array('td' => array('b' => "And here is the output of \$htmlDoc->getValue()", 'br' => '', '-content' => $htmlDoc->getValue()))))))))); # end of hash $options = array('attributes' => array('body' => array('bgcolor', 'link', 'vlink'), '-all' => array('align', 'color'), 'a' => 'href', 'font' => 'size', 'table' => array('cellpadding', 'cellspacing'))); $htmlDoc->fromArray($htmlArray, $options); print $htmlDoc->toString();
<?php /* This little test demonstrates the use of fromFile() ** mainly so you can play with the MINIXML_USEFROMFILECACHING ** option. For the moment, file caching is hardly usefull ** but this may change if we implement an XSLT interface. */ header('Content-type: text/plain'); require_once 'minixml.inc.php'; $xmlDoc = new MiniXMLDoc(); $xmlDoc->fromFile('./test.xml'); print $xmlDoc->toString();
<TD> <PRE> <div ALIGN="CENTER"><B>MiniXML output</B></div><CODE> <?php /* We create a new MiniXMLDoc object */ $returnedXMLDoc = new MiniXMLDoc(); /* And parse the returned string (assume it was stored in ** $xmlString */ $returnedXMLDoc->fromString($xmlString); /* Now to verify that the document has been initialised from ** the string, we use toString() to output an XML document. */ print "Call to : \$returnedXMLDoc-><font color=\"ee3333\">toString</font>() returns:\n"; print htmlentities($returnedXMLDoc->toString()); print "Call to : \$returnedXMLDoc-><font color=\"ee3333\">getValue</font>() returns:"; print "\n\n</CODE></PRE><FONT SIZE=\"-2\">" . $returnedXMLDoc->getValue() . "</FONT><PRE><CODE>"; /* We can now query the document, fetching elements by name ** (and path) or as a list of children. ** ** Let's start by fetching the partsRateReply element. ** Normally, you'd be verifying that the element was found ** but in order to keep this light and keep everybody from ** getting into the habit of good error checking, I'll skip ** it. ** ** getElement() returns the first element with a matching name. ** if there are multiple elements with the same name, use one ** of the methods below. */
/** * */ function makeXMLData() { require_once MIGUELBASE_MINIXML . '/minixml.inc.php'; $dump_buffer = ''; $xml = new MiniXMLDoc(); $xmlRoot =& $xml->getRoot(); $config =& $xmlRoot->createChild('config'); $child =& $config->createChild('ddbbSgbd'); $child->text(Session::getValue('host_sgbd')); $child =& $config->createChild('ddbbMainDb'); $child->text(Session::getValue('ddbb_name')); $child =& $config->createChild('ddbbServer'); $child->text(Session::getValue('host_name')); $child =& $config->createChild('ddbbUser'); $child->text(Session::getValue('ddbb_user')); $child =& $config->createChild('ddbbPassword'); $child->text(Session::getValue('ddbb_passwd')); $child =& $config->createChild('siteName'); $child->text(Session::getValue('campus_name')); $child =& $config->createChild('Institution'); $child->text(Session::getValue('inst_name')); $child =& $config->createChild('InstitutionUrl'); $child->text(Session::getValue('inst_url')); $child =& $config->createChild('language'); $child->text(Session::getValue('campus_lang')); $child =& $config->createChild('emailAdministrator'); $child->text(Session::getValue('director_email')); $child =& $config->createChild('administratorName'); $child->text(Session::getValue('admin_name')); $child =& $config->createChild('administratorSurname'); $child->text(Session::getValue('admin_surname')); $child =& $config->createChild('educationManager'); $child->text(Session::getValue('director_name')); $child =& $config->createChild('telephone'); $child->text(Session::getValue('inst_phone')); $child =& $config->createChild('maxFilledSpaceUser'); $child->text('100000'); $child =& $config->createChild('maxFilledSpaceAdmin'); $child->text('1000000'); $child =& $config->createChild('mainInterfaceWidth'); $child->text('100%'); $child =& $config->createChild('miguelVersion'); $child->text(MIGUEL_VERSION); $child =& $config->createChild('versionDb'); $child->text(MIGUEL_DDBB_VERSION); $child =& $config->createChild('userMailCanBeEmpty'); $child->text('true'); $child =& $config->createChild('userPasswordCrypted'); $child->text(Session::getValue('cript_passwd')); //Write data in tmp subfolder File::Write(CONFIG_FILE, $xml->toString()); }