ILIAS  release_4-4 Revision
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
 ilSaxParser ($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
 PEAR ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
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...
 
 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...
 
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. 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...
 

Private Attributes

 $ref = null
 
 $parent_id = 0
 

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 54 of file class.ilContainerReferenceXmlParser.php.

References MODE_CREATE, and ilSaxParser\setXMLContent().

55  {
56  parent::__construct(null);
57 
59  $this->setXMLContent($a_xml);
60  }
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 66 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 216 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 101 of file class.ilContainerReferenceXmlParser.php.

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

102  {
103  global $ilErr;
104 
105  switch($a_name)
106  {
107  case "ContainerReference":
108  break;
109 
110  case 'Title':
111  switch($a_attribs['type'])
112  {
115  break;
116 
117  default:
119  break;
120  }
121  break;
122 
123  case 'Target':
124  $this->getReference()->setTargetId($a_attribs['id']);
125  break;
126  }
127  }
+ Here is the call graph for this function:

◆ handlerCharacterData()

ilContainerReferenceXmlParser::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

handler for character data

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

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

◆ handlerEndTag()

ilContainerReferenceXmlParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

Handler end tag.

Parameters
type$a_xml_parser
type$a_name

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

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

136  {
137  switch($a_name)
138  {
139  case "ContainerReference":
140  $this->save();
141  break;
142 
143  case 'Title':
144  if($this->getReference()->getTitleType() == ilContainerReference::TITLE_TYPE_CUSTOM)
145  {
146  $this->getReference()->setTitle(trim($this->cdata));
147  }
148  break;
149  }
150  $this->cdata = '';
151  }
+ 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 172 of file class.ilContainerReferenceXmlParser.php.

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

Referenced by handlerEndTag().

173  {
177  include_once './Modules/Category/classes/class.ilCategoryXmlParser.php';
178  if ($this->mode == ilCategoryXmlParser::MODE_CREATE)
179  {
180  $this->create();
181  $this->getReference()->create();
182  $this->getReference()->createReference();
183  $this->getReference()->putInTree($this->getParentId());
184  $this->getReference()->setPermissions($this->getParentId());
185  }
186  $this->getReference()->update();
187  return true;
188  }
+ 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 76 of file class.ilContainerReferenceXmlParser.php.

77  {
78  xml_set_object($a_xml_parser,$this);
79  xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
80  xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
81  }

◆ setMode()

ilContainerReferenceXmlParser::setMode (   $mode)

Set import mode.

Parameters
type$mode

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

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

◆ setReference()

ilContainerReferenceXmlParser::setReference ( ilContainerReference  $ref)

Set container reference.

Parameters
ilContainerReference$ref

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

References $ref.

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

◆ startParsing()

ilContainerReferenceXmlParser::startParsing ( )

start the parser

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

References $ref.

87  {
88  parent::startParsing();
89 
90  if($this->ref instanceof ilContainerReference)
91  {
92  return $this->ref;
93  }
94  return 0;
95  }

Field Documentation

◆ $parent_id

ilContainerReferenceXmlParser::$parent_id = 0
private

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

Referenced by getParentId().

◆ $ref

ilContainerReferenceXmlParser::$ref = null
private

◆ MODE_CREATE

const ilContainerReferenceXmlParser::MODE_CREATE = 1

Definition at line 40 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: