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


PHP ilXmlWriter::xmlDumpMem方法代码示例

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


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

示例1: xmlDumpMem

 function xmlDumpMem($format = TRUE)
 {
     $this->getXML();
     return parent::xmlDumpMem($format);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:5,代码来源:class.ilTestResultsToXML.php

示例2: toXML

 /**
  * export questions to xml
  */
 function toXML($questions)
 {
     if (!is_array($questions)) {
         $questions =& $this->getQuestions();
     }
     if (count($questions) == 0) {
         $questions =& $this->getQuestions();
     }
     $xml = "";
     include_once "./Services/Xml/classes/class.ilXmlWriter.php";
     $a_xml_writer = new ilXmlWriter();
     // set xml header
     $a_xml_writer->xmlHeader();
     $attrs = array("xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance", "xsi:noNamespaceSchemaLocation" => "http://www.ilias.de/download/xsd/ilias_survey_4_2.xsd");
     $a_xml_writer->xmlStartTag("surveyobject", $attrs);
     $attrs = array("id" => "qpl_" . $this->getId(), "label" => $this->getTitle(), "online" => $this->getOnline());
     $a_xml_writer->xmlStartTag("surveyquestions", $attrs);
     $a_xml_writer->xmlElement("dummy", NULL, "dummy");
     // add ILIAS specific metadata
     $a_xml_writer->xmlStartTag("metadata");
     $a_xml_writer->xmlStartTag("metadatafield");
     $a_xml_writer->xmlElement("fieldlabel", NULL, "SCORM");
     include_once "./Services/MetaData/classes/class.ilMD.php";
     $md = new ilMD($this->getId(), 0, $this->getType());
     $writer = new ilXmlWriter();
     $md->toXml($writer);
     $metadata = $writer->xmlDumpMem();
     $a_xml_writer->xmlElement("fieldentry", NULL, $metadata);
     $a_xml_writer->xmlEndTag("metadatafield");
     $a_xml_writer->xmlEndTag("metadata");
     $a_xml_writer->xmlEndTag("surveyquestions");
     $a_xml_writer->xmlEndTag("surveyobject");
     $xml = $a_xml_writer->xmlDumpMem(FALSE);
     $questionxml = "";
     foreach ($questions as $key => $value) {
         $questiontype = $this->getQuestiontype($value);
         include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
         SurveyQuestion::_includeClass($questiontype);
         $question = new $questiontype();
         $question->loadFromDb($value);
         $questionxml .= $question->toXML(false);
     }
     $xml = str_replace("<dummy>dummy</dummy>", $questionxml, $xml);
     return $xml;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:48,代码来源:class.ilObjSurveyQuestionPool.php

示例3: getXmlRepresentation

 /**
  * Get xml representation
  *
  * @param	string		entity
  * @param	string		schema version
  * @param	string		id
  * @return	string		xml string
  */
 public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
 {
     $parts = explode(":", $a_id);
     if (sizeof($parts) != 2) {
         return;
     }
     $obj_id = $parts[0];
     $rec_id = $parts[1];
     // any data for current record and object?
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php';
     $raw = ilAdvancedMDValues::findByObjectId($obj_id);
     if (!$raw) {
         return;
     }
     // gather sub-item data from value entries
     $sub_items = array();
     foreach ($raw as $item) {
         $sub_items[$item["sub_type"]][] = $item["sub_id"];
     }
     // gather all relevant data
     $items = array();
     foreach ($sub_items as $sub_type => $sub_ids) {
         foreach (array_unique($sub_ids) as $sub_id) {
             $values_record = new ilAdvancedMDValues($rec_id, $obj_id, $sub_type, $sub_id);
             $defs = $values_record->getDefinitions();
             $values_record->read();
             foreach ($values_record->getADTGroup()->getElements() as $element_id => $element) {
                 if (!$element->isNull()) {
                     $def = $defs[$element_id];
                     $items[$rec_id][] = array('id' => $def->getImportId(), 'sub_type' => $sub_type, 'sub_id' => $sub_id, 'value' => $def->getValueForXML($element));
                 }
             }
         }
     }
     // we only want non-empty fields
     if (sizeof($items)) {
         $xml = new ilXmlWriter();
         foreach ($items as $record_id => $record_items) {
             // no need to state record id here
             $xml->xmlStartTag('AdvancedMetaData');
             foreach ($record_items as $item) {
                 $xml->xmlElement('Value', array('id' => $item['id'], 'sub_type' => $item['sub_type'], 'sub_id' => $item['sub_id']), $item['value']);
             }
             $xml->xmlEndTag('AdvancedMetaData');
         }
         return $xml->xmlDumpMem(false);
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:56,代码来源:class.ilAdvancedMetaDataExporter.php


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