4 include_once
'./Services/Export/classes/class.ilExportOptions.php';
44 public function parse($a_root_id)
46 $this->sxml = simplexml_load_string($this->xml);
47 $this->root_id = $a_root_id;
49 foreach($this->sxml->Item as $item)
51 $this->
initItem($item,$this->mapping->getTargetId());
61 protected function initItem($item, $a_parent_node)
65 $title = (string) $item[
'Title'];
66 $ref_id = (string) $item[
'RefId'];
67 $obj_id = (string) $item[
'Id'];
68 $type = (string) $item[
'Type'];
71 $new_ref = $this->
getMapping()->getMapping(
'Services/Container',
'refs',
$ref_id);
75 ($obj_id == $this->root_id)
80 $new_ref = $this->mapping->getMapping(
'Services/Container',
'refs', 0);
92 foreach($item->Timing as $timing)
94 $this->
parseTiming($new_ref,$a_parent_node,$timing);
97 foreach($item->Item as $subitem)
102 $new_obj_id = $this->mapping->getMapping(
'Services/Container',
'objs', $obj_id);
105 if((
int)$item[
'Style'])
107 self::$style_map[(int)$item[
'Style']][] = $new_obj_id;
111 if($ilSetting->get(
'enable_cat_page_edit',
false))
113 if((
bool)$item[
'Page'])
115 $this->mapping->addMapping(
'Services/COPage',
'pg',
'cont:'.$obj_id,
'cont:'.$new_obj_id);
118 if((
bool)$item[
'StartPage'])
120 $this->mapping->addMapping(
'Services/COPage',
'pg',
'cstr:'.$obj_id,
'cstr:'.$new_obj_id);
134 $type = (string) $timing[
'Type'];
135 $visible = (string) $timing[
'Visible'];
136 $changeable = (string) $timing[
'Changeable'];
138 include_once
'./Services/Object/classes/class.ilObjectActivation.php';
140 $crs_item->setTimingType($type);
141 $crs_item->toggleVisible((
bool) $visible);
142 $crs_item->toggleChangeable((
bool) $changeable);
144 foreach($timing->children() as $sub)
146 switch((
string) $sub->getName())
158 case 'SuggestionStart':
160 $crs_item->setSuggestionStart($dt->get(
IL_CAL_UNIX));
163 case 'SuggestionEnd':
165 $crs_item->setSuggestionEnd($dt->get(
IL_CAL_UNIX));
168 case 'EarliestStart':
170 $crs_item->setEarliestStart($dt->get(
IL_CAL_UNIX));
181 if($crs_item->getTimingStart())
183 $crs_item->update($a_ref_id, $a_parent_id);
198 global $objDefinition;
201 $new_obj_id = $this->
getMapping()->getMapping(
'Services/Container',
'objs', $obj_id);
204 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
208 $obj->createReference();
209 $obj->putInTree($parent_node);
210 $obj->setPermissions($parent_node);
211 $this->mapping->addMapping(
'Services/Container',
'refs',
$ref_id,$obj->getRefId());
212 return $obj->getRefId();
216 $class_name =
"ilObj".$objDefinition->getClassName($type);
217 $location = $objDefinition->getLocation($type);
219 include_once(
$location.
"/class.".$class_name.
".php");
220 $new =
new $class_name();
221 $new->setTitle($title);
223 $new->createReference();
224 $new->putInTree($parent_node);
225 $new->setPermissions($parent_node);
227 $this->mapping->addMapping(
'Services/Container',
'objs', $obj_id, $new->getId());
228 $this->mapping->addMapping(
'Services/Container',
'refs',
$ref_id,$new->getRefId());
230 return $new->getRefId();
initItem($item, $a_parent_node)
Init Item.
__construct(ilImportMapping $mapping, $xml='')
Constructor.
Class ilObject Basic functions for all objects.
getMapping()
Get ilImportMapping object.
static _lookupObjId($a_id)
createObject($ref_id, $obj_id, $type, $title, $parent_node)
Create the objects.
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
parseTiming($a_ref_id, $a_parent_id, $timing)
Parse timing info.
XML parser for container structure.
Class ilObjectActivation.