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


PHP ilXmlWriter::xmlSetDtdDef方法代码示例

本文整理汇总了PHP中ilXmlWriter::xmlSetDtdDef方法的典型用法代码示例。如果您正苦于以下问题:PHP ilXmlWriter::xmlSetDtdDef方法的具体用法?PHP ilXmlWriter::xmlSetDtdDef怎么用?PHP ilXmlWriter::xmlSetDtdDef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilXmlWriter的用法示例。


在下文中一共展示了ilXmlWriter::xmlSetDtdDef方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: toXML

 /**
  * Returns a QTI xml representation of the test
  *
  * @return string The QTI xml representation of the test
  */
 public function toXML()
 {
     include_once "./Services/Xml/classes/class.ilXmlWriter.php";
     $a_xml_writer = new ilXmlWriter();
     // set xml header
     $a_xml_writer->xmlHeader();
     $a_xml_writer->xmlSetDtdDef("<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">");
     $a_xml_writer->xmlStartTag("questestinterop");
     $attrs = array("ident" => "il_" . IL_INST_ID . "_tst_" . $this->getTestId(), "title" => $this->getTitle());
     $a_xml_writer->xmlStartTag("assessment", $attrs);
     // add qti comment
     $a_xml_writer->xmlElement("qticomment", NULL, $this->getDescription());
     // add qti duration
     if ($this->enable_processing_time) {
         preg_match("/(\\d+):(\\d+):(\\d+)/", $this->processing_time, $matches);
         $a_xml_writer->xmlElement("duration", NULL, sprintf("P0Y0M0DT%dH%dM%dS", $matches[1], $matches[2], $matches[3]));
     }
     // add the rest of the preferences in qtimetadata tags, because there is no correspondent definition in QTI
     $a_xml_writer->xmlStartTag("qtimetadata");
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "ILIAS_VERSION");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->ilias->getSetting("ilias_version"));
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // anonymity
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "anonymity");
     $a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getAnonymity()));
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // question set type (fixed, random, dynamic, ...)
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "question_set_type");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getQuestionSetType());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // sequence settings
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "sequence_settings");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getSequenceSettings());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // author
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "author");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getAuthor());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // reset processing time
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "reset_processing_time");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getResetProcessingTime());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // count system
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "count_system");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getCountSystem());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // multiple choice scoring
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "mc_scoring");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getMCScoring());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // multiple choice scoring
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "score_cutting");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getScoreCutting());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // multiple choice scoring
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "password");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getPassword());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // allowed users
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "allowedUsers");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getAllowedUsers());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // allowed users time gap
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "allowedUsersTimeGap");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getAllowedUsersTimeGap());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // pass scoring
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "pass_scoring");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getPassScoring());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // score reporting date
     if ($this->getReportingDate()) {
         $a_xml_writer->xmlStartTag("qtimetadatafield");
         $a_xml_writer->xmlElement("fieldlabel", NULL, "reporting_date");
         preg_match("/(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/", $this->reporting_date, $matches);
         $a_xml_writer->xmlElement("fieldentry", NULL, sprintf("P%dY%dM%dDT%dH%dM%dS", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
         $a_xml_writer->xmlEndTag("qtimetadatafield");
     }
     // number of tries
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "nr_of_tries");
     $a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getNrOfTries()));
//.........这里部分代码省略.........
开发者ID:bheyser,项目名称:qplskl,代码行数:101,代码来源:class.ilObjTest.php

示例2: exportScorm

 /**
  * Export (authoring) scorm package
  */
 function exportScorm($a_inst, $a_target_dir, $ver, &$expLog)
 {
     $a_xml_writer = new ilXmlWriter();
     // export metadata
     $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);
     // export glossary
     if ($this->getAssignedGlossary() != 0) {
         ilUtil::makeDir($a_target_dir . "/glossary");
         include_once "./Modules/Glossary/classes/class.ilObjGlossary.php";
         include_once "./Modules/Glossary/classes/class.ilGlossaryExport.php";
         $glo_xml_writer = new ilXmlWriter();
         $glo_xml_writer->xmlSetDtdDef("<!DOCTYPE ContentObject SYSTEM \"http://www.ilias.de/download/dtd/ilias_co_3_7.dtd\">");
         // set xml header
         $glo_xml_writer->xmlHeader();
         $glos = new ilObjGlossary($this->getAssignedGlossary(), false);
         //$glos->exportHTML($a_target_dir."/glossary", $expLog);
         $glos_export = new ilGlossaryExport($glos, "xml");
         $glos->exportXML($glo_xml_writer, $glos_export->getInstId(), $a_target_dir . "/glossary", $expLog);
         $glo_xml_writer->xmlDumpFile($a_target_dir . "/glossary/glossary.xml");
         $glo_xml_writer->_XmlWriter;
     }
     $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" => "SCORM2004LearningModule"));
     // MetaData
     $this->exportXMLMetaData($a_xml_writer);
     $this->exportXMLStructureObjects($a_xml_writer, $a_inst, $expLog);
     // SCO Objects
     $expLog->write(date("[y-m-d H:i:s] ") . "Start Export Sco Objects");
     $this->exportXMLScoObjects($a_inst, $a_target_dir, $ver, $expLog);
     $expLog->write(date("[y-m-d H:i:s] ") . "Finished Export Sco Objects");
     $a_xml_writer->xmlEndTag("ContentObject");
     $a_xml_writer->xmlDumpFile($a_target_dir . '/index.xml', false);
     if ($ver == "2004 4th") {
         $revision = "4th";
         $ver = "2004";
     }
     if ($ver == "2004 3rd") {
         $revision = "3rd";
         $ver = "2004";
     }
     // add content css (note: this is also done per item)
     $css_dir = $a_target_dir . "/ilias_css_4_2";
     ilUtil::makeDir($css_dir);
     include_once "./Modules/Scorm2004/classes/class.ilScormExportUtil.php";
     ilScormExportUtil::exportContentCSS($this, $css_dir);
     // add manifest
     include_once "./Modules/Scorm2004/classes/class.ilContObjectManifestBuilder.php";
     $manifestBuilder = new ilContObjectManifestBuilder($this);
     $manifestBuilder->buildManifest($ver, $revision);
     $manifestBuilder->dump($a_target_dir);
     $xsl = file_get_contents("./Modules/Scorm2004/templates/xsl/module.xsl");
     $args = array('/_xml' => file_get_contents($a_target_dir . "/imsmanifest.xml"), '/_xsl' => $xsl);
     $xh = xslt_create();
     $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, NULL);
     xslt_free($xh);
     fputs(fopen($a_target_dir . '/index.html', 'w+'), $output);
     // copy xsd files to target
     switch ($ver) {
         case "2004":
             if ($revision == "3rd") {
                 ilUtil::rCopy('./Modules/Scorm2004/templates/xsd/adlcp_130_export_2004', $a_target_dir, false);
             }
             if ($revision == "4th") {
                 ilUtil::rCopy('./Modules/Scorm2004/templates/xsd/adlcp_130_export_2004_4th', $a_target_dir, false);
             }
             break;
         case "12":
             ilUtil::rCopy('./Modules/Scorm2004/templates/xsd/adlcp_120_export_12', $a_target_dir, false);
             break;
     }
     $a_xml_writer->_XmlWriter;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:90,代码来源:class.ilObjSCORM2004LearningModule.php

示例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;
     }
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:51,代码来源:class.ilSCORM2004Asset.php

示例4: toXML

 /**
  * Returns a QTI xml representation of the test
  *
  * @return string The QTI xml representation of the test
  * @access public
  */
 function toXML()
 {
     include_once "./Services/Xml/classes/class.ilXmlWriter.php";
     $a_xml_writer = new ilXmlWriter();
     // set xml header
     $a_xml_writer->xmlHeader();
     $a_xml_writer->xmlSetDtdDef("<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">");
     $a_xml_writer->xmlStartTag("questestinterop");
     $attrs = array("ident" => "il_" . IL_INST_ID . "_tst_" . $this->getTestId(), "title" => $this->getTitle());
     $a_xml_writer->xmlStartTag("assessment", $attrs);
     // add qti comment
     $a_xml_writer->xmlElement("qticomment", NULL, $this->getDescription());
     // add qti duration
     if ($this->enable_processing_time) {
         preg_match("/(\\d+):(\\d+):(\\d+)/", $this->processing_time, $matches);
         $a_xml_writer->xmlElement("duration", NULL, sprintf("P0Y0M0DT%dH%dM%dS", $matches[1], $matches[2], $matches[3]));
     }
     // add the rest of the preferences in qtimetadata tags, because there is no correspondent definition in QTI
     $a_xml_writer->xmlStartTag("qtimetadata");
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "ILIAS_VERSION");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->ilias->getSetting("ilias_version"));
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // anonymity
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "anonymity");
     $a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->getAnonymity()));
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // random test
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "random_test");
     $a_xml_writer->xmlElement("fieldentry", NULL, sprintf("%d", $this->isRandomTest()));
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // sequence settings
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "sequence_settings");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getSequenceSettings());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // author
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "author");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getAuthor());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // reset processing time
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "reset_processing_time");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getResetProcessingTime());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // count system
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "count_system");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getCountSystem());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // multiple choice scoring
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "mc_scoring");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getMCScoring());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // multiple choice scoring
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "score_cutting");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getScoreCutting());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // multiple choice scoring
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "password");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getPassword());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // allowed users
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "allowedUsers");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getAllowedUsers());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // allowed users time gap
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "allowedUsersTimeGap");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getAllowedUsersTimeGap());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // pass scoring
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "pass_scoring");
     $a_xml_writer->xmlElement("fieldentry", NULL, $this->getPassScoring());
     $a_xml_writer->xmlEndTag("qtimetadatafield");
     // score reporting date
     if ($this->getReportingDate()) {
         $a_xml_writer->xmlStartTag("qtimetadatafield");
         $a_xml_writer->xmlElement("fieldlabel", NULL, "reporting_date");
         preg_match("/(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/", $this->reporting_date, $matches);
         $a_xml_writer->xmlElement("fieldentry", NULL, sprintf("P%dY%dM%dDT%dH%dM%dS", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
         $a_xml_writer->xmlEndTag("qtimetadatafield");
     }
     // number of tries
     $a_xml_writer->xmlStartTag("qtimetadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "nr_of_tries");
//.........这里部分代码省略.........
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:101,代码来源:class.ilObjTest.php


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