ILIAS  release_8 Revision v8.24
ilMDXMLCopier Class Reference
+ Inheritance diagram for ilMDXMLCopier:
+ Collaboration diagram for ilMDXMLCopier:

Public Member Functions

 __construct ($content, $a_rbac_id, $a_obj_id, $a_obj_type)
 
 startParsing ()
 stores xml data in array More...
 
 handlerBeginTag ($a_xml_parser, string $a_name, array $a_attribs)
 
 handlerEndTag ($a_xml_parser, string $a_name)
 
 handlerCharacterData ($a_xml_parser, string $a_data)
 
 __setFilter ()
 
 __inFilter (string $a_tag_name)
 
- Public Member Functions inherited from ilMDSaxParser
 __construct (?string $a_xml_file='')
 
 enableMDParsing (bool $a_status)
 
 getMDParsingStatus ()
 
 setMDObject (ilMD $md)
 
 getMDObject ()
 
 inMetaData ()
 
 setHandlers ($a_xml_parser)
 Set event handlers. More...
 
 handlerBeginTag ($a_xml_parser, string $a_name, array $a_attribs)
 
 handlerEndTag ($a_xml_parser, string $a_name)
 
 handlerCharacterData ($a_xml_parser, string $a_data)
 
 __getCharacterData ()
 
 __pushParent (object $md_obj)
 
 __popParent ()
 
 __getParent ()
 
- Public Member Functions inherited from ilSaxParser
 __construct (?string $path_to_file='', ?bool $throw_exception=false)
 
 setXMLContent (string $a_xml_content)
 
 getXMLContent ()
 
 getInputType ()
 
 startParsing ()
 stores xml data in array More...
 
 createParser ()
 
 setHandlers ($a_xml_parser)
 
 parse ($a_xml_parser, $a_fp=null)
 

Protected Attributes

bool $in_meta_data = false
 
- Protected Attributes inherited from ilMDSaxParser
bool $md_in_md = false
 
string $md_chr_data = ''
 
ilMDIdentifier $md_ide = null
 
ilMDLanguage $md_lan = null
 
ilMDDescription $md_des = null
 
ilMDLifecycle $md_lif = null
 
ilMDContribute $md_con = null
 
ilMDEntity $md_ent = null
 
ilMDMetaMetadata $md_met = null
 
ilMDTechnical $md_tec = null
 
ilMDFormat $md_for = null
 
ilMDLocation $md_loc = null
 
ilMDRequirement $md_req = null
 
ilMDOrComposite $md_orc = null
 
ilMDEducational $md_edu = null
 
ilMDTypicalAgeRange $md_typ = null
 
ilMDRights $md_rig = null
 
ilMDRelation $md_rel = null
 
ilMDIdentifier_ $md_ide_ = null
 
ilMDAnnotation $md_ann = null
 
ilMDClassification $md_cla = null
 
ilMDTaxonPath $md_taxp = null
 
ilMDTaxon $md_tax = null
 
ilMDKeyword $md_key = null
 
array $md_parent = array()
 
ilMD $md = null
 
ilMDGeneral $md_gen = null
 
ilLogger $meta_log
 
- Protected Attributes inherited from ilSaxParser
ilLanguage $lng = null
 

Private Attributes

array $filter = []
 

Additional Inherited Members

- Data Fields inherited from ilSaxParser
string $xml_file
 
bool $throw_exception = false
 
- Protected Member Functions inherited from ilMDSaxParser
 trimAndStripAttribs (array $attribs)
 
 trimAndStrip (string $input)
 
- Protected Member Functions inherited from ilSaxParser
 openXMLFile ()
 
 handleError (string $message)
 
 setThrowException (bool $throw_exception)
 

Detailed Description

Definition at line 25 of file class.ilMDXMLCopier.php.

Constructor & Destructor Documentation

◆ __construct()

ilMDXMLCopier::__construct (   $content,
  $a_rbac_id,
  $a_obj_id,
  $a_obj_type 
)

Definition at line 30 of file class.ilMDXMLCopier.php.

31 {
32 $this->setMDObject(new ilMD($a_rbac_id, $a_obj_id, $a_obj_type));
33
35 $this->setXMLContent($content);
36
37 // set filter of tags which are handled in this class
38 $this->__setFilter();
39 }
setXMLContent(string $a_xml_content)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct(), __setFilter(), ilMDSaxParser\setMDObject(), and ilSaxParser\setXMLContent().

+ Here is the call graph for this function:

Member Function Documentation

◆ __inFilter()

ilMDXMLCopier::__inFilter ( string  $a_tag_name)

Definition at line 124 of file class.ilMDXMLCopier.php.

124 : bool
125 {
126 return in_array($a_tag_name, $this->filter, true);
127 }

References ILIAS\UI\examples\Symbol\Glyph\Filter\filter().

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __setFilter()

ilMDXMLCopier::__setFilter ( )

Definition at line 119 of file class.ilMDXMLCopier.php.

119 : void
120 {
121 $this->filter[] = 'Identifier';
122 }

References ILIAS\UI\examples\Symbol\Glyph\Filter\filter().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handlerBeginTag()

ilMDXMLCopier::handlerBeginTag (   $a_xml_parser,
string  $a_name,
array  $a_attribs 
)
Parameters
XMLParser | resource$a_xml_parserreference to the xml parser

Reimplemented from ilMDSaxParser.

Reimplemented in ilSCORM13MDImporter.

Definition at line 62 of file class.ilMDXMLCopier.php.

62 : void
63 {
64 if ($this->in_meta_data && !$this->__inFilter($a_name)) {
65 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
66 return;
67 }
68
69 switch ($a_name) {
70 case 'MetaData':
71 $this->in_meta_data = true;
72 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
73 break;
74
75 case 'Identifier':
76 $par = $this->__getParent();
77 $this->md_ide = $par->addIdentifier();
78 $this->md_ide->setCatalog($a_attribs['Catalog'] ?? '');
79 $this->md_ide->setEntry('il__' . $this->md->getObjType() . '_' . $this->md->getObjId());
80 $this->md_ide->save();
81 $this->__pushParent($this->md_ide);
82 break;
83 }
84 }
__pushParent(object $md_obj)
__inFilter(string $a_tag_name)

References ilMDSaxParser\__getParent(), __inFilter(), and ilMDSaxParser\__pushParent().

+ Here is the call graph for this function:

◆ handlerCharacterData()

ilMDXMLCopier::handlerCharacterData (   $a_xml_parser,
string  $a_data 
)
Parameters
XMLParser | resource$a_xml_parserreference to the xml parser

Reimplemented from ilMDSaxParser.

Definition at line 112 of file class.ilMDXMLCopier.php.

112 : void
113 {
114 if ($this->in_meta_data) {
115 parent::handlerCharacterData($a_xml_parser, $a_data);
116 }
117 }

◆ handlerEndTag()

ilMDXMLCopier::handlerEndTag (   $a_xml_parser,
string  $a_name 
)
Parameters
XMLParser | resource$a_xml_parserreference to the xml parser

Reimplemented from ilMDSaxParser.

Reimplemented in ilSCORM13MDImporter.

Definition at line 89 of file class.ilMDXMLCopier.php.

89 : void
90 {
91 if ($this->in_meta_data && !$this->__inFilter($a_name)) {
92 parent::handlerEndTag($a_xml_parser, $a_name);
93 return;
94 }
95 switch ($a_name) {
96 case 'Identifier':
97 $par = $this->__getParent();
98 $par->update();
99 $this->__popParent();
100 break;
101
102 case 'MetaData':
103 $this->in_meta_data = false;
104 parent::handlerEndTag($a_xml_parser, $a_name);
105 break;
106 }
107 }

References ilMDSaxParser\__getParent(), __inFilter(), and ilMDSaxParser\__popParent().

+ Here is the call graph for this function:

◆ startParsing()

ilMDXMLCopier::startParsing ( )

stores xml data in array

Exceptions
ilSaxParserException

Reimplemented from ilSaxParser.

Definition at line 41 of file class.ilMDXMLCopier.php.

41 : void
42 {
43 // delete existing entries from creations process
44 $clone_md = $this->getMDObject();
45 $clone_md->deleteAll();
46
47 // rewrite autogenerated entry
48 $identifier = new ilMDIdentifier(
49 $clone_md->getRBACId(),
50 $clone_md->getObjId(),
51 $clone_md->getObjType(),
52 );
53 $identifier->setEntry('il__' . $clone_md->getObjType() . '_' . $clone_md->getObjId());
54 $identifier->update();
55
56 parent::startParsing();
57 }

References ilMDSaxParser\getMDObject().

Referenced by ilSCORM13MDImporter\import().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $filter

array ilMDXMLCopier::$filter = []
private

Definition at line 27 of file class.ilMDXMLCopier.php.

◆ $in_meta_data

bool ilMDXMLCopier::$in_meta_data = false
protected

Definition at line 28 of file class.ilMDXMLCopier.php.


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