当前位置: 首页>>代码示例>>PHP>>正文


PHP ilXmlWriter::appendXml方法代码示例

本文整理汇总了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;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:83,代码来源:class.ilExport.php


注:本文中的ilXmlWriter::appendXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。