ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilImportContainer Class Reference

Import class. More...

+ Inheritance diagram for ilImportContainer:
+ Collaboration diagram for ilImportContainer:

Public Member Functions

 __construct ($a_target_id)
 Constructor.
- Public Member Functions inherited from ilImport
 getMapping ()
 Get mapping object.
 setEntityTypes ($a_val)
 Set entity types.
 getEntityTypes ()
 Get entity types.
 addSkipEntity ($a_component, $a_entity, $skip=true)
 Add skip entity.
 setCurrentDataset ($a_val)
 Set currrent dataset.
 getCurrentDataset ()
 Get currrent dataset.
 afterEntityTypes ()
 After entity types are parsed.
 importRecord ($a_entity, $a_types, $a_record)
 After entity types are parsed.
 importEntity ($a_tmp_file, $a_filename, $a_entity, $a_component, $a_copy_file=false)
 Import entity.
 importObject ($a_new_obj, $a_tmp_file, $a_filename, $a_type, $a_comp="", $a_copy_file=false)
 Import repository object export file.
 processItemXml ($a_entity, $a_schema_version, $a_id, $a_xml, $a_install_id, $a_install_url)
 Process item xml.

Protected Member Functions

 doImportObject ($dir, $type)
 Import a container.
 createDummy ($a_type)
 Create dummy object.
- Protected Member Functions inherited from ilImport
 doImportObject ($dir, $a_type, $a_component="", $a_tmpdir="")
 Import repository object export file.

Additional Inherited Members

- Protected Attributes inherited from ilImport
 $install_id = ""
 $install_url = ""
 $entities = ""
 $mapping = null
 $skip_entity = array()

Detailed Description

Import class.

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

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

Constructor & Destructor Documentation

ilImportContainer::__construct (   $a_target_id)

Constructor.

Parameters
int$a_target_idId of parent node
Returns

Reimplemented from ilImport.

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

{
parent::__construct($a_target_id);
}

Member Function Documentation

ilImportContainer::createDummy (   $a_type)
protected

Create dummy object.

Parameters
object$a_type
Returns

Definition at line 72 of file class.ilImportContainer.php.

References $location, and ilImport\getMapping().

Referenced by doImportObject().

{
global $objDefinition;
$class_name = "ilObj".$objDefinition->getClassName($a_type);
$location = $objDefinition->getLocation($a_type);
include_once($location."/class.".$class_name.".php");
$new = new $class_name();
$new->setTitle('Import');
$new->create(true);
$new->createReference();
$new->putInTree($this->getMapping()->getTargetId());
$new->setPermissions($this->getMapping()->getTargetId());
$this->getMapping()->addMapping('Services/Container','objs', 0, $new->getId());
$this->getMapping()->addMapping('Services/Container','refs', 0,$new->getRefId());
return $new;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilImportContainer::doImportObject (   $dir,
  $type 
)
protected

Import a container.

Parameters
object$dir
object$type
Returns

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

References $GLOBALS, $ret, and createDummy().

{
$manifest_file = $dir."/manifest.xml";
if(!file_exists($manifest_file))
{
return false;
}
include_once("./Services/Export/classes/class.ilManifestParser.php");
$parser = new ilManifestParser($manifest_file);
// Handling single containers without subitems
if(!$parser->getExportSets())
{
$this->createDummy($type);
$new_id = parent::doImportObject($dir,$type);
return $new_id;
}
// Handling containers with subitems
$first = true;
foreach($parser->getExportSets() as $set)
{
$GLOBALS['ilLog']->write(__METHOD__.': do import with dir '.$dir.DIRECTORY_SEPARATOR.$set['path'].' and type '.$set['type']);
$new_id = parent::doImportObject($dir.DIRECTORY_SEPARATOR.$set['path'],$set['type']);
if($first)
{
$ret = $new_id;
$first = false;
}
}
return $ret;
}

+ Here is the call graph for this function:


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