29 protected \ILIAS\Repository\Deletion\Deletion
$deletion;
44 string $a_parent_cmd =
""
49 $this->
lng = $DIC->language();
51 $this->
ctrl = $DIC->ctrl();
52 $this->tpl =
$DIC[
"tpl"];
53 $this->obj_definition =
$DIC[
"objDefinition"];
54 $this->
access = $DIC->access();
55 $this->tree =
$DIC->repositoryTree();
56 $this->parent_gui = $a_parent_gui;
57 $this->parent_cmd = $a_parent_cmd;
59 $this->
logger = $DIC->logger()->rep();
60 $this->request =
$DIC->repository()
65 $this->deletion =
$DIC->repository()->internal()->domain()->deletion();
73 $next_class = $this->
ctrl->getNextClass($this);
74 switch ($next_class) {
75 case "ilpropertyformgui":
77 $this->
ctrl->forwardCommand($form);
81 $cmd = $this->
ctrl->getCmd(
'cancel');
89 $this->
ctrl->returnToParent($this);
95 $this->
lng->loadLanguageModule(
'rep');
97 $trash_ids = $this->request->getTrashIds();
99 $this->
ctrl->setParameter($this,
'trash_ids', implode(
',', $trash_ids));
101 if (!count($trash_ids)) {
102 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_one'),
true);
103 $this->
ctrl->returnToParent($this);
109 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'rep_target_location_info'));
110 $this->tpl->setContent($form->getHTML());
119 $trash_ids = $this->request->getTrashIds();
121 $form = $this->initFormTrashTargetLocation();
122 if (!$form->checkInput() && count($trash_ids)) {
123 $this->
lng->loadLanguageModule(
'search');
124 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'search_no_selection'),
true);
125 $this->
ctrl->returnToParent($this);
130 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_undeleted'),
true);
131 $this->
ctrl->returnToParent($this);
133 $this->tpl->setOnScreenMessage(
'failure',
$e->getMessage(),
true);
134 $this->
ctrl->returnToParent($this);
141 $form->setFormAction($this->
ctrl->getFormAction($this));
144 $this->
lng->txt(
'rep_target_location'),
148 $target->setRequired(
true);
152 ilAdministrationGUI::class,
153 get_class($this->parent_gui),
155 ilPropertyFormGUI::class,
156 ilFormPropertyDispatchGUI::class,
157 ilRepositorySelector2InputGUI::class
159 'handleExplorerCommand',
162 'rep_exp_sel_' . $target->getPostVar()
164 $explorer->setSelectMode($target->getPostVar() .
"_sel",
false);
166 $explorer->setTypeWhiteList([
'root',
'cat',
'crs',
'grp',
'fold']);
167 $target->setExplorerGUI($explorer);
169 $form->addItem($target);
170 $form->addCommandButton(
'doRestoreToNewLocation', $this->
lng->txt(
'btn_undelete'));
171 $form->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
178 bool $a_supress_message =
false
182 $ilCtrl = $this->ctrl;
184 $objDefinition = $this->obj_definition;
186 if (!is_array($a_ids) || count($a_ids) === 0) {
192 $a_ids = array_unique($a_ids);
196 if (!$a_supress_message) {
197 $msg =
$lng->txt(
"info_delete_sure");
200 $msg .=
"<br/>" .
$lng->txt(
"info_delete_warning_no_trash");
203 $cgui->setHeaderText($msg);
205 $cgui->setFormAction($ilCtrl->getFormAction($this->parent_gui));
206 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelDelete");
207 $cgui->setConfirm(
$lng->txt(
"confirm"),
"confirmedDelete");
209 $form_name =
"cgui_" . md5(uniqid(
'',
true));
210 $cgui->setFormName($form_name);
217 $alt = ($objDefinition->isPlugin($type))
219 :
$lng->txt(
"icon") .
" " .
$lng->txt(
"obj_" . $type);
225 $this->handleMultiReferences($obj_id,
$ref_id, $form_name),
234 if (is_array($deps) && count($deps) > 0) {
236 $deps_html =
"<br/><br/>" . $tab->getHTML();
239 $tpl->
setContent($cgui->getHTML() . $deps_html);
250 $ilAccess = $this->access;
256 if (count($all_refs) > 1) {
257 $lng->loadLanguageModule(
"rep");
262 foreach ($all_refs as $mref_id) {
264 if ($mref_id != $a_ref_id && !$tree->
isDeleted($mref_id)) {
265 if ($ilAccess->checkAccess(
"read",
"", $mref_id)) {
267 if ($ilAccess->checkAccess(
"delete",
"", $mref_id)) {
272 $path = $this->buildPath([$mref_id]);
275 "path" => array_shift(
$path),
276 "delete" => $may_delete
287 $tpl =
new ilTemplate(
"tpl.rep_multi_ref.html",
true,
true,
"components/ILIAS/Repository/Trash");
289 $tpl->
setVariable(
"TXT_INTRO",
$lng->txt(
"rep_multiple_reference_deletion_intro"));
291 if ($may_delete_any) {
292 $tpl->
setVariable(
"TXT_INSTRUCTION",
$lng->txt(
"rep_multiple_reference_deletion_instruction"));
296 $var_name =
"mref_id[]";
298 foreach ($items as $item) {
299 if ($item[
"delete"]) {
305 $tpl->
setVariable(
"TXT_ITEM_INFO",
$lng->txt(
"rep_no_permission_to_delete"));
314 if ($may_delete_any > 1) {
316 $tpl->
setVariable(
"ITEM_NAME",
"sall_" . $a_ref_id);
318 $tpl->
setVariable(
"ITEM_ADD",
" onclick=\"il.Util.setChecked('" .
319 $a_form_name .
"', '" . $var_name .
"', document." . $a_form_name .
320 ".sall_" . $a_ref_id .
".checked)\"");
332 "TXT_ADDITIONAL_INFO",
333 sprintf(
$lng->txt(
"rep_object_references_cannot_be_read"),
$counter)
351 if (count($objects) === 0) {
352 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"msg_trash_empty"));
356 $ttab->setData($objects);
372 $lng->loadLanguageModule(
'rep');
374 if (!is_array($a_ref_ids) || count($a_ref_ids) === 0) {
375 $this->tpl->setOnScreenMessage(
'failure',
$lng->txt(
"no_checkbox"),
true);
380 if ($tree_trash_queries->isTrashedTrash($a_ref_ids)) {
381 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'rep_failure_trashed_trash'),
true);
387 foreach ($a_ref_ids as $deleted_node_id) {
388 $target_id = $tree_trash_queries->findRepositoryLocationForDeletedNode($deleted_node_id);
390 $by_location[$target_id][] = $deleted_node_id;
393 foreach ($by_location as $target_id => $deleted_node_ids) {
396 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_undeleted"),
true);
397 }
catch (Exception
$e) {
398 $this->tpl->setOnScreenMessage(
'failure',
$e->getMessage(),
true);
411 if (!is_array($a_ref_ids) || count($a_ref_ids) === 0) {
412 $this->tpl->setOnScreenMessage(
'failure',
$lng->txt(
"no_checkbox"),
true);
415 $this->deletion->deleteObjectsByRefIds($a_ref_ids);
417 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"info_deleted"),
true);
419 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_removed"),
true);
424 $this->tpl->setOnScreenMessage(
'failure',
$e->getMessage(),
true);
431 bool $a_from_recovery_folder =
false
435 if (!is_array($a_ref_ids) || count($a_ref_ids) === 0) {
436 $this->tpl->setOnScreenMessage(
'failure',
$lng->txt(
"no_checkbox"),
true);
442 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_removed"),
true);
443 }
catch (Exception
$e) {
461 if (!count($ref_ids)) {
466 foreach ($ref_ids as
$ref_id) {
469 foreach ($path_full as $idx =>
$data) {
471 $path .=
" » ";
476 $path .= (
'<a target="_top" href="' .
477 ilLink::_getLink(
$data[
'ref_id'],
$data[
'type']) .
'">' .
495 $ilCtrl = $this->
ctrl;
497 $objDefinition = $this->obj_definition;
500 if (!is_array($a_ids)) {
505 $cgui->setFormAction($ilCtrl->getFormAction($this->parent_gui));
506 $cgui->setCancel(
$lng->txt(
"cancel"),
"trash");
507 $cgui->setConfirm(
$lng->txt(
"confirm"),
"removeFromSystem");
508 $cgui->setFormName(
"trash_confirmation");
509 $cgui->setHeaderText(
$lng->txt(
"info_delete_sure"));
511 foreach ($a_ids as
$id) {
515 $alt = ($objDefinition->isPlugin($type))
517 :
$lng->txt(
"icon") .
" " .
$lng->txt(
"obj_" . $type);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
Component logger with individual log levels by component id.
parses the objects.xml it handles the xml-description of all ilias objects
static getClassByType(string $obj_type)
Class ilObjectGUI Basic methods of all Output classes.
static lookupTxtById(string $plugin_id, string $lang_var)
static _lookupType(int $id, bool $reference=false)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static _getAllReferences(int $id)
get all reference ids for object ID
static collectDeletionDependencies(array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
Collect deletion dependencies.
static _lookupObjId(int $ref_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static restoreObjects(int $a_cur_ref_id, array $a_ref_ids)
Move objects from trash back to repository.
static removeObjectsFromSystem(array $a_ref_ids, bool $a_from_recovery_folder=false)
remove objects from trash bin and all entries therefore every object needs a specific deleteObject() ...
Explorer for selecting repository items.
Repository GUI Utilities.
handleMultiReferences(int $a_obj_id, int $a_ref_id, string $a_form_name)
ilObjectDefinition $obj_definition
ILIAS Repository Deletion Deletion $deletion
restoreObjects(int $a_cur_ref_id, array $a_ref_ids)
Restore objects from trash.
showTrashTable(int $a_ref_id)
buildPath(array $ref_ids)
Build path with deep-link.
ilGlobalTemplateInterface $tpl
deleteObjects(int $a_cur_ref_id, array $a_ref_ids)
restoreToNewLocation(?ilPropertyFormGUI $form=null)
initFormTrashTargetLocation()
confirmRemoveFromSystemObject(array $a_ids)
Confirmation for trash.
showDeleteConfirmation(?array $a_ids, bool $a_supress_message=false)
removeObjectsFromSystem(array $a_ref_ids, bool $a_from_recovery_folder=false)
special template class to simplify handling of ITX/PEAR
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
getPathFull(int $a_endnode_id, int $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
isDeleted(int $a_node_id)
This is a wrapper for isSaved() with a more useful name.
getSavedNodeData(int $a_parent_id)
get data saved/deleted nodes
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
setVariable(string $variable, $value='')
Sets the given variable to the given value.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setContent(string $a_html)
Sets content for standard template.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc