コード例 #1
0
 public function listExportFiles()
 {
     global $tpl, $ilToolbar, $ilCtrl, $lng;
     $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
     if (count($this->getFormats()) > 1) {
         foreach ($this->getFormats() as $f) {
             $options[$f["key"]] = $f["txt"];
         }
         include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
         $si = new ilSelectInputGUI($lng->txt("type"), "format");
         $si->setOptions($options);
         $ilToolbar->addInputItem($si, true);
         $ilToolbar->addFormButton($lng->txt("exp_create_file"), "createExportFile");
     } else {
         $format = $this->getFormats();
         $format = $format[0];
         $ilToolbar->addFormButton($lng->txt("exp_create_file") . " (" . $format["txt"] . ")", "create_" . $format["key"]);
     }
     require_once 'class.ilTestArchiver.php';
     $archiver = new ilTestArchiver($this->getParentGUI()->object->getId());
     $archive_dir = $archiver->getZipExportDirectory();
     $archive_files = array();
     if (file_exists($archive_dir) && is_dir($archive_dir)) {
         $archive_files = scandir($archive_dir);
     }
     $export_dir = $this->obj->getExportDirectory();
     $export_files = $this->obj->getExportFiles($export_dir);
     $data = array();
     if (count($export_files) > 0) {
         foreach ($export_files as $exp_file) {
             $file_arr = explode("__", $exp_file);
             array_push($data, array('file' => $exp_file, 'size' => filesize($export_dir . "/" . $exp_file), 'timestamp' => $file_arr[0]));
         }
     }
     if (count($archive_files) > 0) {
         foreach ($archive_files as $exp_file) {
             if ($exp_file == '.' || $exp_file == '..') {
                 continue;
             }
             $file_arr = explode("_", $exp_file);
             array_push($data, array('file' => $exp_file, 'size' => filesize($archive_dir . "/" . $exp_file), 'timestamp' => $file_arr[4]));
         }
     }
     require_once 'Modules/Test/classes/tables/class.ilTestExportTableGUI.php';
     $table = new ilTestExportTableGUI($this, 'listExportFiles', $this->obj);
     $table->setSelectAllCheckbox("file");
     foreach ($this->getCustomColumns() as $c) {
         $table->addCustomColumn($c["txt"], $c["obj"], $c["func"]);
     }
     foreach ($this->getCustomMultiCommands() as $c) {
         $table->addCustomMultiCommand($c["txt"], "multi_" . $c["func"]);
     }
     $table->setData($data);
     $tpl->setContent($table->getHTML());
 }
コード例 #2
0
 /**
  * confirmation screen for export file deletion
  */
 function confirmDeleteExportFileObject()
 {
     if (!isset($_POST["file"])) {
         ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
         $this->ctrl->redirect($this, "export");
     }
     ilUtil::sendQuestion($this->lng->txt("info_delete_sure"));
     $export_dir = $this->object->getExportDirectory();
     $export_files = $this->object->getExportFiles($export_dir);
     $data = array();
     if (count($_POST["file"]) > 0) {
         foreach ($_POST["file"] as $exp_file) {
             $file_arr = explode("__", $exp_file);
             array_push($data, array('file' => $exp_file, 'size' => filesize($export_dir . "/" . $exp_file), 'date' => $file_arr[0]));
         }
     }
     include_once "./Modules/Test/classes/tables/class.ilTestExportTableGUI.php";
     $table_gui = new ilTestExportTableGUI($this, 'export', true);
     $table_gui->setData($data);
     $this->tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
 }