/**
  * display status information or report errors messages
  * in case of error
  *
  * @access	public
  */
 function uploadObject()
 {
     global $_FILES, $rbacsystem;
     include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
     // check create permission
     if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], "sahs")) {
         $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->WARNING);
     } elseif ($_FILES["scormfile"]["name"]) {
         // check if file was uploaded
         $source = $_FILES["scormfile"]["tmp_name"];
         if ($source == 'none' || !$source) {
             $this->ilias->raiseError($this->lng->txt("msg_no_file"), $this->ilias->error_obj->MESSAGE);
         }
         // get_cfg_var("upload_max_filesize"); // get the may filesize form t he php.ini
         switch ($__FILES["scormfile"]["error"]) {
             case UPLOAD_ERR_INI_SIZE:
                 $this->ilias->raiseError($this->lng->txt("err_max_file_size_exceeds"), $this->ilias->error_obj->MESSAGE);
                 break;
             case UPLOAD_ERR_FORM_SIZE:
                 $this->ilias->raiseError($this->lng->txt("err_max_file_size_exceeds"), $this->ilias->error_obj->MESSAGE);
                 break;
             case UPLOAD_ERR_PARTIAL:
                 $this->ilias->raiseError($this->lng->txt("err_partial_file_upload"), $this->ilias->error_obj->MESSAGE);
                 break;
             case UPLOAD_ERR_NO_FILE:
                 $this->ilias->raiseError($this->lng->txt("err_no_file_uploaded"), $this->ilias->error_obj->MESSAGE);
                 break;
         }
         $file = pathinfo($_FILES["scormfile"]["name"]);
     } elseif ($_POST["uploaded_file"]) {
         // check if the file is in the upload directory and readable
         if (!ilUploadFiles::_checkUploadFile($_POST["uploaded_file"])) {
             $this->ilias->raiseError($this->lng->txt("upload_error_file_not_found"), $this->ilias->error_obj->MESSAGE);
         }
         $file = pathinfo($_POST["uploaded_file"]);
     } else {
         $this->ilias->raiseError($this->lng->txt("msg_no_file"), $this->ilias->error_obj->MESSAGE);
     }
     $name = substr($file["basename"], 0, strlen($file["basename"]) - strlen($file["extension"]) - 1);
     if ($name == "") {
         $name = $this->lng->txt("no_title");
     }
     // create and insert object in objecttree
     switch ($_POST["sub_type"]) {
         case "scorm2004":
             include_once "./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php";
             $newObj = new ilObjSCORM2004LearningModule();
             $newObj->setEditable($_POST["editable"] == 'y');
             $newObj->setImportSequencing($_POST["import_sequencing"]);
             $newObj->setSequencingExpertMode($_POST["import_sequencing"]);
             break;
         case "scorm":
             include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php";
             $newObj = new ilObjSCORMLearningModule();
             break;
         case "aicc":
             include_once "./Modules/ScormAicc/classes/class.ilObjAICCLearningModule.php";
             $newObj = new ilObjAICCLearningModule();
             break;
         case "hacp":
             include_once "./Modules/ScormAicc/classes/class.ilObjHACPLearningModule.php";
             $newObj = new ilObjHACPLearningModule();
             break;
     }
     $newObj->setTitle($name);
     $newObj->setSubType($_POST["sub_type"]);
     $newObj->setDescription("");
     $newObj->create(true);
     $newObj->createReference();
     $newObj->putInTree($_GET["ref_id"]);
     $newObj->setPermissions($_GET["ref_id"]);
     $newObj->notify("new", $_GET["ref_id"], $_GET["parent_non_rbac_id"], $_GET["ref_id"], $newObj->getRefId());
     // create data directory, copy file to directory
     $newObj->createDataDirectory();
     if ($_FILES["scormfile"]["name"]) {
         // copy uploaded file to data directory
         $file_path = $newObj->getDataDirectory() . "/" . $_FILES["scormfile"]["name"];
         ilUtil::moveUploadedFile($_FILES["scormfile"]["tmp_name"], $_FILES["scormfile"]["name"], $file_path);
     } else {
         // copy uploaded file to data directory
         $file_path = $newObj->getDataDirectory() . "/" . $_POST["uploaded_file"];
         ilUploadFiles::_copyUploadFile($_POST["uploaded_file"], $file_path);
     }
     ilUtil::unzip($file_path);
     ilUtil::renameExecutables($newObj->getDataDirectory());
     $title = $newObj->readObject();
     if ($title != "") {
         ilObject::_writeTitle($newObj->getId(), $title);
         /*$md = new ilMD($newObj->getId(),0, $newObj->getType());
         		if(is_object($md_gen = $md->getGeneral()))
         		{
         			$md_gen->setTitle($title);
         			$md_gen->update();
         		}*/
     }
     ilUtil::sendInfo($this->lng->txt($newObj->getType() . "_added"), true);
     ilUtil::redirect("ilias.php?baseClass=ilSAHSEditGUI&ref_id=" . $newObj->getRefId());
 }
 /**
  * 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;
 }