/**
  * Init upload form.
  */
 public function initUploadForm()
 {
     global $lng, $ilCtrl;
     include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     // type selection
     $options = array("scorm2004" => $lng->txt("lm_type_scorm2004"), "scorm" => $lng->txt("lm_type_scorm"), "aicc" => $lng->txt("lm_type_aicc"), "hacp" => $lng->txt("lm_type_hacp"));
     $si = new ilSelectInputGUI($this->lng->txt("type"), "sub_type");
     $si->setOptions($options);
     $this->form->addItem($si);
     // input file
     $fi = new ilFileInputGUI($this->lng->txt("select_file"), "scormfile");
     $fi->setRequired(true);
     $this->form->addItem($fi);
     // todo "uploaded file"
     // todo wysiwyg editor removement
     include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
     if (ilUploadFiles::_getUploadDirectory()) {
         $options = array();
         $fi->setRequired(false);
         $files = ilUploadFiles::_getUploadFiles();
         $options[""] = $this->lng->txt("cont_select_from_upload_dir");
         foreach ($files as $file) {
             $file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
             $options[$file] = $file;
         }
         //
         $si = new ilSelectInputGUI($this->lng->txt("cont_uploaded_file"), "uploaded_file");
         $si->setOptions($options);
         $this->form->addItem($si);
     }
     // validate file
     $cb = new ilCheckboxInputGUI($this->lng->txt("cont_validate_file"), "validate");
     $cb->setValue("y");
     //$cb->setChecked(true);
     $this->form->addItem($cb);
     // import for editing
     $cb = new ilCheckboxInputGUI($this->lng->txt("sahs_authoring_mode"), "editable");
     $cb->setValue("y");
     $cb->setInfo($this->lng->txt("sahs_authoring_mode_info"));
     $this->form->addItem($cb);
     //
     $radg = new ilRadioGroupInputGUI($lng->txt("sahs_sequencing"), "import_sequencing");
     $radg->setValue(0);
     $op1 = new ilRadioOption($lng->txt("sahs_std_sequencing"), 0, $lng->txt("sahs_std_sequencing_info"));
     $radg->addOption($op1);
     $op1 = new ilRadioOption($lng->txt("sahs_import_sequencing"), 1, $lng->txt("sahs_import_sequencing_info"));
     $radg->addOption($op1);
     $cb->addSubItem($radg);
     $this->form->addCommandButton("upload", $lng->txt("import"));
     $this->form->addCommandButton("cancel", $lng->txt("cancel"));
     $this->form->setTitle($lng->txt("import_sahs"));
     $this->form->setFormAction($ilCtrl->getFormAction($this, "upload"));
     $this->form->setTarget(ilFrameTargetInfo::_getFrame("MainContent"));
 }
 /**
  * list files
  */
 function listFiles()
 {
     global $ilToolbar, $lng, $ilCtrl;
     // determine directory
     // FIXME: I have to call stripSlashes here twice, because I could not
     //        determine where the second layer of slashes is added to the
     //        URL Parameter
     $cur_subdir = ilUtil::stripSlashes(ilUtil::stripSlashes($_GET["cdir"]));
     $new_subdir = ilUtil::stripSlashes(ilUtil::stripSlashes($_GET["newdir"]));
     if ($new_subdir == "..") {
         $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir, "/"));
     } else {
         if (!empty($new_subdir)) {
             if (!empty($cur_subdir)) {
                 $cur_subdir = $cur_subdir . "/" . $new_subdir;
             } else {
                 $cur_subdir = $new_subdir;
             }
         }
     }
     $cur_subdir = str_replace("..", "", $cur_subdir);
     $cur_dir = !empty($cur_subdir) ? $this->main_dir . "/" . $cur_subdir : $this->main_dir;
     $this->ctrl->setParameter($this, "cdir", $cur_subdir);
     // toolbar for adding files/directories
     $ilToolbar->setFormAction($ilCtrl->getFormAction($this), true);
     include_once "./Services/Form/classes/class.ilTextInputGUI.php";
     if ($this->getAllowDirectories() && $this->getAllowDirectoryCreation()) {
         $ti = new ilTextInputGUI($this->lng->txt("cont_new_dir"), "new_dir");
         $ti->setMaxLength(80);
         $ti->setSize(10);
         $ilToolbar->addInputItem($ti, true);
         $ilToolbar->addFormButton($lng->txt("create"), "createDirectory");
         $ilToolbar->addSeparator();
     }
     include_once "./Services/Form/classes/class.ilFileInputGUI.php";
     if ($this->getAllowFileCreation()) {
         $fi = new ilFileInputGUI($this->lng->txt("cont_new_file"), "new_file");
         $fi->setSize(10);
         $ilToolbar->addInputItem($fi, true);
         $ilToolbar->addFormButton($lng->txt("upload"), "uploadFile");
     }
     include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
     if (ilUploadFiles::_getUploadDirectory()) {
         $ilToolbar->addSeparator();
         $files = ilUploadFiles::_getUploadFiles();
         $options[""] = $lng->txt("cont_select_from_upload_dir");
         foreach ($files as $file) {
             $file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
             $options[$file] = $file;
         }
         include_once "./Services/Form/classes/class.ilSelectInputGUI.php";
         $si = new ilSelectInputGUI($this->lng->txt("cont_uploaded_file"), "uploaded_file");
         $si->setOptions($options);
         $ilToolbar->addInputItem($si, true);
         $ilToolbar->addFormButton($lng->txt("copy"), "uploadFile");
     }
     // load files templates
     include_once "./Services/FileSystem/classes/class.ilFileSystemTableGUI.php";
     $fs_table = new ilFileSystemTableGUI($this, "listFiles", $cur_dir, $cur_subdir, $this->label_enable, $this->file_labels, $this->label_header, $this->commands, $this->getPostDirPath());
     $fs_table->setId($this->getTableId());
     if ($this->getTitle() != "") {
         $fs_table->setTitle($this->getTitle());
     }
     if ($_GET["resetoffset"] == 1) {
         $fs_table->resetOffset();
     }
     $this->tpl->setContent($fs_table->getHTML());
 }
 /**
  * upload new version of module
  */
 function newModuleVersion()
 {
     $obj_id = ilObject::_lookupObjectId($_GET['ref_id']);
     $type = ilObjSAHSLearningModule::_lookupSubType($obj_id);
     // display import form
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.scorm_new_version_import.html", "Modules/ScormAicc");
     $this->tpl->setVariable("TYPE_IMG", ilUtil::getImagePath('icon_slm.png'));
     $this->tpl->setVariable("ALT_IMG", $this->lng->txt("obj_sahs"));
     $this->ctrl->setParameter($this, "new_type", "sahs");
     $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
     $this->tpl->setVariable("BTN_NAME", "newModuleVersionUpload");
     $this->tpl->setVariable("TARGET", ' target="' . ilFrameTargetInfo::_getFrame("MainContent") . '" ');
     $this->tpl->setVariable("TXT_SELECT_LMTYPE", $this->lng->txt("type"));
     if ($type == "scorm2004") {
         $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("lm_type_scorm2004"));
     } else {
         $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("lm_type_scorm"));
     }
     include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
     if (ilUploadFiles::_getUploadDirectory()) {
         $files = ilUploadFiles::_getUploadFiles();
         foreach ($files as $file) {
             $file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
             $this->tpl->setCurrentBlock("option_uploaded_file");
             $this->tpl->setVariable("UPLOADED_FILENAME", $file);
             $this->tpl->setVariable("TXT_UPLOADED_FILENAME", $file);
             $this->tpl->parseCurrentBlock();
         }
         $this->tpl->setCurrentBlock("select_uploaded_file");
         $this->tpl->setVariable("TXT_SELECT_FROM_UPLOAD_DIR", $this->lng->txt("cont_select_from_upload_dir"));
         $this->tpl->setVariable("TXT_UPLOADED_FILE", $this->lng->txt("cont_uploaded_file"));
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setVariable("TXT_UPLOAD", $this->lng->txt("upload"));
     $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
     $this->tpl->setVariable("TXT_IMPORT_LM", $this->lng->txt("import_sahs"));
     $this->tpl->setVariable("TXT_SELECT_FILE", $this->lng->txt("select_file"));
     // gives out the limit as a little notice
     $this->tpl->setVariable("TXT_FILE_INFO", $this->lng->txt("file_notice") . " " . $this->getMaxFileSize());
 }