19 declare(strict_types=1);
52 public array $element_as_array;
54 public function getSubElements(): \Generator
56 foreach ($this->element_as_array[
'subs'] as $sub_array) {
58 $sub->element_as_array = $sub_array;
65 return new class ($this->element_as_array) extends
NullDefinition {
66 public function __construct(
protected array $element_as_array)
70 public function name():
string 72 return $this->element_as_array[
'name'];
79 return new class ($this->element_as_array) extends
NullData {
80 public function __construct(
protected array $element_as_array)
84 public function type():
Type 86 return $this->element_as_array[
'type'];
89 public function value():
string 91 return $this->element_as_array[
'value'];
96 $root->element_as_array = $set_as_array;
98 return new class ($root) extends
NullSet {
116 public function tagForElement(
120 if (!isset($element->element_as_array[
'specials'])) {
124 return new class ($element->element_as_array[
'specials']) extends
NullTag {
126 protected array $specials
130 public function isExportedAsLangString():
bool 132 return in_array(SpecialCase::LANGSTRING, $this->specials);
135 public function isTranslatedAsCopyright():
bool 140 public function isOmitted():
bool 142 return in_array(SpecialCase::OMITTED, $this->specials);
145 public function isExportedAsAttribute():
bool 154 public function __construct(
protected bool $cp_selection_active)
158 public function copyrightForExport(
string $copyright):
string 160 return '~parsed:' . $copyright .
'~';
163 public function isCopyrightSelectionActive():
bool 165 return $this->cp_selection_active;
173 protected array
$path = [];
175 public function withNextStep(
string $name,
bool $add_as_first =
false):
BuilderInterface 177 $clone = clone $this;
178 $clone->path[] = $name;
184 $string = implode(
'>', $this->path);
185 return new class ($string) extends
NullPath {
186 public function __construct(
protected string $string)
192 return $this->string;
201 public function prepareCreateOrUpdate(
207 $path->
toString() !==
'rights>description>string' ||
210 throw new \ilMDXMLException(
211 'Unexpected preparation, path: "' . $path->
toString() .
212 '", value count: "' . count($values) .
'"' 221 'name' =>
'copyright',
222 'type' => Type::NULL,
226 'type' => Type::STRING,
233 $set->
getRoot()->element_as_array[
'subs'][] = $insert_array;
238 return new Standard($dictionary, $copyright_handler, $path_factory, $manipulator);
245 'type' => Type::NULL,
250 'type' => Type::STRING,
256 'type' => Type::NULL,
261 'type' => Type::NON_NEG_INT,
262 'value' =>
'val1.2.1',
268 'value' =>
'val1.2.2',
276 $expected_xml = <<<XML
277 <?xml version=
"1.0"?>
279 <el1.1>val1.1</el1.1>
281 <el1.2.1>val1.2.1</el1.2.1>
282 <el1.2.2>val1.2.2</el1.2.2>
288 $set = $this->
getSet($set_array);
289 $xml = $writer->write($set);
291 $this->assertXmlStringEqualsXmlString($expected_xml, $xml->asXML());
298 'type' => Type::NULL,
303 'type' => Type::STRING,
309 'type' => Type::STRING,
316 $expected_xml = <<<XML
317 <?xml version=
"1.0"?>
325 $set = $this->
getSet($set_array);
326 $xml = $writer->write($set);
328 $this->assertXmlStringEqualsXmlString($expected_xml, $xml->asXML());
335 'type' => Type::NULL,
340 'type' => Type::LANG,
347 $expected_xml = <<<XML
348 <?xml version=
"1.0"?>
355 $set = $this->
getSet($set_array);
356 $xml = $writer->write($set);
358 $this->assertXmlStringEqualsXmlString($expected_xml, $xml->asXML());
365 'type' => Type::NULL,
370 'type' => Type::NULL,
372 'specials' => [SpecialCase::LANGSTRING],
376 'type' => Type::STRING,
377 'value' =>
'some text',
381 'name' =>
'language',
382 'type' => Type::LANG,
391 $expected_xml = <<<XML
392 <?xml version=
"1.0"?>
395 <
string language=
"br">some text</
string>
401 $set = $this->
getSet($set_array);
402 $xml = $writer->write($set);
404 $this->assertXmlStringEqualsXmlString($expected_xml, $xml->asXML());
411 'type' => Type::NULL,
416 'type' => Type::NULL,
418 'specials' => [SpecialCase::LANGSTRING],
422 'type' => Type::STRING,
423 'value' =>
'some text',
431 $expected_xml = <<<XML
432 <?xml version=
"1.0"?>
435 <
string>some text</
string>
441 $set = $this->
getSet($set_array);
442 $xml = $writer->write($set);
444 $this->assertXmlStringEqualsXmlString($expected_xml, $xml->asXML());
451 'type' => Type::NULL,
456 'type' => Type::NULL,
458 'specials' => [SpecialCase::LANGSTRING],
462 'type' => Type::STRING,
463 'value' =>
'some text',
467 'name' =>
'language',
468 'type' => Type::LANG,
477 $expected_xml = <<<XML
478 <?xml version=
"1.0"?>
481 <
string language=
"none">some text</
string>
487 $set = $this->
getSet($set_array);
488 $xml = $writer->write($set);
490 $this->assertXmlStringEqualsXmlString($expected_xml, $xml->asXML());
497 'type' => Type::NULL,
502 'type' => Type::NULL,
504 'specials' => [SpecialCase::LANGSTRING],
507 'name' =>
'language',
508 'type' => Type::LANG,
517 $expected_xml = <<<XML
518 <?xml version=
"1.0"?>
527 $set = $this->
getSet($set_array);
528 $xml = $writer->write($set);
530 $this->assertXmlStringEqualsXmlString($expected_xml, $xml->asXML());
537 'type' => Type::NULL,
542 'type' => Type::STRING,
543 'value' =>
'some license',
550 $expected_xml = <<<XML
551 <?xml version=
"1.0"?>
553 <cp>~parsed:some license~</cp>
558 $set = $this->
getSet($set_array);
559 $xml = $writer->write($set);
561 $this->assertXmlStringEqualsXmlString($expected_xml, $xml->asXML());
568 'type' => Type::NULL,
573 'type' => Type::STRING,
574 'value' =>
'some value',
580 $expected_xml = <<<XML
581 <?xml version=
"1.0"?>
583 <el2>some value</el2>
584 <copyright><
string>~parsed:~</
string></copyright>
589 $set = $this->
getSet($set_array);
590 $xml = $writer->write($set);
592 $this->assertXmlStringEqualsXmlString($expected_xml, $xml->asXML());
599 'type' => Type::NULL,
604 'type' => Type::STRING,
606 'specials' => [SpecialCase::OMITTED],
612 $expected_xml = <<<XML
613 <?xml version=
"1.0"?>
618 $set = $this->
getSet($set_array);
619 $xml = $writer->write($set);
621 $this->assertXmlStringEqualsXmlString($expected_xml, $xml->asXML());
628 'type' => Type::NULL,
633 'type' => Type::NULL,
635 'specials' => [SpecialCase::OMITTED],
639 'type' => Type::STRING,
640 'value' =>
'val1.1.1',
645 'type' => Type::STRING,
646 'value' =>
'val1.1.2',
654 $expected_xml = <<<XML
655 <?xml version=
"1.0"?>
660 $set = $this->
getSet($set_array);
661 $xml = $writer->write($set);
663 $this->assertXmlStringEqualsXmlString($expected_xml, $xml->asXML());
670 'type' => Type::NULL,
675 'type' => Type::NULL,
680 'type' => Type::STRING,
681 'value' =>
'val1.1.1',
687 'type' => Type::STRING,
688 'value' =>
'val1.1.2',
696 $expected_xml = <<<XML
697 <?xml version=
"1.0"?>
699 <el1.1 el1.1.1=
"val1.1.1">
700 <el1.1.2>val1.1.2</el1.1.2>
706 $set = $this->
getSet($set_array);
707 $xml = $writer->write($set);
709 $this->assertXmlStringEqualsXmlString($expected_xml, $xml->asXML());
716 'type' => Type::NULL,
721 'type' => Type::NULL,
727 'type' => Type::NULL,
734 $expected_xml = <<<XML
735 <?xml version=
"1.0"?>
743 $set = $this->
getSet($set_array);
744 $xml = $writer->write($set);
746 $this->assertXmlStringEqualsXmlString($expected_xml, $xml->asXML());
753 'type' => Type::NULL,
758 'type' => Type::VOCAB_VALUE,
759 'value' =>
'This contains !@#$%^&*(){}[]<>?=+\/|"\' a bunch of special characters.',
765 $expected_xml = <<<XML
766 <?xml version=
"1.0"?>
768 <el1.1>This contains !@#$%^&*(){}[]<>?=+\/|
"' a bunch of special characters.</el1.1> 772 $writer = $this->getStandardWriter(); 773 $set = $this->getSet($set_array); 774 $xml = $writer->write($set); 776 $this->assertXmlStringEqualsXmlString($expected_xml, $xml->asXML()); 779 public function testWriteWithLangStringContainingSpecialCharacters(): void 783 'type' => Type::NULL, 788 'type' => Type::NULL, 790 'specials' => [SpecialCase::LANGSTRING], 794 'type' => Type::STRING, 795 'value' => 'This contains !@#$%^&*(){}[]<>?=+\/|"\
' a bunch of special characters.',
799 'name' =>
'language',
800 'type' => Type::LANG,
809 $expected_xml = <<<XML
810 <?xml version=
"1.0"?>
813 <
string language=
"br">This contains !@#$%^&*(){}[]<>?=+\/|
"' a bunch of special characters.</string> 818 $writer = $this->getStandardWriter(); 819 $set = $this->getSet($set_array); 820 $xml = $writer->write($set); 822 $this->assertXmlStringEqualsXmlString($expected_xml, $xml->asXML());
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct()
Constructor setup ILIAS global object public.
custom()
expected output: > ILIAS shows a base horizontal bar chart but customized with e.g.
language()
description: > Example for rendring a language glyph.