3 require_once(
'./Services/Repository/classes/class.ilObjectPlugin.php');
65 public function __construct($a_parent_gui, $a_parent_cmd =
"")
69 $this->lng = $DIC->language();
71 $this->ctrl = $DIC->ctrl();
72 $this->tpl = $DIC[
"tpl"];
73 $this->obj_definition = $DIC[
"objDefinition"];
74 $this->access = $DIC->access();
75 $this->tree = $DIC->repositoryTree();
76 $this->parent_gui = $a_parent_gui;
77 $this->parent_cmd = $a_parent_cmd;
79 $this->logger = $DIC->logger()->rep();
89 $logger = $DIC->logger()->rep();
90 $next_class = $this->ctrl->getNextClass($this);
91 switch ($next_class) {
92 case "ilpropertyformgui":
94 $this->ctrl->forwardCommand($form);
98 $cmd = $this->ctrl->getCmd(
'cancel');
110 $this->ctrl->returnToParent($this);
119 $this->lng->loadLanguageModule(
'rep');
121 if (isset(
$_POST[
'trash_id'])) {
122 $trash_ids = (array)
$_POST[
'trash_id'];
123 } elseif (isset($_REQUEST[
'trash_ids'])) {
124 $trash_ids = explode(
',',
$_POST[
'trash_ids']);
127 $this->ctrl->setParameter($this,
'trash_ids', implode(
',', $trash_ids));
129 if (!count($trash_ids)) {
131 $this->ctrl->returnToParent($this);
138 $this->tpl->setContent($form->getHTML());
147 if (isset($_REQUEST[
'trash_ids'])) {
148 $trash_ids = explode(
',', $_REQUEST[
'trash_ids']);
152 if (!$form->checkInput() && count($trash_ids)) {
153 $this->lng->loadLanguageModule(
'search');
155 $this->ctrl->returnToParent($this);
160 \ilUtil::sendSuccess($this->lng->txt(
'msg_undeleted'),
true);
161 $this->ctrl->returnToParent($this);
164 $this->ctrl->returnToParent($this);
173 $form = new \ilPropertyFormGUI();
174 $form->setFormAction($this->ctrl->getFormAction($this));
176 $target = new \ilRepositorySelector2InputGUI(
177 $this->lng->txt(
'rep_target_location'),
181 $target->setRequired(
true);
183 $explorer = new \ilRepositorySelectorExplorerGUI(
185 \ilAdministrationGUI::class,
186 get_class($this->parent_gui),
187 \ilRepUtilGUI::class,
188 \ilPropertyFormGUI::class,
189 \ilFormPropertyDispatchGUI::class,
190 \ilRepositorySelector2InputGUI::class
192 'handleExplorerCommand',
195 'rep_exp_sel_' . $target->getPostVar()
197 $explorer->setSelectMode($target->getPostVar() .
"_sel",
false);
198 $explorer->setRootId(ROOT_FOLDER_ID);
199 $explorer->setTypeWhiteList([
'root',
'cat',
'crs',
'grp',
'fold']);
200 $target->setExplorerGUI($explorer);
202 $form->addItem($target);
203 $form->addCommandButton(
'doRestoreToNewLocation', $this->lng->txt(
'btn_undelete'));
204 $form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
221 if (!is_array($a_ids) || count($a_ids) == 0) {
227 $a_ids = array_unique((array) $a_ids);
229 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
232 if (!$a_supress_message) {
233 $msg =
$lng->txt(
"info_delete_sure");
236 $msg .=
"<br/>" .
$lng->txt(
"info_delete_warning_no_trash");
239 $cgui->setHeaderText($msg);
241 $cgui->setFormAction(
$ilCtrl->getFormAction($this->parent_gui));
242 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelDelete");
243 $cgui->setConfirm(
$lng->txt(
"confirm"),
"confirmedDelete");
245 $form_name =
"cgui_" . md5(uniqid());
246 $cgui->setFormName($form_name);
249 foreach ($a_ids as $ref_id) {
253 $alt = ($objDefinition->isPlugin(
$type))
263 ilObject::_getIcon($obj_id,
"small",
$type),
271 if (is_array($deps) && count($deps) > 0) {
272 include_once(
"./Services/Repository/classes/class.ilRepDependenciesTableGUI.php");
274 $deps_html =
"<br/><br/>" .
$tab->getHTML();
277 $tpl->setContent($cgui->getHTML() . $deps_html);
298 if (
sizeof($all_refs) > 1) {
299 $lng->loadLanguageModule(
"rep");
304 foreach ($all_refs as $mref_id) {
306 if ($mref_id != $a_ref_id && !
$tree->isDeleted($mref_id)) {
307 if ($ilAccess->checkAccess(
"read",
"", $mref_id)) {
309 if ($ilAccess->checkAccess(
"delete",
"", $mref_id)) {
314 $items[] = array(
"id" => $mref_id,
315 "path" => array_shift($this->
buildPath(array($mref_id))),
316 "delete" => $may_delete);
326 $tpl =
new ilTemplate(
"tpl.rep_multi_ref.html",
true,
true,
"Services/Repository");
328 $tpl->setVariable(
"TXT_INTRO",
$lng->txt(
"rep_multiple_reference_deletion_intro"));
330 if ($may_delete_any) {
331 $tpl->setVariable(
"TXT_INSTRUCTION",
$lng->txt(
"rep_multiple_reference_deletion_instruction"));
335 $var_name =
"mref_id[]";
337 foreach ($items as $item) {
338 if ($item[
"delete"]) {
339 $tpl->setCurrentBlock(
"cbox");
340 $tpl->setVariable(
"ITEM_NAME", $var_name);
341 $tpl->setVariable(
"ITEM_VALUE", $item[
"id"]);
342 $tpl->parseCurrentBlock();
344 $tpl->setCurrentBlock(
"item_info");
345 $tpl->setVariable(
"TXT_ITEM_INFO",
$lng->txt(
"rep_no_permission_to_delete"));
346 $tpl->parseCurrentBlock();
349 $tpl->setCurrentBlock(
"item");
350 $tpl->setVariable(
"ITEM_TITLE", $item[
"path"]);
351 $tpl->parseCurrentBlock();
354 if ($may_delete_any > 1) {
355 $tpl->setCurrentBlock(
"cbox");
356 $tpl->setVariable(
"ITEM_NAME",
"sall_" . $a_ref_id);
357 $tpl->setVariable(
"ITEM_VALUE",
"");
358 $tpl->setVariable(
"ITEM_ADD",
" onclick=\"il.Util.setChecked('" .
359 $a_form_name .
"', '" . $var_name .
"', document." . $a_form_name .
360 ".sall_" . $a_ref_id .
".checked)\"");
361 $tpl->parseCurrentBlock();
363 $tpl->setCurrentBlock(
"item");
364 $tpl->setVariable(
"ITEM_TITLE",
$lng->txt(
"select_all"));
365 $tpl->parseCurrentBlock();
370 $tpl->setCurrentBlock(
"add_info");
372 "TXT_ADDITIONAL_INFO",
373 sprintf(
$lng->txt(
"rep_object_references_cannot_be_read"), $counter)
375 $tpl->parseCurrentBlock();
393 $objects =
$tree->getSavedNodeData($a_ref_id);
395 if (count($objects) == 0) {
399 include_once(
"./Services/Repository/classes/class.ilTrashTableGUI.php");
401 $ttab->setData($objects);
403 $tpl->setContent($ttab->getHTML());
415 $lng->loadLanguageModule(
'rep');
417 if (!is_array($a_ref_ids) || count($a_ref_ids) == 0) {
422 $tree_trash_queries = new \ilTreeTrashQueries();
423 if ($tree_trash_queries->isTrashedTrash($a_ref_ids)) {
431 foreach ($a_ref_ids as $deleted_node_id) {
432 $target_id = $tree_trash_queries->findRepositoryLocationForDeletedNode($deleted_node_id);
434 $by_location[
$target_id][] = $deleted_node_id;
437 foreach ($by_location as
$target_id => $deleted_node_ids) {
440 ilUtil::sendSuccess(
$lng->txt(
"msg_undeleted"),
true);
456 if (!is_array($a_ref_ids) || count($a_ref_ids) == 0) {
460 include_once(
"./Services/Repository/classes/class.ilRepUtil.php");
464 ilUtil::sendSuccess(
$lng->txt(
"info_deleted"),
true);
466 ilUtil::sendSuccess(
$lng->txt(
"msg_removed"),
true);
482 if (!is_array($a_ref_ids) || count($a_ref_ids) == 0) {
486 include_once(
"./Services/Repository/classes/class.ilRepUtil.php");
489 ilUtil::sendSuccess(
$lng->txt(
"msg_removed"),
true);
509 include_once
'Services/Link/classes/class.ilLink.php';
511 if (!count($ref_ids)) {
516 foreach ($ref_ids as $ref_id) {
518 $path_full =
$tree->getPathFull($ref_id);
519 foreach ($path_full as $idx =>
$data) {
521 $path .=
" » ";
523 if ($ref_id !=
$data[
'ref_id']) {
524 $path .=
$data[
'title'];
526 $path .= (
'<a target="_top" href="' .
528 $data[
'title'] .
'</a>');
548 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
550 if (!is_array($a_ids)) {
551 $a_ids = array($a_ids);
555 $cgui->setFormAction(
$ilCtrl->getFormAction($this->parent_gui));
556 $cgui->setCancel(
$lng->txt(
"cancel"),
"trash");
557 $cgui->setConfirm(
$lng->txt(
"confirm"),
"removeFromSystem");
558 $cgui->setFormName(
"trash_confirmation");
559 $cgui->setHeaderText(
$lng->txt(
"info_delete_sure"));
561 foreach ($a_ids as $id) {
565 $alt = ($objDefinition->isPlugin(
$type))
573 ilObject::_getIcon($obj_id,
"small",
$type),
578 $tpl->setContent($cgui->getHTML());
static getClassByType($a_obj_type)
Get class by type.
restoreToNewLocation(\ilPropertyFormGUI $form=null)
static lookupTxtById($plugin_id, $lang_var)
initFormTrashTargetLocation()
removeObjectsFromSystem($a_ref_ids, $a_from_recovery_folder=false)
Remove objects from system.
showTrashTable($a_ref_id)
Get trashed objects for a container.
deleteObjects($a_cur_ref_id, $a_ref_ids)
Delete objects.
static restoreObjects($a_cur_ref_id, $a_ref_ids)
Move objects from trash back to repository.
static _getAllReferences($a_id)
get all reference ids of object
static collectDeletionDependencies(&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
Collect deletion dependencies.
__construct($a_parent_gui, $a_parent_cmd="")
Constructor.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _lookupObjId($a_id)
Repository GUI Utilities.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
showDeleteConfirmation($a_ids, $a_supress_message=false)
Show delete confirmation table.
confirmRemoveFromSystemObject($a_ids)
Confirmation for trash.
buildPath($ref_ids)
Build path with deep-link.
doRestoreToNewLocation()
Perform restore to new location.
handleMultiReferences($a_obj_id, $a_ref_id, $a_form_name)
Build subitem list for multiple references.
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
restoreObjects($a_cur_ref_id, $a_ref_ids)
Restore objects from trash.
Confirmation screen class.
static deleteObjects($a_cur_ref_id, $a_ids)
Delete objects.
static removeObjectsFromSystem($a_ref_ids, $a_from_recovery_folder=false)
remove objects from trash bin and all entries therefore every object needs a specific deleteObject() ...