本文整理汇总了PHP中ilXmlWriter::xmlElement方法的典型用法代码示例。如果您正苦于以下问题:PHP ilXmlWriter::xmlElement方法的具体用法?PHP ilXmlWriter::xmlElement怎么用?PHP ilXmlWriter::xmlElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilXmlWriter
的用法示例。
在下文中一共展示了ilXmlWriter::xmlElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toXml
/**
* Write xml
* @param ilXmlWriter $writer
*/
public function toXml(ilXmlWriter $writer)
{
switch ($this->getPatternSubType()) {
case ilDidacticTemplateFilterPattern::PATTERN_SUBTYPE_REGEX:
default:
$writer->xmlElement('excludePattern', array('preg' => $this->getPattern()));
}
}
示例2: 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;
}
示例3: addPropertiesToXML
protected function addPropertiesToXML(ilXmlWriter $a_writer)
{
$a_writer->xmlElement('FieldValue', array("id" => "min"), $this->getMin());
$a_writer->xmlElement('FieldValue', array("id" => "max"), $this->getMax());
$a_writer->xmlElement('FieldValue', array("id" => "suffix"), $this->getSuffix());
}
示例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: 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) {
//.........这里部分代码省略.........
示例6: toXML
/**
* To Xml.
* This method writes only the subset Record (including all fields)
* Use class.ilAdvancedMDRecordXMLWriter to generate a complete xml presentation.
*
* @access public
* @param object ilXmlWriter
*
*/
public function toXML(ilXmlWriter $writer)
{
$writer->xmlStartTag('Record', array('active' => $this->isActive() ? 1 : 0, 'id' => $this->generateImportId()));
$writer->xmlElement('Title', null, $this->getTitle());
$writer->xmlElement('Description', null, $this->getDescription());
foreach ($this->getAssignedObjectTypes() as $obj_type) {
$writer->xmlElement('ObjectType', null, $obj_type);
}
include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php';
foreach (ilAdvancedMDFieldDefinition::_getDefinitionsByRecordId($this->getRecordId()) as $definition) {
$definition->toXML($writer);
}
$writer->xmlEndTag('Record');
}
示例7: addToXML
/**
* add user defined field data to xml (using usr dtd)
* @param ilXmlWriter $xml_writer
*/
function addToXML($xml_writer)
{
include_once './Services/User/classes/class.ilUserDefinedFields.php';
$udf_obj =& ilUserDefinedFields::_getInstance();
foreach ($udf_obj->getDefinitions() as $definition) {
if ($definition["export"] != FALSE) {
$xml_writer->xmlElement('UserDefinedField', array('Id' => $definition['il_id'], 'Name' => $definition['field_name']), (string) $this->user_data['f_' . (int) $definition['field_id']]);
}
}
}
示例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 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, IMAGEMAP_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->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 answers to presentation
$attrs = array("ident" => "IM", "rcardinality" => "Single");
$a_xml_writer->xmlStartTag("response_xy", $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");
}
}
$a_xml_writer->xmlStartTag("render_hotspot");
$a_xml_writer->xmlStartTag("material");
$imagetype = "image/jpeg";
if (preg_match("/.*\\.(png|gif)\$/", $this->object->getImageFilename(), $matches)) {
$imagetype = "image/" . $matches[1];
}
$attrs = array("imagtype" => $imagetype, "label" => $this->object->getImageFilename());
if ($a_include_binary) {
if ($force_image_references) {
$attrs["uri"] = $this->object->getImagePathWeb() . $this->object->getImageFilename();
$a_xml_writer->xmlElement("matimage", $attrs);
} else {
$attrs["embedded"] = "base64";
$imagepath = $this->object->getImagePath() . $this->object->getImageFilename();
$fh = fopen($imagepath, "rb");
if ($fh == false) {
global $ilErr;
$ilErr->raiseError($this->object->lng->txt("error_open_image_file"), $ilErr->MESSAGE);
return;
}
$imagefile = fread($fh, filesize($imagepath));
fclose($fh);
$base64 = base64_encode($imagefile);
$a_xml_writer->xmlElement("matimage", $attrs, $base64, FALSE, FALSE);
}
} else {
$a_xml_writer->xmlElement("matimage", $attrs);
}
$a_xml_writer->xmlEndTag("material");
// add answers
foreach ($this->object->getAnswers() as $index => $answer) {
$rared = "";
switch ($answer->getArea()) {
case "rect":
$rarea = "Rectangle";
//.........这里部分代码省略.........
示例10: addPropertiesToXML
protected function addPropertiesToXML(ilXmlWriter $a_writer)
{
foreach ($this->getOptions() as $value) {
$a_writer->xmlElement('FieldValue', null, $value);
}
}
示例11: toXML
/**
* 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, $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");
// 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, "points_wrong");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getPointsWrong());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "errortext");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getErrorText());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "textsize");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getTextSize());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "errordata");
$serialized = array();
foreach ($this->object->getErrorData() as $data) {
array_push($serialized, array($data->text_correct, $data->text_wrong, $data->points));
}
$a_xml_writer->xmlElement("fieldentry", NULL, serialize($serialized));
$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 answers to presentation
$a_xml_writer->xmlEndTag("flow");
$a_xml_writer->xmlEndTag("presentation");
$a_xml_writer->xmlEndTag("item");
$a_xml_writer->xmlEndTag("questestinterop");
$xml = $a_xml_writer->xmlDumpMem(FALSE);
if (!$a_include_header) {
$pos = strpos($xml, "?>");
$xml = substr($xml, $pos + 2);
}
return $xml;
}
示例12: 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");
}
//.........这里部分代码省略.........
示例13: 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, MATCHING_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");
// 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, "shuffle");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getShuffle());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, "thumb_geometry");
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getThumbGeometry());
$a_xml_writer->xmlEndTag("qtimetadatafield");
$a_xml_writer->xmlStartTag("qtimetadatafield");
$a_xml_writer->xmlElement("fieldlabel", NULL, 'matching_mode');
$a_xml_writer->xmlElement("fieldentry", NULL, $this->object->getMatchingMode());
$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 answers to presentation
$attrs = array("ident" => "MQ", "rcardinality" => "Multiple");
$a_xml_writer->xmlStartTag("response_grp", $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();
if ($this->object->getShuffle()) {
$attrs = array("shuffle" => "Yes");
} else {
$attrs = array("shuffle" => "No");
}
$a_xml_writer->xmlStartTag("render_choice", $attrs);
// add answertext
$matchingtext_orders = array();
foreach ($this->object->getMatchingPairs() as $index => $matchingpair) {
array_push($matchingtext_orders, $matchingpair->term->identifier);
}
$termids = array();
foreach ($this->object->getTerms() as $term) {
array_push($termids, $term->identifier);
}
// add answers
foreach ($this->object->getDefinitions() as $definition) {
$attrs = array("ident" => $definition->identifier, "match_max" => "1", "match_group" => join($termids, ","));
//.........这里部分代码省略.........
示例14: _exportContainerSortingSettings
/**
* sorting XML-export for all container objects
*
* @param ilXmlWriter $xml
* @param $obj_id
*/
public static function _exportContainerSortingSettings(ilXmlWriter $xml, $obj_id)
{
$settings = self::getInstanceByObjId($obj_id);
$attr = array();
switch ($settings->getSortMode()) {
case ilContainer::SORT_MANUAL:
switch ($settings->getSortNewItemsOrder()) {
case ilContainer::SORT_NEW_ITEMS_ORDER_ACTIVATION:
$order = 'Activation';
break;
case ilContainer::SORT_NEW_ITEMS_ORDER_CREATION:
$order = 'Creation';
break;
case ilContainer::SORT_NEW_ITEMS_ORDER_TITLE:
$order = 'Title';
break;
}
$attr = array('direction' => $settings->getSortDirection() == ilContainer::SORT_DIRECTION_ASC ? "ASC" : "DESC", 'position' => $settings->getSortNewItemsPosition() == ilContainer::SORT_NEW_ITEMS_POSITION_BOTTOM ? "Bottom" : "Top", 'order' => $order, 'type' => 'Manual');
break;
case ilContainer::SORT_CREATION:
$attr = array('direction' => $settings->getSortDirection() == ilContainer::SORT_DIRECTION_ASC ? "ASC" : "DESC", 'type' => 'Creation');
break;
case ilContainer::SORT_TITLE:
$attr = array('direction' => $settings->getSortDirection() == ilContainer::SORT_DIRECTION_ASC ? "ASC" : "DESC", 'type' => 'Title');
break;
case ilContainer::SORT_ACTIVATION:
$attr = array('direction' => $settings->getSortDirection() == ilContainer::SORT_DIRECTION_ASC ? "ASC" : "DESC", 'type' => 'Activation');
break;
case ilContainer::SORT_INHERIT:
$attr = array('type' => 'Inherit');
}
$xml->xmlElement('Sort', $attr);
}
示例15: 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");
//.........这里部分代码省略.........