本文整理汇总了PHP中ilXmlWriter::xmlStartTag方法的典型用法代码示例。如果您正苦于以下问题:PHP ilXmlWriter::xmlStartTag方法的具体用法?PHP ilXmlWriter::xmlStartTag怎么用?PHP ilXmlWriter::xmlStartTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilXmlWriter
的用法示例。
在下文中一共展示了ilXmlWriter::xmlStartTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: simpleExport
public function simpleExport($orgu_ref_id)
{
$nodes = $this->getStructure($orgu_ref_id);
$writer = new ilXmlWriter();
$writer->xmlStartTag("OrgUnits");
foreach ($nodes as $orgu_ref_id) {
$orgu = new ilObjOrgUnit($orgu_ref_id);
if ($orgu->getRefId() == ilObjOrgUnit::getRootOrgRefId()) {
continue;
}
$attributes = $this->getAttributesForOrgu($orgu);
$writer->xmlStartTag("OrgUnit", $attributes);
$writer->xmlElement("external_id", null, $this->buildExternalId($orgu_ref_id));
$writer->xmlElement("title", null, $orgu->getTitle());
$writer->xmlElement("description", null, $orgu->getDescription());
$writer->xmlEndTag("OrgUnit");
}
$writer->xmlEndTag("OrgUnits");
return $writer;
}
示例2: _appendXMLByObjId
/**
* Get xml of object values
*
* @access public
* @static
* @param object instance of ilXmlWriter
* @param int $a_obj_id
*/
public static function _appendXMLByObjId(ilXmlWriter $xml_writer, $a_obj_id)
{
global $ilDB;
$type = ilObject::_lookupType($a_obj_id);
// Get active field_definitions
$query = "SELECT field_id FROM adv_md_record amr " . "JOIN adv_md_record_objs amro ON amr.record_id = amro.record_id " . "JOIN adv_mdf_definition amfd ON amr.record_id = amfd.record_id " . "WHERE active = 1 " . "AND obj_type = " . $ilDB->quote($type, 'text') . " ";
$xml_writer->xmlStartTag('AdvancedMetaData');
$res = $ilDB->query($query);
while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDValue.php';
$value = ilAdvancedMDValue::_getInstance($a_obj_id, $row->field_id);
$value->appendXML($xml_writer);
}
$xml_writer->xmlEndTag('AdvancedMetaData');
}
示例3: toXML
/**
* Returns a QTI xml representation of the question
*
* Returns a QTI xml representation of the question and sets the internal
* domxml variable with the DOM XML representation of the QTI xml representation
*
* @return string The QTI xml representation of the question
* @access public
*/
function toXML($a_include_header = true, $a_include_binary = true, $a_shuffle = false, $test_output = false, $force_image_references = false)
{
global $ilias;
include_once "./Services/Math/classes/class.EvalMath.php";
$eval = new EvalMath();
$eval->suppress_errors = TRUE;
include_once "./Services/Xml/classes/class.ilXmlWriter.php";
$a_xml_writer = new ilXmlWriter();
// set xml header
$a_xml_writer->xmlHeader();
$a_xml_writer->xmlStartTag("questestinterop");
$attrs = array("ident" => "il_" . IL_INST_ID . "_qst_" . $this->object->getId(), "title" => $this->object->getTitle(), "maxattempts" => $this->object->getNrOfTries());
$a_xml_writer->xmlStartTag("item", $attrs);
// add question description
$a_xml_writer->xmlElement("qticomment", NULL, $this->object->getComment());
// add estimated working time
$workingtime = $this->object->getEstimatedWorkingTime();
$duration = sprintf("P0Y0M0DT%dH%dM%dS", $workingtime["h"], $workingtime["m"], $workingtime["s"]);
$a_xml_writer->xmlElement("duration", NULL, $duration);
// add ILIAS specific metadata
$a_xml_writer->xmlStartTag("itemmetadata");
$a_xml_writer->xmlStartTag("qtimetadata");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "ILIAS_VERSION");
$a_xml_writer->xmlElement("fieldentry", NULL, $ilias->getSetting("ilias_version"));
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "QUESTIONTYPE");
$a_xml_writer->xmlElement("fieldentry", NULL, CLOZE_TEST_IDENTIFIER);
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "AUTHOR");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getAuthor());
$a_xml_writer->xmlEndTag("qtimetadatafield");
// additional content editing information
$this->addAdditionalContentEditingModeInformation($a_xml_writer);
$this->addGeneralMetadata($a_xml_writer);
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "textgaprating");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getTextgapRating());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "fixedTextLength");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getFixedTextLength());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "identicalScoring");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getIdenticalScoring());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "combinations");
$a_xml_writer->xmlElement("fieldentry", NULL, base64_encode(json_encode($this->object->getGapCombinations())));
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlEndTag("qtimetadata");
$a_xml_writer->xmlEndTag("itemmetadata");
// PART I: qti presentation
$attrs = array("label" => $this->object->getTitle());
$a_xml_writer->xmlStartTag("presentation", $attrs);
// add flow to presentation
$a_xml_writer->xmlStartTag("flow");
$questionText = $this->object->getQuestion() ? $this->object->getQuestion() : ' ';
$this->object->addQTIMaterial($a_xml_writer, $questionText);
$text_parts = preg_split("/\\[gap.*?\\[\\/gap\\]/", $this->object->getClozeText());
// add material with question text to presentation
for ($i = 0; $i <= $this->object->getGapCount(); $i++) {
$this->object->addQTIMaterial($a_xml_writer, $text_parts[$i]);
if ($i < $this->object->getGapCount()) {
// add gap
$gap = $this->object->getGap($i);
switch ($gap->getType()) {
case CLOZE_SELECT:
// comboboxes
$attrs = array("ident" => "gap_{$i}", "rcardinality" => "Single");
$a_xml_writer->xmlStartTag("response_str", $attrs);
$solution = $this->object->getSuggestedSolution($i);
if (count($solution)) {
if (preg_match("/il_(\\d*?)_(\\w+)_(\\d+)/", $solution["internal_link"], $matches)) {
$attrs = array("label" => "suggested_solution");
$a_xml_writer->xmlStartTag("material", $attrs);
$intlink = "il_" . IL_INST_ID . "_" . $matches[2] . "_" . $matches[3];
if (strcmp($matches[1], "") != 0) {
$intlink = $solution["internal_link"];
}
$a_xml_writer->xmlElement("mattext", NULL, $intlink);
$a_xml_writer->xmlEndTag("material");
}
}
$attrs = array("shuffle" => $gap->getShuffle() ? "Yes" : "No");
$a_xml_writer->xmlStartTag("render_choice", $attrs);
// add answers
foreach ($gap->getItems() as $answeritem) {
//.........这里部分代码省略.........
示例4: toXML
/**
* To Xml.
* This method writes only the subset Field
* Use class.ilAdvancedMDRecordXMLWriter to generate a complete xml presentation.
*
* @param ilXmlWriter $a_writer
*/
public function toXML(ilXmlWriter $a_writer)
{
$a_writer->xmlStartTag('Field', array('id' => $this->generateImportId($this->getFieldId()), 'searchable' => $this->isSearchable() ? 'Yes' : 'No', 'fieldType' => self::getTypeString($this->getType())));
$a_writer->xmlElement('FieldTitle', null, $this->getTitle());
$a_writer->xmlElement('FieldDescription', null, $this->getDescription());
$a_writer->xmlElement('FieldPosition', null, $this->getPosition());
$this->addPropertiesToXML($a_writer);
$a_writer->xmlEndTag('Field');
}
示例5: exportPDF
function exportPDF($a_inst, $a_target_dir, &$expLog)
{
global $tpl, $lng, $ilCtrl;
$a_xml_writer = new ilXmlWriter();
$a_xml_writer->xmlStartTag("ContentObject", array("Type" => "SCORM2004SCO"));
$this->exportPDFPrepareXmlNFiles($a_inst, $a_target_dir, $expLog, $a_xml_writer);
$a_xml_writer->xmlEndTag("ContentObject");
include_once 'Services/Transformation/classes/class.ilXML2FO.php';
$xml2FO = new ilXML2FO();
$xml2FO->setXSLTLocation('./Modules/Scorm2004/templates/xsl/contentobject2fo.xsl');
$xml2FO->setXMLString($a_xml_writer->xmlDumpMem());
$xml2FO->setXSLTParams(array('target_dir' => $a_target_dir));
$xml2FO->transform();
$fo_string = $xml2FO->getFOString();
$fo_xml = simplexml_load_string($fo_string);
$fo_ext = $fo_xml->xpath("//fo:declarations");
$fo_ext = $fo_ext[0];
$results = array();
include_once "./Services/Utilities/classes/class.ilFileUtils.php";
ilFileUtils::recursive_dirscan($a_target_dir . "/objects", $results);
if (is_array($results["file"])) {
foreach ($results["file"] as $key => $value) {
$e = $fo_ext->addChild("fox:embedded-file", "", "http://xml.apache.org/fop/extensions");
$e->addAttribute("src", $results[path][$key] . $value);
$e->addAttribute("name", $value);
$e->addAttribute("desc", "");
}
}
$fo_string = $fo_xml->asXML();
$a_xml_writer->_XmlWriter;
return $fo_string;
}
示例6: toXML
/**
* Returns a QTI xml representation of the question
*
* Returns a QTI xml representation of the question and sets the internal
* domxml variable with the DOM XML representation of the QTI xml representation
*
* @return string The QTI xml representation of the question
* @access public
*/
function toXML($a_include_header = true, $a_include_binary = true, $a_shuffle = false, $test_output = false, $force_image_references = false)
{
global $ilias;
include_once "./classes/class.ilXmlWriter.php";
$a_xml_writer = new ilXmlWriter();
// set xml header
$a_xml_writer->xmlHeader();
$a_xml_writer->xmlStartTag("questestinterop");
$attrs = array("ident" => "il_" . IL_INST_ID . "_qst_" . $this->object->getId(), "title" => $this->object->getTitle());
$a_xml_writer->xmlStartTag("item", $attrs);
// add question description
$a_xml_writer->xmlElement("qticomment", NULL, $this->object->getComment());
// add estimated working time
$workingtime = $this->object->getEstimatedWorkingTime();
$duration = sprintf("P0Y0M0DT%dH%dM%dS", $workingtime["h"], $workingtime["m"], $workingtime["s"]);
$a_xml_writer->xmlElement("duration", NULL, $duration);
// add ILIAS specific metadata
$a_xml_writer->xmlStartTag("itemmetadata");
$a_xml_writer->xmlStartTag("qtimetadata");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "ILIAS_VERSION");
$a_xml_writer->xmlElement("fieldentry", NULL, $ilias->getSetting("ilias_version"));
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "QUESTIONTYPE");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getQuestionType());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "AUTHOR");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getAuthor());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "points");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getPoints());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "textrating");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getTextRating());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "requestedanswers");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getCorrectAnswers());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlEndTag("qtimetadata");
// removed additional metadata from assFormulaQuestion
$a_xml_writer->xmlEndTag("itemmetadata");
// PART I: qti presentation
$attrs = array("label" => $this->object->getTitle());
$a_xml_writer->xmlStartTag("presentation", $attrs);
// add flow to presentation
$a_xml_writer->xmlStartTag("flow");
// add material with question text to presentation
$this->object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
// add answers to presentation
$attrs = array();
$attrs = array("ident" => "SYNTAX TREE", "rcardinality" => "Multiple");
$a_xml_writer->xmlStartTag("response_lid", $attrs);
$solution = $this->object->getSuggestedSolution(0);
if (count($solution)) {
if (preg_match("/il_(\\d*?)_(\\w+)_(\\d+)/", $solution["internal_link"], $matches)) {
$a_xml_writer->xmlStartTag("material");
$intlink = "il_" . IL_INST_ID . "_" . $matches[2] . "_" . $matches[3];
if (strcmp($matches[1], "") != 0) {
$intlink = $solution["internal_link"];
}
$attrs = array("label" => "suggested_solution");
$a_xml_writer->xmlElement("mattext", $attrs, $intlink);
$a_xml_writer->xmlEndTag("material");
}
}
// shuffle output
$attrs = array();
$a_xml_writer->xmlStartTag("render_choice", $attrs);
$answers =& $this->object->getAnswers();
$akeys = array_keys($answers);
if ($this->object->getShuffle() && $a_shuffle) {
$akeys = $this->object->pcArrayShuffle($akeys);
}
// add answers
foreach ($akeys as $index) {
$answer = $answers[$index];
$attrs = array("ident" => $index);
$a_xml_writer->xmlStartTag("response_label", $attrs);
$this->object->addQTIMaterial($a_xml_writer, $answer->getAnswertext());
$a_xml_writer->xmlEndTag("response_label");
}
$a_xml_writer->xmlEndTag("render_choice");
$a_xml_writer->xmlEndTag("response_lid");
$a_xml_writer->xmlEndTag("flow");
$a_xml_writer->xmlEndTag("presentation");
// PART II: qti resprocessing
//.........这里部分代码省略.........
示例7: 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;
}
示例8: toXML
/**
* Write link XML
* @param ilXmlWriter $writer
* @return
*/
public function toXML(ilXmlWriter $writer)
{
foreach (self::getAllItemIds($this->getLinkResourceId()) as $link_id) {
$link = self::lookupItem($this->getLinkResourceId(), $link_id);
$writer->xmlStartTag('WebLink', array('id' => $link['link_id'], 'active' => $link['active'] ? 1 : 0, 'valid' => $link['valid'] ? 1 : 0, 'disableValidation' => $link['disable_check'] ? 1 : 0));
$writer->xmlElement('Title', array(), $link['title']);
$writer->xmlElement('Description', array(), $link['description']);
$writer->xmlElement('Target', array(), $link['target']);
// Dynamic parameters
include_once './Modules/WebResource/classes/class.ilParameterAppender.php';
foreach (ilParameterAppender::_getParams($link_id) as $param_id => $param) {
$value = '';
switch ($param['value']) {
case LINKS_USER_ID:
$value = 'userId';
break;
case LINKS_LOGIN:
$value = 'userName';
break;
case LINKS_MATRICULATION:
$value = 'matriculation';
break;
}
if (!$value) {
// Fix for deprecated LINKS_SESSION
continue;
}
$writer->xmlElement('DynamicParameter', array('id' => $param_id, 'name' => $param['name'], 'type' => $value));
}
$writer->xmlEndTag('WebLink');
}
return true;
}
示例9: 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()));
//.........这里部分代码省略.........
示例10: toXML
/**
* Returns a QTI xml representation of the question
*
* Returns a QTI xml representation of the question and sets the internal
* domxml variable with the DOM XML representation of the QTI xml representation
*
* @return string The QTI xml representation of the question
* @access public
*/
function toXML($a_include_header = true, $a_include_binary = true, $a_shuffle = false, $test_output = false, $force_image_references = false)
{
global $ilias;
include_once "./Services/Xml/classes/class.ilXmlWriter.php";
$a_xml_writer = new ilXmlWriter();
// set xml header
$a_xml_writer->xmlHeader();
$a_xml_writer->xmlStartTag("questestinterop");
$attrs = array("ident" => "il_" . IL_INST_ID . "_qst_" . $this->object->getId(), "title" => $this->object->getTitle(), "maxattempts" => $this->object->getNrOfTries());
$a_xml_writer->xmlStartTag("item", $attrs);
// add question description
$a_xml_writer->xmlElement("qticomment", NULL, $this->object->getComment());
// add estimated working time
$workingtime = $this->object->getEstimatedWorkingTime();
$duration = sprintf("P0Y0M0DT%dH%dM%dS", $workingtime["h"], $workingtime["m"], $workingtime["s"]);
$a_xml_writer->xmlElement("duration", NULL, $duration);
// add ILIAS specific metadata
$a_xml_writer->xmlStartTag("itemmetadata");
$a_xml_writer->xmlStartTag("qtimetadata");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "ILIAS_VERSION");
$a_xml_writer->xmlElement("fieldentry", NULL, $ilias->getSetting("ilias_version"));
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "QUESTIONTYPE");
$a_xml_writer->xmlElement("fieldentry", NULL, TEXT_QUESTION_IDENTIFIER);
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "AUTHOR");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getAuthor());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "textrating");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getTextRating());
$a_xml_writer->xmlEndTag("qtimetadatafield");
/*
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "keywords");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getKeywords());
$a_xml_writer->xmlEndTag("qtimetadatafield");
*/
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "matchcondition");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->matchcondition);
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "termscoring");
$scores = serialize($this->object->getAnswers());
$a_xml_writer->xmlElement("fieldentry", NULL, $scores);
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "termrelation");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getKeywordRelation());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "specificfeedback");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getKeywordRelation());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlEndTag("qtimetadata");
$a_xml_writer->xmlEndTag("itemmetadata");
// PART I: qti presentation
$attrs = array("label" => $this->object->getTitle());
$a_xml_writer->xmlStartTag("presentation", $attrs);
// add flow to presentation
$a_xml_writer->xmlStartTag("flow");
// add material with question text to presentation
$this->object->addQTIMaterial($a_xml_writer, $this->object->getQuestion());
// add information on response rendering
$attrs = array("ident" => "TEXT", "rcardinality" => "Ordered");
$a_xml_writer->xmlStartTag("response_str", $attrs);
$attrs = array("fibtype" => "String", "prompt" => "Box");
if ($this->object->getMaxNumOfChars() > 0) {
$attrs["maxchars"] = $this->object->getMaxNumOfChars();
}
$a_xml_writer->xmlStartTag("render_fib", $attrs);
$attrs = array("ident" => "A");
$a_xml_writer->xmlStartTag("response_label", $attrs);
$a_xml_writer->xmlEndTag("response_label");
$a_xml_writer->xmlEndTag("render_fib");
$solution = $this->object->getSuggestedSolution(0);
if (count($solution)) {
if (preg_match("/il_(\\d*?)_(\\w+)_(\\d+)/", $solution["internal_link"], $matches)) {
$a_xml_writer->xmlStartTag("material");
$intlink = "il_" . IL_INST_ID . "_" . $matches[2] . "_" . $matches[3];
if (strcmp($matches[1], "") != 0) {
$intlink = $solution["internal_link"];
}
$attrs = array("label" => "suggested_solution");
$a_xml_writer->xmlElement("mattext", $attrs, $intlink);
$a_xml_writer->xmlEndTag("material");
}
//.........这里部分代码省略.........
示例11: toXML
/**
* Returns a QTI xml representation of the survey
*
* @return string The QTI xml representation of the survey
* @access public
*/
function toXML()
{
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" => $this->getSurveyId(), "title" => $this->getTitle());
$a_xml_writer->xmlStartTag("survey", $attrs);
$a_xml_writer->xmlElement("description", NULL, $this->getDescription());
$a_xml_writer->xmlElement("author", NULL, $this->getAuthor());
$a_xml_writer->xmlStartTag("objectives");
$attrs = array("label" => "introduction");
$this->addMaterialTag($a_xml_writer, $this->getIntroduction(), TRUE, TRUE, $attrs);
$attrs = array("label" => "outro");
$this->addMaterialTag($a_xml_writer, $this->getOutro(), TRUE, TRUE, $attrs);
$a_xml_writer->xmlEndTag("objectives");
if ($this->getAnonymize()) {
$attribs = array("enabled" => "1");
} else {
$attribs = array("enabled" => "0");
}
$a_xml_writer->xmlElement("anonymisation", $attribs);
$a_xml_writer->xmlStartTag("restrictions");
if ($this->getAnonymize() == 2) {
$attribs = array("type" => "free");
} else {
$attribs = array("type" => "restricted");
}
$a_xml_writer->xmlElement("access", $attribs);
if ($this->getStartDate()) {
$attrs = array("type" => "date");
preg_match("/(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/", $this->getStartDate(), $matches);
$a_xml_writer->xmlElement("startingtime", $attrs, sprintf("%04d-%02d-%02dT%02d:%02d:00", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
}
if ($this->getEndDate()) {
$attrs = array("type" => "date");
preg_match("/(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/", $this->getEndDate(), $matches);
$a_xml_writer->xmlElement("endingtime", $attrs, sprintf("%04d-%02d-%02dT%02d:%02d:00", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
}
$a_xml_writer->xmlEndTag("restrictions");
// constraints
$pages =& $this->getSurveyPages();
$hasconstraints = FALSE;
foreach ($pages as $question_array) {
foreach ($question_array as $question) {
if (count($question["constraints"])) {
$hasconstraints = TRUE;
}
}
}
if ($hasconstraints) {
$a_xml_writer->xmlStartTag("constraints");
foreach ($pages as $question_array) {
foreach ($question_array as $question) {
if (count($question["constraints"])) {
// found constraints
foreach ($question["constraints"] as $constraint) {
$attribs = array("sourceref" => $question["question_id"], "destref" => $constraint["question"], "relation" => $constraint["short"], "value" => $constraint["value"], "conjunction" => $constraint["conjunction"]);
$a_xml_writer->xmlElement("constraint", $attribs);
}
}
}
}
$a_xml_writer->xmlEndTag("constraints");
}
// add the rest of the preferences in qtimetadata tags, because there is no correspondent definition in QTI
$a_xml_writer->xmlStartTag("metadata");
$a_xml_writer->xmlStartTag("metadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "evaluation_access");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getEvaluationAccess());
$a_xml_writer->xmlEndTag("metadatafield");
$a_xml_writer->xmlStartTag("metadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "status");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getStatus());
$a_xml_writer->xmlEndTag("metadatafield");
$a_xml_writer->xmlStartTag("metadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "display_question_titles");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->getShowQuestionTitles());
$a_xml_writer->xmlEndTag("metadatafield");
$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("survey");
$attribs = array("id" => $this->getId());
$a_xml_writer->xmlStartTag("surveyquestions", $attribs);
//.........这里部分代码省略.........
示例12: getXmlRepresentation
/**
* Get xml representation
* <dataset install_id="123" install_url="...">
* <types entity="table_name" version="4.0.1">
* <ftype name="field_1" type="text" />
* <ftype name="field_2" type="date" />
* <ftype name="field_3" type="integer" />
* </types>
* <types ...>
* ...
* </types>
* <set entity="table_name">
* <rec>
* <field_1>content</field_1>
* <field_2>my_date</field_2>
* <field_3>my_number</field_3>
* </rec>
* ...
* </set>
* </dataset>
*/
final function getXmlRepresentation($a_entity, $a_schema_version, $a_ids, $a_field = "", $a_omit_header = false, $a_omit_types = false)
{
$this->dircnt = 1;
// step 1: check target release and supported versions
// step 2: init writer
include_once "./Services/Xml/classes/class.ilXmlWriter.php";
$writer = new ilXmlWriter();
if (!$a_omit_header) {
$writer->xmlHeader();
}
// collect namespaces
$namespaces = $prefixes = array();
$this->getNamespaces($namespaces, $a_entity, $a_schema_version);
$atts = array("InstallationId" => IL_INST_ID, "InstallationUrl" => ILIAS_HTTP_PATH, "TopEntity" => $a_entity);
$cnt = 1;
foreach ($namespaces as $entity => $ns) {
$prefix = "ns" . $cnt;
$prefixes[$entity] = $prefix;
// $atts["xmlns:".$prefix] = $ns;
$cnt++;
}
$writer->xmlStartTag($this->getDSPrefixString() . 'DataSet', $atts);
// add types
if (!$a_omit_types) {
$this->addTypesXml($writer, $a_entity, $a_schema_version);
}
// add records
$this->addRecordsXml($writer, $prefixes, $a_entity, $a_schema_version, $a_ids, $a_field = "");
$writer->xmlEndTag($this->getDSPrefixString() . "DataSet");
//if ($a_entity == "mep")
//{
// echo "<pre>".htmlentities($writer->xmlDumpMem(true))."</pre>"; exit;
//}
return $writer->xmlDumpMem(false);
}
示例13: 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");
//.........这里部分代码省略.........
示例14: toXML
/**
* Write webresource xml
* @param ilXmlWriter $writer
* @return
*/
public function toXML(ilXmlWriter $writer)
{
$attribs = array("obj_id" => "il_" . IL_INST_ID . "_webr_" . $this->getId());
$writer->xmlStartTag('WebLinks', $attribs);
// LOM MetaData
include_once 'Services/MetaData/classes/class.ilMD2XML.php';
$md2xml = new ilMD2XML($this->getId(), $this->getId(), 'webr');
$md2xml->startExport();
$writer->appendXML($md2xml->getXML());
// Sorting
include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
switch (ilContainerSortingSettings::_lookupSortMode($this->getId())) {
case ilContainer::SORT_MANUAL:
$writer->xmlElement('Sorting', array('type' => 'Manual'));
break;
case ilContainer::SORT_TITLE:
default:
$writer->xmlElement('Sorting', array('type' => 'Title'));
break;
}
// All links
include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
$links = new ilLinkResourceItems($this->getId());
$links->toXML($writer);
$writer->xmlEndTag('WebLinks');
return true;
}
示例15: _exportContainerSettings
public static function _exportContainerSettings(ilXmlWriter $a_xml, $a_obj_id)
{
// container settings
$settings = self::_getContainerSettings($a_obj_id);
if (sizeof($settings)) {
$a_xml->xmlStartTag("ContainerSettings");
foreach ($settings as $keyword => $value) {
// :TODO: proper custom icon export/import
if (stristr($keyword, "icon")) {
continue;
}
$a_xml->xmlStartTag('ContainerSetting', array('id' => $keyword));
$a_xml->xmlData($value);
$a_xml->xmlEndTag("ContainerSetting");
}
$a_xml->xmlEndTag("ContainerSettings");
}
}