ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilExportContainer Class Reference

Export Container. More...

+ Inheritance diagram for ilExportContainer:
+ Collaboration diagram for ilExportContainer:

Public Member Functions

 __construct (ilExportOptions $eo)
 Constructor.
 exportObject ($a_type, $a_id, $a_target_release)
 Export a container.
- Public Member Functions inherited from ilExport
 __construct ()
 Default constructor.
 _getExportFiles ($a_obj_id, $a_export_types="", $a_obj_type="")
 Get Export Files.
 _createExportDirectory ($a_obj_id, $a_export_type="xml", $a_obj_type="")
 Create export directory.
 _generateIndexFile ($a_filename, $a_obj_id, $a_files, $a_type="")
 Generates an index.html file including links to all xml files included (for container exports)
 exportObject ($a_type, $a_id, $a_target_release, $a_config="")
 Export an ILIAS object (the object type must be known by objDefinition)
 processExporter ($a_comp, $a_class, $a_entity, $a_target_release, $a_id)
 Process exporter.

Protected Member Functions

 manifestWriterBegin ($a_type, $a_id, $a_target_release)
 Write container manifest.
 addContainer ()
 Add container description.
 addSubitems ($a_id, $a_type, $a_target_release)
 Add subitems.
 manifestWriterEnd ($a_type, $a_id, $a_target_release)
 Write manifest footer.

Private Attributes

 $cont_export_dir = ''
 $cont_manifest_writer = null
 $eo = null

Additional Inherited Members

- Static Public Member Functions inherited from ilExport
static _getFileTypeString ($a_obj_type)
 Get file type string.
static _getValidExportSubItems ($a_ref_id)
 Get a list of subitems of a repository resource, that implement the export.
static _getLastExportFileDate ($a_obj_id, $a_type="", $a_obj_type="")
 Get date of last export file.
static _getLastExportFileInformation ($a_obj_id, $a_type="", $a_obj_type="")
 Get last export file information.
static _getExportDirectory ($a_obj_id, $a_type="xml", $a_obj_type="")
 Get export directory.
- Static Public Attributes inherited from ilExport
static $new_file_structure = array('exc','crs','sess','file','grp','frm')
static $export_implementer = array("tst", "lm", "glo")
static $file_type_str

Detailed Description

Export Container.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

ilExportContainer::__construct ( ilExportOptions  $eo)

Constructor.

Parameters
ilExportOptions$eo
Returns

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

References $eo, and ilExport\__construct().

{
$this->eo = $eo;
}

+ Here is the call graph for this function:

Member Function Documentation

ilExportContainer::addContainer ( )
protected

Add container description.

Returns

Definition at line 88 of file class.ilExportContainer.php.

Referenced by exportObject().

{
}

+ Here is the caller graph for this function:

ilExportContainer::addSubitems (   $a_id,
  $a_type,
  $a_target_release 
)
protected

Add subitems.

Parameters
object$a_id
object$a_type
Returns

Definition at line 100 of file class.ilExportContainer.php.

References $GLOBALS, $ref_id, ilExport\_getExportDirectory(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilExportFileInfo\lookupLastExport(), ilUtil\makeDirParents(), and ilUtil\unzip().

Referenced by exportObject().

{
$set_number = 1;
foreach($this->eo->getSubitemsForExport() as $ref_id)
{
// get last export file
$expi = ilExportFileInfo::lookupLastExport($obj_id, 'xml',$a_target_release);
if(!$expi instanceof ilExportFileInfo)
{
$GLOBALS['ilLog']->write(__METHOD__.': Cannot find export file for refId '.$ref_id.', type '.ilObject::_lookupType($a_id));
continue;
}
$exp_dir = ilExport::_getExportDirectory($obj_id,'xml',ilObject::_lookupType($obj_id));
$exp_full = $exp_dir.DIRECTORY_SEPARATOR.$expi->getFilename();
$GLOBALS['ilLog']->write(__METHOD__.': zip path '.$exp_full);
// Unzip
ilUtil::unzip($exp_full,true,false);
// create set directory
ilUtil::makeDirParents($this->cont_export_dir.DIRECTORY_SEPARATOR.'set_'.$set_number);
// cut .zip
$new_path_rel = 'set_'.$set_number.DIRECTORY_SEPARATOR.$expi->getBasename();
$new_path_abs = $this->cont_export_dir.DIRECTORY_SEPARATOR.$new_path_rel;
$GLOBALS['ilLog']->write(__METHOD__.': '.$new_path_rel.' '.$new_path_abs);
// Move export
rename(
$exp_dir.DIRECTORY_SEPARATOR.$expi->getBasename(),
$new_path_abs
);
$GLOBALS['ilLog']->write($exp_dir.DIRECTORY_SEPARATOR.$expi->getBasename().' -> '.$new_path_abs);
// Delete latest container xml of source
if($a_id == $obj_id)
{
$expi->delete();
if(file_exists($exp_full))
{
$GLOBALS['ilLog']->write(__METHOD__.': Deleting'. $exp_full);
unlink($exp_full);
}
}
$this->cont_manifest_writer->xmlElement(
'ExportSet',
array(
'Path' => $new_path_rel,
'Type' => ilObject::_lookupType($obj_id)
)
);
++$set_number;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExportContainer::exportObject (   $a_type,
  $a_id,
  $a_target_release 
)

Export a container.

Parameters
object$a_type
object$a_obj_id
object$a_target_release
Returns

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

References $GLOBALS, ilExport\_createExportDirectory(), ilExport\_getExportDirectory(), addContainer(), addSubitems(), ilUtil\delDir(), ilUtil\makeDirParents(), manifestWriterBegin(), manifestWriterEnd(), and ilUtil\zip().

{
// Create base export directory
ilExport::_createExportDirectory($a_id, "xml", $a_type);
$export_dir = ilExport::_getExportDirectory($a_id, "xml", $a_type);
$ts = time();
$sub_dir = $ts."__".IL_INST_ID."__".$a_type."_".$a_id;
$this->cont_export_dir = $export_dir.DIRECTORY_SEPARATOR.$sub_dir;
ilUtil::makeDirParents($this->cont_export_dir);
$GLOBALS['ilLog']->write(__METHOD__.' using base directory: '.$this->export_run_dir);
$this->manifestWriterBegin($a_type, $a_id, $a_target_release);
$this->addContainer();
$this->addSubitems($a_id,$a_type,$a_target_release);
$this->manifestWriterEnd($a_type, $a_id, $a_target_release);
ilUtil::zip($this->cont_export_dir, $this->cont_export_dir.'.zip');
ilUtil::delDir($this->cont_export_dir);
}

+ Here is the call graph for this function:

ilExportContainer::manifestWriterBegin (   $a_type,
  $a_id,
  $a_target_release 
)
protected

Write container manifest.

Returns

Definition at line 67 of file class.ilExportContainer.php.

References $GLOBALS, and ilObject\_lookupTitle().

Referenced by exportObject().

{
$GLOBALS['ilLog']->write(__METHOD__.': wrinting manifest');
include_once "./Services/Xml/classes/class.ilXmlWriter.php";
$this->cont_manifest_writer = new ilXmlWriter();
$this->cont_manifest_writer->xmlHeader();
$this->cont_manifest_writer->xmlStartTag(
'Manifest',
array(
"MainEntity" => $a_type,
"Title" => ilObject::_lookupTitle($a_id),
"TargetRelease" => $a_target_release,
"InstallationId" => IL_INST_ID,
"InstallationUrl" => ILIAS_HTTP_PATH)
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilExportContainer::manifestWriterEnd (   $a_type,
  $a_id,
  $a_target_release 
)
protected

Write manifest footer.

Parameters
object$a_type
object$a_id
object$a_target_release
Returns

Definition at line 172 of file class.ilExportContainer.php.

References $GLOBALS.

Referenced by exportObject().

{
$this->cont_manifest_writer->xmlEndTag('Manifest');
$GLOBALS['ilLog']->write(__METHOD__.': '.$this->cont_export_dir.DIRECTORY_SEPARATOR.'manifest.xml');
$this->cont_manifest_writer->xmlDumpFile($this->cont_export_dir.DIRECTORY_SEPARATOR.'manifest.xml',true);
}

+ Here is the caller graph for this function:

Field Documentation

ilExportContainer::$cont_export_dir = ''
private

Definition at line 17 of file class.ilExportContainer.php.

ilExportContainer::$cont_manifest_writer = null
private

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

ilExportContainer::$eo = null
private

Definition at line 19 of file class.ilExportContainer.php.

Referenced by __construct().


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