28 public function __construct($a_parent_gui, $a_main_obj = null)
32 $this->parent_gui = $a_parent_gui;
33 if ($a_main_obj == null) {
34 $this->obj = $a_parent_gui->object;
36 $this->obj = $a_main_obj;
38 $lng->loadLanguageModule(
"exp");
47 include_once(
"./Services/Export/classes/class.ilExportTableGUI.php");
66 public function addFormat($a_key, $a_txt =
"", $a_call_obj = null, $a_call_func =
"")
71 $a_txt = $lng->txt(
"exp_" . $a_key);
73 $this->
formats[] =
array(
"key" => $a_key,
"txt" => $a_txt,
74 "call_obj" => $a_call_obj,
"call_func" => $a_call_func);
95 $this->custom_columns[] =
array(
"txt" => $a_txt,
108 $this->custom_multi_commands[] =
array(
"txt" => $a_txt,
143 if (method_exists($this->obj,
'getRefId') and $this->obj->getRefId()) {
144 if (!$ilAccess->checkAccess(
'write',
'', $this->obj->getRefId())) {
145 $ilErr->raiseError($lng->txt(
'permission_denied'), $ilErr->WARNING);
149 $cmd = $ilCtrl->getCmd(
"listExportFiles");
152 case "listExportFiles":
157 if (substr($cmd, 0, 7) ==
"create_") {
159 } elseif (substr($cmd, 0, 6) ==
"multi_") {
178 include_once
"Services/UIComponent/Button/classes/class.ilSubmitButton.php";
182 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
188 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
191 $ilToolbar->addInputItem(
$si,
true);
193 $button->setCaption(
"exp_create_file");
194 $button->setCommand(
"createExportFile");
199 $button->setCaption($lng->txt(
"exp_create_file") .
" (" .
$format[
"txt"] .
")",
false);
200 $button->setCommand(
"create_" .
$format[
"key"]);
203 $ilToolbar->addButtonInstance($button);
206 $table->setSelectAllCheckbox(
"file");
208 $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") {
229 $format = substr($ilCtrl->getCmd(), 7);
233 if (is_object($f[
"call_obj"])) {
234 $f[
"call_obj"]->{$f[
"call_func"]}();
238 include_once(
"./Services/Export/classes/class.ilExport.php");
240 $exp->exportObject($this->obj->getType(), $this->obj->getId());
246 $ilCtrl->redirect($this,
"listExportFiles");
256 if (!is_array(
$_POST[
"file"]) || count(
$_POST[
"file"]) == 0) {
258 $ilCtrl->redirect($this,
"listExportFiles");
260 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
262 $cgui->setFormAction($ilCtrl->getFormAction($this));
263 $cgui->setHeaderText($lng->txt(
"exp_really_delete"));
264 $cgui->setCancel($lng->txt(
"cancel"),
"listExportFiles");
265 $cgui->setConfirm($lng->txt(
"delete"),
"delete");
268 if (strpos($i,
':') !==
false) {
269 $iarr = explode(
":", $i);
277 $tpl->setContent($cgui->getHTML());
284 public function delete()
289 $file = explode(
":", $file);
291 $file[1] = basename($file[1]);
293 include_once(
"./Services/Export/classes/class.ilExport.php");
296 str_replace(
"..",
"", $file[0]),
297 $this->obj->getType()
300 $exp_file = $export_dir .
"/" . str_replace(
"..",
"", $file[1]);
301 $exp_dir = $export_dir .
"/" . substr($file[1], 0, strlen($file[1]) - 4);
302 if (@is_file($exp_file)) {
305 if (@is_dir($exp_dir)) {
310 include_once
'./Services/Export/classes/class.ilExportFileInfo.php';
314 $ilCtrl->redirect($this,
"listExportFiles");
324 if (!isset(
$_GET[
"file"]) ||
325 is_array(
$_GET[
"file"])) {
326 $ilCtrl->redirect($this,
"listExportFiles");
330 include_once(
"./Services/Export/classes/class.ilExport.php");
333 str_replace(
"..",
"",
$file[0]),
334 $this->obj->getType()
337 $file[1] = basename($file[1]);
340 $export_dir .
"/" . $file[1],
355 $cmd = substr($ilCtrl->getCmd(), 6);
357 if ($c[
"func"] == $cmd) {
358 $c[
"obj"]->{$c[
"func"]}(
$_POST[
"file"]);
371 $tpl->addJavaScript(
'./Services/CopyWizard/js/ilContainer.js');
372 $tpl->setVariable(
'BODY_ATTRIBUTES',
'onload="ilDisableChilds(\'cmd\');"');
374 include_once
'./Services/Export/classes/class.ilExportSelectionTableGUI.php';
377 $this->tpl->setContent(
$table->getHTML());
386 global $tree,$objDefinition, $ilAccess,
$ilCtrl,
$lng;
388 include_once
'./Services/Export/classes/class.ilExportOptions.php';
392 $items_selected =
false;
393 foreach ($tree->getSubTree($root = $tree->getNodeData($this->getParentGUI()->object->getRefId())) as $node) {
394 if ($node[
'type'] ==
'rolf') {
397 if ($node[
'ref_id'] == $this->
getParentGUI()->object->getRefId()) {
407 if (!$objDefinition->allowExport($node[
'type']) or !$ilAccess->checkAccess(
'write',
'', $node[
'ref_id'])) {
417 $mode = isset(
$_POST[
'cp_options'][$node[
'ref_id']][
'type']) ?
418 $_POST[
'cp_options'][$node[
'ref_id']][
'type'] :
427 $items_selected =
true;
431 include_once(
"./Services/Export/classes/class.ilExport.php");
432 if ($items_selected) {
436 foreach ($eo->getSubitemsForCreation($this->obj->getRefId()) as $ref_id) {
439 $exp->exportObject(
$type, $obj_id);
444 include_once
'./Services/Export/classes/class.ilExportContainer.php';
446 $cexp->exportObject($this->obj->getType(), $this->obj->getId());
449 $exp->exportObject($this->obj->getType(), $this->obj->getId());
456 $ilCtrl->redirect($this,
"listExportFiles");
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
showItemSelection()
Show container item selection table.
handleCustomMultiCommand()
Handle custom multi command.
addCustomColumn($a_txt, $a_obj, $a_func)
Add custom column.
Object selection for export.
addFormat($a_key, $a_txt="", $a_call_obj=null, $a_call_func="")
Add formats.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getCustomColumns()
Get custom columns.
Export User Interface Class.
static newInstance($a_export_id)
Create new instance.
addCustomMultiCommand($a_txt, $a_obj, $a_func)
Add custom multi command.
saveItemSelection()
Save selection of subitems.
static _lookupObjId($a_id)
Stores information of creation date and versions of export files
executeCommand()
Execute command.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
listExportFiles()
List export files.
getCustomMultiCommands()
Get custom multi commands.
Create new PHPExcel object
obj_idprivate
confirmDeletion()
Confirm file deletion.
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
if(empty($password)) $table
__construct($a_parent_gui, $a_main_obj=null)
Constuctor.
static allocateExportId()
Allocate a new export id.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
getParentGUI()
get parent gui
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Confirmation screen class.
createExportFile()
Create export file.