Exemplo n.º 1
0
 /**
  * Clone object dependencies (container sorting)
  *
  * @access public
  * @param int target ref id of new course
  * @param int copy id
  * return bool 
  */
 public function cloneDependencies($a_target_id, $a_copy_id)
 {
     global $ilLog;
     parent::cloneDependencies($a_target_id, $a_copy_id);
     include_once './Services/Container/classes/class.ilContainerSorting.php';
     ilContainerSorting::_getInstance($this->getId())->cloneSorting($a_target_id, $a_copy_id);
     // fix item group references in page content
     include_once "./Modules/ItemGroup/classes/class.ilObjItemGroup.php";
     ilObjItemGroup::fixContainerItemGroupRefsAfterCloning($this, $a_copy_id);
     include_once 'Services/Object/classes/class.ilObjectLP.php';
     $olp = ilObjectLP::getInstance($this->getId());
     $collection = $olp->getCollectionInstance();
     if ($collection) {
         $collection->cloneCollection($a_target_id, $a_copy_id);
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * 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;
     }
 }
 /**
  * Clone object dependencies (container sorting)
  *
  * @access public
  * @param int target ref id of new course
  * @param int copy id
  * return bool 
  */
 public function cloneDependencies($a_target_id, $a_copy_id)
 {
     parent::cloneDependencies($a_target_id, $a_copy_id);
     include_once './Services/Container/classes/class.ilContainerSorting.php';
     ilContainerSorting::_getInstance($this->getId())->cloneSorting($a_target_id, $a_copy_id);
     // fix item group references in page content
     include_once "./Modules/ItemGroup/classes/class.ilObjItemGroup.php";
     ilObjItemGroup::fixContainerItemGroupRefsAfterCloning($this, $a_copy_id);
     return true;
 }