ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 ()
 
 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 26 of file class.ilMDXMLCopier.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

References ILIAS\MetaData\Repository\Validation\Data\__construct(), __setFilter(), ilMDSaxParser\setMDObject(), and ilSaxParser\setXMLContent().

32  {
33  $this->setMDObject(new ilMD($a_rbac_id, $a_obj_id, $a_obj_type));
34 
36  $this->setXMLContent($content);
37 
38  // set filter of tags which are handled in this class
39  $this->__setFilter();
40  }
__construct(VocabulariesInterface $vocabularies)
setXMLContent(string $a_xml_content)
+ Here is the call graph for this function:

Member Function Documentation

◆ __inFilter()

ilMDXMLCopier::__inFilter ( string  $a_tag_name)

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

References ILIAS\Repository\filter().

Referenced by handlerBeginTag(), and handlerEndTag().

125  : bool
126  {
127  return in_array($a_tag_name, $this->filter, true);
128  }
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __setFilter()

ilMDXMLCopier::__setFilter ( )

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

References ILIAS\Repository\filter().

Referenced by __construct().

120  : void
121  {
122  $this->filter[] = 'Identifier';
123  }
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ 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

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

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

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

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

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

◆ handlerEndTag()

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

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

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

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

◆ startParsing()

ilMDXMLCopier::startParsing ( )

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

References ilMDSaxParser\getMDObject(), and ilMDIdentifier\setEntry().

Referenced by ilMD\cloneMD(), and ilSCORM13MDImporter\import().

42  : void
43  {
44  // delete existing entries from creations process
45  $clone_md = $this->getMDObject();
46  $clone_md->deleteAll();
47 
48  // rewrite autogenerated entry
49  $identifier = new ilMDIdentifier(
50  $clone_md->getRBACId(),
51  $clone_md->getObjId(),
52  $clone_md->getObjType(),
53  );
54  $identifier->setEntry('il__' . $clone_md->getObjType() . '_' . $clone_md->getObjId());
55  $identifier->update();
56 
57  parent::startParsing();
58  }
setEntry(string $a_entry)
+ 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 28 of file class.ilMDXMLCopier.php.

◆ $in_meta_data

bool ilMDXMLCopier::$in_meta_data = false
protected

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


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