ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilContainerReferenceXmlParser Class Reference

Group Import Parser. More...

+ Inheritance diagram for ilContainerReferenceXmlParser:
+ Collaboration diagram for ilContainerReferenceXmlParser:

Public Member Functions

 __construct ($a_xml, $a_parent_id=0)
 Constructor. More...
 
 getParentId ()
 Get parent id. More...
 
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class private More...
 
 startParsing ()
 start the parser More...
 
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element More...
 
 handlerEndTag ($a_xml_parser, $a_name)
 Handler end tag. More...
 
 handlerCharacterData ($a_xml_parser, $a_data)
 handler for character data More...
 
 setMode ($mode)
 Set import mode. More...
 
 setReference (ilContainerReference $ref)
 Set container reference. More...
 
 getReference ()
 Get container reference. More...
 
- 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...
 

Data Fields

const MODE_CREATE = 1
 
const MODE_UPDATE = 2
 
- 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()
 

Protected Member Functions

 save ()
 Save category object. More...
 
- 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

 $error
 

Private Attributes

 $ref = null
 
 $parent_id = 0
 

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...
 

Detailed Description

Group Import Parser.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 38 of file class.ilContainerReferenceXmlParser.php.

Constructor & Destructor Documentation

◆ __construct()

ilContainerReferenceXmlParser::__construct (   $a_xml,
  $a_parent_id = 0 
)

Constructor.

Parameters
string$a_xml_filexml file

public

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

References $DIC, MODE_CREATE, and ilSaxParser\setXMLContent().

60  {
61  global $DIC;
62 
63  $this->error = $DIC["ilErr"];
64  parent::__construct(null);
65 
67  $this->setXMLContent($a_xml);
68  }
global $DIC
Definition: saml.php:7
setXMLContent($a_xml_content)
+ Here is the call graph for this function:

Member Function Documentation

◆ getParentId()

ilContainerReferenceXmlParser::getParentId ( )

Get parent id.

Returns
type

Definition at line 74 of file class.ilContainerReferenceXmlParser.php.

References $parent_id.

Referenced by save().

+ Here is the caller graph for this function:

◆ getReference()

ilContainerReferenceXmlParser::getReference ( )

Get container reference.

Returns
ilContainerReference

Definition at line 217 of file class.ilContainerReferenceXmlParser.php.

References $ref.

Referenced by handlerBeginTag(), handlerEndTag(), and save().

+ Here is the caller graph for this function:

◆ handlerBeginTag()

ilContainerReferenceXmlParser::handlerBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element

Definition at line 108 of file class.ilContainerReferenceXmlParser.php.

References $error, $ilErr, getReference(), and ilContainerReference\TITLE_TYPE_REUSE.

109  {
111 
112  switch ($a_name) {
113  case "ContainerReference":
114  break;
115 
116  case 'Title':
117  switch ($a_attribs['type']) {
120  break;
121 
122  default:
124  break;
125  }
126  break;
127 
128  case 'Target':
129  $this->getReference()->setTargetId($a_attribs['id']);
130  break;
131  }
132  }
global $ilErr
Definition: raiseError.php:16
+ Here is the call graph for this function:

◆ handlerCharacterData()

ilContainerReferenceXmlParser::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

handler for character data

Definition at line 160 of file class.ilContainerReferenceXmlParser.php.

161  {
162  #$a_data = str_replace("<","&lt;",$a_data);
163  #$a_data = str_replace(">","&gt;",$a_data);
164 
165  if (!empty($a_data)) {
166  $this->cdata .= $a_data;
167  }
168  }

◆ handlerEndTag()

ilContainerReferenceXmlParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

Handler end tag.

Parameters
type$a_xml_parser
type$a_name

Definition at line 140 of file class.ilContainerReferenceXmlParser.php.

References getReference(), save(), and ilContainerReference\TITLE_TYPE_CUSTOM.

141  {
142  switch ($a_name) {
143  case "ContainerReference":
144  $this->save();
145  break;
146 
147  case 'Title':
148  if ($this->getReference()->getTitleType() == ilContainerReference::TITLE_TYPE_CUSTOM) {
149  $this->getReference()->setTitle(trim($this->cdata));
150  }
151  break;
152  }
153  $this->cdata = '';
154  }
+ Here is the call graph for this function:

◆ save()

ilContainerReferenceXmlParser::save ( )
protected

Save category object.

Returns
type

mode can be create or update

Definition at line 174 of file class.ilContainerReferenceXmlParser.php.

References getParentId(), getReference(), and ilCategoryXmlParser\MODE_CREATE.

Referenced by handlerEndTag().

175  {
179  include_once './Modules/Category/classes/class.ilCategoryXmlParser.php';
180  if ($this->mode == ilCategoryXmlParser::MODE_CREATE) {
181  $this->create();
182  $this->getReference()->create();
183  $this->getReference()->createReference();
184  $this->getReference()->putInTree($this->getParentId());
185  $this->getReference()->setPermissions($this->getParentId());
186  }
187  $this->getReference()->update();
188  return true;
189  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setHandlers()

ilContainerReferenceXmlParser::setHandlers (   $a_xml_parser)

set event handler should be overwritten by inherited class private

Definition at line 84 of file class.ilContainerReferenceXmlParser.php.

85  {
86  xml_set_object($a_xml_parser, $this);
87  xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
88  xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
89  }

◆ setMode()

ilContainerReferenceXmlParser::setMode (   $mode)

Set import mode.

Parameters
type$mode

Definition at line 198 of file class.ilContainerReferenceXmlParser.php.

199  {
200  $this->mode = $mode;
201  }

◆ setReference()

ilContainerReferenceXmlParser::setReference ( ilContainerReference  $ref)

Set container reference.

Parameters
ilContainerReference$ref

Definition at line 208 of file class.ilContainerReferenceXmlParser.php.

References $ref.

209  {
210  $this->ref = $ref;
211  }

◆ startParsing()

ilContainerReferenceXmlParser::startParsing ( )

start the parser

Definition at line 94 of file class.ilContainerReferenceXmlParser.php.

References $ref.

95  {
96  parent::startParsing();
97 
98  if ($this->ref instanceof ilContainerReference) {
99  return $this->ref;
100  }
101  return 0;
102  }

Field Documentation

◆ $error

ilContainerReferenceXmlParser::$error
protected

Definition at line 43 of file class.ilContainerReferenceXmlParser.php.

Referenced by handlerBeginTag().

◆ $parent_id

ilContainerReferenceXmlParser::$parent_id = 0
private

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

Referenced by getParentId().

◆ $ref

ilContainerReferenceXmlParser::$ref = null
private

◆ MODE_CREATE

const ilContainerReferenceXmlParser::MODE_CREATE = 1

Definition at line 45 of file class.ilContainerReferenceXmlParser.php.

Referenced by __construct().

◆ MODE_UPDATE

const ilContainerReferenceXmlParser::MODE_UPDATE = 2

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