ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLearningSequenceXMLParser Class Reference
+ Inheritance diagram for ilLearningSequenceXMLParser:
+ Collaboration diagram for ilLearningSequenceXMLParser:

Public Member Functions

 __construct (ilObjLearningSequence $obj, string $xml)
 
 start ()
 
 setHandlers ($parser)
 
 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 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 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
 

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 20 of file class.ilLearningSequenceXMLParser.php.

References settings(), and ilSaxParser\setXMLContent().

21  {
22  parent::__construct();
23 
24  $this->obj = $obj;
25  $this->storing = false;
26  $this->setXMLContent($xml);
27 
28  $this->object = array();
29  $this->ls_item_data = array();
30  $this->settings = array();
31  $this->lp_settings = array();
32  $this->lp_settings["lp_item_ref_ids"] = array();
33  $this->counter = 0;
34  }
settings()
Definition: settings.php:2
setXMLContent($a_xml_content)
+ Here is the call graph for this function:

Member Function Documentation

◆ beginStoreCData()

ilLearningSequenceXMLParser::beginStoreCData ( )
protected

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

Referenced by handleBeginTag().

133  {
134  $this->storing = true;
135  }
+ Here is the caller graph for this function:

◆ endStoreCData()

ilLearningSequenceXMLParser::endStoreCData ( )
protected

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

Referenced by handleEndTag().

138  {
139  $this->storing = false;
140  }
+ Here is the caller graph for this function:

◆ handleBeginTag()

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

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

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

60  {
61  $this->actual_name = $name;
62 
63  switch ($name) {
64  case "lso":
65  $this->object["ref_id"] = $attributes["ref_id"];
66  break;
67  case "ls_item":
68  $this->ls_item_data[$this->counter]["id"] = $attributes["id"];
69  $this->beginStoreCData();
70  break;
71  default:
72  break;
73  }
74  }
if(array_key_exists('yes', $_REQUEST)) $attributes
Definition: getconsent.php:85
+ Here is the call graph for this function:

◆ handleCharacterData()

ilLearningSequenceXMLParser::handleCharacterData (   $parser,
  $data 
)

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

References $data, and storeData().

127  {
128  $this->cdata = $data ?? "";
129  $this->storeData();
130  }
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ handleEndTag()

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

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

References endStoreCData(), and settings().

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

◆ setHandlers()

ilLearningSequenceXMLParser::setHandlers (   $parser)

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

References $parser.

50  {
51  xml_set_object($parser, $this);
52  xml_set_element_handler($parser, "handleBeginTag", "handleEndTag");
53  xml_set_character_data_handler($parser, 'handleCharacterData');
54  }
$parser
Definition: BPMN2Parser.php:23

◆ start()

ilLearningSequenceXMLParser::start ( )

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

References $ret, and ilSaxParser\startParsing().

36  : array
37  {
38  $this->startParsing();
39 
40  $ret = array();
41  $ret["object"] = $this->object;
42  $ret["item_data"] = $this->ls_item_data;
43  $ret["settings"] = $this->settings;
44  $ret["lp_settings"] = $this->lp_settings;
45 
46  return $ret;
47  }
startParsing()
stores xml data in array
$ret
Definition: parser.php:6
+ Here is the call graph for this function:

◆ storeData()

ilLearningSequenceXMLParser::storeData ( )
protected

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

References $counter.

Referenced by handleCharacterData().

143  {
144  if ($this->storing) {
145  $this->ls_item_data[$this->counter][$this->actual_name] = $this->cdata ?? "";
146  }
147  }
+ Here is the caller graph for this function:

Field Documentation

◆ $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: