19 declare(strict_types=1);
31 protected \ILIAS\Export\InternalGUIService
$gui;
54 $this->
lng = $DIC->language();
55 $this->
lng->loadLanguageModule(
"exp");
57 $this->
http = $DIC->http();
60 $this->tpl = $DIC->ui()->mainTemplate();
61 $this->
ctrl = $DIC->ctrl();
62 $this->
access = $DIC->access();
63 $this->error = $DIC[
'ilErr'];
64 $this->
toolbar = $DIC->toolbar();
65 $this->parent_gui = $a_parent_gui;
66 $this->objDefinition = $DIC[
'objDefinition'];
67 $this->tree = $DIC->repositoryTree();
68 if ($a_main_obj == null) {
69 $this->obj = $a_parent_gui->getObject();
71 $this->obj = $a_main_obj;
73 $this->gui = $DIC->export()->internal()->gui();
78 if ($this->
http->wrapper()->query()->has(
'file')) {
79 return $this->
http->wrapper()->query()->retrieve(
81 $this->
refinery->kindlyTo()->string()
89 if ($this->
http->wrapper()->post()->has(
'file')) {
90 return $this->
http->wrapper()->post()->retrieve(
93 $this->
refinery->kindlyTo()->string()
102 if ($this->
http->wrapper()->post()->has(
'format')) {
103 return $this->
http->wrapper()->post()->retrieve(
105 $this->
refinery->kindlyTo()->string()
114 if ($this->
http->wrapper()->post()->has(
'cp_options')) {
115 $custom_transformer = $this->
refinery->custom()->transformation(
120 $options = $this->
http->wrapper()->post()->retrieve(
142 object $a_call_obj = null,
143 string $a_call_func =
"" 146 $a_txt = $this->
lng->txt(
"exp_" . $a_key);
148 $this->formats[] = array(
151 "call_obj" => $a_call_obj,
152 "call_func" => $a_call_func
163 $this->custom_columns[] = array(
"txt" => $a_txt,
171 $this->custom_multi_commands[] = array(
"txt" => $a_txt,
190 if (method_exists($this->obj,
'getRefId') and $this->obj->getRefId()) {
191 if (!$this->
access->checkAccess(
'write',
'', $this->obj->getRefId())) {
192 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->WARNING);
199 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"exp_error_disabled"));
204 $cmd = $this->
ctrl->getCmd(
"listExportFiles");
207 case "listExportFiles":
212 if (substr($cmd, 0, 7) ==
"create_") {
214 } elseif (substr($cmd, 0, 6) ==
"multi_") {
226 $this->
toolbar->setFormAction($this->
ctrl->getFormAction($this));
231 $options[
$f[
"key"]] = $f[
"txt"];
235 $this->
toolbar->addInputItem($si,
true);
238 $this->
lng->txt(
"exp_create_file"),
240 )->submit()->toToolbar();
243 $format = $format[0];
246 $this->
lng->txt(
"exp_create_file") .
" (" . $format[
"txt"] .
")",
247 "create_" . $format[
"key"]
248 )->submit()->toToolbar();
252 $table->setSelectAllCheckbox(
"file");
254 $table->addCustomColumn($c[
"txt"], $c[
"obj"], $c[
"func"]);
257 $table->addCustomMultiCommand($c[
"txt"],
"multi_" . $c[
"func"]);
259 $this->tpl->setContent($table->getHTML());
264 if ($this->
ctrl->getCmd() ==
"createExportFile") {
267 $format = substr($this->
ctrl->getCmd(), 7);
270 if (
$f[
"key"] == $format) {
271 if (is_object(
$f[
"call_obj"])) {
272 $f[
"call_obj"]->{
$f[
"call_func"]}();
276 } elseif ($format ==
"xml") {
278 $exp->exportObject($this->obj->getType(), $this->obj->getId());
283 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"exp_file_created"),
true);
284 $this->
ctrl->redirect($this,
"listExportFiles");
293 if (!count($files)) {
294 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"no_checkbox"),
true);
295 $this->
ctrl->redirect($this,
"listExportFiles");
298 $cgui->setFormAction($this->
ctrl->getFormAction($this));
299 $cgui->setHeaderText($this->
lng->txt(
"exp_really_delete"));
300 $cgui->setCancel($this->
lng->txt(
"cancel"),
"listExportFiles");
301 $cgui->setConfirm($this->
lng->txt(
"delete"),
"delete");
303 foreach ($files as $i) {
304 if (strpos($i,
':') !==
false) {
305 $iarr = explode(
":", $i);
312 $this->tpl->setContent($cgui->getHTML());
316 public function delete():
void 319 foreach ($files as $file) {
320 $file = explode(
":", $file);
322 $file[1] = basename($file[1]);
326 str_replace(
"..",
"", $file[0]),
327 $this->obj->getType()
330 $exp_file = $export_dir .
"/" . str_replace(
"..",
"", $file[1]);
331 $exp_dir = $export_dir .
"/" . substr($file[1], 0, strlen($file[1]) - 4);
332 if (is_file($exp_file)) {
335 if (is_dir($exp_dir)) {
343 if (count($files) > 0) {
344 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'export_files_deleted'),
true);
346 $this->
ctrl->redirect($this,
"listExportFiles");
356 $this->
ctrl->redirect($this,
"listExportFiles");
359 $file = explode(
":", trim($file));
362 str_replace(
"..",
"", $file[0]),
363 $this->obj->getType()
366 $file[1] = basename($file[1]);
369 $export_dir .
"/" . $file[1],
376 $cmd = substr($this->
ctrl->getCmd(), 6);
378 if (
$c[
"func"] == $cmd) {
389 $this->tpl->addJavaScript(
'./Services/CopyWizard/js/ilContainer.js');
390 $this->tpl->setVariable(
'BODY_ATTRIBUTES',
'onload="ilDisableChilds(\'cmd\');"');
393 $table->parseContainer($this->
getParentGUI()->getObject()->getRefId());
394 $this->tpl->setContent($table->getHTML());
407 $exp_limit->checkLimitation(
412 $this->tpl->setOnScreenMessage(
'failure', $e->getMessage());
417 $items_selected =
false;
418 foreach ($this->tree->getSubTree($root = $this->tree->getNodeData($this->getParentGUI()->getObject()->getRefId())) as $node) {
419 if ($node[
'type'] ===
'rolf') {
422 if ($node[
'ref_id'] == $this->
getParentGUI()->getObject()->getRefId()) {
425 (
int) $node[
'ref_id'],
426 (
int) $node[
'obj_id'],
432 if (!$this->objDefinition->allowExport($node[
'type']) || !$this->
access->checkAccess(
435 (
int) $node[
'ref_id']
439 (
int) $node[
'ref_id'],
440 (
int) $node[
'obj_id'],
449 (
int) $node[
'ref_id'],
450 (
int) $node[
'obj_id'],
453 if ($mode != ilExportOptions::EXPORT_OMIT) {
454 $items_selected =
true;
458 if ($items_selected) {
462 foreach ($eo->getSubitemsForCreation($this->obj->getRefId()) as
$ref_id) {
465 $exp->exportObject($type, $obj_id);
471 $cexp->exportObject($this->obj->getType(), $this->obj->getId());
474 $exp->exportObject($this->obj->getType(), $this->obj->getId());
480 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'export_created'),
true);
481 $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)
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...
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)
ILIAS Export InternalGUIService $gui
Export User Interface Class.
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...
initExportOptionsFromPost()
addCustomColumn(string $a_txt, object $a_obj, string $a_func)
Error Handling & global info handling.
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()