/**
  * Custom callback after object is created (in parent containert
  * 
  * @param ilObject $a_obj 
  */
 public function afterSaveCallback(ilObject $a_obj)
 {
     // add new object to materials
     include_once './Modules/ItemGroup/classes/class.ilItemGroupItems.php';
     $items = new ilItemGroupItems($this->object->getRefId());
     $items->addItem($a_obj->getRefId());
     $items->update();
 }
 /**
  * Import record
  *
  * @param
  * @return
  */
 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 {
     global $ilLog;
     //echo $a_entity;
     //var_dump($a_rec);
     switch ($a_entity) {
         case "itgr":
             include_once "./Modules/ItemGroup/classes/class.ilObjItemGroup.php";
             if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['Id'])) {
                 $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
             } else {
                 $newObj = new ilObjItemGroup();
                 $newObj->setType("itgr");
                 $newObj->create(true);
             }
             $newObj->setTitle($a_rec["Title"]);
             $newObj->setDescription($a_rec["Description"]);
             $newObj->update(true);
             $this->current_obj = $newObj;
             $a_mapping->addMapping("Modules/ItemGroup", "itgr", $a_rec["Id"], $newObj->getId());
             break;
         case "itgr_item":
             if ($obj_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['ItemId'])) {
                 $ref_id = current(ilObject::_getAllReferences($obj_id));
                 include_once './Modules/ItemGroup/classes/class.ilItemGroupItems.php';
                 $itgri = new ilItemGroupItems();
                 $itgri->setItemGroupId($this->current_obj->getId());
                 $itgri->read();
                 $itgri->addItem($ref_id);
                 //$ilLog->write("Adding item with ref id -".$ref_id."- to group with id -".$this->current_obj->getId()."-.");
                 $itgri->update();
             }
             break;
     }
 }