ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilECSCourseCreationHandler Class Reference

Description of class. More...

+ Collaboration diagram for ilECSCourseCreationHandler:

Public Member Functions

 __construct (ilECSSetting $server, $a_mid)
 Constructor
 getServer ()
 Get server settings.
 getMapping ()
 Get mapping settings.
 getCourseUrl ()
 Get course url.
 isObjectCreated ()
 Check if an object (course / group) has been created.
 setObjectCreated ($a_status)
 Set object created status.
 getMid ()
 Get mid of course event.
 handle ($a_content_id, $course)
 Handle sync request.

Protected Member Functions

 doAttributeMapping ($a_content_id, $course)
 Sync attribute mapping.
 syncParentContainer ($a_content_id, $course)
 Sync parent container.
 syncNodeToTop ($tree_id, $cms_id)
 Sync node to top.
 syncCategory ($tobj_id, $parent_ref_id)
 Sync category.
 doSync ($a_content_id, $course, $a_parent_obj_id)
 Handle all in one setting.
 createParallelCourses ($a_content_id, $course, $parent_ref)
 Create parallel courses.
 createParallelCourse ($a_content_id, $course, $group, $parent_ref)
 Create parallel course.
 updateParallelCourses ($a_content_id, $course, $parent_obj)
 Update parallel group data.
 createParallelGroups ($a_content_id, $course, $parent_ref)
 This create parallel groups.
 createParallelGroup ($a_content_id, $course, $group, $parent_ref)
 Create parallel group.
 updateParallelGroups ($a_content_id, $course, $parent_obj)
 Update parallel group data.
 getImportId ($a_content_id, $a_sub_id=NULL)
 Get import id of remote course Return 0 if object isn't imported.
 updateCourseData ($course, $obj_id)
 Update course data.
 createCourseData ($course)
 Create course data from json.
 createCourseReference ($crs, $a_parent_obj_id)
 Create course reference.
 setImported ($a_content_id, $object, $a_ecs_id=0, $a_sub_id=0)
 Set new course object imported.
 addUrlEntry ($a_obj_id)
 Add an url entry.
 handleCourseUrlUpdate ()
 Update course url.

Private Attributes

 $server = null
 $mapping = null
 $course_url = null
 $object_created = false
 $mid

Detailed Description

Description of class.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 14 of file class.ilECSCourseCreationHandler.php.

Constructor & Destructor Documentation

ilECSCourseCreationHandler::__construct ( ilECSSetting  $server,
  $a_mid 
)

Constructor

Definition at line 28 of file class.ilECSCourseCreationHandler.php.

References $server, ilECSNodeMappingSettings\getInstanceByServerMid(), getMid(), and getServer().

{
$this->server = $server;
$this->mid = $a_mid;
$this->mapping = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid());
include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseUrl.php';
$this->course_url = new ilECSCourseUrl();
}

+ Here is the call graph for this function:

Member Function Documentation

ilECSCourseCreationHandler::addUrlEntry (   $a_obj_id)
protected

Add an url entry.

Parameters
type$a_obj_id

Definition at line 646 of file class.ilECSCourseCreationHandler.php.

References $ref_id, ilObject\_getAllReferences(), ilLink\_getLink(), ilObject\_lookupTitle(), and getCourseUrl().

Referenced by createCourseReference(), updateParallelCourses(), and updateParallelGroups().

{
$refs = ilObject::_getAllReferences($a_obj_id);
$ref_id = end($refs);
if(!$ref_id)
{
return false;
}
include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseLmsUrl.php';
$lms_url = new ilECSCourseLmsUrl();
$lms_url->setTitle(ilObject::_lookupTitle($a_obj_id));
include_once './Services/Link/classes/class.ilLink.php';
$lms_url->setUrl(ilLink::_getLink($ref_id));
$this->getCourseUrl()->addLmsCourseUrls($lms_url);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::createCourseData (   $course)
protected

Create course data from json.

Returns
ilObjCourse

Definition at line 587 of file class.ilECSCourseCreationHandler.php.

References $GLOBALS, and $title.

Referenced by doSync().

{
include_once './Modules/Course/classes/class.ilObjCourse.php';
$course_obj = new ilObjCourse();
$title = $course->title;
$GLOBALS['ilLog']->write(__METHOD__.': Creating new course instance from ecs : '. $title);
$course_obj->setTitle($title);
$course_obj->create();
return $course_obj;
}

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::createCourseReference (   $crs,
  $a_parent_obj_id 
)
protected

Create course reference.

Parameters
ilObjCourse$crs_obj
int$a_parent_obj_id
Returns
ilObjCourse

Definition at line 604 of file class.ilECSCourseCreationHandler.php.

References $ref_id, ilObject\_getAllReferences(), addUrlEntry(), and setObjectCreated().

Referenced by createParallelCourse(), and doSync().

{
$ref_ids = ilObject::_getAllReferences($a_parent_obj_id);
$ref_id = end($ref_ids);
$crs->createReference();
$crs->putInTree($ref_id);
$crs->setPermissions($ref_id);
$this->setObjectCreated(true);
$this->addUrlEntry($crs->getId());
return $crs;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::createParallelCourse (   $a_content_id,
  $course,
  $group,
  $parent_ref 
)
protected

Create parallel course.

Parameters
type$course
type$group
type$parent_ref

Definition at line 417 of file class.ilECSCourseCreationHandler.php.

References $GLOBALS, $title, ilObject\_lookupObjId(), createCourseReference(), setImported(), and setObjectCreated().

Referenced by createParallelCourses(), and updateParallelCourses().

{
include_once './Modules/Course/classes/class.ilObjCourse.php';
$course_obj = new ilObjCourse();
$title = strlen($group->title) ? $group->title : $course->title;
$GLOBALS['ilLog']->write(__METHOD__.': Creating new parallel course instance from ecs : '. $title);
$course_obj->setTitle($title);
$course_obj->setSubscriptionMaxMembers((int) $group->maxParticipants);
$course_obj->create();
$this->createCourseReference($course_obj, ilObject::_lookupObjId($parent_ref));
$this->setImported($course->lectureID, $course_obj,$a_content_id, $group->id);
$this->setObjectCreated(true);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::createParallelCourses (   $a_content_id,
  $course,
  $parent_ref 
)
protected

Create parallel courses.

Parameters
intecontent id
type$course
type$parent_ref

Definition at line 402 of file class.ilECSCourseCreationHandler.php.

References createParallelCourse().

Referenced by doSync().

{
foreach((array) $course->groups as $group)
{
$this->createParallelCourse($a_content_id,$course, $group, $parent_ref);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::createParallelGroup (   $a_content_id,
  $course,
  $group,
  $parent_ref 
)
protected

Create parallel group.

Parameters
type$course
type$group

Definition at line 489 of file class.ilECSCourseCreationHandler.php.

References $title, GRP_TYPE_CLOSED, setImported(), and setObjectCreated().

Referenced by createParallelGroups(), and updateParallelGroups().

{
include_once './Modules/Group/classes/class.ilObjGroup.php';
$group_obj = new ilObjGroup();
$title = strlen($group->title) ? $group->title : $course->title;
$group_obj->setTitle($title);
$group_obj->setMaxMembers((int) $group->maxParticipants);
$group_obj->create();
$group_obj->createReference();
$group_obj->putInTree($parent_ref);
$group_obj->setPermissions($parent_ref);
$group_obj->initGroupStatus(GRP_TYPE_CLOSED);
$this->setImported($course->lectureID, $group_obj, $a_content_id, $group->id);
$this->setObjectCreated(true);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::createParallelGroups (   $a_content_id,
  $course,
  $parent_ref 
)
protected

This create parallel groups.

Parameters
type$course
ilObjCourse

Definition at line 475 of file class.ilECSCourseCreationHandler.php.

References createParallelGroup().

Referenced by doSync().

{
foreach((array) $course->groups as $group)
{
$this->createParallelGroup($a_content_id,$course, $group, $parent_ref);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::doAttributeMapping (   $a_content_id,
  $course 
)
protected

Sync attribute mapping.

Parameters
type$a_content_id
type$course

Definition at line 136 of file class.ilECSCourseCreationHandler.php.

References $GLOBALS, $ref_id, ilObject\_getAllReferences(), ilObject\_lookupObjId(), ilECSCourseMappingRule\doMappings(), doSync(), getImportId(), getMapping(), getMid(), ilECSCourseMappingRule\getRuleRefIds(), getServer(), and ilECSCourseMappingRule\isMatching().

Referenced by handle().

{
// Check if course is already created
$course_id = $course->lectureID;
$obj_id = $this->getImportId($course_id);
if($obj_id)
{
// do update
$GLOBALS['ilLog']->write(__METHOD__.' Performing update of already imported course.');
$refs = ilObject::_getAllReferences($obj_id);
$ref = end($refs);
return $this->doSync(
$a_content_id,
$course,
ilObject::_lookupObjId($GLOBALS['tree']->getParentId($ref))
);
}
// Get all rules
$matching_rule = 0;
include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseMappingRule.php';
foreach(ilECSCourseMappingRule::getRuleRefIds($this->getServer()->getServerId(), $this->getMid()) as $ref_id)
{
$course,
$this->getServer()->getServerId(),
$this->getMid(),
$ref_id))
{
$matching_rule = $ref_id;
}
}
if(!$matching_rule)
{
// Put course in default category
$GLOBALS['ilLog']->write(__METHOD__.': No matching attribute mapping rule found.');
$GLOBALS['ilLog']->write(__METHOD__.': Using course default category');
return $this->doSync($a_content_id,$course,ilObject::_lookupObjId($this->getMapping()->getDefaultCourseCategory()));
}
// map according mapping rules
$parent_ref = ilECSCourseMappingRule::doMappings($course,$this->getServer()->getServerId(),$this->getMid(),$ref_id);
$this->doSync($a_content_id, $course, ilObject::_lookupObjId($parent_ref));
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::doSync (   $a_content_id,
  $course,
  $a_parent_obj_id 
)
protected

Handle all in one setting.

Parameters
type$a_content_id
type$course

Definition at line 308 of file class.ilECSCourseCreationHandler.php.

References $GLOBALS, ilObject\_getAllReferences(), createCourseData(), createCourseReference(), createParallelCourses(), createParallelGroups(), getCourseUrl(), getImportId(), handleCourseUrlUpdate(), ilECSMappingUtils\PARALLEL_ALL_COURSES, ilECSMappingUtils\PARALLEL_COURSES_FOR_LECTURERS, ilECSMappingUtils\PARALLEL_GROUPS_IN_COURSE, ilECSMappingUtils\PARALLEL_ONE_COURSE, setImported(), updateCourseData(), updateParallelCourses(), and updateParallelGroups().

Referenced by doAttributeMapping(), and handle().

{
// Check if course is already created
$course_id = $course->lectureID;
$this->getCourseUrl()->setCmsLectureId($course_id);
$obj_id = $this->getImportId($course_id);
$GLOBALS['ilLog']->write(__METHOD__.': Handling course '. print_r($course,true));
// Handle parallel groups
if($obj_id)
{
// update multiple courses/groups according to parallel scenario
$GLOBALS['ilLog']->write(__METHOD__.': '.$course->groupScenario);
include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php';
switch((int) $course->groupScenario)
{
$GLOBALS['ilLog']->write(__METHOD__.': Performing update for parallel groups in course.');
$this->updateParallelGroups($course,$obj_id);
break;
$GLOBALS['ilLog']->write(__METHOD__.': Performing update for parallel courses.');
$this->updateParallelCourses($a_content_id,$course, $a_parent_obj_id);
break;
default:
// nothing to do
break;
}
// do update
$this->updateCourseData($course,$obj_id);
}
else
{
include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php';
switch((int) $course->groupScenario)
{
$GLOBALS['ilLog']->write(__METHOD__.': Parallel scenario "groups in courses".');
$crs = $this->createCourseData($course);
$crs = $this->createCourseReference($crs, $a_parent_obj_id);
$this->setImported($course_id, $crs, $a_content_id);
// Create parallel groups under crs
$this->createParallelGroups($a_content_id,$course,$crs->getRefId());
break;
// Import empty to store the ecs ressource id (used for course member update).
$this->setImported($course_id,NULL,$a_content_id);
$GLOBALS['ilLog']->write(__METHOD__.': Parallel scenario "Courses foreach Lecturer".');
break;
$GLOBALS['ilLog']->write(__METHOD__.': Parallel scenario "Many courses".');
$refs = ilObject::_getAllReferences($a_parent_obj_id);
$ref = end($refs);
$crs = $this->createCourseData($course);
$this->createCourseReference($crs, $a_parent_obj_id);
$this->setImported($course_id, $crs, $a_content_id);
$this->createParallelCourses($a_content_id,$course, $ref);
break;
default:
$GLOBALS['ilLog']->write(__METHOD__.': Parallel scenario "One Course".');
$crs = $this->createCourseData($course);
$this->createCourseReference($crs, $a_parent_obj_id);
$this->setImported($course_id, $crs, $a_content_id);
break;
}
}
// finally update course urls
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::getCourseUrl ( )

Get course url.

Returns
ilECSCourseUrl Description

Definition at line 61 of file class.ilECSCourseCreationHandler.php.

References $course_url.

Referenced by addUrlEntry(), doSync(), handle(), and handleCourseUrlUpdate().

{
}

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::getImportId (   $a_content_id,
  $a_sub_id = NULL 
)
protected

Get import id of remote course Return 0 if object isn't imported.

Searches for the (hopefully) unique content id of an imported object

Parameters
type$a_content_id
Returns
type

Definition at line 547 of file class.ilECSCourseCreationHandler.php.

References getMid(), getServer(), and ilECSImport\lookupObjIdByContentId().

Referenced by doAttributeMapping(), doSync(), syncNodeToTop(), updateParallelCourses(), and updateParallelGroups().

{
include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
$this->getServer()->getServerId(),
$this->getMid(),
$a_content_id,
$a_sub_id
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::getMapping ( )

Get mapping settings.

Returns
ilECSNodeMappingSettings

Definition at line 52 of file class.ilECSCourseCreationHandler.php.

References $mapping.

Referenced by doAttributeMapping(), and handle().

{
}

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::getMid ( )

Get mid of course event.

Returns
type

Definition at line 88 of file class.ilECSCourseCreationHandler.php.

References $mid.

Referenced by __construct(), doAttributeMapping(), getImportId(), handleCourseUrlUpdate(), setImported(), syncCategory(), syncNodeToTop(), and syncParentContainer().

{
return $this->mid;
}

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::getServer ( )

Get server settings.

Returns
ilECSSetting

Definition at line 43 of file class.ilECSCourseCreationHandler.php.

References $server.

Referenced by __construct(), doAttributeMapping(), getImportId(), handleCourseUrlUpdate(), setImported(), syncCategory(), syncNodeToTop(), and syncParentContainer().

{
return $this->server;
}

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::handle (   $a_content_id,
  $course 
)

Handle sync request.

Parameters
intecs content id
type$course

Definition at line 98 of file class.ilECSCourseCreationHandler.php.

References $GLOBALS, ilObject\_lookupObjId(), ilObject\_lookupTitle(), doAttributeMapping(), doSync(), getCourseUrl(), getMapping(), setObjectCreated(), and syncParentContainer().

{
$GLOBALS['ilLog']->write(__METHOD__.': --------- content id '.$a_content_id);
// prepare course url
// if any object (course group) will be created, a list of all course urls
// will be sent to ecs.
$this->setObjectCreated(false);
$this->getCourseUrl()->setECSId($a_content_id);
if($this->getMapping()->isAttributeMappingEnabled())
{
$GLOBALS['ilLog']->write(__METHOD__.': Handling advanced attribute mapping');
return $this->doAttributeMapping($a_content_id,$course);
}
if($this->getMapping()->isAllInOneCategoryEnabled())
{
$GLOBALS['ilLog']->write(__METHOD__.': Handling course all in one category setting');
return $this->doSync($a_content_id, $course,ilObject::_lookupObjId($this->getMapping()->getAllInOneCategory()));
}
$parent_obj_id = $this->syncParentContainer($a_content_id,$course);
if($parent_obj_id)
{
$GLOBALS['ilLog']->write(__METHOD__.': Using already mapped category: '. ilObject::_lookupTitle($parent_obj_id));
return $this->doSync($a_content_id,$course,$parent_obj_id);
}
$GLOBALS['ilLog']->write(__METHOD__.': Using course default category');
return $this->doSync($a_content_id,$course,ilObject::_lookupObjId($this->getMapping()->getDefaultCourseCategory()));
}

+ Here is the call graph for this function:

ilECSCourseCreationHandler::handleCourseUrlUpdate ( )
protected

Update course url.

Definition at line 667 of file class.ilECSCourseCreationHandler.php.

References $GLOBALS, getCourseUrl(), getMid(), getServer(), and isObjectCreated().

Referenced by doSync().

{
$GLOBALS['ilLog']->write(__METHOD__.': Starting course url update');
if($this->isObjectCreated())
{
$GLOBALS['ilLog']->write(__METHOD__.': Sending new course group url');
$this->getCourseUrl()->send($this->getServer(), $this->getMid());
}
else
{
$GLOBALS['ilLog']->write(__METHOD__.': No courses groups created. Aborting');
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::isObjectCreated ( )

Check if an object (course / group) has been created.

Returns
bool

Definition at line 70 of file class.ilECSCourseCreationHandler.php.

References $object_created.

Referenced by handleCourseUrlUpdate().

{
}

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::setImported (   $a_content_id,
  $object,
  $a_ecs_id = 0,
  $a_sub_id = 0 
)
protected

Set new course object imported.

Parameters
int$a_content_id
ilObjCourse$crs

Definition at line 623 of file class.ilECSCourseCreationHandler.php.

References $GLOBALS, getMid(), and getServer().

Referenced by createParallelCourse(), createParallelGroup(), and doSync().

{
include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
$import = new ilECSImport(
$this->getServer()->getServerId(),
is_object($object) ? $object->getId() : 0
);
$GLOBALS['ilLog']->write(__METHOD__.': Imported with ecs id '.$a_ecs_id);
$import->setSubId($a_sub_id);
$import->setMID($this->getMid());
$import->setEContentId($a_ecs_id);
$import->setContentId($a_content_id);
$import->setImported(true);
$import->save();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::setObjectCreated (   $a_status)

Set object created status.

Parameters
bool$a_status

Definition at line 79 of file class.ilECSCourseCreationHandler.php.

Referenced by createCourseReference(), createParallelCourse(), createParallelGroup(), and handle().

{
$this->object_created = $a_status;
}

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::syncCategory (   $tobj_id,
  $parent_ref_id 
)
protected

Sync category.

Parameters
type$tobj_id
type$parent_ref_id

Definition at line 270 of file class.ilECSCourseCreationHandler.php.

References $data, $GLOBALS, getMid(), getServer(), and ilECSImport\setMID().

Referenced by syncNodeToTop().

{
include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
$data = new ilECSCmsData($tobj_id);
include_once './Modules/Category/classes/class.ilObjCategory.php';
$cat = new ilObjCategory();
$cat->setTitle($data->getTitle());
$cat->create(); // true for upload
$cat->createReference();
$cat->putInTree($parent_ref_id);
$cat->setPermissions($parent_ref_id);
$cat->deleteTranslation($GLOBALS['lng']->getDefaultLanguage());
$cat->addTranslation(
$data->getTitle(),
$cat->getLongDescription(),
$GLOBALS['lng']->getDefaultLanguage(),
1
);
// set imported
$import = new ilECSImport(
$this->getServer()->getServerId(),
$cat->getId()
);
$import->setMID($this->getMid());
$import->setEContentId($data->getCmsId());
$import->setImported(true);
$import->save();
return $cat->getId();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::syncNodeToTop (   $tree_id,
  $cms_id 
)
protected

Sync node to top.

Parameters
type$tree_id
type$parent_id
Returns
int obj_id of container

Definition at line 214 of file class.ilECSCourseCreationHandler.php.

References $GLOBALS, $ref_id, ilObject\_getAllReferences(), getImportId(), getMid(), getServer(), ilECSCmsData\lookupCmsIds(), ilECSCmsData\lookupObjId(), and syncCategory().

{
$obj_id = $this->getImportId($cms_id);
if($obj_id)
{
// node already imported
return $obj_id;
}
$this->getServer()->getServerId(),
$this->getMid(),
$tree_id,
$cms_id);
// node is not imported
$GLOBALS['ilLog']->write(__METHOD__.': ecs node with id '. $cms_id. ' is not imported!');
// check for mapping: if mapping is available create category
include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingAssignment.php';
$this->getServer()->getServerId(),
$this->getMid(),
$tree_id,
$tobj_id);
if($ass->isMapped())
{
$GLOBALS['ilLog']->write(__METHOD__.': node is mapped');
return $this->syncCategory($tobj_id,$ass->getRefId());
}
// Start recursion to top
include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php';
$tree = new ilECSCmsTree($tree_id);
$parent_tobj_id = $tree->getParentId($tobj_id);
if($parent_tobj_id)
{
$cms_ids = ilECSCmsData::lookupCmsIds(array($parent_tobj_id));
$obj_id = $this->syncNodeToTop($tree_id, $cms_ids[0]);
}
if($obj_id)
{
$refs = ilObject::_getAllReferences($obj_id);
$ref_id = end($refs);
return $this->syncCategory($tobj_id, $ref_id);
}
return 0;
}

+ Here is the call graph for this function:

ilECSCourseCreationHandler::syncParentContainer (   $a_content_id,
  $course 
)
protected

Sync parent container.

Parameters
type$a_content_id
type$course

Definition at line 189 of file class.ilECSCourseCreationHandler.php.

References $GLOBALS, getMid(), getServer(), and ilECSCmsData\lookupFirstTreeOfNode().

Referenced by handle().

{
if(!is_array($course->allocations))
{
$GLOBALS['ilLog']->write(__METHOD__.': No allocation in course defined.');
return 0;
}
if(!$course->allocations[0]->parentID)
{
$GLOBALS['ilLog']->write(__METHOD__.': No allocation parent in course defined.');
return 0;
}
$parent_id = $course->allocations[0]->parentID;
include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
$parent_tid = ilECSCmsData::lookupFirstTreeOfNode($this->getServer()->getServerId(), $this->getMid(), $parent_id);
return $this->syncNodetoTop($parent_tid, $parent_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::updateCourseData (   $course,
  $obj_id 
)
protected

Update course data.

Parameters
type$course

Definition at line 562 of file class.ilECSCourseCreationHandler.php.

References $GLOBALS, $ref_id, $title, ilObject\_getAllReferences(), and ilObjectFactory\getInstanceByRefId().

Referenced by doSync().

{
// do update
$refs = ilObject::_getAllReferences($obj_id);
$ref_id = end($refs);
if(!$crs_obj instanceof ilObject)
{
$GLOBALS['ilLog']->write(__METHOD__.': Cannot instantiate course instance');
return true;
}
// Update title
$title = $course->title;
$GLOBALS['ilLog']->write(__METHOD__.': new title is : '. $title);
$crs_obj->setTitle($title);
$crs_obj->update();
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::updateParallelCourses (   $a_content_id,
  $course,
  $parent_obj 
)
protected

Update parallel group data.

Parameters
type$course
type$parent_obj

Definition at line 438 of file class.ilECSCourseCreationHandler.php.

References $GLOBALS, $title, ilObject\_getAllReferences(), addUrlEntry(), createParallelCourse(), getImportId(), and ilObjectFactory\getInstanceByObjId().

Referenced by doSync().

{
$parent_refs = ilObject::_getAllReferences($parent_obj);
$parent_ref = end($parent_refs);
foreach((array) $course->groups as $group)
{
$title = strlen($group->title) ? $group->title : $course->title;
$obj_id = $this->getImportId($course->lectureID, $group->id);
$GLOBALS['ilLog']->write(__METHOD__.': Imported obj id is ' .$obj_id);
if(!$obj_id)
{
$this->createParallelCourse($a_content_id, $course, $group, $parent_ref);
}
else
{
$course_obj = ilObjectFactory::getInstanceByObjId($obj_id,false);
if($course_obj instanceof ilObjCourse)
{
$GLOBALS['ilLog']->write(__METHOD__.': New title is '. $title);
$course_obj->setTitle($title);
$course_obj->setSubscriptionMaxMembers($group->maxParticipants);
$course_obj->update();
}
}
$this->addUrlEntry($this->getImportId($course->lectureID, $group->ID));
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilECSCourseCreationHandler::updateParallelGroups (   $a_content_id,
  $course,
  $parent_obj 
)
protected

Update parallel group data.

Parameters
type$course
type$parent_obj

Definition at line 511 of file class.ilECSCourseCreationHandler.php.

References $GLOBALS, $title, ilObject\_getAllReferences(), addUrlEntry(), createParallelGroup(), getImportId(), and ilObjectFactory\getInstanceByObjId().

Referenced by doSync().

{
$parent_refs = ilObject::_getAllReferences($parent_obj);
$parent_ref = end($parent_refs);
foreach((array) $course->groups as $group)
{
$obj_id = $this->getImportId($course->lectureID, $group->id);
$GLOBALS['ilLog']->write(__METHOD__.': Imported obj id is ' .$obj_id);
if(!$obj_id)
{
$this->createParallelGroup($a_content_id,$course, $group, $parent_ref);
}
else
{
$group_obj = ilObjectFactory::getInstanceByObjId($obj_id,false);
if($group_obj instanceof ilObjGroup)
{
$title = strlen($group->title) ? $group->title : $course->title;
$GLOBALS['ilLog']->write(__METHOD__.': New title is '. $title);
$group_obj->setTitle($title);
$group_obj->setMaxMembers((int) $group->maxParticipants);
$group_obj->update();
}
}
$this->addUrlEntry($this->getImportId($course->lectureID, $group->id));
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilECSCourseCreationHandler::$course_url = null
private

Definition at line 18 of file class.ilECSCourseCreationHandler.php.

Referenced by getCourseUrl().

ilECSCourseCreationHandler::$mapping = null
private

Definition at line 17 of file class.ilECSCourseCreationHandler.php.

Referenced by getMapping().

ilECSCourseCreationHandler::$mid
private

Definition at line 21 of file class.ilECSCourseCreationHandler.php.

Referenced by getMid().

ilECSCourseCreationHandler::$object_created = false
private

Definition at line 19 of file class.ilECSCourseCreationHandler.php.

Referenced by isObjectCreated().

ilECSCourseCreationHandler::$server = null
private

Definition at line 16 of file class.ilECSCourseCreationHandler.php.

Referenced by __construct(), and getServer().


The documentation for this class was generated from the following file: