} while (is_file($exportdir . $filepath) || is_dir($exportdir . $filepath) || is_link($exportdir . $filepath)); } file_put_contents($exportdir . $filepath, $filecontent); create_ressource($resources, 'RES-' . $ridentifier, $filepath); create_item($desc_organization, 'ITEM-' . $identifier, fullname($USER, $USER->id), 'RES-' . $ridentifier); $identifier++; $ridentifier++; //echo '<div class="block_exabis_eportfolio_export">'; //echo "<h3>" . get_string("categories","block_exabis_eportfolio") . "</h3>"; $owncats = get_records_select("block_exabeporcate", "userid={$USER->id} AND pid=0", "name ASC"); $i = 0; if ($owncats) { foreach ($owncats as $owncat) { unset($item); $i++; $item =& $parsedDoc->createElement('item'); $item->attribute('identifier', sprintf('B%04d', $i)); $item->attribute('isvisible', 'true'); $itemtitle =& $item->createChild('title'); $itemtitle->text($owncat->name); // get everything inside this category: $mainNotEmpty = get_category_content($item, $resources, $owncat->id, $owncat->name, $exportdir, 'data/', $identifier, $ridentifier, $viewid); $innerowncats = get_records_select("block_exabeporcate", "userid={$USER->id} AND pid='{$owncat->id}'", "name ASC"); if ($innerowncats) { foreach ($innerowncats as $innerowncat) { unset($subitem); $i++; $subitem =& $parsedDoc->createElement('item'); $subitem->attribute('identifier', sprintf('B%04d', $i)); $subitem->attribute('isvisible', 'true'); $subitemtitle =& $subitem->createChild('title');
<?php header('Content-type: text/plain'); require_once 'minixml.inc.php'; $xmlDoc = new MiniXMLDoc(); # Fetch the ROOT element for the document # (an instance of XML::Mini::Element) $xmlElement =& $xmlDoc->getRoot(); # Create a sub element $newChild =& $xmlElement->createChild('mychild'); $newChild->text('hello mommy'); # Create an orphan element $orphan =& $xmlDoc->createElement('annie'); $orphan->attribute('hair', '#ff0000'); $orphan->text('tomorrow, tomorrow'); # Adopt the orphan $newChild->prependChild($orphan); $toy =& $xmlDoc->createElement('toy'); $toy->attribute('color', '#0000ff'); $toy->createChild('type', 'teddybear'); $newChild->insertChild($toy, 1); print $xmlDoc->toString(); print "\nUhm, it's not working out - she won't stop singing... Calling removeChild()\n\n"; $newChild->removeChild($orphan); $newChild->text('???'); print $xmlDoc->toString();
$accessid->attribute('password', 'mypassword'); /* Now we list the parts we are interested. This element is ** directly under the partRateRequest element. */ $partList = $rateReq->createChild('partList'); /* Now, we add a <partnum>XXX</partnum> element for ** each part in our array. ** ** Just for fun, here I'm using the createElement/appendChild ** method, instead of $partList->createChild() */ for ($i = 0; $i < count($partNumbers); $i++) { /* using MiniXMLDoc's createElement to create ** an element with no parent */ $aPart = $xmlDoc->createElement('partNum'); /* Set a text value to this element */ $aPart->text($partNumbers[$i]); /* Now, don't forget to append this element to a parent ** or it will simply dissappear */ $partList->appendChild($aPart); } /* OK, we have our request in the xmlDoc. To pass it along to the ** server, we stringify it with: */ $xmlString = $xmlDoc->toString(); /* Here is the output from the toString() call: */ ?>
$epxsurname->cdata($USER->lastname); $epxdescription =& $epxinformation->createChild('epx:description'); $epxsurname->cdata(''); $epxcontacts =& $epxinformation->createChild('epx:contacts'); $epxcategories =& $epxportfolio->createChild('epx:categories'); $epxitems =& $epxportfolio->createChild('epx:items'); //echo '<div class="block_exabis_eportfolio_export">'; //echo "<h3>" . get_string("categories","block_exabis_eportfolio") . "</h3>"; $owncats = get_records_select("block_exabeporcate", "userid={$USER->id} AND pid=0", "name ASC"); $i = 0; if ($owncats) { foreach ($owncats as $owncat) { unset($thiscategory); unset($thiscategorytitle); $i++; $thiscategory =& $parsedDoc->createElement('epx:category'); $thiscategorytitle =& $thiscategory->createChild('epx:title'); $thiscategorytitle->cdata(spch($owncat->name)); $mainNotEmpty = block_exabis_eportfolio_get_epx_category_content($thiscategory, $epxitems, $owncat->id, $exportdir, 'data/', $ridentifier, $viewid); $innerowncats = get_records_select("block_exabeporcate", "userid={$USER->id} AND pid='{$owncat->id}'", "name ASC"); if ($innerowncats) { foreach ($innerowncats as $innerowncat) { unset($thissubcategory); unset($thissubcategorytitle); $i++; $thissubcategory =& $parsedDoc->createElement('epx:subcategory'); $thissubcategorytitle =& $thissubcategory->createChild('epx:title'); $thissubcategorytitle->cdata(spch($innerowncat->name)); $subNotEmpty = block_exabis_eportfolio_get_epx_category_content($thissubcategory, $epxitems, $innerowncat->id, $exportdir, 'data/', $ridentifier, $viewid); if ($subNotEmpty) { // if the subcategory is not empty: