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 for mid ' . $this->getMid().
' tree_id '.$tree_id);
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->setContentId($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__.
': Found obj_id '.$obj_id.
' for course_id '. $course_id );
322 $GLOBALS[
'ilLog']->write(__METHOD__.
': Group scenario '.$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);
364 $GLOBALS[
'ilLog']->write(__METHOD__.
': Parallel scenario "Courses foreach Lecturer".');
368 $GLOBALS[
'ilLog']->write(__METHOD__.
': Parallel scenario "Many courses".');
374 $this->
setImported($course_id, $crs, $a_content_id);
380 $GLOBALS[
'ilLog']->write(__METHOD__.
': Parallel scenario "One Course".');
383 $this->
setImported($course_id, $crs, $a_content_id);
402 foreach((array) $course->groups as $group)
417 include_once
'./Modules/Course/classes/class.ilObjCourse.php';
419 $title = strlen($group->title) ? $group->title : $course->title;
420 $GLOBALS[
'ilLog']->write(__METHOD__.
': Creating new parallel course instance from ecs : '. $title);
421 $course_obj->setTitle($title);
422 $course_obj->setSubscriptionMaxMembers((
int) $group->maxParticipants);
423 $course_obj->create();
426 $this->
setImported($course->lectureID, $course_obj,$a_content_id, $group->id);
439 $parent_ref = end($parent_refs);
441 foreach((array) $course->groups as $group)
443 $title = strlen($group->title) ? $group->title : $course->title;
444 $obj_id = $this->
getImportId($course->lectureID, $group->id);
445 $GLOBALS[
'ilLog']->write(__METHOD__.
': Imported obj id is ' .$obj_id);
455 $GLOBALS[
'ilLog']->write(__METHOD__.
': New title is '. $title);
456 $course_obj->setTitle($title);
457 $course_obj->setSubscriptionMaxMembers($group->maxParticipants);
458 $course_obj->update();
475 foreach((array) $course->groups as $group)
489 include_once
'./Modules/Group/classes/class.ilObjGroup.php';
491 $title = strlen($group->title) ? $group->title : $course->title;
492 $group_obj->setTitle($title);
493 $group_obj->setMaxMembers((
int) $group->maxParticipants);
494 $group_obj->create();
495 $group_obj->createReference();
496 $group_obj->putInTree($parent_ref);
497 $group_obj->setPermissions($parent_ref);
499 $this->
setImported($course->lectureID, $group_obj, $a_content_id, $group->id);
512 $parent_ref = end($parent_refs);
514 foreach((array) $course->groups as $group)
516 $obj_id = $this->
getImportId($course->lectureID, $group->id);
517 $GLOBALS[
'ilLog']->write(__METHOD__.
': Imported obj id is ' .$obj_id);
527 $title = strlen($group->title) ? $group->title : $course->title;
528 $GLOBALS[
'ilLog']->write(__METHOD__.
': New title is '. $title);
529 $group_obj->setTitle($title);
530 $group_obj->setMaxMembers((
int) $group->maxParticipants);
531 $group_obj->update();
547 include_once
'./Services/WebServices/ECS/classes/class.ilECSImport.php';
568 $GLOBALS[
'ilLog']->write(__METHOD__.
': Cannot instantiate course instance');
573 $title = $course->title;
574 $GLOBALS[
'ilLog']->write(__METHOD__.
': new title is : '. $title);
576 $crs_obj->setTitle($title);
587 include_once
'./Modules/Course/classes/class.ilObjCourse.php';
589 $title = $course->title;
590 $GLOBALS[
'ilLog']->write(__METHOD__.
': Creating new course instance from ecs : '. $title);
591 $course_obj->setTitle($title);
592 $course_obj->create();
607 $crs->createReference();
621 protected function setImported($a_content_id, $object, $a_ecs_id = 0, $a_sub_id = 0)
623 include_once
'./Services/WebServices/ECS/classes/class.ilECSImport.php';
626 is_object($object) ? $object->getId() : 0
629 $GLOBALS[
'ilLog']->write(__METHOD__.
': Imported with ecs id '.$a_ecs_id);
631 $import->setSubId($a_sub_id);
632 $import->setMID($this->
getMid());
633 $import->setEContentId($a_ecs_id);
634 $import->setContentId($a_content_id);
635 $import->setImported(
true);
653 include_once
'./Services/WebServices/ECS/classes/Course/class.ilECSCourseLmsUrl.php';
657 include_once
'./Services/Link/classes/class.ilLink.php';
667 $GLOBALS[
'ilLog']->write(__METHOD__.
': Starting course url update');
670 $GLOBALS[
'ilLog']->write(__METHOD__.
': Sending new course group url');
675 $GLOBALS[
'ilLog']->write(__METHOD__.
': No courses groups created. Aborting');