ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 27 of file class.ilMDXMLCopier.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

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

33  {
34  $this->setMDObject(new ilMD($a_rbac_id, $a_obj_id, $a_obj_type));
35 
37  $this->setXMLContent($content);
38 
39  // set filter of tags which are handled in this class
40  $this->__setFilter();
41  }
__construct(Container $dic, ilPlugin $plugin)
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 126 of file class.ilMDXMLCopier.php.

References ILIAS\Repository\filter().

Referenced by handlerBeginTag(), and handlerEndTag().

126  : bool
127  {
128  return in_array($a_tag_name, $this->filter, true);
129  }
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 121 of file class.ilMDXMLCopier.php.

References ILIAS\Repository\filter().

Referenced by __construct().

121  : void
122  {
123  $this->filter[] = 'Identifier';
124  }
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 64 of file class.ilMDXMLCopier.php.

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

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

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

◆ handlerEndTag()

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

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

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

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

◆ startParsing()

ilMDXMLCopier::startParsing ( )

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

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

Referenced by ilMD\cloneMD().

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

◆ $in_meta_data

bool ilMDXMLCopier::$in_meta_data = false
protected

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


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