Ejemplo n.º 1
0
 /**
  * Clone
  *
  * @access public
  * @param int target id
  * @param int copy id
  * 
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilDB, $ilLog;
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     $fb = $this->getFeedBlock();
     include_once "./Services/Block/classes/class.ilExternalFeedBlock.php";
     $new_feed_block = new ilExternalFeedBlock();
     $new_feed_block->setContextObjId($new_obj->getId());
     $new_feed_block->setContextObjType("feed");
     if (is_object($fb)) {
         $new_feed_block->setFeedUrl($fb->getFeedUrl());
         $new_feed_block->setTitle($fb->getTitle());
     }
     $new_feed_block->create();
     return $new_obj;
 }
Ejemplo n.º 2
0
 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree = false)
 {
     global $rbacreview;
     require_once 'Modules/Chatroom/classes/class.ilChatroom.php';
     $original_room = ilChatroom::byObjectId($this->getId());
     $newObj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
     $objId = $newObj->getId();
     $original_settings = $original_room->getSettings();
     $room = new ilChatroom();
     $original_settings['object_id'] = $objId;
     $room->saveSettings($original_settings);
     // rbac log
     include_once "Services/AccessControl/classes/class.ilRbacLog.php";
     $rbac_log_roles = $rbacreview->getParentRoleIds($newObj->getRefId(), false);
     $rbac_log = ilRbacLog::gatherFaPa($newObj->getRefId(), array_keys($rbac_log_roles), true);
     ilRbacLog::add(ilRbacLog::CREATE_OBJECT, $newObj->getRefId(), $rbac_log);
     return $newObj;
 }
Ejemplo n.º 3
0
 /**
  * Clone object
  *
  * @access public
  * @param int ref_id of target container
  * @param int copy id
  * @return object new svy object
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilDB;
     $this->loadFromDb();
     // Copy settings
     $newObj = parent::cloneObject($a_target_id, $a_copy_id);
     $this->cloneMetaData($newObj);
     $newObj->updateMetaData();
     $newObj->setAuthor($this->getAuthor());
     $newObj->setIntroduction($this->getIntroduction());
     $newObj->setOutro($this->getOutro());
     $newObj->setEvaluationAccess($this->getEvaluationAccess());
     $newObj->setStartDate($this->getStartDate());
     $newObj->setEndDate($this->getEndDate());
     $newObj->setInvitation($this->getInvitation());
     $newObj->setInvitationMode($this->getInvitationMode());
     $newObj->setAnonymize($this->getAnonymize());
     $newObj->setShowQuestionTitles($this->getShowQuestionTitles());
     $newObj->setTemplate($this->getTemplate());
     $newObj->setPoolUsage($this->getPoolUsage());
     $newObj->setViewOwnResults($this->hasViewOwnResults());
     $newObj->setMailOwnResults($this->hasMailOwnResults());
     // #12661
     if ($this->get360Mode()) {
         $newObj->set360Mode(true);
         $newObj->set360SelfEvaluation($this->get360SelfEvaluation());
         $newObj->set360SelfAppraisee($this->get360SelfAppraisee());
         $newObj->set360SelfRaters($this->get360SelfRaters());
         $newObj->set360Results($this->get360Results());
         $newObj->set360SkillService($this->get360SkillService());
     }
     // reminder/notification
     $newObj->setReminderStatus($this->getReminderStatus());
     $newObj->setReminderStart($this->getReminderStart());
     $newObj->setReminderEnd($this->getReminderEnd());
     $newObj->setReminderFrequency($this->getReminderFrequency());
     $newObj->setReminderTarget($this->getReminderTarget());
     // reminder_last_sent must not be copied!
     $newObj->setTutorNotificationStatus($this->getTutorNotificationStatus());
     $newObj->setTutorNotificationRecipients($this->getTutorNotificationRecipients());
     $newObj->setTutorNotificationTarget($this->getTutorNotificationTarget());
     $question_pointer = array();
     // clone the questions
     $mapping = array();
     include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
     foreach ($this->questions as $key => $question_id) {
         $question = ilObjSurvey::_instanciateQuestion($question_id);
         if ($question) {
             $question->id = -1;
             $original_id = SurveyQuestion::_getOriginalId($question_id, false);
             $question->saveToDb($original_id);
             $newObj->questions[$key] = $question->getId();
             $question_pointer[$question_id] = $question->getId();
             $mapping[$question_id] = $question->getId();
         }
     }
     //copy online status if object is not the root copy object
     $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
     if (!$cp_options->isRootNode($this->getRefId())) {
         $newObj->setStatus($this->isOnline() ? self::STATUS_ONLINE : self::STATUS_OFFLINE);
     }
     $newObj->saveToDb();
     $newObj->cloneTextblocks($mapping);
     // #14929
     if ($this->get360Mode() && $this->get360SkillService()) {
         include_once "./Modules/Survey/classes/class.ilSurveySkill.php";
         $src_skills = new ilSurveySkill($this);
         $tgt_skills = new ilSurveySkill($newObj);
         foreach ($mapping as $src_qst_id => $tgt_qst_id) {
             $qst_skill = $src_skills->getSkillForQuestion($src_qst_id);
             if ($qst_skill) {
                 $tgt_skills->addQuestionSkillAssignment($tgt_qst_id, $qst_skill["base_skill_id"], $qst_skill["tref_id"]);
             }
         }
     }
     // clone the questionblocks
     $questionblocks = array();
     $questionblock_questions = array();
     $result = $ilDB->queryF("SELECT * FROM svy_qblk_qst WHERE survey_fi = %s", array('integer'), array($this->getSurveyId()));
     if ($result->numRows() > 0) {
         while ($row = $ilDB->fetchAssoc($result)) {
             array_push($questionblock_questions, $row);
             $questionblocks[$row["questionblock_fi"]] = $row["questionblock_fi"];
         }
     }
     // create new questionblocks
     foreach ($questionblocks as $key => $value) {
         $questionblock = ilObjSurvey::_getQuestionblock($key);
         $questionblock_id = ilObjSurvey::_addQuestionblock($questionblock["title"], $questionblock["owner_fi"], $questionblock["show_questiontext"], $questionblock["show_blocktitle"]);
         $questionblocks[$key] = $questionblock_id;
     }
     // create new questionblock questions
     foreach ($questionblock_questions as $key => $value) {
         if ($questionblocks[$value["questionblock_fi"]] && $question_pointer[$value["question_fi"]]) {
             $next_id = $ilDB->nextId('svy_qblk_qst');
             $affectedRows = $ilDB->manipulateF("INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, question_fi) " . "VALUES (%s, %s, %s, %s)", array('integer', 'integer', 'integer', 'integer'), array($next_id, $newObj->getSurveyId(), $questionblocks[$value["questionblock_fi"]], $question_pointer[$value["question_fi"]]));
         }
     }
     // clone the constraints
     $constraints = ilObjSurvey::_getConstraints($this->getSurveyId());
     $newConstraints = array();
     foreach ($constraints as $key => $constraint) {
         if ($question_pointer[$constraint["for_question"]] && $question_pointer[$constraint["question"]]) {
             if (!array_key_exists($constraint['id'], $newConstraints)) {
                 $constraint_id = $newObj->addConstraint($question_pointer[$constraint["question"]], $constraint["relation_id"], $constraint["value"], $constraint['conjunction']);
                 $newConstraints[$constraint['id']] = $constraint_id;
             }
             $newObj->addConstraintToQuestion($question_pointer[$constraint["for_question"]], $newConstraints[$constraint['id']]);
         }
     }
     // clone the obligatory states
     $result = $ilDB->queryF("SELECT * FROM svy_qst_oblig WHERE survey_fi = %s", array('integer'), array($this->getSurveyId()));
     if ($result->numRows() > 0) {
         while ($row = $ilDB->fetchAssoc($result)) {
             if ($question_pointer[$row["question_fi"]]) {
                 $next_id = $ilDB->nextId('svy_qst_oblig');
                 $affectedRows = $ilDB->manipulateF("INSERT INTO svy_qst_oblig (question_obligatory_id, survey_fi, question_fi, " . "obligatory, tstamp) VALUES (%s, %s, %s, %s, %s)", array('integer', 'integer', 'integer', 'text', 'integer'), array($next_id, $newObj->getSurveyId(), $question_pointer[$row["question_fi"]], $row["obligatory"], time()));
             }
         }
     }
     return $newObj;
 }
 /**
 * Creates a 1:1 copy of the object and places the copy in a given repository
 *
 * @access public
 */
 function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilLog;
     $newObj = parent::cloneObject($a_target_id, $a_copy_id);
     $newObj->setOnline($this->getOnline());
     $newObj->saveToDb();
     // clone the questions in the question pool
     $questions =& $this->getQplQuestions();
     foreach ($questions as $question_id) {
         $newObj->copyQuestion($question_id, $newObj->getId());
     }
     // clone meta data
     include_once "./Services/MetaData/classes/class.ilMD.php";
     $md = new ilMD($this->getId(), 0, $this->getType());
     $new_md =& $md->cloneMD($newObj->getId(), 0, $newObj->getType());
     // update the metadata with the new title of the question pool
     $newObj->updateMetaData();
     return $newObj;
 }
Ejemplo n.º 5
0
 /**
  * Clone HTML learning module
  *
  * @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->setTitle($this->getTitle());
     $new_obj->setDescription($this->getDescription());
     $new_obj->setShowLicense($this->getShowLicense());
     $new_obj->setShowBibliographicalData($this->getShowBibliographicalData());
     // copy content
     $new_obj->populateByDirectoy($this->getDataDirectory());
     $new_obj->setStartFile($this->getStartFile());
     $new_obj->update();
     return $new_obj;
 }
 /**
  * Clone scorm object
  *
  * @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);
     // copy properties
     $new_obj->setTitle($this->getTitle());
     $new_obj->setDescription($this->getDescription());
     $new_obj->setSubType($this->getSubType());
     $new_obj->setAPIAdapterName($this->getAPIAdapterName());
     $new_obj->setAPIFunctionsPrefix($this->getAPIFunctionsPrefix());
     $new_obj->setAutoReviewChar($this->getAutoReviewChar());
     $new_obj->setDefaultLessonMode($this->getDefaultLessonMode());
     $new_obj->setEditable($this->getEditable());
     $new_obj->setMaxAttempt($this->getMaxAttempt());
     //		$new_obj->getModuleVersion($this->getModuleVersion());	??
     $new_obj->setModuleVersion(1);
     $new_obj->setCreditMode($this->getCreditMode());
     $new_obj->setAssignedGlossary($this->getAssignedGlossary());
     $new_obj->setTries($this->getTries());
     $new_obj->setSession($this->getSession());
     $new_obj->setNoMenu($this->getNoMenu());
     $new_obj->setHideNavig($this->getHideNavig());
     $new_obj->setSequencing($this->getSequencing());
     $new_obj->setInteractions($this->getInteractions());
     $new_obj->setObjectives($this->getObjectives());
     $new_obj->setComments($this->getComments());
     $new_obj->setTime_from_lms($this->getTime_from_lms());
     $new_obj->setDebug($this->getDebug());
     $new_obj->setLocalization($this->getLocalization());
     $new_obj->setSequencingExpertMode($this->getSequencingExpertMode());
     $new_obj->setDebugPw($this->getDebugPw());
     $new_obj->setOpenMode($this->getOpenMode());
     $new_obj->setWidth($this->getWidth());
     $new_obj->setHeight($this->getHeight());
     $new_obj->setAutoContinue($this->getAutoContinue());
     $new_obj->setAuto_last_visited($this->getAuto_last_visited());
     $new_obj->setCheck_values($this->getCheck_values());
     $new_obj->setOfflineMode($this->getOfflineMode());
     $new_obj->setAutoSuspend($this->getAutoSuspend());
     $new_obj->update();
     // set/copy stylesheet
     /*		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();
     		}*/
     // up to this point $new_obj is of type ilobjsahslearning module
     // create instance of correct subtype and call forward it to
     // cloneIntoNewObject method
     switch ($this->getSubType()) {
         case "scorm":
             include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
             $source_obj = new ilObjSCORMLearningModule($this->getRefId());
             $new_obj = new ilObjSCORMLearningModule($new_obj->getRefId());
             break;
         case "scorm2004":
             include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
             $source_obj = new ilObjSCORM2004LearningModule($this->getRefId());
             $new_obj = new ilObjSCORM2004LearningModule($new_obj->getRefId());
             break;
         case "aicc":
             include_once "./Modules/ScormAicc/classes/class.ilObjAICCLearningModule.php";
             $source_obj = new ilObjAICCLearningModule($this->getRefId());
             $new_obj = new ilObjAICCLearningModule($new_obj->getRefId());
             break;
         case "hacp":
             include_once "./Modules/ScormAicc/classes/class.ilObjHACPLearningModule.php";
             $source_obj = new ilObjHACPLearningModule($this->getRefId());
             $new_obj = new ilObjHACPLearningModule($new_obj->getRefId());
             break;
     }
     // copy data directory
     $new_obj->populateByDirectoy($source_obj->getDataDirectory());
     // copy authored content ...
     if ($new_obj->getEditable()) {
         $source_obj->copyAuthoredContent($new_obj);
     } else {
         // ... or read manifest file
         $new_obj->readObject();
     }
     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.º 8
0
 /**
 * Creates a 1:1 copy of the object and places the copy in a given repository
 *
 * @access public
 */
 function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilLog;
     $newObj = parent::cloneObject($a_target_id, $a_copy_id);
     //copy online status if object is not the root copy object
     $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
     if (!$cp_options->isRootNode($this->getRefId())) {
         $newObj->setOnline($this->getOnline());
     }
     $newObj->setShowTaxonomies($this->getShowTaxonomies());
     $newObj->saveToDb();
     // clone the questions in the question pool
     $questions =& $this->getQplQuestions();
     $questionIdsMap = array();
     foreach ($questions as $question_id) {
         $newQuestionId = $newObj->copyQuestion($question_id, $newObj->getId());
         $questionIdsMap[$question_id] = $newQuestionId;
     }
     // clone meta data
     include_once "./Services/MetaData/classes/class.ilMD.php";
     $md = new ilMD($this->getId(), 0, $this->getType());
     $new_md =& $md->cloneMD($newObj->getId(), 0, $newObj->getType());
     // update the metadata with the new title of the question pool
     $newObj->updateMetaData();
     require_once 'Modules/TestQuestionPool/classes/class.ilQuestionPoolTaxonomiesDuplicator.php';
     $duplicator = new ilQuestionPoolTaxonomiesDuplicator();
     $duplicator->setSourceObjId($this->getId());
     $duplicator->setSourceObjType($this->getType());
     $duplicator->setTargetObjId($newObj->getId());
     $duplicator->setTargetObjType($newObj->getType());
     $duplicator->setQuestionIdMapping($questionIdsMap);
     $duplicator->duplicate();
     $duplicatedTaxKeyMap = $duplicator->getDuplicatedTaxonomiesKeysMap();
     $newObj->setNavTaxonomyId($duplicatedTaxKeyMap->getMappedTaxonomyId($this->getNavTaxonomyId()));
     $newObj->saveToDb();
     return $newObj;
 }
Ejemplo n.º 9
0
 final function cloneObject($a_target_id, $a_copy_id = null, $a_omit_tree = false)
 {
     if ($this->beforeCloneObject()) {
         $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
         if ($new_obj) {
             $this->doCloneObject($new_obj, $a_target_id, $a_copy_id);
             return $new_obj;
         }
     }
 }
 /**
  * Clone container settings
  *
  * @access public
  * @param int target ref_id
  * @param int copy id
  * @return object new object 
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
     $sorting = new ilContainerSortingSettings($new_obj->getId());
     $sorting->setSortMode($this->getOrderType());
     $sorting->update();
     // copy content page
     include_once "./Services/COPage/classes/class.ilPageObject.php";
     if (ilPageObject::_exists($this->getType(), $this->getId())) {
         $orig_page = new ilPageObject($this->getType(), $this->getId());
         $new_page_object = new ilPageObject($this->getType());
         $new_page_object->setParentId($new_obj->getId());
         $new_page_object->setId($new_obj->getId());
         $new_page_object->createFromXML();
         $new_page_object->setXMLContent($orig_page->getXMLContent());
         $new_page_object->buildDom();
         $new_page_object->update();
     }
     return $new_obj;
 }
Ejemplo n.º 11
0
 /**
  * Clone container settings
  *
  * @access public
  * @param int target ref_id
  * @param int copy id
  * @return object new object 
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilLog;
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
     $sorting = new ilContainerSortingSettings($new_obj->getId());
     $sorting->setSortMode($this->getOrderType());
     $sorting->update();
     // copy content page
     include_once "./Services/Container/classes/class.ilContainerPage.php";
     if (ilContainerPage::_exists("cont", $this->getId())) {
         $orig_page = new ilContainerPage($this->getId());
         $orig_page->copy($new_obj->getId(), "cont", $new_obj->getId());
     }
     // #10271 - copy start objects page
     include_once "./Services/Container/classes/class.ilContainerStartObjectsPage.php";
     if (ilContainerStartObjectsPage::_exists("cstr", $this->getId())) {
         $orig_page = new ilContainerStartObjectsPage($this->getId());
         $orig_page->copy($new_obj->getId(), "cstr", $new_obj->getId());
     }
     // #10271
     foreach (self::_getContainerSettings($this->getId()) as $keyword => $value) {
         self::_writeContainerSetting($new_obj->getId(), $keyword, $value);
         // copy custom icons
         if ($keyword == "icon_custom" && $value) {
             // see saveIcons()
             $new_obj->createContainerDirectory();
             $tgt_dir = $new_obj->getContainerDirectory();
             $src_dir = $this->getContainerDirectory();
             $file = "icon_custom.svg";
             $src_file = $src_dir . "/" . $file;
             if (file_exists($src_file)) {
                 copy($src_file, $tgt_dir . "/" . $file);
             }
         }
     }
     return $new_obj;
 }
Ejemplo n.º 12
0
 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree = false)
 {
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
     $new_obj->setOffline($this->isOffline());
     $new_obj->setScheduleType($this->getScheduleType());
     $new_obj->setPublicLog($this->hasPublicLog());
     $smap = null;
     if ($this->getScheduleType() == self::TYPE_FIX_SCHEDULE) {
         $new_obj->setNumberOfSlots($this->getNumberOfSlots());
         // schedules
         include_once "Modules/BookingManager/classes/class.ilBookingSchedule.php";
         foreach (ilBookingSchedule::getList($this->getId()) as $item) {
             $schedule = new ilBookingSchedule($item["booking_schedule_id"]);
             $smap[$item["booking_schedule_id"]] = $schedule->doClone($new_obj->getId());
         }
     }
     // objects
     include_once "Modules/BookingManager/classes/class.ilBookingObject.php";
     foreach (ilBookingObject::getList($this->getId()) as $item) {
         $bobj = new ilBookingObject($item["booking_object_id"]);
         $bobj->doClone($new_obj->getId(), $smap);
     }
     $new_obj->update();
     return $new_obj;
 }
Ejemplo n.º 13
0
 /**
  * Clone wiki
  *
  * @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);
     $new_obj->setTitle($this->getTitle());
     $new_obj->setStartPage($this->getStartPage());
     $new_obj->setShortTitle($this->getShortTitle());
     $new_obj->setRatingOverall($this->getRatingOverall());
     $new_obj->setRating($this->getRating());
     $new_obj->setRatingAsBlock($this->getRatingAsBlock());
     $new_obj->setRatingForNewPages($this->getRatingForNewPages());
     $new_obj->setRatingCategories($this->getRatingCategories());
     $new_obj->setPublicNotes($this->getPublicNotes());
     $new_obj->setIntroduction($this->getIntroduction());
     $new_obj->setImportantPages($this->getImportantPages());
     $new_obj->setPageToc($this->getPageToc());
     $new_obj->update();
     // set/copy stylesheet
     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
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     $pages = ilWikiPage::getAllPages($this->getId());
     if (count($pages) > 0) {
         // if we have any pages, delete the start page first
         $pg_id = ilWikiPage::getPageIdForTitle($new_obj->getId(), $new_obj->getStartPage());
         $start_page = new ilWikiPage($pg_id);
         $start_page->delete();
     }
     $map = array();
     foreach ($pages as $p) {
         $page = new ilWikiPage($p["id"]);
         $new_page = new ilWikiPage();
         $new_page->setTitle($page->getTitle());
         $new_page->setWikiId($new_obj->getId());
         $new_page->setTitle($page->getTitle());
         $new_page->setBlocked($page->getBlocked());
         $new_page->setRating($page->getRating());
         $new_page->hideAdvancedMetadata($page->isAdvancedMetadataHidden());
         $new_page->create();
         $page->copy($new_page->getId(), "", 0, true);
         //$new_page->setXMLContent($page->copyXMLContent(true));
         //$new_page->buildDom(true);
         //$new_page->update();
         $map[$p["id"]] = $new_page->getId();
     }
     // copy important pages
     foreach (ilObjWiki::_lookupImportantPagesList($this->getId()) as $ip) {
         $new_obj->addImportantPage($map[$ip["page_id"]], $ip["ord"], $ip["indent"]);
     }
     // copy rating categories
     include_once "./Services/Rating/classes/class.ilRatingCategory.php";
     foreach (ilRatingCategory::getAllForObject($this->getId()) as $rc) {
         $new_rc = new ilRatingCategory();
         $new_rc->setParentId($new_obj->getId());
         $new_rc->setTitle($rc["title"]);
         $new_rc->setDescription($rc["description"]);
         $new_rc->save();
     }
     return $new_obj;
 }
Ejemplo n.º 14
0
 /**
  * Clone media cast
  *
  * @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);
     $new_obj->setTitle($this->getTitle());
     $new_obj->setPublicFiles($this->getPublicFiles());
     $new_obj->setDownloadable($this->getDownloadable());
     $new_obj->setDefaultAccess($this->getDefaultAccess());
     $new_obj->setOrder($this->getOrder());
     $new_obj->update();
     // copy items
     $this->copyItems($new_obj);
     // copy order!?
     return $new_obj;
 }
Ejemplo n.º 15
0
 /**
  * Clone
  *
  * @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);
     $this->cloneMetaData($new_obj);
     // object created now copy other settings
     include_once 'Modules/WebResource/classes/class.ilLinkResourceItems.php';
     $links = new ilLinkResourceItems($this->getId());
     $links->cloneItems($new_obj->getId());
     // append copy info weblink title
     if (ilLinkResourceItems::_isSingular($new_obj->getId())) {
         $first = ilLinkResourceItems::_getFirstLink($new_obj->getId());
         ilLinkResourceItems::updateTitle($first['link_id'], $new_obj->getTitle());
     }
     return $new_obj;
 }
Ejemplo n.º 16
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;
 }
Ejemplo n.º 17
0
 /**
  * Clone HTML learning module
  *
  * @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);
     //copy online status if object is not the root copy object
     $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
     if (!$cp_options->isRootNode($this->getRefId())) {
         $new_obj->setOnline($this->getOnline());
     }
     $new_obj->setTitle($this->getTitle());
     $new_obj->setDescription($this->getDescription());
     $new_obj->setShowLicense($this->getShowLicense());
     $new_obj->setShowBibliographicalData($this->getShowBibliographicalData());
     // copy content
     $new_obj->populateByDirectoy($this->getDataDirectory());
     $new_obj->setStartFile($this->getStartFile());
     $new_obj->update();
     return $new_obj;
 }
Ejemplo n.º 18
0
 /**
  * Clone container settings
  *
  * @access public
  * @param int target ref_id
  * @param int copy id
  * @return object new object 
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilLog;
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     include_once './Services/Container/classes/class.ilContainerSortingSettings.php';
     $sorting = new ilContainerSortingSettings($new_obj->getId());
     $sorting->setSortMode($this->getOrderType());
     $sorting->update();
     // copy content page
     //		$ilLog->write("copy container, lookup page");
     include_once "./Services/Container/classes/class.ilContainerPage.php";
     if (ilContainerPage::_exists("cont", $this->getId())) {
         //$ilLog->write("...page found");
         $orig_page = new ilContainerPage($this->getId());
         $orig_page->copy($new_obj->getId(), "cont", $new_obj->getId());
         /*$new_page_object = new ilContainerPage();
         		$new_page_object->setParentId($new_obj->getId());
         		$new_page_object->setId($new_obj->getId());
         		$new_page_object->createFromXML();
         		$new_page_object->setXMLContent($orig_page->getXMLContent());
         		$new_page_object->buildDom(true);
         		$new_page_object->update();*/
         //$ilLog->write("...copy ml");
         // copy (page) multilang settings
         /*include_once("./Services/COPage/classes/class.ilPageMultiLang.php");
         		$ml = new ilPageMultiLang("cont", $this->getId());
         		$ml->copy("cont", $new_obj->getId());*/
     }
     return $new_obj;
 }
 /**
  * Clone media pool
  *
  * @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);
     $new_obj->setTitle($this->getTitle());
     $new_obj->setDescription($this->getDescription());
     $new_obj->setDefaultWidth($this->getDefaultWidth());
     $new_obj->setDefaultHeight($this->getDefaultHeight());
     $new_obj->update();
     // copy content
     $this->copyTreeContent($new_obj, $new_obj->getTree()->readRootId(), $this->getTree()->readRootId());
     return $new_obj;
 }
 /**
  * Clone
  *
  * @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);
     $this->cloneMetaData($new_obj);
     // object created now copy other settings
     include_once 'Modules/WebResource/classes/class.ilLinkResourceItems.php';
     $links = new ilLinkResourceItems($this->getId());
     $links->cloneItems($new_obj->getId());
     return $new_obj;
 }
Ejemplo n.º 21
0
 /**
  * Clone course reference
  *
  * @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);
     $query = "INSERT INTO container_reference (obj_id, target_obj_id, title_type) " . "VALUES( " . $ilDB->quote($new_obj->getId(), 'integer') . ", " . $ilDB->quote($this->getTargetId(), 'integer') . ", " . $ilDB->quote($this->getTitleType(), 'integer') . ' ' . ")";
     $ilDB->manipulate($query);
     return $new_obj;
 }
Ejemplo n.º 22
0
 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree = false)
 {
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
     //copy online status if object is not the root copy object
     $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
     if (!$cp_options->isRootNode($this->getRefId())) {
         $new_obj->setOffline($this->isOffline());
     }
     $new_obj->setScheduleType($this->getScheduleType());
     $new_obj->setPublicLog($this->hasPublicLog());
     $new_obj->setOverallLimit($this->getOverallLimit());
     $smap = null;
     if ($this->getScheduleType() == self::TYPE_FIX_SCHEDULE) {
         // schedules
         include_once "Modules/BookingManager/classes/class.ilBookingSchedule.php";
         foreach (ilBookingSchedule::getList($this->getId()) as $item) {
             $schedule = new ilBookingSchedule($item["booking_schedule_id"]);
             $smap[$item["booking_schedule_id"]] = $schedule->doClone($new_obj->getId());
         }
     }
     // objects
     include_once "Modules/BookingManager/classes/class.ilBookingObject.php";
     foreach (ilBookingObject::getList($this->getId()) as $item) {
         $bobj = new ilBookingObject($item["booking_object_id"]);
         $bobj->doClone($new_obj->getId(), $smap);
     }
     $new_obj->update();
     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.º 24
0
 /**
  * Clone object
  *
  * @access public
  * @param int ref id of parent container
  * @param int copy id
  * @return object new test object
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilDB, $ilLog;
     $this->loadFromDb();
     // Copy settings
     $newObj = parent::cloneObject($a_target_id, $a_copy_id);
     $this->cloneMetaData($newObj);
     $newObj->setAnonymity($this->getAnonymity());
     $newObj->setAnswerFeedback($this->getAnswerFeedback());
     $newObj->setAnswerFeedbackPoints($this->getAnswerFeedbackPoints());
     $newObj->setAuthor($this->getAuthor());
     $newObj->setCountSystem($this->getCountSystem());
     $newObj->setECTSFX($this->getECTSFX());
     $newObj->setECTSGrades($this->getECTSGrades());
     $newObj->setECTSOutput($this->getECTSOutput());
     $newObj->setEnableProcessingTime($this->getEnableProcessingTime());
     $newObj->setEndingTime($this->getEndingTime());
     $newObj->setFixedParticipants($this->getFixedParticipants());
     $newObj->setInstantFeedbackSolution($this->getInstantFeedbackSolution());
     $newObj->setIntroduction($this->getIntroduction());
     $newObj->setFinalStatement($this->getFinalStatement());
     $newObj->setShowInfo($this->getShowInfo());
     $newObj->setForceJS($this->getForceJS());
     $newObj->setCustomStyle($this->getCustomStyle());
     $newObj->setKiosk($this->getKiosk());
     $newObj->setShowFinalStatement($this->getShowFinalStatement());
     $newObj->setListOfQuestionsSettings($this->getListOfQuestionsSettings());
     $newObj->setMCScoring($this->getMCScoring());
     $newObj->setMailNotification($this->getMailNotification());
     $newObj->setMailNotificationType($this->getMailNotificationType());
     $newObj->setNrOfTries($this->getNrOfTries());
     $newObj->setPassScoring($this->getPassScoring());
     $newObj->setPassword($this->getPassword());
     $newObj->setProcessingTime($this->getProcessingTime());
     $newObj->setRandomQuestionCount($this->getRandomQuestionCount());
     $newObj->setRandomTest($this->isRandomTest());
     $newObj->setReportingDate($this->getReportingDate());
     $newObj->setResetProcessingTime($this->getResetProcessingTime());
     $newObj->setResultsPresentation($this->getResultsPresentation());
     $newObj->setScoreCutting($this->getScoreCutting());
     $newObj->setScoreReporting($this->getScoreReporting());
     $newObj->setSequenceSettings($this->getSequenceSettings());
     $newObj->setShowCancel($this->getShowCancel());
     $newObj->setShowMarker($this->getShowMarker());
     $newObj->setShuffleQuestions($this->getShuffleQuestions());
     $newObj->setStartingTime($this->getStartingTime());
     $newObj->setTitleOutput($this->getTitleOutput());
     $newObj->setUsePreviousAnswers($this->getUsePreviousAnswers());
     $newObj->setCertificateVisibility($this->getCertificateVisibility());
     $newObj->mark_schema = clone $this->mark_schema;
     $newObj->setEnabledViewMode($this->getEnabledViewMode());
     $newObj->setTemplate($this->getTemplate());
     $newObj->setPoolUsage($this->getPoolUsage());
     $newObj->setPrintBestSolutionWithResult($this->isBestSolutionPrintedWithResult());
     $newObj->saveToDb();
     // clone certificate
     include_once "./Services/Certificate/classes/class.ilCertificate.php";
     include_once "./Modules/Test/classes/class.ilTestCertificateAdapter.php";
     $cert = new ilCertificate(new ilTestCertificateAdapter($this));
     $newcert = new ilCertificate(new ilTestCertificateAdapter($newObj));
     $cert->cloneCertificate($newcert);
     if ($this->isRandomTest()) {
         $newObj->saveRandomQuestionCount($newObj->getRandomQuestionCount());
         $this->cloneRandomQuestions($newObj->getTestId());
     } else {
         include_once "./Services/CopyWizard/classes/class.ilCopyWizardOptions.php";
         $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
         // clone the questions
         include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
         foreach ($this->questions as $key => $question_id) {
             $question = ilObjTest::_instanciateQuestion($question_id);
             $newObj->questions[$key] = $question->duplicate(true, null, null, null, $newObj->getId());
             $original_id = assQuestion::_getOriginalId($question_id);
             $question = ilObjTest::_instanciateQuestion($newObj->questions[$key]);
             $question->saveToDb($original_id);
             // Save the mapping of old question id <-> new question id
             // This will be used in class.ilObjCourse::cloneDependencies to copy learning objectives
             $cwo->appendMapping($this->getRefId() . '_' . $question_id, $newObj->getRefId() . '_' . $newObj->questions[$key]);
             $ilLog->write(__METHOD__ . ': Added mapping ' . $this->getRefId() . '_' . $question_id . ' <-> ' . $newObj->getRefId() . '_' . $newObj->questions[$key]);
         }
     }
     $newObj->saveToDb();
     return $newObj;
 }
Ejemplo n.º 25
0
 /**
  * Clone object
  *
  * @access public
  * @param int ref_id of target container
  * @param int copy id
  * @return object new svy object
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilDB;
     $this->loadFromDb();
     // Copy settings
     $newObj = parent::cloneObject($a_target_id, $a_copy_id);
     $this->cloneMetaData($newObj);
     $newObj->updateMetaData();
     $newObj->setAuthor($this->getAuthor());
     $newObj->setIntroduction($this->getIntroduction());
     $newObj->setOutro($this->getOutro());
     $newObj->setStatus($this->getStatus());
     $newObj->setEvaluationAccess($this->getEvaluationAccess());
     $newObj->setStartDate($this->getStartDate());
     $newObj->setEndDate($this->getEndDate());
     $newObj->setInvitation($this->getInvitation());
     $newObj->setInvitationMode($this->getInvitationMode());
     $newObj->setAnonymize($this->getAnonymize());
     $newObj->setShowQuestionTitles($this->getShowQuestionTitles());
     $newObj->setTemplate($this->getTemplate());
     // :;TODO: 360° ?!
     // reminder/notification
     $newObj->setReminderStatus($this->getReminderStatus());
     $newObj->setReminderStart($this->getReminderStart());
     $newObj->setReminderEnd($this->getReminderEnd());
     $newObj->setReminderFrequency($this->getReminderFrequency());
     $newObj->setReminderTarget($this->getReminderTarget());
     // reminder_last_sent must not be copied!
     $newObj->setTutorNotificationStatus($this->getTutorNotificationStatus());
     $newObj->setTutorNotificationRecipients($this->getTutorNotificationRecipients());
     $newObj->setTutorNotificationTarget($this->getTutorNotificationTarget());
     $question_pointer = array();
     // clone the questions
     $mapping = array();
     include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
     foreach ($this->questions as $key => $question_id) {
         $question = ilObjSurvey::_instanciateQuestion($question_id);
         if ($question) {
             $question->id = -1;
             $original_id = SurveyQuestion::_getOriginalId($question_id);
             $question->saveToDb($original_id);
             $newObj->questions[$key] = $question->getId();
             $question_pointer[$question_id] = $question->getId();
             $mapping[$question_id] = $question->getId();
         }
     }
     $newObj->saveToDb();
     $newObj->cloneTextblocks($mapping);
     // clone the questionblocks
     $questionblocks = array();
     $questionblock_questions = array();
     $result = $ilDB->queryF("SELECT * FROM svy_qblk_qst WHERE survey_fi = %s", array('integer'), array($this->getSurveyId()));
     if ($result->numRows() > 0) {
         while ($row = $ilDB->fetchAssoc($result)) {
             array_push($questionblock_questions, $row);
             $questionblocks[$row["questionblock_fi"]] = $row["questionblock_fi"];
         }
     }
     // create new questionblocks
     foreach ($questionblocks as $key => $value) {
         $questionblock = ilObjSurvey::_getQuestionblock($key);
         $questionblock_id = ilObjSurvey::_addQuestionblock($questionblock["title"], $questionblock["owner_fi"]);
         $questionblocks[$key] = $questionblock_id;
     }
     // create new questionblock questions
     foreach ($questionblock_questions as $key => $value) {
         if ($questionblocks[$value["questionblock_fi"]] && $question_pointer[$value["question_fi"]]) {
             $next_id = $ilDB->nextId('svy_qblk_qst');
             $affectedRows = $ilDB->manipulateF("INSERT INTO svy_qblk_qst (qblk_qst_id, survey_fi, questionblock_fi, question_fi) " . "VALUES (%s, %s, %s, %s)", array('integer', 'integer', 'integer', 'integer'), array($next_id, $newObj->getSurveyId(), $questionblocks[$value["questionblock_fi"]], $question_pointer[$value["question_fi"]]));
         }
     }
     // clone the constraints
     $constraints = ilObjSurvey::_getConstraints($this->getSurveyId());
     $newConstraints = array();
     foreach ($constraints as $key => $constraint) {
         if ($question_pointer[$constraint["for_question"]] && $question_pointer[$constraint["question"]]) {
             if (!array_key_exists($constraint['id'], $newConstraints)) {
                 $constraint_id = $newObj->addConstraint($question_pointer[$constraint["question"]], $constraint["relation_id"], $constraint["value"], $constraint['conjunction']);
                 $newConstraints[$constraint['id']] = $constraint_id;
             }
             $newObj->addConstraintToQuestion($question_pointer[$constraint["for_question"]], $newConstraints[$constraint['id']]);
         }
     }
     // clone the obligatory states
     $result = $ilDB->queryF("SELECT * FROM svy_qst_oblig WHERE survey_fi = %s", array('integer'), array($this->getSurveyId()));
     if ($result->numRows() > 0) {
         while ($row = $ilDB->fetchAssoc($result)) {
             if ($question_pointer[$row["question_fi"]]) {
                 $next_id = $ilDB->nextId('svy_qst_oblig');
                 $affectedRows = $ilDB->manipulateF("INSERT INTO svy_qst_oblig (question_obligatory_id, survey_fi, question_fi, " . "obligatory, tstamp) VALUES (%s, %s, %s, %s, %s)", array('integer', 'integer', 'integer', 'text', 'integer'), array($next_id, $newObj->getSurveyId(), $question_pointer[$row["question_fi"]], $row["obligatory"], time()));
             }
         }
     }
     return $newObj;
 }
Ejemplo n.º 26
0
 /**
  * Clone glossary
  *
  * @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);
     //copy online status if object is not the root copy object
     $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
     if (!$cp_options->isRootNode($this->getRefId())) {
         $new_obj->setOnline($this->getOnline());
     }
     //		$new_obj->setTitle($this->getTitle());
     $new_obj->setDescription($this->getDescription());
     $new_obj->setVirtualMode($this->getVirtualMode());
     $new_obj->setPresentationMode($this->getPresentationMode());
     $new_obj->setSnippetLength($this->getSnippetLength());
     $new_obj->update();
     // set/copy stylesheet
     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 taxonomy
     if (($tax_id = $this->getTaxonomyId()) > 0) {
         // clone it
         include_once "./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
         $tax = new ilObjTaxonomy($tax_id);
         $new_tax = $tax->cloneObject(0, 0, true);
         $map = $tax->getNodeMapping();
         // assign new taxonomy to new glossary
         ilObjTaxonomy::saveUsage($new_tax->getId(), $new_obj->getId());
     }
     // assign new tax/new glossary
     // handle mapping
     // prepare tax node assignments objects
     include_once "./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php";
     if ($tax_id > 0) {
         $tax_ass = new ilTaxNodeAssignment("glo", $this->getId(), "term", $tax_id);
         $new_tax_ass = new ilTaxNodeAssignment("glo", $new_obj->getId(), "term", $new_tax->getId());
     }
     // copy terms
     foreach (ilGlossaryTerm::getTermList($this->getId()) as $term) {
         $new_term_id = ilGlossaryTerm::_copyTerm($term["id"], $new_obj->getId());
         // copy tax node assignments
         if ($tax_id > 0) {
             $assignmts = $tax_ass->getAssignmentsOfItem($term["id"]);
             foreach ($assignmts as $a) {
                 if ($map[$a["node_id"]] > 0) {
                     $new_tax_ass->addAssignment($map[$a["node_id"]], $new_term_id);
                 }
             }
         }
     }
     return $new_obj;
 }
Ejemplo n.º 27
0
 /**
  * Clone object
  *
  * @access public
  * @param int ref id of parent container
  * @param int copy id
  * @return object new test object
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilLog, $tree, $ilDB, $ilPluginAdmin;
     $this->loadFromDb();
     // Copy settings
     /** @var $newObj ilObjTest */
     $newObj = parent::cloneObject($a_target_id, $a_copy_id);
     $this->cloneMetaData($newObj);
     $newObj->setAnonymity($this->getAnonymity());
     $newObj->setAnswerFeedback($this->getAnswerFeedback());
     $newObj->setAnswerFeedbackPoints($this->getAnswerFeedbackPoints());
     $newObj->setAuthor($this->getAuthor());
     $newObj->setLimitUsersEnabled($this->isLimitUsersEnabled());
     $newObj->setAllowedUsers($this->getAllowedUsers());
     $newObj->setAllowedUsersTimeGap($this->getAllowedUsersTimeGap());
     $newObj->setCountSystem($this->getCountSystem());
     $newObj->setECTSFX($this->getECTSFX());
     $newObj->setECTSGrades($this->getECTSGrades());
     $newObj->setECTSOutput($this->getECTSOutput());
     $newObj->setEnableProcessingTime($this->getEnableProcessingTime());
     $newObj->setEndingTimeEnabled($this->isEndingTimeEnabled());
     $newObj->setEndingTime($this->getEndingTime());
     $newObj->setFixedParticipants($this->getFixedParticipants());
     $newObj->setInstantFeedbackSolution($this->getInstantFeedbackSolution());
     $newObj->setIntroductionEnabled($this->isIntroductionEnabled());
     $newObj->setIntroduction($this->getIntroduction());
     $newObj->setFinalStatement($this->getFinalStatement());
     $newObj->setShowInfo($this->getShowInfo());
     $newObj->setForceJS($this->getForceJS());
     $newObj->setCustomStyle($this->getCustomStyle());
     $newObj->setKiosk($this->getKiosk());
     $newObj->setShowFinalStatement($this->getShowFinalStatement());
     $newObj->setListOfQuestionsSettings($this->getListOfQuestionsSettings());
     $newObj->setMCScoring($this->getMCScoring());
     $newObj->setMailNotification($this->getMailNotification());
     $newObj->setMailNotificationType($this->getMailNotificationType());
     $newObj->setNrOfTries($this->getNrOfTries());
     $newObj->setPassScoring($this->getPassScoring());
     $newObj->setPasswordEnabled($this->isPasswordEnabled());
     $newObj->setPassword($this->getPassword());
     $newObj->setProcessingTime($this->getProcessingTime());
     $newObj->setQuestionSetType($this->getQuestionSetType());
     $newObj->setReportingDate($this->getReportingDate());
     $newObj->setResetProcessingTime($this->getResetProcessingTime());
     $newObj->setResultsPresentation($this->getResultsPresentation());
     $newObj->setScoreCutting($this->getScoreCutting());
     $newObj->setScoreReporting($this->getScoreReporting());
     $newObj->setSequenceSettings($this->getSequenceSettings());
     $newObj->setShowCancel($this->getShowCancel());
     $newObj->setShowMarker($this->getShowMarker());
     $newObj->setShuffleQuestions($this->getShuffleQuestions());
     $newObj->setStartingTimeEnabled($this->isStartingTimeEnabled());
     $newObj->setStartingTime($this->getStartingTime());
     $newObj->setTitleOutput($this->getTitleOutput());
     $newObj->setUsePreviousAnswers($this->getUsePreviousAnswers());
     $newObj->setRedirectionMode($this->getRedirectionMode());
     $newObj->setRedirectionUrl($this->getRedirectionUrl());
     $newObj->setCertificateVisibility($this->getCertificateVisibility());
     $newObj->mark_schema = clone $this->mark_schema;
     $newObj->setEnabledViewMode($this->getEnabledViewMode());
     $newObj->setTemplate($this->getTemplate());
     $newObj->setPoolUsage($this->getPoolUsage());
     $newObj->setPrintBestSolutionWithResult($this->isBestSolutionPrintedWithResult());
     $newObj->setShowExamIdInTestPassEnabled($this->isShowExamIdInTestPassEnabled());
     $newObj->setShowExamIdInTestResultsEnabled($this->isShowExamIdInTestResultsEnabled());
     $newObj->setEnableExamView($this->getEnableExamview());
     $newObj->setShowExamViewHtml($this->getShowExamviewHtml());
     $newObj->setShowExamViewPdf($this->getShowExamviewPdf());
     $newObj->setEnableArchiving($this->getEnableArchiving());
     $newObj->setSignSubmission($this->getSignSubmission());
     $newObj->setCharSelectorAvailability((int) $this->getCharSelectorAvailability());
     $newObj->setCharSelectorDefinition($this->getCharSelectorDefinition());
     $newObj->setSkillServiceEnabled($this->isSkillServiceEnabled());
     $newObj->setResultFilterTaxIds($this->getResultFilterTaxIds());
     $newObj->setInstantFeedbackAnswerFixationEnabled($this->isInstantFeedbackAnswerFixationEnabled());
     $newObj->saveToDb();
     // clone certificate
     include_once "./Services/Certificate/classes/class.ilCertificate.php";
     include_once "./Modules/Test/classes/class.ilTestCertificateAdapter.php";
     $cert = new ilCertificate(new ilTestCertificateAdapter($this));
     $newcert = new ilCertificate(new ilTestCertificateAdapter($newObj));
     $cert->cloneCertificate($newcert);
     require_once 'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
     $testQuestionSetConfigFactory = new ilTestQuestionSetConfigFactory($tree, $ilDB, $ilPluginAdmin, $this);
     $testQuestionSetConfigFactory->getQuestionSetConfig()->cloneQuestionSetRelatedData($newObj);
     require_once 'Modules/Test/classes/class.ilTestSkillLevelThresholdList.php';
     $skillLevelThresholdList = new ilTestSkillLevelThresholdList($ilDB);
     $skillLevelThresholdList->setTestId($this->getTestId());
     $skillLevelThresholdList->loadFromDb();
     $skillLevelThresholdList->cloneListForTest($newObj->getTestId());
     $newObj->saveToDb();
     $newObj->updateMetaData();
     // #14467
     return $newObj;
 }
Ejemplo n.º 28
0
 /**
  * Clone Object
  * @param int $a_target_id
  * @param int $a_copy_id
  * @return object
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     /**
      * @var $ilDB ilDB
      */
     global $ilDB;
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     $this->cloneAutoGeneratedRoles($new_obj);
     ilForumProperties::getInstance($this->getId())->copy($new_obj->getId());
     $this->Forum->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($this->getId()));
     $topData = $this->Forum->getOneTopic();
     $nextId = $ilDB->nextId('frm_data');
     $statement = $ilDB->insert('frm_data', array('top_pk' => array('integer', $nextId), 'top_frm_fk' => array('integer', $new_obj->getId()), 'top_name' => array('text', $topData['top_name']), 'top_description' => array('text', $topData['top_description']), 'top_num_posts' => array('integer', $topData['top_num_posts']), 'top_num_threads' => array('integer', $topData['top_num_threads']), 'top_last_post' => array('text', $topData['top_last_post']), 'top_mods' => array('integer', !is_numeric($topData['top_mods']) ? 0 : $topData['top_mods']), 'top_date' => array('timestamp', $topData['top_date']), 'visits' => array('integer', $topData['visits']), 'top_update' => array('timestamp', $topData['top_update']), 'update_user' => array('integer', $topData['update_user']), 'top_usr_id' => array('integer', $topData['top_usr_id'])));
     // read options
     include_once 'Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
     $cwo = ilCopyWizardOptions::_getInstance($a_copy_id);
     $options = $cwo->getOptions($this->getRefId());
     $options['threads'] = $this->Forum->_getThreads($this->getId());
     // Generate starting threads
     include_once 'Modules/Forum/classes/class.ilFileDataForum.php';
     $new_frm = $new_obj->Forum;
     $new_frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($new_obj->getId()));
     $new_frm->setForumId($new_obj->getId());
     $new_frm->setForumRefId($new_obj->getRefId());
     $new_topic = $new_frm->getOneTopic();
     foreach ($options['threads'] as $thread_id => $thread_subject) {
         $this->Forum->setMDB2WhereCondition('thr_pk = %s ', array('integer'), array($thread_id));
         $old_thread = $this->Forum->getOneThread();
         $old_post_id = $this->Forum->getFirstPostByThread($old_thread['thr_pk']);
         $old_post = $this->Forum->getOnePost($old_post_id);
         // Now create new thread and first post
         $new_post = $new_frm->generateThread($new_topic['top_pk'], $old_thread['thr_usr_id'], $old_thread['thr_subject'], ilForum::_lookupPostMessage($old_post_id), $old_post['notify'], 0, $old_thread['thr_usr_alias'], $old_thread['thr_date']);
         // Copy attachments
         $old_forum_files = new ilFileDataForum($this->getId(), $old_post_id);
         $old_forum_files->ilClone($new_obj->getId(), $new_post);
     }
     return $new_obj;
 }
 /**
  * Creates a 1:1 copy of the object and places the copy in a given repository
  *
  * @access public
  */
 function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilLog;
     $newObj = parent::cloneObject($a_target_id, $a_copy_id);
     //copy online status if object is not the root copy object
     $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
     if (!$cp_options->isRootNode($this->getRefId())) {
         $newObj->setOnline($this->getOnline());
     }
     $newObj->saveToDb();
     // clone the questions in the question pool
     $questions =& $this->getQuestions();
     foreach ($questions as $question_id) {
         $newObj->copyQuestion($question_id, $newObj->getId());
     }
     // clone meta data
     include_once "./Services/MetaData/classes/class.ilMD.php";
     $md = new ilMD($this->getId(), 0, $this->getType());
     $new_md =& $md->cloneMD($newObj->getId(), 0, $newObj->getType());
     // update the metadata with the new title of the question pool
     $newObj->updateMetaData();
     return $newObj;
 }
Ejemplo n.º 30
0
 /**
  * Clone media cast
  *
  * @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);
     //copy online status if object is not the root copy object
     $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
     if (!$cp_options->isRootNode($this->getRefId())) {
         $new_obj->setOnline($this->getOnline());
     }
     //$new_obj->setTitle($this->getTitle());
     $new_obj->setPublicFiles($this->getPublicFiles());
     $new_obj->setDownloadable($this->getDownloadable());
     $new_obj->setDefaultAccess($this->getDefaultAccess());
     $new_obj->setOrder($this->getOrder());
     $new_obj->setViewMode($this->getViewMode());
     $new_obj->update();
     include_once "./Services/Block/classes/class.ilBlockSetting.php";
     $pf = ilBlockSetting::_lookup("news", "public_feed", 0, $this->getId());
     $keeprss = (int) ilBlockSetting::_lookup("news", "keep_rss_min", 0, $this->getId());
     ilBlockSetting::_write("news", "public_feed", $pf, 0, $new_obj->getId());
     ilBlockSetting::_write("news", "keep_rss_min", $keeprss, 0, $new_obj->getId());
     // copy items
     $this->copyItems($new_obj);
     // copy order!?
     return $new_obj;
 }