Ejemplo n.º 1
0
 /**
  * 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;
 }
Ejemplo n.º 2
0
 /**
  * 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 learning module
  *
  * @access public
  * @param int target ref_id
  * @param int copy id
  *
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilDB, $ilUser, $ilias;
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     $this->cloneMetaData($new_obj);
     //$new_obj->createProperties();
     $new_obj->setTitle($this->getTitle());
     $new_obj->setDescription($this->getDescription());
     $new_obj->setLayoutPerPage($this->getLayoutPerPage());
     $new_obj->setLayout($this->getLayout());
     $new_obj->setTOCMode($this->getTOCMode());
     $new_obj->setActiveLMMenu($this->isActiveLMMenu());
     $new_obj->setActiveTOC($this->isActiveTOC());
     $new_obj->setActiveNumbering($this->isActiveNumbering());
     $new_obj->setActivePrintView($this->isActivePrintView());
     $new_obj->setActivePreventGlossaryAppendix($this->isActivePreventGlossaryAppendix());
     $new_obj->setActiveDownloads($this->isActiveDownloads());
     $new_obj->setActiveDownloadsPublic($this->isActiveDownloadsPublic());
     $new_obj->setPublicNotes($this->publicNotes());
     $new_obj->setCleanFrames($this->cleanFrames());
     $new_obj->setHistoryUserComments($this->isActiveHistoryUserComments());
     $new_obj->setPublicAccessMode($this->getPublicAccessMode());
     $new_obj->setPageHeader($this->getPageHeader());
     $new_obj->setRating($this->hasRating());
     $new_obj->update();
     $new_obj->createLMTree();
     // copy style
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $style_id = $this->getStyleSheetId();
     if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id)) {
         $style_obj = $ilias->obj_factory->getInstanceByObjId($style_id);
         $new_id = $style_obj->ilClone();
         $new_obj->setStyleSheetId($new_id);
         $new_obj->update();
     }
     // copy content
     $this->copyAllPagesAndChapters($new_obj);
     // 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;
 }
Ejemplo n.º 4
0
 /**
  * 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;
 }
 /**
  * Clone exercise (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;
     // Copy settings
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     $new_obj->setInstruction($this->getInstruction());
     $new_obj->setTimestamp($this->getTimestamp());
     $new_obj->setPassMode($this->getPassMode());
     $new_obj->saveData();
     $new_obj->setPassNr($this->getPassNr());
     $new_obj->setShowSubmissions($this->getShowSubmissions());
     $new_obj->setCompletionBySubmission($this->isCompletionBySubmissionEnabled());
     $new_obj->update();
     // Copy assignments
     include_once "./Modules/Exercise/classes/class.ilExAssignment.php";
     ilExAssignment::cloneAssignmentsOfExercise($this->getId(), $new_obj->getId());
     //$tmp_file_obj =& new ilFileDataExercise($this->getId());
     //$tmp_file_obj->ilClone($new_obj->getId());
     //unset($tmp_file_obj);
     // 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;
 }
Ejemplo n.º 6
0
 /**
  * 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, $ilAppEventHandler;
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     $this->read();
     // Copy settings
     $this->cloneSettings($new_obj);
     // Clone appointment
     $new_app = $this->getFirstAppointment()->cloneObject($new_obj->getId());
     $new_obj->setAppointments(array($new_app));
     $new_obj->update();
     // Clone session files
     foreach ($this->files as $file) {
         $file->cloneFiles($new_obj->getEventId());
     }
     // Raise update forn new appointments
     // 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;
 }