本文整理汇总了PHP中ilXmlWriter::appendXml方法的典型用法代码示例。如果您正苦于以下问题:PHP ilXmlWriter::appendXml方法的具体用法?PHP ilXmlWriter::appendXml怎么用?PHP ilXmlWriter::appendXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilXmlWriter
的用法示例。
在下文中一共展示了ilXmlWriter::appendXml方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processExporter
/**
* Process exporter
*
* @param
* @return
*/
function processExporter($a_comp, $a_class, $a_entity, $a_target_release, $a_id)
{
$success = true;
if (!is_array($a_id)) {
if ($a_id == "") {
return;
}
$a_id = array($a_id);
}
// get exporter object
$export_class_file = "./" . $a_comp . "/classes/class." . $a_class . ".php";
//echo "1-".$export_class_file."-"; exit;
if (!is_file($export_class_file)) {
echo "1-not found:" . $export_class_file . "-";
exit;
return false;
}
include_once $export_class_file;
$exp = new $a_class();
if (!isset($this->cnt[$a_comp])) {
$this->cnt[$a_comp] = 1;
} else {
$this->cnt[$a_comp]++;
}
$set_dir_relative = $a_comp . "/set_" . $this->cnt[$a_comp];
$set_dir_absolute = $this->export_run_dir . "/" . $set_dir_relative;
ilUtil::makeDirParents($set_dir_absolute);
$exp->init();
$sv = $exp->determineSchemaVersion($a_entity, $a_target_release);
// process head dependencies
$sequence = $exp->getXmlExportHeadDependencies($a_entity, $a_target_release, $a_id);
foreach ($sequence as $s) {
$comp = explode("/", $s["component"]);
$exp_class = "il" . $comp[1] . "Exporter";
$s = $this->processExporter($s["component"], $exp_class, $s["entity"], $a_target_release, $s["ids"]);
if (!$s) {
$success = false;
}
}
// write export.xml file
$export_writer = new ilXmlWriter();
$export_writer->xmlHeader();
$attribs = array("InstallationId" => IL_INST_ID, "InstallationUrl" => ILIAS_HTTP_PATH, "Entity" => $a_entity, "SchemaVersion" => $sv["schema_version"], "TargetRelease" => $a_target_release, "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", "xmlns:exp" => "http://www.ilias.de/Services/Export/exp/4_1", "xsi:schemaLocation" => "http://www.ilias.de/Services/Export/exp/4_1 " . ILIAS_HTTP_PATH . "/xml/ilias_export_4_1.xsd");
if ($sv["namespace"] != "" && $sv["xsd_file"] != "") {
$attribs["xsi:schemaLocation"] .= " " . $sv["namespace"] . " " . ILIAS_HTTP_PATH . "/xml/" . $sv["xsd_file"];
$attribs["xmlns"] = $sv["namespace"];
}
if ($sv["uses_dataset"]) {
$attribs["xsi:schemaLocation"] .= " " . "http://www.ilias.de/Services/DataSet/ds/4_3 " . ILIAS_HTTP_PATH . "/xml/ilias_ds_4_3.xsd";
$attribs["xmlns:ds"] = "http://www.ilias.de/Services/DataSet/ds/4_3";
}
$export_writer->xmlStartTag('exp:Export', $attribs);
$dir_cnt = 1;
foreach ($a_id as $id) {
$exp->setExportDirectories($set_dir_relative . "/expDir_" . $dir_cnt, $set_dir_absolute . "/expDir_" . $dir_cnt);
$export_writer->xmlStartTag('exp:ExportItem', array("Id" => $id));
//$xml = $exp->getXmlRepresentation($a_entity, $a_target_release, $id);
$xml = $exp->getXmlRepresentation($a_entity, $sv["schema_version"], $id);
$export_writer->appendXml($xml);
$export_writer->xmlEndTag('exp:ExportItem');
$dir_cnt++;
}
$export_writer->xmlEndTag('exp:Export');
$export_writer->xmlDumpFile($set_dir_absolute . "/export.xml", false);
$this->manifest_writer->xmlElement("ExportFile", array("Component" => $a_comp, "Path" => $set_dir_relative . "/export.xml"));
// process tail dependencies
$sequence = $exp->getXmlExportTailDependencies($a_entity, $a_target_release, $a_id);
foreach ($sequence as $s) {
$comp = explode("/", $s["component"]);
$exp_class = "il" . $comp[1] . "Exporter";
$s = $this->processExporter($s["component"], $exp_class, $s["entity"], $a_target_release, $s["ids"]);
if (!$s) {
$success = false;
}
}
return $success;
}