/** * Clone folder * * @access public * @param int target id * @param int copy id * */ public function cloneObject($a_target_id, $a_copy_id = 0) { $new_obj = parent::cloneObject($a_target_id, $a_copy_id); // Copy learning progress settings include_once 'Services/Tracking/classes/class.ilLPObjSettings.php'; $obj_settings = new ilLPObjSettings($this->getId()); $obj_settings->cloneSettings($new_obj->getId()); unset($obj_settings); return $new_obj; }
/** * Clone course (no member data) * * @access public * @param int target ref_id * @param int copy id * */ public function cloneObject($a_target_id, $a_copy_id = 0) { global $ilDB, $ilUser; $new_obj = parent::cloneObject($a_target_id, $a_copy_id); $this->cloneAutoGeneratedRoles($new_obj); $this->cloneMetaData($new_obj); // Assign admin $new_obj->getMemberObject()->add($ilUser->getId(), IL_CRS_ADMIN); // #14596 $cwo = ilCopyWizardOptions::_getInstance($a_copy_id); if ($cwo->isRootNode($this->getRefId())) { $this->setOfflineStatus(true); } // Copy settings $this->cloneSettings($new_obj); // Course Defined Fields include_once 'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php'; ilCourseDefinedFieldDefinition::_clone($this->getId(), $new_obj->getId()); // Clone course files include_once 'Modules/Course/classes/class.ilCourseFile.php'; ilCourseFile::_cloneFiles($this->getId(), $new_obj->getId()); // Copy learning progress settings include_once 'Services/Tracking/classes/class.ilLPObjSettings.php'; $obj_settings = new ilLPObjSettings($this->getId()); $obj_settings->cloneSettings($new_obj->getId()); unset($obj_settings); // clone icons global $ilLog; $ilLog->write(__METHOD__ . ': ' . $this->getBigIconPath() . ' ' . $this->getSmallIconPath()); $new_obj->saveIcons($this->getBigIconPath(), $this->getSmallIconPath(), $this->getTinyIconPath()); // clone certificate (#11085) include_once "./Services/Certificate/classes/class.ilCertificate.php"; include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php"; $cert = new ilCertificate(new ilCourseCertificateAdapter($this)); $newcert = new ilCertificate(new ilCourseCertificateAdapter($new_obj)); $cert->cloneCertificate($newcert); return $new_obj; }
/** * Clone course (no member data) * * @access public * @param int target ref_id * @param int copy id * */ public function cloneObject($a_target_id, $a_copy_id = 0) { global $ilDB, $ilUser; $new_obj = parent::cloneObject($a_target_id, $a_copy_id); /* done in class.ilContainer include_once('./Services/Container/classes/class.ilContainerSortingSettings.php'); ilContainerSortingSettings::_cloneSettings($this->getId(),$new_obj->getId()); */ include_once "./Services/Object/classes/class.ilObjectTranslation.php"; $ot = ilObjectTranslation::getInstance($this->getId()); $ot->copy($new_obj->getId()); /* $first = true; $translations = $this->getTranslations(); if(is_array($translations['Fobject'])) { foreach($translations['Fobject'] as $num => $translation) { $new_obj->addTranslation($translation['title'],$translation['desc'],$translation['lang'],$first); if($first) { $first = false; } } }*/ // clone icons $new_obj->saveIcons($this->getBigIconPath(), $this->getSmallIconPath(), $this->getTinyIconPath()); return $new_obj; }
/** * Clone group (no member data) * * @access public * @param int target ref_id * @param int copy id * */ public function cloneObject($a_target_id, $a_copy_id = 0) { global $ilDB, $ilUser; $new_obj = parent::cloneObject($a_target_id, $a_copy_id); $new_obj->setGroupType($this->getGroupType()); $new_obj->initGroupStatus($this->getGroupType() ? $this->getGroupType() : $this->readGroupStatus()); $this->cloneAutoGeneratedRoles($new_obj); $new_obj->setRegistrationType($this->getRegistrationType()); $new_obj->setInformation($this->getInformation()); $new_obj->setRegistrationStart($this->getRegistrationStart()); $new_obj->setRegistrationEnd($this->getRegistrationEnd()); $new_obj->enableUnlimitedRegistration($this->isRegistrationUnlimited()); $new_obj->setPassword($this->getPassword()); $new_obj->enableMembershipLimitation($this->isMembershipLimited()); $new_obj->setMaxMembers($this->getMaxMembers()); $new_obj->enableWaitingList($this->isWaitingListEnabled()); // map $new_obj->setLatitude($this->getLatitude()); $new_obj->setLongitude($this->getLongitude()); $new_obj->setLocationZoom($this->getLocationZoom()); $new_obj->setEnableGroupMap($this->getEnableGroupMap()); $new_obj->enableRegistrationAccessCode($this->isRegistrationAccessCodeEnabled()); include_once './Services/Membership/classes/class.ilMembershipRegistrationCodeUtils.php'; $new_obj->setRegistrationAccessCode(ilMembershipRegistrationCodeUtils::generateCode()); $new_obj->setViewMode($this->getViewMode()); $new_obj->setMailToMembersType($this->getMailToMembersType()); $new_obj->update(); global $ilLog; $ilLog->write(__METHOD__ . ': Starting add user'); // Assign user as admin include_once './Modules/Group/classes/class.ilGroupParticipants.php'; $part = ilGroupParticipants::_getInstanceByObjId($new_obj->getId()); $part->add($ilUser->getId(), IL_GRP_ADMIN); $part->updateNotification($ilUser->getId(), 1); // Copy learning progress settings include_once 'Services/Tracking/classes/class.ilLPObjSettings.php'; $obj_settings = new ilLPObjSettings($this->getId()); $obj_settings->cloneSettings($new_obj->getId()); unset($obj_settings); // clone icons $new_obj->saveIcons($this->getBigIconPath(), $this->getSmallIconPath(), $this->getTinyIconPath()); return $new_obj; }