ILIAS  release_7 Revision v7.30-3-g800a261c036
ilLearningSequenceXMLParser Class Reference
+ Inheritance diagram for ilLearningSequenceXMLParser:
+ Collaboration diagram for ilLearningSequenceXMLParser:

Public Member Functions

 __construct (ilObjLearningSequence $obj, string $xml)
 
 start ()
 
 setHandlers ($parser)
 set event handler should be overwritten by inherited class @access private More...
 
 handleBeginTag ( $parser, string $name, array $attributes)
 
 handleEndTag ($parser, string $name)
 
 handleCharacterData ($parser, $data)
 
- Public Member Functions inherited from ilSaxParser
 __construct ($a_xml_file='', $throwException=false)
 Constructor setup ILIAS global object @access public. More...
 
 setXMLContent ($a_xml_content)
 
 getXMLContent ()
 
 getInputType ()
 
 startParsing ()
 stores xml data in array More...
 
 createParser ()
 create parser More...
 
 setOptions ($a_xml_parser)
 set parser options More...
 
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class @access private More...
 
 openXMLFile ()
 open xml file More...
 
 parse ($a_xml_parser, $a_fp=null)
 parse xml file More...
 
 freeParser ($a_xml_parser)
 free xml parser handle More...
 
 setThrowException ($throwException)
 set error handling More...
 
- Public Member Functions inherited from PEAR
 __construct ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes. More...
 
 isError ($data, $code=null)
 Tell whether a value is a PEAR error. More...
 
 expectError ($code=' *')
 This method is used to tell which errors you expect to get. More...
 
 popExpect ()
 This method pops one element off the expected error codes stack. More...
 
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available. More...
 
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack. More...
 
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. More...
 
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options. More...
 
 staticPushErrorHandling ($mode, $options=null)
 
 staticPopErrorHandling ()
 
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack. More...
 
 popErrorHandling ()
 Pop the last error handler used. More...
 
 loadExtension ($ext)
 OS independant PHP extension load. More...
 

Protected Member Functions

 beginStoreCData ()
 
 endStoreCData ()
 
 storeData ()
 
- Protected Member Functions inherited from ilSaxParser
 handleError ($message, $code)
 use given error handler to handle error message or internal ilias error message handle More...
 

Protected Attributes

 $storing
 
 $counter
 

Private Attributes

 $cdata = ''
 

Additional Inherited Members

- Static Public Member Functions inherited from PEAR
static & getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. More...
 
static setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 
- Data Fields inherited from ilSaxParser
 $input_type = null
 
 $xml_content = ''
 
 $ilias
 
 $lng
 
 $xml_file
 
 $throwException = false
 
- Data Fields inherited from PEAR
 $_debug = false
 
 $_default_error_mode = null
 
 $_default_error_options = null
 
 $_default_error_handler = ''
 
 $_error_class = 'PEAR_Error'
 
 $_expected_errors = array()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLearningSequenceXMLParser::__construct ( ilObjLearningSequence  $obj,
string  $xml 
)

Definition at line 23 of file class.ilLearningSequenceXMLParser.php.

24 {
26
27 $this->obj = $obj;
28 $this->storing = false;
29 $this->setXMLContent($xml);
30
31 $this->object = array();
32 $this->ls_item_data = array();
33 $this->settings = array();
34 $this->lp_settings = array();
35 $this->lp_settings["lp_item_ref_ids"] = array();
36 $this->counter = 0;
37 }
setXMLContent($a_xml_content)
$xml
Definition: metadata.php:332
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
settings()
Definition: settings.php:2

References ILIAS\GlobalScreen\Provider\__construct(), settings(), and ilSaxParser\setXMLContent().

+ Here is the call graph for this function:

Member Function Documentation

◆ beginStoreCData()

ilLearningSequenceXMLParser::beginStoreCData ( )
protected

Definition at line 139 of file class.ilLearningSequenceXMLParser.php.

140 {
141 $this->storing = true;
142 }

Referenced by handleBeginTag().

+ Here is the caller graph for this function:

◆ endStoreCData()

ilLearningSequenceXMLParser::endStoreCData ( )
protected

Definition at line 144 of file class.ilLearningSequenceXMLParser.php.

145 {
146 $this->storing = false;
147 }

Referenced by handleEndTag().

+ Here is the caller graph for this function:

◆ handleBeginTag()

ilLearningSequenceXMLParser::handleBeginTag (   $parser,
string  $name,
array  $attributes 
)

Definition at line 59 of file class.ilLearningSequenceXMLParser.php.

63 {
64 $this->actual_name = $name;
65
66 switch ($name) {
67 case "lso":
68 $this->object["ref_id"] = $attributes["ref_id"];
69 break;
70 case "ls_item":
71 $this->ls_item_data[$this->counter]["id"] = $attributes["id"];
72 $this->beginStoreCData();
73 break;
74 default:
75 break;
76 }
77 }
if($format !==null) $name
Definition: metadata.php:230
$attributes
Definition: metadata.php:231

References $attributes, $counter, $name, and beginStoreCData().

+ Here is the call graph for this function:

◆ handleCharacterData()

ilLearningSequenceXMLParser::handleCharacterData (   $parser,
  $data 
)

Definition at line 133 of file class.ilLearningSequenceXMLParser.php.

134 {
135 $this->cdata .= ($data ?? "");
136 $this->storeData();
137 }
$data
Definition: storeScorm.php:23

References $data, and storeData().

+ Here is the call graph for this function:

◆ handleEndTag()

ilLearningSequenceXMLParser::handleEndTag (   $parser,
string  $name 
)

Definition at line 79 of file class.ilLearningSequenceXMLParser.php.

80 {
81 $this->cdata = trim($this->cdata);
82
83 switch ($name) {
84 case "title":
85 $this->obj->setTitle(trim($this->cdata));
86 break;
87 case "description":
88 $this->obj->setDescription(trim($this->cdata));
89 break;
90 case "ls_item":
91 $this->endStoreCData();
92 break;
93 case "ls_item_order_number":
94 $this->counter++;
95 break;
96 case "abstract":
97 $this->settings["abstract"] = base64_decode(trim($this->cdata));
98 break;
99 case "extro":
100 $this->settings["extro"] = base64_decode(trim($this->cdata));
101 break;
102 case "abstract_img":
103 $this->settings["abstract_img"] = trim($this->cdata);
104 break;
105 case "extro_img":
106 $this->settings["extro_img"] = trim($this->cdata);
107 break;
108 case "abstract_img_data":
109 $this->settings["abstract_img_data"] = trim($this->cdata);
110 break;
111 case "extro_img_data":
112 $this->settings["extro_img_data"] = trim($this->cdata);
113 break;
114 case "members_gallery":
115 $this->settings["members_gallery"] = trim($this->cdata);
116 break;
117 case "lp_item_ref_id":
118 $this->lp_settings["lp_item_ref_ids"][] = trim($this->cdata);
119 break;
120 case "lp_type":
121 $this->lp_settings["lp_type"] = trim($this->cdata);
122 break;
123 case "lp_mode":
124 $this->lp_settings["lp_mode"] = trim($this->cdata);
125 break;
126 default:
127 break;
128 }
129
130 $this->cdata = '';
131 }

References $name, endStoreCData(), and settings().

+ Here is the call graph for this function:

◆ setHandlers()

ilLearningSequenceXMLParser::setHandlers (   $a_xml_parser)

set event handler should be overwritten by inherited class @access private

Reimplemented from ilSaxParser.

Definition at line 52 of file class.ilLearningSequenceXMLParser.php.

53 {
54 xml_set_object($parser, $this);
55 xml_set_element_handler($parser, "handleBeginTag", "handleEndTag");
56 xml_set_character_data_handler($parser, 'handleCharacterData');
57 }

◆ start()

ilLearningSequenceXMLParser::start ( )

Definition at line 39 of file class.ilLearningSequenceXMLParser.php.

39 : array
40 {
41 $this->startParsing();
42
43 $ret = array();
44 $ret["object"] = $this->object;
45 $ret["item_data"] = $this->ls_item_data;
46 $ret["settings"] = $this->settings;
47 $ret["lp_settings"] = $this->lp_settings;
48
49 return $ret;
50 }
startParsing()
stores xml data in array
$ret
Definition: parser.php:6

References $ret, and ilSaxParser\startParsing().

+ Here is the call graph for this function:

◆ storeData()

ilLearningSequenceXMLParser::storeData ( )
protected

Definition at line 149 of file class.ilLearningSequenceXMLParser.php.

150 {
151 if ($this->storing) {
152 $this->ls_item_data[$this->counter][$this->actual_name] = $this->cdata ?? "";
153 }
154 }

References $counter.

Referenced by handleCharacterData().

+ Here is the caller graph for this function:

Field Documentation

◆ $cdata

ilLearningSequenceXMLParser::$cdata = ''
private

Definition at line 21 of file class.ilLearningSequenceXMLParser.php.

◆ $counter

ilLearningSequenceXMLParser::$counter
protected

Definition at line 18 of file class.ilLearningSequenceXMLParser.php.

Referenced by handleBeginTag(), and storeData().

◆ $storing

ilLearningSequenceXMLParser::$storing
protected

Definition at line 13 of file class.ilLearningSequenceXMLParser.php.


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