ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilStyleImporter Class Reference

Importer class for style. More...

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

Public Member Functions

 init ()
 Init.
 importXmlRepresentation ($a_entity, $a_id, $a_xml, $a_mapping)
 Import xml representation.
- Public Member Functions inherited from ilXmlImporter
 __construct ()
 Constructor.
 setInstallId ($a_val)
 Set installation id.
 getInstallId ()
 Get installation id.
 setInstallUrl ($a_val)
 Set installation url.
 getInstallUrl ()
 Get installation url.
 setSchemaVersion ($a_val)
 Set schema version.
 getSchemaVersion ()
 Get schema version.
 setImportDirectory ($a_val)
 Set import directory.
 getImportDirectory ()
 Get import directory.
 setSkipEntities ($a_val)
 Set skip entities.
 getSkipEntities ()
 Get skip entities.
 finalProcessing ($a_mapping)
 Final processing.

Additional Inherited Members

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

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

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 20 of file class.ilStyleImporter.php.

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

{
// see ilStyleExporter::getXmlRepresentation()
if(preg_match("/<StyleSheetExport><ImagePath>(.+)<\/ImagePath>/", $a_xml, $hits))
{
$path = $hits[1];
$a_xml = str_replace($hits[0], "", $a_xml);
$a_xml = str_replace("</StyleSheetExport>", "", $a_xml);
}
// temp xml-file
$tmp_file = $this->getImportDirectory()."/sty_".$a_id.".xml";
file_put_contents($tmp_file, $a_xml);
include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
$style = new ilObjStyleSheet();
$style->createFromXMLFile($tmp_file);
$new_id = $style->getId();
unlink($tmp_file);
// images
if($path)
{
$source = $this->getImportDirectory()."/".$path;
if(is_dir($source))
{
$target = $style->getImagesDirectory();
if(!is_dir($target))
{
}
ilUtil::rCopy($source, $target);
}
}
$a_mapping->addMapping("Services/Style", "sty", $a_id, $new_id);
}

+ Here is the call graph for this function:

ilStyleImporter::init ( )

Init.

Reimplemented from ilXmlImporter.

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

{
}

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