3 include_once
'./Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingSettings.php';
4 include_once
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
5 include_once
'./Services/WebServices/ECS/classes/class.ilECSParticipantSettings.php';
34 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCourseUrl.php';
81 $this->object_created = $a_status;
98 public function handle($a_content_id,$course)
100 $GLOBALS[
'ilLog']->write(__METHOD__.
': --------- content id '.$a_content_id);
109 if($this->
getMapping()->isAttributeMappingEnabled())
111 $GLOBALS[
'ilLog']->write(__METHOD__.
': Handling advanced attribute mapping');
115 if($this->
getMapping()->isAllInOneCategoryEnabled())
117 $GLOBALS[
'ilLog']->write(__METHOD__.
': Handling course all in one category setting');
125 return $this->
doSync($a_content_id,$course,$parent_obj_id);
127 $GLOBALS[
'ilLog']->write(__METHOD__.
': Using course default category');
139 $course_id = $course->lectureID;
145 $GLOBALS[
'ilLog']->write(__METHOD__.
' Performing update of already imported course.');
159 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCourseMappingRule.php';
174 $GLOBALS[
'ilLog']->write(__METHOD__.
': No matching attribute mapping rule found.');
175 $GLOBALS[
'ilLog']->write(__METHOD__.
': Using course default category');
191 if(!is_array($course->allocations))
193 $GLOBALS[
'ilLog']->write(__METHOD__.
': No allocation in course defined.');
196 if(!$course->allocations[0]->parentID)
198 $GLOBALS[
'ilLog']->write(__METHOD__.
': No allocation parent in course defined.');
201 $parent_id = $course->allocations[0]->parentID;
203 include_once
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
205 return $this->syncNodetoTop($parent_tid, $parent_id);
230 $GLOBALS[
'ilLog']->write(__METHOD__.
': ecs node with id '. $cms_id.
' is not imported!');
233 include_once
'./Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php';
242 $GLOBALS[
'ilLog']->write(__METHOD__.
': node is mapped');
247 include_once
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php';
249 $parent_tobj_id = $tree->getParentId($tobj_id);
272 include_once
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
275 include_once
'./Modules/Category/classes/class.ilObjCategory.php';
277 $cat->setTitle(
$data->getTitle());
279 $cat->createReference();
280 $cat->putInTree($parent_ref_id);
281 $cat->setPermissions($parent_ref_id);
282 $cat->deleteTranslation(
$GLOBALS[
'lng']->getDefaultLanguage());
283 $cat->addTranslation(
285 $cat->getLongDescription(),
286 $GLOBALS[
'lng']->getDefaultLanguage(),
296 $import->setEContentId(
$data->getCmsId());
297 $import->setImported(
true);
300 return $cat->getId();
308 protected function doSync($a_content_id, $course, $a_parent_obj_id)
311 $course_id = $course->lectureID;
316 $GLOBALS[
'ilLog']->write(__METHOD__.
': Handling course '. print_r($course,
true));
322 $GLOBALS[
'ilLog']->write(__METHOD__.
': '.$course->groupScenario);
323 include_once
'./Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php';
324 switch((
int) $course->groupScenario)
327 $GLOBALS[
'ilLog']->write(__METHOD__.
': Performing update for parallel groups in course.');
332 $GLOBALS[
'ilLog']->write(__METHOD__.
': Performing update for parallel courses.');
348 include_once
'./Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php';
349 switch((
int) $course->groupScenario)
352 $GLOBALS[
'ilLog']->write(__METHOD__.
': Parallel scenario "groups in courses".');
355 $this->
setImported($course_id, $crs, $a_content_id);
366 $GLOBALS[
'ilLog']->write(__METHOD__.
': Parallel scenario "Courses foreach Lecturer".');
370 $GLOBALS[
'ilLog']->write(__METHOD__.
': Parallel scenario "Many courses".');
376 $this->
setImported($course_id, $crs, $a_content_id);
382 $GLOBALS[
'ilLog']->write(__METHOD__.
': Parallel scenario "One Course".');
385 $this->
setImported($course_id, $crs, $a_content_id);
404 foreach((array) $course->groups as $group)
419 include_once
'./Modules/Course/classes/class.ilObjCourse.php';
421 $title = strlen($group->title) ? $group->title : $course->title;
422 $GLOBALS[
'ilLog']->write(__METHOD__.
': Creating new parallel course instance from ecs : '.
$title);
423 $course_obj->setTitle(
$title);
424 $course_obj->setSubscriptionMaxMembers((
int) $group->maxParticipants);
425 $course_obj->create();
428 $this->
setImported($course->lectureID, $course_obj,$a_content_id, $group->id);
441 $parent_ref = end($parent_refs);
443 foreach((array) $course->groups as $group)
445 $title = strlen($group->title) ? $group->title : $course->title;
446 $obj_id = $this->
getImportId($course->lectureID, $group->id);
447 $GLOBALS[
'ilLog']->write(__METHOD__.
': Imported obj id is ' .$obj_id);
458 $course_obj->setTitle(
$title);
459 $course_obj->setSubscriptionMaxMembers($group->maxParticipants);
460 $course_obj->update();
477 foreach((array) $course->groups as $group)
491 include_once
'./Modules/Group/classes/class.ilObjGroup.php';
493 $title = strlen($group->title) ? $group->title : $course->title;
494 $group_obj->setTitle(
$title);
495 $group_obj->setMaxMembers((
int) $group->maxParticipants);
496 $group_obj->create();
497 $group_obj->createReference();
498 $group_obj->putInTree($parent_ref);
499 $group_obj->setPermissions($parent_ref);
501 $this->
setImported($course->lectureID, $group_obj, $a_content_id, $group->id);
514 $parent_ref = end($parent_refs);
516 foreach((array) $course->groups as $group)
518 $obj_id = $this->
getImportId($course->lectureID, $group->id);
519 $GLOBALS[
'ilLog']->write(__METHOD__.
': Imported obj id is ' .$obj_id);
529 $title = strlen($group->title) ? $group->title : $course->title;
531 $group_obj->setTitle(
$title);
532 $group_obj->setMaxMembers((
int) $group->maxParticipants);
533 $group_obj->update();
549 include_once
'./Services/WebServices/ECS/classes/class.ilECSImport.php';
570 $GLOBALS[
'ilLog']->write(__METHOD__.
': Cannot instantiate course instance');
578 $crs_obj->setTitle(
$title);
589 include_once
'./Modules/Course/classes/class.ilObjCourse.php';
592 $GLOBALS[
'ilLog']->write(__METHOD__.
': Creating new course instance from ecs : '.
$title);
593 $course_obj->setTitle(
$title);
594 $course_obj->create();
609 $crs->createReference();
623 protected function setImported($a_content_id, $object, $a_ecs_id = 0, $a_sub_id = 0)
625 include_once
'./Services/WebServices/ECS/classes/class.ilECSImport.php';
628 is_object($object) ? $object->getId() : 0
631 $GLOBALS[
'ilLog']->write(__METHOD__.
': Imported with ecs id '.$a_ecs_id);
633 $import->setSubId($a_sub_id);
634 $import->setMID($this->
getMid());
635 $import->setEContentId($a_ecs_id);
636 $import->setContentId($a_content_id);
637 $import->setImported(
true);
655 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCourseLmsUrl.php';
659 include_once
'./Services/Link/classes/class.ilLink.php';
669 $GLOBALS[
'ilLog']->write(__METHOD__.
': Starting course url update');
672 $GLOBALS[
'ilLog']->write(__METHOD__.
': Sending new course group url');
677 $GLOBALS[
'ilLog']->write(__METHOD__.
': No courses groups created. Aborting');