5 include_once
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php';
6 include_once
'./Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignments.php';
7 include_once
'./Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php';
36 include_once
'./Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingSettings.php';
82 include_once
'./Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignments.php';
93 $GLOBALS[
'ilLog']->write(__METHOD__.
': No directory allocation settings. Aborting');
98 include_once
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
115 if($this->default_settings[
'tree_update'] ==
false)
117 $GLOBALS[
'ilLog']->write(__METHOD__.
': Tree update disabled for tree with id '. $this->getTree()->getTreeId());
122 include_once
'./Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php';
129 $a_root_ref_id = $mapping->getRefId();
149 include_once
'./Services/WebServices/ECS/classes/class.ilECSImport.php';
153 $cms_data->getCmsId());
156 $GLOBALS[
'ilLog']->write(__METHOD__.
': cms tree node not imported. tnode_id: '. $a_tnode_id);
160 $GLOBALS[
'ilLog']->write(__METHOD__.
' parent ref:'.$a_parent_ref_id.
' tnode:'. $a_tnode_id);
162 $import_ref_id = end($ref_ids);
163 $import_ref_id_parent = $tree->getParentId($import_ref_id);
165 if($a_parent_ref_id != $import_ref_id_parent)
168 $GLOBALS[
'ilLog']->write(__METHOD__.
': Moving node '.$a_parent_ref_id.
' to '.$import_ref_id);
169 $tree->moveTree($import_ref_id,$a_parent_ref_id);
173 $childs = $this->
getTree()->getChilds($a_tnode_id);
174 foreach((array) $childs as $node)
186 protected function syncNode($tree_obj_id,$parent_id,$a_mapped =
false)
188 $childs = $this->
getTree()->getChilds($tree_obj_id);
196 if($assignment->getRefId())
198 $parent_id = $assignment->getRefId();
202 if($assignment->isMapped())
209 $parent_id = $this->
syncCategory($assignment,$parent_id);
216 foreach($childs as $node)
218 $this->
syncNode($node[
'child'],$parent_id,$a_mapped);
230 include_once
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
236 include_once
'./Services/WebServices/ECS/classes/class.ilECSImport.php';
248 if(($cat instanceof
ilObject) and $this->default_settings[
'title_update'])
250 $GLOBALS[
'ilLog']->write(__METHOD__.
': Updating cms category ');
251 $GLOBALS[
'ilLog']->write(__METHOD__.
': Title is '. $data->getTitle());
252 $cat->deleteTranslation(
$GLOBALS[
'lng']->getDefaultLanguage());
253 $cat->addTranslation(
255 $cat->getLongDescription(),
256 $GLOBALS[
'lng']->getDefaultLanguage(),
259 $cat->setTitle($data->getTitle());
264 $GLOBALS[
'ilLog']->write(__METHOD__.
': Updating cms category -> nothing to do');
270 $GLOBALS[
'ilLog']->write(__METHOD__.
': Creating new cms category');
273 include_once
'./Modules/Category/classes/class.ilObjCategory.php';
275 $cat->setTitle($data->getTitle());
277 $cat->createReference();
278 $cat->putInTree($parent_id);
279 $cat->setPermissions($parent_id);
280 $cat->deleteTranslation(
$GLOBALS[
'lng']->getDEfaultLanguage());
281 $cat->addTranslation(
283 $cat->getLongDescription(),
284 $GLOBALS[
'lng']->getDefaultLanguage(),
293 $import->
setMID($this->mid);
294 $import->setContentId($data->getCmsId());
295 $import->setImported(
true);
298 return $cat->getRefId();
302 $GLOBALS[
'ilLog']->write(__METHOD__.
': Creation of empty containers is disabled.');