3include_once 
'./Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingSettings.php';
 
    4include_once 
'./Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
 
    5include_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(),
 
  295                $import->setMID($this->
getMid());
 
  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');
 
static lookupObjId($a_server_id, $a_mid, $a_tree_id, $cms_id)
static lookupCmsIds($a_obj_ids)
static lookupFirstTreeOfNode($a_server_id, $a_mid, $cms_id)
Lookup first obj_id of cms node @global $ilDB $ilDB.
syncCategory($tobj_id, $parent_ref_id)
Sync category.
updateCourseData($course, $obj_id)
Update course data.
getCourseUrl()
Get course url.
handle($a_content_id, $course)
Handle sync request.
createParallelGroups($a_content_id, $course, $parent_ref)
This create parallel groups.
getImportId($a_content_id, $a_sub_id=NULL)
Get import id of remote course Return 0 if object isn't imported.
getMid()
Get mid of course event.
doAttributeMapping($a_content_id, $course)
Sync attribute mapping.
createCourseData($course)
Create course data from json.
updateParallelGroups($a_content_id, $course, $parent_obj)
Update parallel group data.
setImported($a_content_id, $object, $a_ecs_id=0, $a_sub_id=0)
Set new course object imported.
createCourseReference($crs, $a_parent_obj_id)
Create course reference.
handleCourseUrlUpdate()
Update course url.
setObjectCreated($a_status)
Set object created status.
createParallelGroup($a_content_id, $course, $group, $parent_ref)
Create parallel group.
isObjectCreated()
Check if an object (course / group) has been created.
addUrlEntry($a_obj_id)
Add an url entry.
createParallelCourse($a_content_id, $course, $group, $parent_ref)
Create parallel course.
createParallelCourses($a_content_id, $course, $parent_ref)
Create parallel courses.
getServer()
Get server settings.
getMapping()
Get mapping settings.
updateParallelCourses($a_content_id, $course, $parent_obj)
Update parallel group data.
syncParentContainer($a_content_id, $course)
Sync parent container.
doSync($a_content_id, $course, $a_parent_obj_id)
Handle all in one setting.
syncNodeToTop($tree_id, $cms_id)
Sync node to top.
__construct(ilECSSetting $server, $a_mid)
@maybe Constructor
Represents a ecs course lms url.
static isMatching($course, $a_sid, $a_mid, $a_ref_id)
Check if rule matches.
static doMappings($course, $a_sid, $a_mid, $a_ref_id)
static getRuleRefIds($a_sid, $a_mid)
Represents a ecs course url.
Storage of ECS imported objects.
static lookupObjIdByContentId($a_server_id, $a_mid, $a_content_id, $a_sub_id='')
Lookup obj_id by content id.
const PARALLEL_COURSES_FOR_LECTURERS
const PARALLEL_ONE_COURSE
const PARALLEL_ALL_COURSES
const PARALLEL_GROUPS_IN_COURSE
static getInstanceByServerMid($a_server_id, $a_mid)
Get instance.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObject Basic functions for all objects.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.