3 declare(strict_types=1);
53 $this->
lng = $DIC->language();
54 $this->
lng->loadLanguageModule(
"exp");
56 $this->
http = $DIC->http();
59 $this->tpl = $DIC->ui()->mainTemplate();
60 $this->
ctrl = $DIC->ctrl();
61 $this->
access = $DIC->access();
62 $this->error = $DIC[
'ilErr'];
63 $this->
toolbar = $DIC->toolbar();
64 $this->parent_gui = $a_parent_gui;
65 $this->objDefinition = $DIC[
'objDefinition'];
66 $this->tree = $DIC->repositoryTree();
67 if ($a_main_obj == null) {
68 $this->obj = $a_parent_gui->getObject();
70 $this->obj = $a_main_obj;
76 if ($this->
http->wrapper()->query()->has(
'file')) {
77 return $this->
http->wrapper()->query()->retrieve(
79 $this->
refinery->kindlyTo()->string()
87 if ($this->
http->wrapper()->post()->has(
'file')) {
88 return $this->
http->wrapper()->post()->retrieve(
91 $this->
refinery->kindlyTo()->string()
100 if ($this->
http->wrapper()->post()->has(
'format')) {
101 return $this->
http->wrapper()->post()->retrieve(
103 $this->
refinery->kindlyTo()->string()
112 if ($this->
http->wrapper()->post()->has(
'cp_options')) {
113 $custom_transformer = $this->
refinery->custom()->transformation(
118 $options = $this->
http->wrapper()->post()->retrieve(
140 object $a_call_obj = null,
141 string $a_call_func =
"" 144 $a_txt = $this->
lng->txt(
"exp_" . $a_key);
146 $this->formats[] = array(
149 "call_obj" => $a_call_obj,
150 "call_func" => $a_call_func
161 $this->custom_columns[] = array(
"txt" => $a_txt,
169 $this->custom_multi_commands[] = array(
"txt" => $a_txt,
188 if (method_exists($this->obj,
'getRefId') and $this->obj->getRefId()) {
189 if (!$this->
access->checkAccess(
'write',
'', $this->obj->getRefId())) {
190 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->WARNING);
197 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"exp_error_disabled"));
202 $cmd = $this->
ctrl->getCmd(
"listExportFiles");
205 case "listExportFiles":
210 if (substr($cmd, 0, 7) ==
"create_") {
212 } elseif (substr($cmd, 0, 6) ==
"multi_") {
226 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this));
231 $options[
$f[
"key"]] = $f[
"txt"];
234 $si->setOptions($options);
235 $this->
toolbar->addInputItem($si,
true);
237 $button->setCaption(
"exp_create_file");
238 $button->setCommand(
"createExportFile");
243 $button->setCaption($this->
lng->txt(
"exp_create_file") .
" (" .
$format[
"txt"] .
")",
false);
244 $button->setCommand(
"create_" .
$format[
"key"]);
247 $this->
toolbar->addButtonInstance($button);
250 $table->setSelectAllCheckbox(
"file");
252 $table->addCustomColumn($c[
"txt"], $c[
"obj"], $c[
"func"]);
255 $table->addCustomMultiCommand($c[
"txt"],
"multi_" . $c[
"func"]);
257 $this->tpl->setContent($table->getHTML());
262 if ($this->
ctrl->getCmd() ==
"createExportFile") {
269 if (is_object(
$f[
"call_obj"])) {
270 $f[
"call_obj"]->{
$f[
"call_func"]}();
276 $exp->exportObject($this->obj->getType(), $this->obj->getId());
281 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exp_file_created"),
true);
282 $this->
ctrl->redirect($this,
"listExportFiles");
291 if (!count($files)) {
292 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"no_checkbox"),
true);
293 $this->
ctrl->redirect($this,
"listExportFiles");
296 $cgui->setFormAction($this->
ctrl->getFormAction($this));
297 $cgui->setHeaderText($this->
lng->txt(
"exp_really_delete"));
298 $cgui->setCancel($this->
lng->txt(
"cancel"),
"listExportFiles");
299 $cgui->setConfirm($this->
lng->txt(
"delete"),
"delete");
301 foreach ($files as
$i) {
302 if (strpos($i,
':') !==
false) {
303 $iarr = explode(
":", $i);
310 $this->tpl->setContent($cgui->getHTML());
314 public function delete():
void 317 foreach ($files as $file) {
318 $file = explode(
":", $file);
320 $file[1] = basename($file[1]);
324 str_replace(
"..",
"", $file[0]),
325 $this->obj->getType()
328 $exp_file = $export_dir .
"/" . str_replace(
"..",
"", $file[1]);
329 $exp_dir = $export_dir .
"/" . substr($file[1], 0, strlen($file[1]) - 4);
330 if (is_file($exp_file)) {
333 if (is_dir($exp_dir)) {
341 if (count($files) > 0) {
342 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'export_files_deleted'),
true);
344 $this->
ctrl->redirect($this,
"listExportFiles");
354 $this->
ctrl->redirect($this,
"listExportFiles");
357 $file = explode(
":", trim($file));
360 str_replace(
"..",
"", $file[0]),
361 $this->obj->getType()
364 $file[1] = basename($file[1]);
367 $export_dir .
"/" . $file[1],
374 $cmd = substr($this->
ctrl->getCmd(), 6);
376 if (
$c[
"func"] == $cmd) {
387 $this->tpl->addJavaScript(
'./Services/CopyWizard/js/ilContainer.js');
388 $this->tpl->setVariable(
'BODY_ATTRIBUTES',
'onload="ilDisableChilds(\'cmd\');"');
391 $table->parseContainer($this->
getParentGUI()->getObject()->getRefId());
392 $this->tpl->setContent($table->getHTML());
405 $exp_limit->checkLimitation(
410 $this->tpl->setOnScreenMessage(
'failure', $e->getMessage());
415 $items_selected =
false;
416 foreach ($this->tree->getSubTree($root = $this->tree->getNodeData($this->getParentGUI()->getObject()->getRefId())) as $node) {
417 if ($node[
'type'] ===
'rolf') {
420 if ($node[
'ref_id'] == $this->
getParentGUI()->getObject()->getRefId()) {
423 (
int) $node[
'ref_id'],
424 (
int) $node[
'obj_id'],
430 if (!$this->objDefinition->allowExport($node[
'type']) || !$this->
access->checkAccess(
433 (
int) $node[
'ref_id']
437 (
int) $node[
'ref_id'],
438 (
int) $node[
'obj_id'],
447 (
int) $node[
'ref_id'],
448 (
int) $node[
'obj_id'],
451 if ($mode != ilExportOptions::EXPORT_OMIT) {
452 $items_selected =
true;
456 if ($items_selected) {
460 foreach ($eo->getSubitemsForCreation($this->obj->getRefId()) as
$ref_id) {
463 $exp->exportObject(
$type, $obj_id);
469 $cexp->exportObject($this->obj->getType(), $this->obj->getId());
472 $exp->exportObject($this->obj->getType(), $this->obj->getId());
478 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'export_created'),
true);
479 $this->
ctrl->redirect($this,
"listExportFiles");
__construct(object $a_parent_gui, ?ilObject $a_main_obj=null)
showItemSelection()
Show container item selection table.
array $custom_multi_commands
ilObjectDefinition $objDefinition
static newInstance(int $a_export_id)
ilGlobalTemplateInterface $tpl
addCustomMultiCommand(string $a_txt, object $a_obj, string $a_func)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getExportDirectory(int $a_obj_id, string $a_type="xml", string $a_obj_type="", string $a_entity="")
Get export directory for an repository object.
handleCustomMultiCommand()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initFileIdentifiersFromPost()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
parses the objects.xml it handles the xml-description of all ilias objects
static http()
Fetches the global http state from ILIAS.
static delDir(string $a_dir, bool $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
addFormat(string $a_key, string $a_txt="", object $a_call_obj=null, string $a_call_func="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initExportOptionsFromPost()
addCustomColumn(string $a_txt, object $a_obj, string $a_func)
Error Handling & global info handling uses PEAR error class.
const SET_EXPORT_DISABLED
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
confirmDeletion()
Confirm file deletion.
Class ilContainerGUI This is a base GUI class for all container objects in ILIAS: root folder...
initFileIdentifierFromQuery()
static _lookupType(int $id, bool $reference=false)
static allocateExportId()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...