32 $this->parent_gui = $a_parent_gui;
33 if ($a_main_obj == null)
35 $this->obj = $a_parent_gui->object;
39 $this->obj = $a_main_obj;
41 $lng->loadLanguageModule(
"exp");
59 function addFormat($a_key, $a_txt =
"", $a_call_obj = null, $a_call_func =
"")
65 $a_txt = $lng->txt(
"exp_".$a_key);
67 $this->formats[] = array(
"key" => $a_key,
"txt" => $a_txt,
68 "call_obj" => $a_call_obj,
"call_func" => $a_call_func);
89 $this->custom_columns[] = array(
"txt" => $a_txt,
102 $this->custom_multi_commands[] = array(
"txt" => $a_txt,
137 if(method_exists($this->obj,
'getRefId') and $this->obj->getRefId())
139 if(!$ilAccess->checkAccess(
'write',
'',$this->obj->getRefId()))
141 $ilErr->raiseError($lng->txt(
'permission_denied'),$ilErr->WARNING);
145 $cmd = $ilCtrl->getCmd(
"listExportFiles");
149 case "listExportFiles":
154 if (substr(
$cmd, 0, 7) ==
"create_")
158 else if (substr(
$cmd, 0, 6) ==
"multi_")
181 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
187 $options[$f[
"key"]] = $f[
"txt"];
189 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
191 $si->setOptions($options);
192 $ilToolbar->addInputItem(
$si,
true);
193 $ilToolbar->addFormButton($lng->txt(
"exp_create_file"),
"createExportFile");
198 $format = $format[0];
199 $ilToolbar->addFormButton($lng->txt(
"exp_create_file").
" (".$format[
"txt"].
")",
"create_".$format[
"key"]);
202 include_once(
"./Services/Export/classes/class.ilExportTableGUI.php");
204 $table->setSelectAllCheckbox(
"file");
207 $table->addCustomColumn($c[
"txt"], $c[
"obj"], $c[
"func"]);
211 $table->addCustomMultiCommand($c[
"txt"],
"multi_".$c[
"func"]);
213 $tpl->setContent($table->getHTML());
226 if ($ilCtrl->getCmd() ==
"createExportFile")
232 $format = substr($ilCtrl->getCmd(), 7);
236 if ($f[
"key"] == $format)
238 if (is_object($f[
"call_obj"]))
240 $f[
"call_obj"]->$f[
"call_func"]();
246 else if ($format ==
"xml")
248 include_once(
"./Services/Export/classes/class.ilExport.php");
250 $exp->exportObject($this->obj->getType(),$this->obj->getId(),
"4.3.0");
256 $ilCtrl->redirect($this,
"listExportFiles");
266 if (!is_array(
$_POST[
"file"]) || count(
$_POST[
"file"]) == 0)
269 $ilCtrl->redirect($this,
"listExportFiles");
273 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
275 $cgui->setFormAction($ilCtrl->getFormAction($this));
276 $cgui->setHeaderText($lng->txt(
"exp_really_delete"));
277 $cgui->setCancel($lng->txt(
"cancel"),
"listExportFiles");
278 $cgui->setConfirm($lng->txt(
"delete"),
"delete");
280 foreach (
$_POST[
"file"] as $i)
282 $iarr = explode(
":", $i);
283 $cgui->addItem(
"file[]", $i, $iarr[1]);
286 $tpl->setContent($cgui->getHTML());
299 $file = explode(
":", $file);
301 $file[1] = basename($file[1]);
303 include_once(
"./Services/Export/classes/class.ilExport.php");
305 str_replace(
"..",
"", $file[0]), $this->obj->getType());
307 $exp_file = $export_dir.
"/".str_replace(
"..",
"", $file[1]);
308 $exp_dir = $export_dir.
"/".substr($file[1], 0, strlen($file[1]) - 4);
309 if (@is_file($exp_file))
313 if (@is_dir($exp_dir))
319 include_once
'./Services/Export/classes/class.ilExportFileInfo.php';
323 $ilCtrl->redirect($this,
"listExportFiles");
333 if(!isset(
$_POST[
"file"]))
336 $ilCtrl->redirect($this,
"listExportFiles");
339 if (count(
$_POST[
"file"]) > 1)
342 $ilCtrl->redirect($this,
"listExportFiles");
346 include_once(
"./Services/Export/classes/class.ilExport.php");
348 str_replace(
"..",
"",
$file[0]), $this->obj->getType());
350 $file[1] = basename($file[1]);
366 $cmd = substr($ilCtrl->getCmd(), 6);
369 if ($c[
"func"] ==
$cmd)
371 $c[
"obj"]->$c[
"func"](
$_POST[
"file"]);
384 $tpl->addJavaScript(
'./Services/CopyWizard/js/ilContainer.js');
385 $tpl->setVariable(
'BODY_ATTRIBUTES',
'onload="ilDisableChilds(\'cmd\');"');
387 include_once
'./Services/Export/classes/class.ilExportSelectionTableGUI.php';
389 $table->parseContainer($this->
getParentGUI()->object->getRefId());
390 $this->tpl->setContent($table->getHTML());
399 global $tree,$objDefinition, $ilAccess,
$ilCtrl,
$lng;
401 include_once
'./Services/Export/classes/class.ilExportOptions.php';
405 $items_selected =
false;
406 foreach($tree->getSubTree($root = $tree->getNodeData($this->getParentGUI()->object->getRefId())) as $node)
408 if($node[
'type'] ==
'rolf')
412 if($node[
'ref_id'] == $this->
getParentGUI()->object->getRefId())
423 if(!$objDefinition->allowExport($node[
'type']) or !$ilAccess->checkAccess(
'write',
'',$node[
'ref_id']))
435 $mode = isset(
$_POST[
'cp_options'][$node[
'ref_id']][
'type']) ?
436 $_POST[
'cp_options'][$node[
'ref_id']][
'type'] :
446 $items_selected =
true;
450 include_once(
"./Services/Export/classes/class.ilExport.php");
456 foreach($eo->getSubitemsForCreation($this->obj->getRefId()) as
$ref_id)
460 $exp->exportObject($type,$obj_id,
'4.1.0');
465 include_once
'./Services/Export/classes/class.ilExportContainer.php';
467 $cexp->exportObject($this->obj->getType(),$this->obj->getId(),
'4.1.0');
472 $exp->exportObject($this->obj->getType(),$this->obj->getId(),
"4.1.0");
479 $ilCtrl->redirect($this,
"listExportFiles");