ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
ILIAS\Conditions\Export\XMLReader Class Reference
+ Collaboration diagram for ILIAS\Conditions\Export\XMLReader:

Public Member Functions

 __construct (protected Factory $factory)
 
 readString (string $xml)
 

Detailed Description

Definition at line 28 of file XMLReader.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Conditions\Export\XMLReader::__construct ( protected Factory  $factory)

Definition at line 30 of file XMLReader.php.

32 {
33 }

Member Function Documentation

◆ readString()

ILIAS\Conditions\Export\XMLReader::readString ( string  $xml)

Definition at line 35 of file XMLReader.php.

35 : InfoCollection
36 {
37 $info_collection = $this->factory->infoCollection();
38 $xml_root = new SimpleXMLElement($xml);
39 foreach ($xml_root->children() as $condition) {
40 $condition_objects = [];
41 $preconditions_root = $condition->children()[0];
42 foreach ($preconditions_root->children() as $precondition) {
43 $trigger = $precondition->children()[0];
44 $condition_trigger = new ilConditionTrigger(
45 (int) $trigger->attributes()->ref_id,
46 (int) $trigger->attributes()->obj_id,
47 (string) $trigger->attributes()->type
48 );
49 $condition_objects[] = (new ilCondition(
50 $condition_trigger,
51 (string) $precondition->attributes()->operator,
52 (string) $precondition->attributes()->value
53 ))
54 ->withId((int) $precondition->attributes()->id)
55 ->withObligatory(((int) $precondition->attributes()->is_obligatory) === 1);
56 }
57 $condition_set = (new ilConditionSet($condition_objects))
58 ->withHiddenStatus(((int) $condition->attributes()->hide_object_enabled) === 1)
59 ->withNumObligatory((int) $condition->attributes()->number_of_required_materials);
60 if ($condition->attributes()->all_obligatory_enabled) {
61 $condition_set = $condition_set->withAllObligatory();
62 }
63 $info_collection = $info_collection->withInfo($this->factory->info()
64 ->withObjectId((int) $condition->attributes()->object_id)
65 ->withObjectType((string) $condition->attributes()->object_type)
66 ->withConditionSet($condition_set)
67 ->withReferenceId((int) $condition->attributes()->reference_id));
68 }
69 return $info_collection;
70 }
factory()
Condition set Note: This object currently focuses on repository objects as targets.
Represents a condition trigger object.
Condition class.

References factory().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: