4include_once 
'./Services/Export/classes/class.ilExportOptions.php';
 
   48        $this->obj_definition = 
$DIC[
"objDefinition"];
 
   64    public function parse($a_root_id)
 
   66        $this->sxml = simplexml_load_string($this->xml);
 
   67        $this->root_id = $a_root_id;
 
   69        foreach ($this->sxml->Item as $item) {
 
   70            $this->
initItem($item, $this->mapping->getTargetId());
 
   80    protected function initItem($item, $a_parent_node)
 
   84        $title = (string) $item[
'Title'];
 
   85        $ref_id = (string) $item[
'RefId'];
 
   86        $obj_id = (string) $item[
'Id'];
 
   87        $type = (string) $item[
'Type'];
 
   90        $new_ref = $this->
getMapping()->getMapping(
'Services/Container', 
'refs', $ref_id);
 
   94            ($obj_id == $this->root_id)
 
   98            $new_ref = $this->mapping->getMapping(
'Services/Container', 
'refs', 0);
 
  109        foreach ($item->Timing as $timing) {
 
  110            $this->
parseTiming($new_ref, $a_parent_node, $timing);
 
  113        foreach ($item->Item as $subitem) {
 
  114            $this->
initItem($subitem, $new_ref);
 
  117        $new_obj_id = $this->mapping->getMapping(
'Services/Container', 
'objs', $obj_id);
 
  120        if ((
int) $item[
'Style']) {
 
  121            self::$style_map[(int) $item[
'Style']][] = $new_obj_id;
 
  125        if (
$ilSetting->get(
'enable_cat_page_edit', 
false)) {
 
  126            if ($item[
'Page'] == 
"1") {
 
  127                $this->mapping->addMapping(
'Services/COPage', 
'pg', 
'cont:' . $obj_id, 
'cont:' . $new_obj_id);
 
  128                $this->cont_log->debug(
"add pg cont mapping, old: " . $obj_id . 
", new: " . $new_obj_id . 
", Page: -" . $item[
'Page'] . 
"-");
 
  131            if ($item[
'StartPage'] == 
"1") {
 
  132                $this->mapping->addMapping(
'Services/COPage', 
'pg', 
'cstr:' . $obj_id, 
'cstr:' . $new_obj_id);
 
  146        $type = (string) $timing[
'Type'];
 
  147        $visible = (string) $timing[
'Visible'];
 
  148        $changeable = (string) $timing[
'Changeable'];
 
  150        include_once 
'./Services/Object/classes/class.ilObjectActivation.php';
 
  152        $crs_item->setTimingType(
$type);
 
  153        $crs_item->toggleVisible((
bool) $visible);
 
  154        $crs_item->toggleChangeable((
bool) $changeable);
 
  156        foreach ($timing->children() as $sub) {
 
  157            switch ((
string) $sub->getName()) {
 
  168                case 'SuggestionStart':
 
  170                    $crs_item->setSuggestionStart($dt->get(
IL_CAL_UNIX));
 
  173                case 'SuggestionEnd':
 
  175                    $crs_item->setSuggestionEnd($dt->get(
IL_CAL_UNIX));
 
  178                case 'EarliestStart':
 
  180                    $crs_item->setEarliestStart($dt->get(
IL_CAL_UNIX));
 
  189        if ($crs_item->getTimingStart()) {
 
  190            $crs_item->update($a_ref_id, $a_parent_id);
 
  208        $new_obj_id = $this->
getMapping()->getMapping(
'Services/Container', 
'objs', $obj_id);
 
  210            include_once 
'./Services/Object/classes/class.ilObjectFactory.php';
 
  213                $obj->createReference();
 
  214                $obj->putInTree($parent_node);
 
  215                $obj->setPermissions($parent_node);
 
  216                $this->mapping->addMapping(
'Services/Container', 
'refs', $ref_id, $obj->getRefId());
 
  217                return $obj->getRefId();
 
  221        $class_name = 
"ilObj" . $objDefinition->getClassName(
$type);
 
  224        include_once(
$location . 
"/class." . $class_name . 
".php");
 
  225        $new = 
new $class_name();
 
  228        $new->createReference();
 
  229        $new->putInTree($parent_node);
 
  230        $new->setPermissions($parent_node);
 
  232        $this->mapping->addMapping(
'Services/Container', 
'objs', $obj_id, $new->getId());
 
  233        $this->mapping->addMapping(
'Services/Container', 
'refs', $ref_id, $new->getRefId());
 
  235        return $new->getRefId();
 
An exception for terminatinating execution or to throw for unit testing.
XML parser for container structure.
initItem($item, $a_parent_node)
Init Item.
__construct(ilImportMapping $mapping, $xml='')
Constructor.
parseTiming($a_ref_id, $a_parent_id, $timing)
Parse timing info.
createObject($ref_id, $obj_id, $type, $title, $parent_node)
Create the objects.
getMapping()
Get ilImportMapping object.
@classDescription Date and time handling
static getLogger($a_component_id)
Get component logger.
Class ilObjectActivation.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)