ILIAS  release_7 Revision v7.30-3-g800a261c036
ilStyleImporter Class Reference

Importer class for style. More...

+ Inheritance diagram for ilStyleImporter:
+ Collaboration diagram for ilStyleImporter:

Public Member Functions

 init ()
 Init. More...
 
 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import xml representation. More...
 
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 Constructor. More...
 
 setImport ($a_val)
 Set import. More...
 
 getImport ()
 Get import. More...
 
 init ()
 Init. More...
 
 setInstallId ($a_val)
 Set installation id. More...
 
 getInstallId ()
 Get installation id. More...
 
 setInstallUrl ($a_val)
 Set installation url. More...
 
 getInstallUrl ()
 Get installation url. More...
 
 setSchemaVersion ($a_val)
 Set schema version. More...
 
 getSchemaVersion ()
 Get schema version. More...
 
 setImportDirectory ($a_val)
 Set import directory. More...
 
 getImportDirectory ()
 Get import directory. More...
 
 setSkipEntities ($a_val)
 Set skip entities. More...
 
 getSkipEntities ()
 Get skip entities. More...
 
 exportedFromSameInstallation ()
 Is exporting and importing installation identical? More...
 
 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import xml representation. More...
 
 finalProcessing ($a_mapping)
 Final processing. More...
 
 afterContainerImportProcessing (ilImportMapping $mapping)
 Called after all container objects have been implemented. More...
 

Protected Attributes

 $log
 
- Protected Attributes inherited from ilXmlImporter
 $skip_entities = array()
 
 $imp
 

Detailed Description

Importer class for style.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id

Definition at line 13 of file class.ilStyleImporter.php.

Member Function Documentation

◆ importXmlRepresentation()

ilStyleImporter::importXmlRepresentation (   $a_entity,
  $a_id,
  $a_xml,
  $a_mapping 
)

Import xml representation.

Parameters
stringentity
stringtarget release
stringid
Returns
string xml string

Reimplemented from ilXmlImporter.

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

33 {
34 $this->log->debug("import xml " . $a_entity);
35
36 if (true) {
37 include_once("./Services/DataSet/classes/class.ilDataSetImportParser.php");
38 $parser = new ilDataSetImportParser(
39 $a_entity,
40 $this->getSchemaVersion(),
41 $a_xml,
42 $this->ds,
43 $a_mapping
44 );
45 return;
46 }
47
48 // see ilStyleExporter::getXmlRepresentation()
49 if (preg_match("/<StyleSheetExport><ImagePath>(.+)<\/ImagePath>/", $a_xml, $hits)) {
50 $path = $hits[1];
51 $a_xml = str_replace($hits[0], "", $a_xml);
52 $a_xml = str_replace("</StyleSheetExport>", "", $a_xml);
53 }
54
55 // temp xml-file
56 $tmp_file = $this->getImportDirectory() . "/sty_" . $a_id . ".xml";
57 file_put_contents($tmp_file, $a_xml);
58
59 include_once "./Services/Style/Content/classes/class.ilObjStyleSheet.php";
60 $style = new ilObjStyleSheet();
61 $style->createFromXMLFile($tmp_file);
62 $new_id = $style->getId();
63
64 unlink($tmp_file);
65
66 // images
67 if ($path) {
68 $source = $this->getImportDirectory() . "/" . $path;
69 if (is_dir($source)) {
70 $target = $style->getImagesDirectory();
71 if (!is_dir($target)) {
73 }
74 ilUtil::rCopy($source, $target);
75 }
76 }
77
78 $a_mapping->addMapping("Services/Style", "sty", $a_id, $new_id);
79 }
Manifest parser for ILIAS standard export files.
Class ilObjStyleSheet.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static makeDirParents($a_dir)
Create a new directory and all parent directories.
getSchemaVersion()
Get schema version.
getImportDirectory()
Get import directory.
$source
Definition: metadata.php:76

References $source, ilXmlImporter\getImportDirectory(), ilXmlImporter\getSchemaVersion(), ilUtil\makeDirParents(), and ilUtil\rCopy().

+ Here is the call graph for this function:

◆ init()

ilStyleImporter::init ( )

Init.

Reimplemented from ilXmlImporter.

Definition at line 20 of file class.ilStyleImporter.php.

21 {
22 $this->log = ilLoggerFactory::getLogger('styl');
23
24 include_once("./Services/Style/classes/class.ilStyleDataSet.php");
25 $this->ds = new ilStyleDataSet();
26 $this->ds->setDSPrefix("ds");
27 $this->ds->setImportDirectory($this->getImportDirectory());
28
29 $this->log->debug("initialized");
30 }
static getLogger($a_component_id)
Get component logger.
Style Data set class.

References ilXmlImporter\getImportDirectory(), and ilLoggerFactory\getLogger().

+ Here is the call graph for this function:

Field Documentation

◆ $log

ilStyleImporter::$log
protected

Definition at line 18 of file class.ilStyleImporter.php.


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