Repository GUI Utilities.
More...
◆ __construct()
ilRepUtilGUI::__construct |
( |
|
$a_parent_gui, |
|
|
|
$a_parent_cmd = "" |
|
) |
| |
Constructor.
- Parameters
-
object | parent gui object |
string | current parent command (like in table2gui) |
Definition at line 65 of file class.ilRepUtilGUI.php.
References $DIC, and settings().
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();
◆ buildPath()
ilRepUtilGUI::buildPath |
( |
|
$ref_ids | ) |
|
|
protected |
Build path with deep-link.
- Parameters
-
- Returns
- array
Definition at line 505 of file class.ilRepUtilGUI.php.
References $data, $result, $tree, and ilLink\_getLink().
Referenced by handleMultiReferences().
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>');
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
◆ cancel()
◆ confirmRemoveFromSystemObject()
ilRepUtilGUI::confirmRemoveFromSystemObject |
( |
|
$a_ids | ) |
|
Confirmation for trash.
- Parameters
-
Definition at line 542 of file class.ilRepUtilGUI.php.
References $ctrl, $ilCtrl, $lng, $obj_definition, $tpl, $type, ilObject\_lookupObjId(), ilObject\_lookupType(), ilObjectFactory\getClassByType(), and ilObjectPlugin\lookupTxtById().
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.
static lookupTxtById($plugin_id, $lang_var)
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
Confirmation screen class.
◆ deleteObjects()
ilRepUtilGUI::deleteObjects |
( |
|
$a_cur_ref_id, |
|
|
|
$a_ref_ids |
|
) |
| |
◆ doRestoreToNewLocation()
ilRepUtilGUI::doRestoreToNewLocation |
( |
| ) |
|
Perform restore to new location.
Definition at line 144 of file class.ilRepUtilGUI.php.
References Vendor\Package\$e, initFormTrashTargetLocation(), ilRepUtil\restoreObjects(), and ilUtil\sendFailure().
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);
initFormTrashTargetLocation()
static restoreObjects($a_cur_ref_id, $a_ref_ids)
Move objects from trash back to repository.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
◆ executeCommand()
ilRepUtilGUI::executeCommand |
( |
| ) |
|
- Exceptions
-
Definition at line 85 of file class.ilRepUtilGUI.php.
References $DIC, $logger, and initFormTrashTargetLocation().
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');
initFormTrashTargetLocation()
◆ handleMultiReferences()
ilRepUtilGUI::handleMultiReferences |
( |
|
$a_obj_id, |
|
|
|
$a_ref_id, |
|
|
|
$a_form_name |
|
) |
| |
Build subitem list for multiple references.
- Parameters
-
int | $a_obj_id | |
int | $a_ref_id | |
string | $a_form_name | |
- Returns
- string
Definition at line 289 of file class.ilRepUtilGUI.php.
References $access, $lng, $tpl, $tree, ilObject\_getAllReferences(), and buildPath().
Referenced by showDeleteConfirmation().
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();
static _getAllReferences($a_id)
get all reference ids of object
buildPath($ref_ids)
Build path with deep-link.
◆ initFormTrashTargetLocation()
ilRepUtilGUI::initFormTrashTargetLocation |
( |
| ) |
|
|
protected |
- Returns
Definition at line 171 of file class.ilRepUtilGUI.php.
Referenced by doRestoreToNewLocation(), executeCommand(), and restoreToNewLocation().
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'));
◆ removeObjectsFromSystem()
ilRepUtilGUI::removeObjectsFromSystem |
( |
|
$a_ref_ids, |
|
|
|
$a_from_recovery_folder = false |
|
) |
| |
Remove objects from system.
Definition at line 478 of file class.ilRepUtilGUI.php.
References Vendor\Package\$e, $lng, ilRepUtil\removeObjectsFromSystem(), and ilUtil\sendFailure().
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);
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
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() ...
◆ restoreObjects()
ilRepUtilGUI::restoreObjects |
( |
|
$a_cur_ref_id, |
|
|
|
$a_ref_ids |
|
) |
| |
Restore objects from trash.
- Parameters
-
int | current ref id |
int[] | array of ref ids to be restored |
Definition at line 412 of file class.ilRepUtilGUI.php.
References Vendor\Package\$e, $lng, $target_id, ilRepUtil\restoreObjects(), and ilUtil\sendFailure().
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);
static restoreObjects($a_cur_ref_id, $a_ref_ids)
Move objects from trash back to repository.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
◆ restoreToNewLocation()
- Parameters
-
\ilPropertyFormGUI | null | $form | |
- Returns
- bool
Definition at line 117 of file class.ilRepUtilGUI.php.
References $_POST, initFormTrashTargetLocation(), ilUtil\sendFailure(), and ilUtil\sendInfo().
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());
initFormTrashTargetLocation()
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
◆ showDeleteConfirmation()
ilRepUtilGUI::showDeleteConfirmation |
( |
|
$a_ids, |
|
|
|
$a_supress_message = false |
|
) |
| |
Show delete confirmation table.
Definition at line 213 of file class.ilRepUtilGUI.php.
References $ctrl, $ilCtrl, $ilSetting, $lng, $obj_definition, $settings, $tab, $tpl, $type, ilObject\_lookupObjId(), ilObject\_lookupType(), ilObject\collectDeletionDependencies(), ilObjectFactory\getClassByType(), handleMultiReferences(), ilObjectPlugin\lookupTxtById(), and ilUtil\sendFailure().
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);
static getClassByType($a_obj_type)
Get class by type.
static lookupTxtById($plugin_id, $lang_var)
static collectDeletionDependencies(&$deps, $a_ref_id, $a_obj_id, $a_type, $a_depth=0)
Collect deletion dependencies.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
handleMultiReferences($a_obj_id, $a_ref_id, $a_form_name)
Build subitem list for multiple references.
Confirmation screen class.
◆ showTrashTable()
ilRepUtilGUI::showTrashTable |
( |
|
$a_ref_id | ) |
|
Get trashed objects for a container.
- Parameters
-
interger | ref id of container |
Definition at line 387 of file class.ilRepUtilGUI.php.
References $lng, $tpl, $tree, and ilUtil\sendInfo().
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());
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
◆ $access
◆ $ctrl
◆ $lng
◆ $logger
ilRepUtilGUI::$logger = null |
|
private |
◆ $obj_definition
ilRepUtilGUI::$obj_definition |
|
protected |
◆ $settings
◆ $tpl
◆ $tree
The documentation for this class was generated from the following file: