コード例 #1
0
ファイル: class.ilObjTest.php プロジェクト: bheyser/qplskl
 /**
  * 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;
 }
コード例 #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;
 }
コード例 #3
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;
 }