本文整理汇总了PHP中ilXmlWriter::xmlDumpFile方法的典型用法代码示例。如果您正苦于以下问题:PHP ilXmlWriter::xmlDumpFile方法的具体用法?PHP ilXmlWriter::xmlDumpFile怎么用?PHP ilXmlWriter::xmlDumpFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilXmlWriter
的用法示例。
在下文中一共展示了ilXmlWriter::xmlDumpFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildInsertStatementsXML
/**
*
* @param object $a_table
* @param object $a_file [optional]
* @return
*/
function buildInsertStatementsXML($a_table, $a_basedir)
{
global $ilLog;
include_once './Services/Xml/classes/class.ilXmlWriter.php';
$w = new ilXmlWriter();
$w->xmlStartTag('Table', array('name' => $a_table));
$set = $this->il_db->query("SELECT * FROM `" . $a_table . "`");
$ins_st = "";
$first = true;
while ($rec = $this->il_db->fetchAssoc($set)) {
#$ilLog->write('Num: '.$num++);
$w->xmlStartTag('Row');
$fields = array();
$types = array();
$values = array();
foreach ($rec as $f => $v) {
if ($this->fields[$f]['type'] == 'text' and $this->fields[$f]['length'] >= 1000) {
$v = $this->shortenText($a_table, $f, $v, $this->fields[$f]['length']);
}
$w->xmlElement('Value', array('name' => $f, 'type' => $this->fields[$f]['type']), $v);
}
$w->xmlEndTag('Row');
}
$w->xmlEndTag('Table');
$w->xmlDumpFile($a_basedir . '/' . $a_table . '.xml', FALSE);
}
示例2: xmlDumpFile
function xmlDumpFile($file, $format = TRUE)
{
$this->getXML();
return parent::xmlDumpFile($file, $format);
}
示例3: exportScorm
function exportScorm($a_inst, $a_target_dir, $ver, &$expLog)
{
copy('./xml/ilias_co_3_7.dtd', $a_target_dir . '/ilias_co_3_7.dtd');
copy('./Modules/Scorm2004/templates/xsl/sco.xsl', $a_target_dir . '/sco.xsl');
$a_xml_writer = new ilXmlWriter();
// MetaData
//file_put_contents($a_target_dir.'/indexMD.xml','<lom xmlns="http://ltsc.ieee.org/xsd/LOM"><general/><classification/></lom>');
$this->exportXMLMetaData($a_xml_writer);
$metadata_xml = $a_xml_writer->xmlDumpMem(false);
$a_xml_writer->_XmlWriter;
$xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/metadata.xsl");
$args = array('/_xml' => $metadata_xml, '/_xsl' => $xsl);
$xh = xslt_create();
$output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, NULL);
xslt_free($xh);
file_put_contents($a_target_dir . '/indexMD.xml', $output);
$a_xml_writer = new ilXmlWriter();
// set dtd definition
$a_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
// set generated comment
$a_xml_writer->xmlSetGenCmt("Export of ILIAS Content Module " . $this->getId() . " of installation " . $a_inst . ".");
// set xml header
$a_xml_writer->xmlHeader();
global $ilBench;
$a_xml_writer->xmlStartTag("ContentObject", array("Type" => "SCORM2004SCO"));
$this->exportXMLMetaData($a_xml_writer);
$this->exportXMLPageObjects($a_target_dir, $a_xml_writer, $a_inst, $expLog);
$this->exportXMLMediaObjects($a_xml_writer, $a_inst, $a_target_dir, $expLog);
$this->exportHTML($a_inst, $a_target_dir, $expLog);
//overwrite scorm.js for scrom 1.2
if ($ver == "12") {
copy('./Modules/Scorm2004/scripts/scorm_12.js', $a_target_dir . '/js/scorm.js');
}
$a_xml_writer->xmlEndTag("ContentObject");
$a_xml_writer->xmlDumpFile($a_target_dir . '/index.xml', false);
$a_xml_writer->_XmlWriter;
// export sco data (currently only objective) to sco.xml
if ($this->getType() == "sco") {
$objectives_text = "";
$a_xml_writer = new ilXmlWriter();
$tr_data = $this->getObjectives();
foreach ($tr_data as $data) {
$objectives_text .= $data->getObjectiveID();
}
$a_xml_writer->xmlStartTag("sco");
$a_xml_writer->xmlElement("objective", null, $objectives_text);
$a_xml_writer->xmlEndTag("sco");
$a_xml_writer->xmlDumpFile($a_target_dir . '/sco.xml', false);
$a_xml_writer->_XmlWriter;
}
}
示例4: 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;
}