/**
  * Duplicate media object, return new media object
  */
 function duplicate()
 {
     $new_obj = new ilObjMediaObject();
     $new_obj->setTitle($this->getTitle());
     $new_obj->setDescription($this->getDescription());
     // media items
     foreach ($this->getMediaItems() as $key => $val) {
         $new_obj->addMediaItem($val);
     }
     $new_obj->create(false, true);
     // files
     $new_obj->createDirectory();
     self::_createThumbnailDirectory($new_obj->getId());
     ilUtil::rCopy(ilObjMediaObject::_getDirectory($this->getId()), ilObjMediaObject::_getDirectory($new_obj->getId()));
     ilUtil::rCopy(ilObjMediaObject::_getThumbnailDirectory($this->getId()), ilObjMediaObject::_getThumbnailDirectory($new_obj->getId()));
     // meta data
     include_once "Services/MetaData/classes/class.ilMD.php";
     $md = new ilMD(0, $this->getId(), "mob");
     $new_md = $md->cloneMD(0, $new_obj->getId(), "mob");
     return $new_obj;
 }
Esempio n. 2
0
 /**
  * get media file directory
  */
 function getThumbnailDirectory($a_mode = "filesystem")
 {
     return ilObjMediaObject::_getThumbnailDirectory($this->getMobId(), $a_mode);
 }