ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilObjectCopyGUI Class Reference

GUI class for the workflow of copying objects. More...

+ Collaboration diagram for ilObjectCopyGUI:

Public Member Functions

 executeCommand ()
 
 setMode (int $mode)
 
 getMode ()
 
 setSubMode (int $mode)
 
 getSubMode ()
 
 getParentObject ()
 Get parent gui object. More...
 
 getType ()
 
 setType (string $type)
 
 setSource (array $source_ids)
 
 getSources ()
 
 getFirstSource ()
 
 setTarget (int $ref_id)
 
 setTargets (array $targets)
 
 getTargets ()
 
 getFirstTarget ()
 
 keepObjectsInClipboard ()
 
 copyMultipleNonContainer (array $sources)
 Copy multiple non container. More...
 
 showSourceSearch (?string $tpl_var)
 Show init screen Normally shown below the create and import form when creating a new object. More...
 

Data Fields

const SOURCE_SELECTION = 1
 
const TARGET_SELECTION = 2
 
const SEARCH_SOURCE = 3
 
const SUBMODE_COMPLETE = 1
 
const SUBMODE_CONTENT_ONLY = 2
 
const TAB_SELECTION_TARGET_TREE = 1
 
const TAB_SELECTION_SOURCE_TREE = 2
 
const TAB_SELECTION_MEMBERSHIP = 3
 
const TAB_GROUP_SC_SELECTION = 1
 

Protected Member Functions

 init ()
 
 initTabs ()
 
 setTabs (int $tab_group, int $active_tab)
 
 adoptContent ()
 Adopt content (crs in crs, grp in grp, crs in grp or grp in crs) More...
 
 initTargetSelection ()
 Init copy from repository/search list commands. More...
 
 initSourceSelection ()
 
 showSourceSelectionMembership ()
 show target selection membership More...
 
 showTargetSelectionTree ()
 
 showSourceSelectionTree ()
 
 saveTarget ()
 
 cancel ()
 
 searchSource ()
 
 saveSource ()
 
 saveSourceMembership ()
 Save selected source from membership screen. More...
 
 showCopyPageSelection ()
 
 saveCopyPage ()
 
 showItemSelection (bool $copy_page=false)
 
 copySingleObject ()
 Start cloning a single (not container) object. More...
 
 copyContainerToTargets ()
 
 showCopyProgress ()
 
 updateProgress ()
 
 copyContainer (int $target_ref_id)
 
 initFormSearch ()
 
 unsetSession ()
 Unset session variables. More...
 

Protected Attributes

ilCtrl $ctrl
 
ilTree $tree
 
ilTabsGUI $tabs
 
ilGlobalTemplateInterface $tpl
 
ilObjectDefinition $obj_definition
 
ilObjectDataCache $obj_data_cache
 
ilAccessHandler $access
 
ilErrorHandling $error
 
ilRbacSystem $rbacsystem
 
ilObjUser $user
 
ilRbacReview $rbacreview
 
ilLogger $log
 
ilLanguage $lng
 
RequestWrapper $request_wrapper
 
ArrayBasedRequestWrapper $post_wrapper
 
Refinery $refinery
 
ServerRequestInterface $request
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
ContainerDBRepository $container_repo
 
ImplementsCreationCallback $parent_obj = null
 
ClipboardManager $clipboard
 
int $mode = 0
 
int $sub_mode = self::SUBMODE_COMPLETE
 
string $type = ''
 
array $sources = []
 
array $targets = []
 
array $targets_copy_id = []
 
ilPropertyFormGUI $form
 

Private Member Functions

 getPrimaryButtonLabel ()
 
 getOnLoadCode (string $cmd)
 
 getErrorMessageOnDisallowedObjectTypeForTarget (int $ref_id)
 
 executeNextStepAfterSourceSelection ()
 
 buildCopyPageSelectionForm ()
 
 isCopyingParentPageNeeded ()
 
 copyParentPage ()
 

Private Attributes

ilObjectRequestRetriever $retriever
 

Detailed Description

Member Function Documentation

◆ adoptContent()

ilObjectCopyGUI::adoptContent ( )
protected

Adopt content (crs in crs, grp in grp, crs in grp or grp in crs)

Definition at line 239 of file class.ilObjectCopyGUI.php.

239 : void
240 {
241 $this->ctrl->setParameter($this, 'smode', self::SUBMODE_CONTENT_ONLY);
242 $this->ctrl->setParameter($this, 'selectMode', self::SOURCE_SELECTION);
243
244 $this->setSubMode(self::SUBMODE_CONTENT_ONLY);
245 $this->setMode(self::SOURCE_SELECTION);
246 $this->setTarget($this->request_wrapper->retrieve("ref_id", $this->refinery->kindlyTo()->int()));
247
248 $this->initSourceSelection();
249 }

References ILIAS\Repository\ctrl(), initSourceSelection(), setMode(), setSubMode(), and setTarget().

+ Here is the call graph for this function:

◆ buildCopyPageSelectionForm()

ilObjectCopyGUI::buildCopyPageSelectionForm ( )
private

Definition at line 780 of file class.ilObjectCopyGUI.php.

780 : Standard
781 {
782 $form_action = $this->ctrl->getFormAction($this, 'saveCopyPage');
783
784 $input = [
785 'copy_page' => $this->ui_factory->input()->field()
786 ->radio(
787 $this->lng->txt('cntr_adopt_content')
788 )
789 ->withOption('1', $this->lng->txt('copy_container_page_yes_label'), $this->lng->txt('copy_container_page_yes_byline'))
790 ->withOption('0', $this->lng->txt('copy_container_page_no_label'))
791 ->withValue('1')
792 ->withAdditionalTransformation($this->refinery->kindlyTo()->bool())
793 ];
794
795 return $this->ui_factory->input()->container()->form()
796 ->standard($form_action, $input)
797 ->withSubmitLabel($this->lng->txt('next'));
798 }
This describes a standard form.
Definition: Standard.php:29

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

Referenced by saveCopyPage(), and showCopyPageSelection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancel()

ilObjectCopyGUI::cancel ( )
protected

Definition at line 614 of file class.ilObjectCopyGUI.php.

614 : void
615 {
616 $ilCtrl = $this->ctrl;
617 $ilCtrl->setReturnByClass(get_class($this->parent_obj), 'cancel');
618 $ilCtrl->returnToParent($this);
619 }
setReturnByClass(string $a_class, ?string $a_cmd=null)
@inheritDoc

References $ctrl, and ilCtrl\setReturnByClass().

+ Here is the call graph for this function:

◆ copyContainer()

ilObjectCopyGUI::copyContainer ( int  $target_ref_id)
protected

Definition at line 1055 of file class.ilObjectCopyGUI.php.

1055 : array
1056 {
1057 if ($this->getSubMode() != self::SUBMODE_CONTENT_ONLY) {
1058 if (!$this->rbacsystem->checkAccess('create', $target_ref_id, $this->getType())) {
1059 $this->log->notice(
1060 'Permission denied for target: ' .
1061 $target_ref_id .
1062 ' type: ' .
1063 $this->getType() .
1064 ' CREATE'
1065 );
1066 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
1067 $this->ctrl->returnToParent($this);
1068 }
1069 }
1070
1071 if (!$this->getFirstSource()) {
1072 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
1073 $this->ctrl->returnToParent($this);
1074 }
1075
1076 $options = [];
1077 if ($this->post_wrapper->has("cp_options")) {
1078 $options = $this->post_wrapper->retrieve(
1079 "cp_options",
1080 $this->refinery->kindlyTo()->dictOf(
1081 $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
1082 )
1083 );
1084 }
1085
1086 $this->log->debug('Copy container (sources): ' . print_r($this->getSources(), true));
1087
1089 $result = $orig->cloneAllObject(
1090 $_COOKIE[session_name()],
1091 CLIENT_ID,
1092 $this->getType(),
1093 $target_ref_id,
1094 $this->getFirstSource(),
1095 $options,
1096 false,
1097 $this->getSubMode()
1098 );
1099
1100 $this->targets_copy_id[$target_ref_id] = $result['copy_id'];
1101
1102 $new_ref_id = (int) $result['ref_id'];
1103 if ($new_ref_id > 0) {
1104 $new_obj = ilObjectFactory::getInstanceByRefId((int) $result['ref_id'], false);
1105 if ($new_obj instanceof ilObject) {
1106 $this->parent_obj->callCreationCallback(
1107 $new_obj,
1108 $this->obj_definition,
1109 $this->retriever->getMaybeInt('crtcb', 0)
1110 );
1111 }
1112 }
1113 return $result;
1114 }
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObject Basic functions for all objects.
const CLIENT_ID
Definition: constants.php:41
$_COOKIE[session_name()]
Definition: xapitoken.php:54

References $_COOKIE, CLIENT_ID, ILIAS\Repository\ctrl(), getFirstSource(), ilObjectFactory\getInstanceByRefId(), getSources(), getSubMode(), getType(), ILIAS\Repository\int(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

Referenced by copyContainerToTargets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyContainerToTargets()

ilObjectCopyGUI::copyContainerToTargets ( )
protected

Definition at line 929 of file class.ilObjectCopyGUI.php.

929 : void
930 {
931 $this->log->debug('Copy container to targets: ' . print_r($_REQUEST, true));
932 $this->log->debug('Source(s): ' . print_r($this->getSources(), true));
933 $this->log->debug('Target(s): ' . print_r($this->getTargets(), true));
934
935 if ($this->isCopyingParentPageNeeded()) {
936 $this->copyParentPage();
937 }
938
939 $result = 1;
940 foreach ($this->getTargets() as $target_ref_id) {
941 $result = $this->copyContainer((int) $target_ref_id);
942 }
943
944 $this->clipboard->clear();
945
946 if (ilCopyWizardOptions::_isFinished($result['copy_id'])) {
947 $this->log->info('Object copy completed.');
948 $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_duplicated"), true);
949 if ($this->getSubMode() == self::SUBMODE_CONTENT_ONLY) {
950 $this->ctrl->returnToParent($this);
951 }
952 $link = ilLink::_getLink($result['ref_id']);
953 $this->ctrl->redirectToURL($link);
954 } else {
955 $this->log->debug('Object copy in progress.');
956 $this->showCopyProgress();
957 }
958 }
static _isFinished(int $a_copy_id)
copyContainer(int $target_ref_id)

References ilCopyWizardOptions\_isFinished(), copyContainer(), copyParentPage(), ILIAS\Repository\ctrl(), getSources(), getSubMode(), getTargets(), isCopyingParentPageNeeded(), ILIAS\Repository\lng(), and showCopyProgress().

+ Here is the call graph for this function:

◆ copyMultipleNonContainer()

ilObjectCopyGUI::copyMultipleNonContainer ( array  $sources)

Copy multiple non container.

Parameters
array$sourcesarray of source ref ids

Definition at line 840 of file class.ilObjectCopyGUI.php.

840 : void
841 {
842 // check permissions
843 foreach ($sources as $source_ref_id) {
844 $source_type = ilObject::_lookupType($source_ref_id, true);
845
846 // Create permission
847 // begin-patch mc
848 foreach ($this->getTargets() as $target_ref_id) {
849 if (!$this->rbacsystem->checkAccess('create', $target_ref_id, $source_type)) {
850 $this->log->notice(
851 'Permission denied for target_id: ' .
852 $target_ref_id .
853 ' source_type: ' .
854 $source_type .
855 ' CREATE'
856 );
857 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
858 $this->ctrl->returnToParent($this);
859 }
860 }
861
862 // Copy permission
863 if (!$this->access->checkAccess('copy', '', $source_ref_id)) {
864 $this->log->notice('Permission denied for source_ref_id: ' . $source_ref_id . ' COPY');
865 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
866 $this->ctrl->returnToParent($this);
867 }
868
869 // check that these objects are really not containers
870 if ($this->obj_definition->isContainer($source_type) and $this->getSubMode() != self::SUBMODE_CONTENT_ONLY) {
871 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('cntr_container_only_on_their_own'), true);
872 $this->ctrl->returnToParent($this);
873 }
874 }
875
876 reset($sources);
877
878
879 ilLoggerFactory::getLogger('obj')->debug('Copy multiple non containers. Sources: ' . print_r($sources, true));
880
881 $new_obj = null;
882 // clone
883 foreach ($sources as $source_ref_id) {
884 ilLoggerFactory::getLogger('obj')->debug('Copying source ref_id : ' . $source_ref_id);
885
886 // begin-patch mc
887 foreach ($this->getTargets() as $target_ref_id) {
888 // Save wizard options
890 $wizard_options = ilCopyWizardOptions::_getInstance($copy_id);
891 $wizard_options->saveOwner($this->user->getId());
892 $wizard_options->saveRoot((int) $source_ref_id);
893 $wizard_options->read();
894
895 $orig = ilObjectFactory::getInstanceByRefId((int) $source_ref_id);
896 $new_obj = $orig->cloneObject($target_ref_id, $copy_id);
897
898 // Delete wizard options
899 $wizard_options->deleteAll();
900 $this->parent_obj->callCreationCallback(
901 $new_obj,
902 $this->obj_definition,
903 $this->retriever->getMaybeInt('crtcb', 0)
904 );
905
906 // rbac log
907 if (ilRbacLog::isActive()) {
908 $rbac_log_roles = $this->rbacreview->getParentRoleIds($new_obj->getRefId());
909 $rbac_log = ilRbacLog::gatherFaPa($new_obj->getRefId(), array_keys($rbac_log_roles), true);
910 ilRbacLog::add(ilRbacLog::COPY_OBJECT, $new_obj->getRefId(), $rbac_log, (bool) $source_ref_id);
911 }
912 }
913 }
914
915 $this->clipboard->clear();
916 $this->log->info('Object copy completed.');
917 if (count($sources) == 1) {
918 $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_duplicated"), true);
919 $ref_id = $new_obj->getRefId();
920 } else {
921 $this->tpl->setOnScreenMessage('success', $this->lng->txt("objects_duplicated"), true);
922 $ref_id = $this->getFirstTarget();
923 }
924
925 $this->tpl->setOnScreenMessage('success', $this->lng->txt("objects_duplicated"), true);
926 ilUtil::redirect(ilLink::_getLink($ref_id));
927 }
static _allocateCopyId()
Allocate a copy for further entries.
static _getInstance(int $a_copy_id)
static getLogger(string $a_component_id)
Get component logger.
static _lookupType(int $id, bool $reference=false)
const COPY_OBJECT
static add(int $action, int $ref_id, array $diff, bool $source_ref_id=false)
static gatherFaPa(int $ref_id, array $role_ids, bool $add_action=false)
static isActive()
static redirect(string $a_script)
$ref_id
Definition: ltiauth.php:66

References $ref_id, $sources, ilCopyWizardOptions\_allocateCopyId(), ilCopyWizardOptions\_getInstance(), ilObject\_lookupType(), ILIAS\Repository\access(), ilRbacLog\add(), ilRbacLog\COPY_OBJECT, ILIAS\Repository\ctrl(), ilRbacLog\gatherFaPa(), getFirstTarget(), ilObjectFactory\getInstanceByRefId(), ilLoggerFactory\getLogger(), getTargets(), ilRbacLog\isActive(), ILIAS\Repository\lng(), ilUtil\redirect(), and ILIAS\Repository\user().

Referenced by copySingleObject(), and saveTarget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyParentPage()

ilObjectCopyGUI::copyParentPage ( )
private

Definition at line 966 of file class.ilObjectCopyGUI.php.

966 : void
967 {
968 $source_object = ilObjectFactory::getInstanceByRefId($this->getFirstSource());
969 $target_object = $this->getParentObject()->getObject();
971 "cont",
972 $source_object->getId()
973 )) {
974 $orig_page = new ilContainerPage($source_object->getId());
975 $orig_page->copy($target_object->getId(), "cont", $target_object->getId());
976 }
977
978 $style_id = ilObjStyleSheet::lookupObjectStyle($source_object->getId());
979 if ($style_id <= 0) {
980 return;
981 }
982 if (ilObjStyleSheet::_lookupStandard($style_id)) {
983 ilObjStyleSheet::writeStyleUsage($target_object->getId(), $style_id);
984 return;
985 }
986 $style_obj = ilObjectFactory::getInstanceByObjId($style_id);
987 $new_id = $style_obj->ilClone();
988 ilObjStyleSheet::writeStyleUsage($target_object->getId(), $new_id);
989 ilObjStyleSheet::writeOwner($target_object->getId(), $new_id);
990 $reuse = $this->container_repo->readReuse($source_object->getRefId());
991 $this->container_repo->updateReuse($target_object->getRefId(), $reuse);
992 }
Container page object.
static _lookupStandard(int $a_id)
Lookup standard flag.
static writeStyleUsage(int $a_obj_id, int $a_style_id)
Write style usage.
static writeOwner($obj_id, $style_id)
static lookupObjectStyle(int $a_obj_id)
Lookup object style.
getParentObject()
Get parent gui object.
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.

References ilPageObject\_exists(), ilObjStyleSheet\_lookupStandard(), getFirstSource(), ilObjectFactory\getInstanceByObjId(), ilObjectFactory\getInstanceByRefId(), getParentObject(), ilObjStyleSheet\lookupObjectStyle(), ilObjStyleSheet\writeOwner(), and ilObjStyleSheet\writeStyleUsage().

Referenced by copyContainerToTargets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copySingleObject()

ilObjectCopyGUI::copySingleObject ( )
protected

Start cloning a single (not container) object.

Definition at line 824 of file class.ilObjectCopyGUI.php.

824 : void
825 {
826 // Source defined
827 if ($this->getSources() === []) {
828 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
829 $this->ctrl->returnToParent($this);
830 }
831
832 $this->copyMultipleNonContainer($this->getSources());
833 }
copyMultipleNonContainer(array $sources)
Copy multiple non container.

References copyMultipleNonContainer(), ILIAS\Repository\ctrl(), getSources(), and ILIAS\Repository\lng().

Referenced by executeNextStepAfterSourceSelection(), and saveTarget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjectCopyGUI::executeCommand ( )

Definition at line 133 of file class.ilObjectCopyGUI.php.

133 : void
134 {
135 $this->init();
136 $this->initTabs();
137
138 $this->ctrl->getNextClass($this);
139 $cmd = $this->ctrl->getCmd();
140
141 $this->$cmd();
142 }

References ILIAS\Repository\ctrl(), init(), and initTabs().

+ Here is the call graph for this function:

◆ executeNextStepAfterSourceSelection()

ilObjectCopyGUI::executeNextStepAfterSourceSelection ( )
private

Definition at line 746 of file class.ilObjectCopyGUI.php.

746 : void
747 {
748 if (!$this->obj_definition->isContainer($this->getType())) {
749 $this->copySingleObject();
750 return;
751 }
752
753 if (count($this->getSources()) === 1
755 'cont',
757 )
758 ) {
759 $this->showCopyPageSelection();
760 return;
761 }
762
763 $this->showItemSelection();
764 }
copySingleObject()
Start cloning a single (not container) object.
showItemSelection(bool $copy_page=false)
static _lookupObjId(int $ref_id)

References ilPageObject\_exists(), ilObject\_lookupObjId(), copySingleObject(), getFirstSource(), getSources(), showCopyPageSelection(), and showItemSelection().

Referenced by saveSource(), and saveSourceMembership().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getErrorMessageOnDisallowedObjectTypeForTarget()

ilObjectCopyGUI::getErrorMessageOnDisallowedObjectTypeForTarget ( int  $ref_id)
private

Definition at line 702 of file class.ilObjectCopyGUI.php.

702 : string
703 {
704 foreach ($this->getTargets() as $target_ref_id) {
705 $target_type = ilObject::_lookupType($target_ref_id, true);
706 $target_class_name = ilObjectFactory::getClassByType($target_type);
707 $target_object = new $target_class_name($target_ref_id);
708 $possible_subtypes = $target_object->getPossibleSubObjects();
709
710 $source_type = ilObject::_lookupType($ref_id, true);
711
712 if (!array_key_exists($source_type, $possible_subtypes)
713 && $this->getSubMode() != self::SUBMODE_CONTENT_ONLY
714 && ($source_type !== 'crs' || $target_type !== 'crs')
715 ) {
716 return sprintf(
717 $this->lng->txt('msg_obj_may_not_contain_objects_of_type'),
718 $this->lng->txt('obj_' . $target_type),
719 $this->lng->txt('obj_' . $source_type)
720 );
721 }
722 }
723
724 return '';
725 }
static getClassByType(string $obj_type)

References $ref_id, ilObject\_lookupType(), ilObjectFactory\getClassByType(), getSubMode(), getTargets(), and ILIAS\Repository\lng().

Referenced by saveSource().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFirstSource()

ilObjectCopyGUI::getFirstSource ( )

Definition at line 578 of file class.ilObjectCopyGUI.php.

578 : int
579 {
580 if (count($this->sources)) {
581 return (int) $this->sources[0];
582 }
583 return 0;
584 }

Referenced by copyContainer(), copyParentPage(), executeNextStepAfterSourceSelection(), init(), saveSourceMembership(), saveTarget(), searchSource(), and showItemSelection().

+ Here is the caller graph for this function:

◆ getFirstTarget()

ilObjectCopyGUI::getFirstTarget ( )

Definition at line 604 of file class.ilObjectCopyGUI.php.

604 : int
605 {
606 if (array_key_exists(0, $this->getTargets())) {
607 $targets = $this->getTargets();
608 return (int) $targets[0];
609 }
610 return 0;
611 }

References getTargets().

Referenced by copyMultipleNonContainer(), init(), and showSourceSelectionTree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMode()

ilObjectCopyGUI::getMode ( )

Definition at line 533 of file class.ilObjectCopyGUI.php.

533 : int
534 {
535 return $this->mode;
536 }

References $mode.

Referenced by setTabs().

+ Here is the caller graph for this function:

◆ getOnLoadCode()

ilObjectCopyGUI::getOnLoadCode ( string  $cmd)
private

Definition at line 391 of file class.ilObjectCopyGUI.php.

391 : Closure
392 {
393 return function ($id) use ($cmd) {
394 return "document.getElementById('$id')"
395 . '.addEventListener("click", '
396 . '(e) => {e.preventDefault();'
397 . 'e.target.setAttribute("name", "cmd[' . $cmd . ']");'
398 . 'e.target.form.requestSubmit(e.target);});';
399 };
400 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

Referenced by showTargetSelectionTree().

+ Here is the caller graph for this function:

◆ getParentObject()

ilObjectCopyGUI::getParentObject ( )

Get parent gui object.

Definition at line 551 of file class.ilObjectCopyGUI.php.

551 : ?ilObjectGUI
552 {
553 return $this->parent_obj;
554 }
ImplementsCreationCallback $parent_obj
Class ilObjectGUI Basic methods of all Output classes.

References $parent_obj.

Referenced by copyParentPage(), and init().

+ Here is the caller graph for this function:

◆ getPrimaryButtonLabel()

ilObjectCopyGUI::getPrimaryButtonLabel ( )
private

Definition at line 382 of file class.ilObjectCopyGUI.php.

382 : string
383 {
384 if ($this->obj_definition->isContainer($this->getType())) {
385 return $this->lng->txt('btn_next');
386 }
387
388 return $this->lng->txt('paste');
389 }

References ILIAS\Repository\lng().

Referenced by showTargetSelectionTree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSources()

ilObjectCopyGUI::getSources ( )

◆ getSubMode()

ilObjectCopyGUI::getSubMode ( )

Definition at line 543 of file class.ilObjectCopyGUI.php.

543 : int
544 {
545 return $this->sub_mode;
546 }

References $sub_mode.

Referenced by copyContainer(), copyContainerToTargets(), getErrorMessageOnDisallowedObjectTypeForTarget(), init(), and setTabs().

+ Here is the caller graph for this function:

◆ getTargets()

ilObjectCopyGUI::getTargets ( )

Definition at line 599 of file class.ilObjectCopyGUI.php.

599 : array
600 {
601 return $this->targets;
602 }

References $targets.

Referenced by copyContainerToTargets(), copyMultipleNonContainer(), getErrorMessageOnDisallowedObjectTypeForTarget(), getFirstTarget(), init(), initSourceSelection(), saveTarget(), and showItemSelection().

+ Here is the caller graph for this function:

◆ getType()

ilObjectCopyGUI::getType ( )

Definition at line 556 of file class.ilObjectCopyGUI.php.

556 : string
557 {
558 return $this->type;
559 }

References $type.

Referenced by copyContainer(), init(), initFormSearch(), searchSource(), and showItemSelection().

+ Here is the caller graph for this function:

◆ init()

ilObjectCopyGUI::init ( )
protected

Definition at line 144 of file class.ilObjectCopyGUI.php.

144 : void
145 {
146 if ($this->retriever->has('smode')) {
147 $this->setSubMode($this->retriever->getMaybeInt('smode') ?? 0);
148 $this->ctrl->setParameter($this, 'smode', $this->getSubMode());
149 ilLoggerFactory::getLogger('obj')->debug('Submode is: ' . $this->getSubMode());
150 }
151
152 // save sources
153 if ($this->retriever->has('source_ids')) {
154 $this->setSource(explode('_', $this->retriever->getMaybeString('source_ids')));
155 $this->ctrl->setParameter($this, 'source_ids', implode('_', $this->getSources()));
156 ilLoggerFactory::getLogger('obj')->debug('Multiple sources: ' . implode('_', $this->getSources()));
157 }
158 if ($this->retriever->has('source_id')) {
159 $this->setSource([$this->retriever->getMaybeInt('source_id')]);
160 $this->ctrl->setParameter($this, 'source_ids', implode('_', $this->getSources()));
161 ilLoggerFactory::getLogger('obj')->debug('source_id is set: ' . implode('_', $this->getSources()));
162 }
163 if ($this->getFirstSource()) {
164 $this->setType(
166 );
167 }
168
169 // creation screen: copy section
170 if ($this->retriever->has('new_type')) {
171 $this->setMode(self::SEARCH_SOURCE);
172 $this->setType($this->retriever->getMaybeString('new_type'));
173 $this->setTarget($this->request_wrapper->retrieve("ref_id", $this->refinery->kindlyTo()->int()));
174
175 $this->ctrl->setParameter($this, 'new_type', $this->getType());
176 $this->ctrl->setParameterByClass(get_class($this->getParentObject()), 'new_type', $this->getType());
177 $this->ctrl->setParameterByClass(get_class($this->getParentObject()), 'cpfl', 1);
178 $this->ctrl->setReturnByClass(get_class($this->getParentObject()), 'create');
179
180 ilLoggerFactory::getLogger('obj')->debug('Copy from object creation for type: ' . $this->getType());
181 return;
182 }
183 // adopt content, and others?
184 elseif ($this->retriever->getMaybeInt('selectMode') === self::SOURCE_SELECTION) {
185 $this->setMode(self::SOURCE_SELECTION);
186
187 $this->ctrl->setParameterByClass(get_class($this->parent_obj), 'selectMode', self::SOURCE_SELECTION);
188 $this->setTarget($this->request_wrapper->retrieve("ref_id", $this->refinery->kindlyTo()->int()));
189 $this->ctrl->setReturnByClass(get_class($this->parent_obj), '');
190
191 ilLoggerFactory::getLogger('obj')->debug('Source selection mode. Target is: ' . $this->getFirstTarget());
192 } elseif ($this->retriever->getMaybeInt('selectMode') === self::TARGET_SELECTION) {
193 $this->setMode(self::TARGET_SELECTION);
194 $this->ctrl->setReturnByClass(get_class($this->parent_obj), '');
195 ilLoggerFactory::getLogger('obj')->debug('Target selection mode.');
196 }
197
198 // save targets
199 if ($this->retriever->has('target_ids')) {
200 $this->setTargets(explode('_', $this->retriever->getMaybeString('target_ids')));
201 ilLoggerFactory::getLogger('obj')->debug('targets are: ' . print_r($this->getTargets(), true));
202 }
203 }
setSource(array $source_ids)
setTargets(array $targets)

References ilObject\_lookupObjId(), ilObject\_lookupType(), ILIAS\Repository\ctrl(), getFirstSource(), getFirstTarget(), ilLoggerFactory\getLogger(), getParentObject(), getSources(), getSubMode(), getTargets(), getType(), setMode(), setSource(), setSubMode(), setTarget(), setTargets(), and setType().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormSearch()

ilObjectCopyGUI::initFormSearch ( )
protected

Definition at line 1135 of file class.ilObjectCopyGUI.php.

1135 : void
1136 {
1137 $this->form = new ilPropertyFormGUI();
1138 $this->form->setTableWidth('600px');
1139 $this->ctrl->setParameter($this, 'new_type', $this->getType());
1140 $this->form->setFormAction($this->ctrl->getFormAction($this));
1141 $this->form->setTitle($this->lng->txt($this->getType() . '_copy'));
1142 $this->form->addCommandButton('searchSource', $this->lng->txt('search_for'));
1143 $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
1144
1145 $tit = new ilTextInputGUI($this->lng->txt('title'), 'tit');
1146 $tit->setSize(40);
1147 $tit->setMaxLength(70);
1148 $tit->setRequired(true);
1149 $tit->setInfo($this->lng->txt('wizard_title_info'));
1150 $this->form->addItem($tit);
1151 }
This class represents a property form user interface.
This class represents a text property in a property form.
form( $class_path, string $cmd, string $submit_caption="")

References ILIAS\Repository\ctrl(), ILIAS\Repository\form(), getType(), and ILIAS\Repository\lng().

Referenced by searchSource(), and showSourceSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSourceSelection()

ilObjectCopyGUI::initSourceSelection ( )
protected

Definition at line 283 of file class.ilObjectCopyGUI.php.

283 : void
284 {
285 // copy opened nodes from repository explorer
286 $node_ids = is_array(ilSession::get('repexpand')) ? ilSession::get('repexpand') : [];
287
288 $this->setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_SOURCE_TREE);
289
290 // open current position
291 // begin-patch mc
292 foreach ($this->getTargets() as $target_ref_id) {
293 $path = $this->tree->getPathId($target_ref_id);
294 foreach ($path as $node_id) {
295 if (!in_array($node_id, $node_ids)) {
296 $node_ids[] = $node_id;
297 }
298 }
299 }
300 // end-patch multi copy
301
302 ilSession::set('paste_copy_repexpand', $node_ids);
303
304 $this->ctrl->setReturnByClass(get_class($this->parent_obj), '');
306 }
setTabs(int $tab_group, int $active_tab)
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
$path
Definition: ltiservices.php:30

References $path, ILIAS\Repository\ctrl(), ilSession\get(), getTargets(), ilSession\set(), setTabs(), and showSourceSelectionTree().

Referenced by adoptContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTabs()

ilObjectCopyGUI::initTabs ( )
protected

Definition at line 205 of file class.ilObjectCopyGUI.php.

205 : void
206 {
207 $this->lng->loadLanguageModule('cntr');
208 $this->tabs->clearTargets();
209 $this->tabs->setBackTarget(
210 $this->lng->txt('cancel'),
211 (string) $this->ctrl->getParentReturn($this->parent_obj)
212 );
213 }

References ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTargetSelection()

ilObjectCopyGUI::initTargetSelection ( )
protected

Init copy from repository/search list commands.

Definition at line 254 of file class.ilObjectCopyGUI.php.

254 : void
255 {
256 $this->ctrl->setParameter($this, 'selectMode', self::TARGET_SELECTION);
257
258 // copy opened nodes from repository explorer
259 $node_ids = is_array(ilSession::get('repexpand')) ? ilSession::get('repexpand') : [];
260
261 // begin-patch mc
262 $this->setTargets([]);
263 // cognos-blu-patch: end
264
265 // open current position
266 foreach ($this->getSources() as $source_id) {
267 if ($source_id) {
268 $path = $this->tree->getPathId($source_id);
269 foreach ($path as $node_id) {
270 if (!in_array($node_id, $node_ids)) {
271 $node_ids[] = $node_id;
272 }
273 }
274 }
275 }
276
277 ilSession::set('paste_copy_repexpand', $node_ids);
278
279 $this->ctrl->setReturnByClass(get_class($this->parent_obj), '');
281 }

References $path, ILIAS\Repository\ctrl(), ilSession\get(), getSources(), ilSession\set(), setTargets(), and showTargetSelectionTree().

+ Here is the call graph for this function:

◆ isCopyingParentPageNeeded()

ilObjectCopyGUI::isCopyingParentPageNeeded ( )
private

Definition at line 960 of file class.ilObjectCopyGUI.php.

960 : bool
961 {
962 return $this->post_wrapper->has('copy_page')
963 && $this->post_wrapper->retrieve('copy_page', $this->refinery->kindlyTo()->bool());
964 }

References ILIAS\Repository\refinery().

Referenced by copyContainerToTargets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ keepObjectsInClipboard()

ilObjectCopyGUI::keepObjectsInClipboard ( )

Definition at line 621 of file class.ilObjectCopyGUI.php.

621 : void
622 {
623 $this->tpl->setOnScreenMessage('success', $this->lng->txt("obj_inserted_clipboard"), true);
624 $ilCtrl = $this->ctrl;
625 $this->clipboard->setCmd("copy");
626 $this->clipboard->setRefIds($this->getSources());
627 $ilCtrl->returnToParent($this);
628 }
returnToParent(object $a_gui_obj, ?string $a_anchor=null)
@inheritDoc

References $ctrl, getSources(), ILIAS\Repository\lng(), and ilCtrl\returnToParent().

+ Here is the call graph for this function:

◆ saveCopyPage()

ilObjectCopyGUI::saveCopyPage ( )
protected

Definition at line 772 of file class.ilObjectCopyGUI.php.

772 : void
773 {
775 $data = $form->withRequest($this->request)->getData();
776
777 $this->showItemSelection($data['copy_page']);
778 }
ilPropertyFormGUI $form

References $data, $form, buildCopyPageSelectionForm(), and showItemSelection().

+ Here is the call graph for this function:

◆ saveSource()

ilObjectCopyGUI::saveSource ( )
protected

Definition at line 678 of file class.ilObjectCopyGUI.php.

678 : void
679 {
680 if (!$this->post_wrapper->has("source")) {
681 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
682 $this->searchSource();
683 return;
684 }
685
686 $source = $this->post_wrapper->retrieve("source", $this->refinery->kindlyTo()->int());
687 $this->setSource([$source]);
688 $this->setType(ilObject::_lookupType($source, true));
689 $this->ctrl->setParameter($this, 'source_id', $source);
690
691 foreach ($this->getSources() as $source_ref_id) {
692 if (($message = $this->getErrorMessageOnDisallowedObjectTypeForTarget($source_ref_id)) !== '') {
693 $this->tpl->setOnScreenMessage('failure', $message);
694 $this->searchSource();
695 return;
696 }
697 }
698
700 }
getErrorMessageOnDisallowedObjectTypeForTarget(int $ref_id)
$message
Definition: xapiexit.php:31

References $message, ilObject\_lookupType(), ILIAS\Repository\ctrl(), executeNextStepAfterSourceSelection(), getErrorMessageOnDisallowedObjectTypeForTarget(), getSources(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), searchSource(), setSource(), and setType().

+ Here is the call graph for this function:

◆ saveSourceMembership()

ilObjectCopyGUI::saveSourceMembership ( )
protected

Save selected source from membership screen.

Definition at line 730 of file class.ilObjectCopyGUI.php.

730 : void
731 {
732 $source = $this->retriever->getMaybeInt('source');
733 if ($source === null) {
734 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
735 $this->ctrl->redirect($this, 'showSourceSelectionMembership');
736 return;
737 }
738
739 $this->setSource([$source]);
740 $this->setType(ilObject::_lookupType($this->getFirstSource(), true));
741 $this->ctrl->setParameter($this, 'source_id', $source);
742
744 }

References ilObject\_lookupType(), ILIAS\Repository\ctrl(), executeNextStepAfterSourceSelection(), getFirstSource(), ILIAS\Repository\lng(), setSource(), and setType().

+ Here is the call graph for this function:

◆ saveTarget()

ilObjectCopyGUI::saveTarget ( )
protected

Definition at line 450 of file class.ilObjectCopyGUI.php.

450 : void
451 {
452 if (!$this->retriever->has('target')) {
453 $this->ctrl->setParameter($this, 'selectMode', self::TARGET_SELECTION);
454 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
456 return;
457 }
458
459 try {
460 $targets = $this->retriever->getArrayOfInt('target');
462 $possible_target = $this->retriever->getMaybeInt('target');
463 $targets = $possible_target === null ? [] : [$possible_target];
464 }
465
466 if ($targets !== []) {
467 $this->setTargets($targets);
468 $this->ctrl->setParameter($this, 'target_ids', implode('_', $this->getTargets()));
469 } elseif (($target = $this->retriever->getMaybeInt('target')) !== null) {
470 $this->setTarget($target);
471 $this->ctrl->setParameter($this, 'target_ids', implode('_', $this->getTargets()));
472 }
473
474 // validate allowed subtypes
475 foreach ($this->getSources() as $source_ref_id) {
476 foreach ($this->getTargets() as $target_ref_id) {
477 $target_type = ilObject::_lookupType((int) $target_ref_id, true);
478 $target_class_name = ilObjectFactory::getClassByType($target_type);
479 $target_object = new $target_class_name((int) $target_ref_id);
480 $possible_subtypes = $target_object->getPossibleSubObjects();
481
482 $source_type = ilObject::_lookupType((int) $source_ref_id, true);
483
484 if (!array_key_exists($source_type, (array) $possible_subtypes)) {
485 $this->tpl->setOnScreenMessage('failure', sprintf(
486 $this->lng->txt('msg_obj_may_not_contain_objects_of_type'),
487 $this->lng->txt('obj_' . $target_type),
488 $this->lng->txt('obj_' . $source_type)
489 ));
491 return;
492 }
493 }
494 }
495
496 if (count($this->getSources()) == 1 && $this->obj_definition->isContainer($this->getType())) {
497 // check, if object should be copied into itself
498 // begin-patch mc
499 $is_child = [];
500 foreach ($this->getTargets() as $target_ref_id) {
501 if ($this->tree->isGrandChild($this->getFirstSource(), (int) $target_ref_id)) {
503 }
504 if ($this->getFirstSource() == (int) $target_ref_id) {
506 }
507 }
508 // end-patch multi copy
509 if (count($is_child) > 0) {
510 $this->tpl->setOnScreenMessage(
511 'failure',
512 $this->lng->txt("msg_not_in_itself") . " " . implode(',', $is_child)
513 );
515 return;
516 }
517
518 $this->showItemSelection();
519 } else {
520 if (count($this->getSources()) == 1) {
521 $this->copySingleObject();
522 } else {
523 $this->copyMultipleNonContainer($this->getSources());
524 }
525 }
526 }
static _lookupTitle(int $obj_id)

References Vendor\Package\$e, $targets, ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), copyMultipleNonContainer(), copySingleObject(), ILIAS\Repository\ctrl(), ilObjectFactory\getClassByType(), getFirstSource(), getSources(), getTargets(), ILIAS\Repository\lng(), setTarget(), setTargets(), showItemSelection(), and showTargetSelectionTree().

+ Here is the call graph for this function:

◆ searchSource()

ilObjectCopyGUI::searchSource ( )
protected

Definition at line 630 of file class.ilObjectCopyGUI.php.

630 : void
631 {
632 if ($this->post_wrapper->has('tit')) {
633 $this->tpl->setOnScreenMessage('info', $this->lng->txt('wizard_search_list'));
634 ilSession::set('source_query', $this->post_wrapper->retrieve("tit", $this->refinery->kindlyTo()->string()));
635 }
636
637 $this->initFormSearch();
638 $this->form->setValuesByPost();
639
640 if (!$this->form->checkInput()) {
641 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_search_string'), true);
642 $this->ctrl->returnToParent($this);
643 return;
644 }
645
646 $tit = $this->form->getInput('tit');
647 if ($tit === "") {
648 $tit = ilSession::get('source_query', '');
649 }
650 $query_parser = new ilQueryParser($tit);
651 $query_parser->setMinWordLength(1);
652 $query_parser->setCombination(ilQueryParser::QP_COMBINATION_AND);
653 $query_parser->parse();
654 if (!$query_parser->validate()) {
655 $this->tpl->setOnScreenMessage('failure', $query_parser->getMessage(), true);
656 $this->ctrl->returnToParent($this);
657 }
658
659 // only like search since fulltext does not support search with less than 3 characters
660 $object_search = new ilLikeObjectSearch($query_parser);
661 $object_search->setFilter([$this->retriever->getMaybeString('new_type')]);
662 $res = $object_search->performSearch();
663 $res->setRequiredPermission('copy');
664 $res->filter(ROOT_FOLDER_ID, true);
665
666 if (!count($results = $res->getResultsByObjId())) {
667 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('search_no_match'), true);
668 $this->ctrl->returnToParent($this);
669 }
670
671 $table = new ilObjectCopySearchResultTableGUI($this, 'searchSource', $this->getType());
672 $table->setFormAction($this->ctrl->getFormAction($this));
673 $table->setSelectedReference($this->getFirstSource());
674 $table->parseSearchResults($results);
675 $this->tpl->setContent($table->getHTML());
676 }
const ROOT_FOLDER_ID
Definition: constants.php:32
$res
Definition: ltiservices.php:69
$results

References $res, $results, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilSession\get(), getFirstSource(), getType(), initFormSearch(), ILIAS\Repository\lng(), ilQueryParser\QP_COMBINATION_AND, ROOT_FOLDER_ID, and ilSession\set().

Referenced by saveSource(), and showItemSelection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMode()

ilObjectCopyGUI::setMode ( int  $mode)

Definition at line 528 of file class.ilObjectCopyGUI.php.

528 : void
529 {
530 $this->mode = $mode;
531 }

References $mode.

Referenced by adoptContent(), and init().

+ Here is the caller graph for this function:

◆ setSource()

ilObjectCopyGUI::setSource ( array  $source_ids)

Definition at line 566 of file class.ilObjectCopyGUI.php.

566 : void
567 {
568 $this->sources = $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())->transform(
569 $source_ids
570 );
571 }

References ILIAS\Repository\refinery().

Referenced by init(), saveSource(), saveSourceMembership(), and unsetSession().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSubMode()

ilObjectCopyGUI::setSubMode ( int  $mode)

Definition at line 538 of file class.ilObjectCopyGUI.php.

538 : void
539 {
540 $this->sub_mode = $mode;
541 }

References $mode.

Referenced by adoptContent(), and init().

+ Here is the caller graph for this function:

◆ setTabs()

ilObjectCopyGUI::setTabs ( int  $tab_group,
int  $active_tab 
)
protected

Definition at line 215 of file class.ilObjectCopyGUI.php.

215 : void
216 {
217 if ($tab_group == self::TAB_GROUP_SC_SELECTION) {
218 if ($this->getSubMode() == self::SUBMODE_CONTENT_ONLY) {
219 if ($this->getMode() == self::SOURCE_SELECTION) {
220 $this->tabs->addTab(
221 (string) self::TAB_SELECTION_SOURCE_TREE,
222 $this->lng->txt('cntr_copy_repo_tree'),
223 $this->ctrl->getLinkTarget($this, 'initSourceSelection')
224 );
225 $this->tabs->addTab(
226 (string) self::TAB_SELECTION_MEMBERSHIP,
227 $this->lng->txt('cntr_copy_crs_grp'),
228 $this->ctrl->getLinkTarget($this, 'showSourceSelectionMembership')
229 );
230 }
231 }
232 }
233 $this->tabs->activateTab((string) $active_tab);
234 }

References getMode(), getSubMode(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by initSourceSelection(), and showSourceSelectionMembership().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTarget()

ilObjectCopyGUI::setTarget ( int  $ref_id)

Definition at line 587 of file class.ilObjectCopyGUI.php.

587 : void
588 {
589 $this->setTargets([$ref_id]);
590 }

References setTargets().

Referenced by adoptContent(), init(), and saveTarget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTargets()

ilObjectCopyGUI::setTargets ( array  $targets)

Definition at line 592 of file class.ilObjectCopyGUI.php.

592 : void
593 {
594 $this->targets = $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())->transform(
596 );
597 }

References ILIAS\Repository\refinery().

Referenced by init(), initTargetSelection(), saveTarget(), and setTarget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setType()

ilObjectCopyGUI::setType ( string  $type)

Definition at line 561 of file class.ilObjectCopyGUI.php.

561 : void
562 {
563 $this->type = $type;
564 }

References $type.

Referenced by init(), saveSource(), and saveSourceMembership().

+ Here is the caller graph for this function:

◆ showCopyPageSelection()

ilObjectCopyGUI::showCopyPageSelection ( )
protected

Definition at line 766 of file class.ilObjectCopyGUI.php.

766 : void
767 {
769 $this->tpl->setContent($this->ui_renderer->render($form));
770 }

References $form, and buildCopyPageSelectionForm().

Referenced by executeNextStepAfterSourceSelection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showCopyProgress()

ilObjectCopyGUI::showCopyProgress ( )
protected

Definition at line 994 of file class.ilObjectCopyGUI.php.

994 : void
995 {
997 if ($this->request_wrapper->has('ref_id')) {
998 $ref_id = $this->request_wrapper->retrieve(
999 'ref_id',
1000 $this->refinery->kindlyTo()->int()
1001 );
1002 }
1003
1004 $this->tabs->setBackTarget(
1005 $this->lng->txt('tab_back_to_repository'),
1006 (string) $this->ctrl->getParentReturn($this->parent_obj)
1007 );
1008
1009 $progress = new ilObjectCopyProgressTableGUI(
1010 $this,
1011 'showCopyProgress',
1012 $ref_id
1013 );
1014 $progress->setObjectInfo($this->targets_copy_id);
1015 $progress->parse();
1016 $progress->init();
1017 $link = ilLink::_getLink($ref_id);
1018 $progress->setRedirectionUrl($link);
1019
1020 $this->tpl->setContent($progress->getHTML());
1021 }

References $ref_id, ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ROOT_FOLDER_ID, and ILIAS\Repository\tabs().

Referenced by copyContainerToTargets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showItemSelection()

ilObjectCopyGUI::showItemSelection ( bool  $copy_page = false)
protected

Definition at line 800 of file class.ilObjectCopyGUI.php.

800 : void
801 {
802 if (!count($this->getSources())) {
803 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
804 $this->searchSource();
805 return;
806 }
807
808 $this->log->debug('Source(s): ' . print_r($this->getSources(), true));
809 $this->log->debug('Target(s): ' . print_r($this->getTargets(), true));
810
811 $this->tpl->setOnScreenMessage('info', $this->lng->txt($this->getType() . '_copy_threads_info'));
812 $this->tpl->addJavaScript('assets/js/ilContainer.js');
813 $this->tpl->setVariable('BODY_ATTRIBUTES', 'onload="ilDisableChilds(\'cmd\');"');
814
815 $table = new ilObjectCopySelectionTableGUI($this, 'showItemSelection', $this->getType(), $copy_page);
816 $table->parseSource($this->getFirstSource());
817
818 $this->tpl->setContent($table->getHTML());
819 }

References getFirstSource(), getSources(), getTargets(), getType(), ILIAS\Repository\lng(), and searchSource().

Referenced by executeNextStepAfterSourceSelection(), saveCopyPage(), and saveTarget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showSourceSearch()

ilObjectCopyGUI::showSourceSearch ( ?string  $tpl_var)

Show init screen Normally shown below the create and import form when creating a new object.

Parameters
?string$tpl_var The tpl variable to fill

Definition at line 1122 of file class.ilObjectCopyGUI.php.

1123 {
1124 $this->unsetSession();
1125 $this->initFormSearch();
1126
1127 if ($tpl_var) {
1128 $this->tpl->setVariable($tpl_var, $this->form->getHTML());
1129 return null;
1130 }
1131
1132 return $this->form;
1133 }
unsetSession()
Unset session variables.

References $form, ILIAS\Repository\form(), initFormSearch(), and unsetSession().

+ Here is the call graph for this function:

◆ showSourceSelectionMembership()

ilObjectCopyGUI::showSourceSelectionMembership ( )
protected

show target selection membership

Definition at line 312 of file class.ilObjectCopyGUI.php.

312 : void
313 {
314 $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_copy_clipboard_source'));
315 $this->setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_MEMBERSHIP);
316
318 $this,
319 'showSourceSelectionMembership',
320 'copy_selection_mmbrs'
321 );
322 $cgs->init();
323 $cgs->setObjects(
324 array_merge(
325 ilParticipants::_getMembershipByType($this->user->getId(), ['crs']),
326 ilParticipants::_getMembershipByType($this->user->getId(), ['grp'])
327 )
328 );
329 $cgs->parse();
330
331 $this->tpl->setContent($cgs->getHTML());
332 }
static _getMembershipByType(int $a_usr_id, array $a_type, bool $a_only_member_role=false)
get membership by type Get course or group membership

References ilParticipants\_getMembershipByType(), ILIAS\Repository\lng(), setTabs(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ showSourceSelectionTree()

ilObjectCopyGUI::showSourceSelectionTree ( )
protected

Definition at line 402 of file class.ilObjectCopyGUI.php.

402 : void
403 {
404 $this->tpl->addBlockFile(
405 'ADM_CONTENT',
406 'adm_content',
407 'tpl.paste_into_multiple_objects.html',
408 "components/ILIAS/ILIASObject"
409 );
410
411 $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_copy_clipboard_source'));
414 'ilias.php?baseClass=ilRepositoryGUI&amp;cmd=goto',
415 'paste_copy_repexpand'
416 );
417 $exp->setRequiredFormItemPermission('visible,read,copy');
418
419 $this->ctrl->setParameter($this, 'selectMode', self::SOURCE_SELECTION);
420 $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showSourceSelectionTree'));
421 $exp->setTargetGet('ref_id');
422 $exp->setPostVar('source');
423 $exp->setCheckedItems($this->getSources());
424 $exp->highlightNode((string) $this->getFirstTarget());
425
426 // Filter to container
427 foreach (['cat', 'root', 'fold'] as $container) {
428 $exp->removeFormItemForType($container);
429 }
430
431 if (!$this->request_wrapper->has("paste_copy_repexpand")) {
432 $expanded = $this->tree->readRootId();
433 } else {
434 $expanded = $this->request_wrapper->retrieve("paste_copy_repexpand", $this->refinery->kindlyTo()->int());
435 }
436
437 $this->tpl->setVariable('FORM_TARGET', '_self');
438 $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'copySelection'));
439
440 $exp->setExpand($expanded);
441 // build html-output
442 $exp->setOutput(0);
443 $output = $exp->getOutput();
444
445 $this->tpl->setVariable('OBJECT_TREE', $output);
446 $this->tpl->setVariable('CMD_SUBMIT', 'saveSource');
447 $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('btn_next'));
448 }
ilPasteIntoMultipleItemsExplorer Explorer
$container
@noRector
Definition: wac.php:37

References $container, ILIAS\Repository\ctrl(), getFirstTarget(), getSources(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilPasteIntoMultipleItemsExplorer\SEL_TYPE_RADIO.

Referenced by initSourceSelection().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showTargetSelectionTree()

ilObjectCopyGUI::showTargetSelectionTree ( )
protected

Definition at line 334 of file class.ilObjectCopyGUI.php.

334 : void
335 {
336 if ($this->obj_definition->isContainer($this->getType())) {
337 $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_copy_clipboard_container'));
338 } else {
339 $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_copy_clipboard'));
340 }
341
342 $exp = new ilRepositorySelectorExplorerGUI($this, "showTargetSelectionTree");
343 $exp->setTypeWhiteList(["root", "cat", "grp", "crs", "fold", "lso", "prg"]);
344 $exp->setSelectMode("target", true);
345 if ($exp->handleCommand()) {
346 return;
347 }
348 $output = $exp->getHTML();
349
350 $t = new ilToolbarGUI();
351 $t->setFormAction($this->ctrl->getFormAction($this, "saveTarget"));
352 $primary_button = $this->ui_factory->button()->primary(
353 $this->getPrimaryButtonLabel(),
354 ''
355 )->withOnLoadCode($this->getOnLoadCode('saveTarget'));
356 $t->addComponent($primary_button);
357 $t->addSeparator();
358
359 $clipboard_btn = $this->ui_factory->button()->standard(
360 $this->lng->txt('obj_insert_into_clipboard'),
361 ''
362 )->withOnLoadCode($this->getOnLoadCode('keepObjectsInClipboard'));
363 $t->addComponent($clipboard_btn);
364
365 $cancel_btn = $this->ui_factory->button()->standard(
366 $this->lng->txt('cancel'),
367 ''
368 )->withOnLoadCode($this->getOnLoadCode('cancel'));
369 $t->addComponent($cancel_btn);
370
371 $t->setCloseFormTag(false);
372 $t->setLeadingImage(ilUtil::getImagePath("nav/arrow_upright.svg"), " ");
373 $output = $t->getHTML() . $output;
374 $t->setLeadingImage(ilUtil::getImagePath("nav/arrow_downright.svg"), " ");
375 $t->setCloseFormTag(true);
376 $t->setOpenFormTag(false);
377 $output .= "<br />" . $t->getHTML();
378
379 $this->tpl->setContent($output);
380 }
Explorer for selecting repository items.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

References ILIAS\Repository\ctrl(), ilUtil\getImagePath(), getOnLoadCode(), getPrimaryButtonLabel(), and ILIAS\Repository\lng().

Referenced by initTargetSelection(), and saveTarget().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unsetSession()

ilObjectCopyGUI::unsetSession ( )
protected

Unset session variables.

Definition at line 1156 of file class.ilObjectCopyGUI.php.

1156 : void
1157 {
1158 ilSession::clear('source_query');
1159 $this->setSource([]);
1160 }
static clear(string $a_var)

References ilSession\clear(), and setSource().

Referenced by showSourceSearch().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateProgress()

ilObjectCopyGUI::updateProgress ( )
protected

Definition at line 1023 of file class.ilObjectCopyGUI.php.

1023 : void
1024 {
1025 $json = new stdClass();
1026 $json->percentage = null;
1027 $json->performed_steps = null;
1028
1029 $copy_id = $this->retriever->getMaybeInt('_copy_id');
1030 $options = ilCopyWizardOptions::_getInstance($copy_id);
1031 $node = $options->fetchFirstNode();
1032 $json->current_node_id = 0;
1033 $json->current_node_title = "";
1034 $json->in_dependencies = false;
1035 if (is_array($node)) {
1036 $json->current_node_id = $node['obj_id'];
1037 $json->current_node_title = $node['title'];
1038 } else {
1039 $node = $options->fetchFirstDependenciesNode();
1040 if (is_array($node)) {
1041 $json->current_node_id = $node['obj_id'];
1042 $json->current_node_title = $node['title'];
1043 $json->in_dependencies = true;
1044 }
1045 }
1046 $json->required_steps = $options->getRequiredSteps();
1047 $json->id = $copy_id;
1048
1049 $this->log->debug('Update copy progress: ' . json_encode($json));
1050
1051 echo json_encode($json);
1052 exit;
1053 }
exit

References ilCopyWizardOptions\_getInstance(), and exit.

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilObjectCopyGUI::$access
protected

Definition at line 63 of file class.ilObjectCopyGUI.php.

◆ $clipboard

ClipboardManager ilObjectCopyGUI::$clipboard
protected

Definition at line 80 of file class.ilObjectCopyGUI.php.

◆ $container_repo

ContainerDBRepository ilObjectCopyGUI::$container_repo
protected

Definition at line 77 of file class.ilObjectCopyGUI.php.

◆ $ctrl

ilCtrl ilObjectCopyGUI::$ctrl
protected

Definition at line 57 of file class.ilObjectCopyGUI.php.

Referenced by cancel(), and keepObjectsInClipboard().

◆ $error

ilErrorHandling ilObjectCopyGUI::$error
protected

Definition at line 64 of file class.ilObjectCopyGUI.php.

◆ $form

ilPropertyFormGUI ilObjectCopyGUI::$form
protected

Definition at line 88 of file class.ilObjectCopyGUI.php.

Referenced by saveCopyPage(), showCopyPageSelection(), and showSourceSearch().

◆ $lng

ilLanguage ilObjectCopyGUI::$lng
protected

Definition at line 69 of file class.ilObjectCopyGUI.php.

◆ $log

ilLogger ilObjectCopyGUI::$log
protected

Definition at line 68 of file class.ilObjectCopyGUI.php.

◆ $mode

int ilObjectCopyGUI::$mode = 0
protected

Definition at line 82 of file class.ilObjectCopyGUI.php.

Referenced by getMode(), setMode(), and setSubMode().

◆ $obj_data_cache

ilObjectDataCache ilObjectCopyGUI::$obj_data_cache
protected

Definition at line 62 of file class.ilObjectCopyGUI.php.

◆ $obj_definition

ilObjectDefinition ilObjectCopyGUI::$obj_definition
protected

Definition at line 61 of file class.ilObjectCopyGUI.php.

◆ $parent_obj

ImplementsCreationCallback ilObjectCopyGUI::$parent_obj = null
protected

Definition at line 79 of file class.ilObjectCopyGUI.php.

Referenced by getParentObject().

◆ $post_wrapper

ArrayBasedRequestWrapper ilObjectCopyGUI::$post_wrapper
protected

Definition at line 71 of file class.ilObjectCopyGUI.php.

◆ $rbacreview

ilRbacReview ilObjectCopyGUI::$rbacreview
protected

Definition at line 67 of file class.ilObjectCopyGUI.php.

◆ $rbacsystem

ilRbacSystem ilObjectCopyGUI::$rbacsystem
protected

Definition at line 65 of file class.ilObjectCopyGUI.php.

◆ $refinery

Refinery ilObjectCopyGUI::$refinery
protected

Definition at line 72 of file class.ilObjectCopyGUI.php.

◆ $request

ServerRequestInterface ilObjectCopyGUI::$request
protected

Definition at line 73 of file class.ilObjectCopyGUI.php.

◆ $request_wrapper

RequestWrapper ilObjectCopyGUI::$request_wrapper
protected

Definition at line 70 of file class.ilObjectCopyGUI.php.

◆ $retriever

ilObjectRequestRetriever ilObjectCopyGUI::$retriever
private

Definition at line 89 of file class.ilObjectCopyGUI.php.

◆ $sources

array ilObjectCopyGUI::$sources = []
protected

Definition at line 85 of file class.ilObjectCopyGUI.php.

Referenced by copyMultipleNonContainer(), and getSources().

◆ $sub_mode

int ilObjectCopyGUI::$sub_mode = self::SUBMODE_COMPLETE
protected

Definition at line 83 of file class.ilObjectCopyGUI.php.

Referenced by getSubMode().

◆ $tabs

ilTabsGUI ilObjectCopyGUI::$tabs
protected

Definition at line 59 of file class.ilObjectCopyGUI.php.

◆ $targets

array ilObjectCopyGUI::$targets = []
protected

Definition at line 86 of file class.ilObjectCopyGUI.php.

Referenced by getTargets(), and saveTarget().

◆ $targets_copy_id

array ilObjectCopyGUI::$targets_copy_id = []
protected

Definition at line 87 of file class.ilObjectCopyGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilObjectCopyGUI::$tpl
protected

Definition at line 60 of file class.ilObjectCopyGUI.php.

◆ $tree

ilTree ilObjectCopyGUI::$tree
protected

Definition at line 58 of file class.ilObjectCopyGUI.php.

◆ $type

string ilObjectCopyGUI::$type = ''
protected

Definition at line 84 of file class.ilObjectCopyGUI.php.

Referenced by getType(), and setType().

◆ $ui_factory

UIFactory ilObjectCopyGUI::$ui_factory
protected

Definition at line 74 of file class.ilObjectCopyGUI.php.

◆ $ui_renderer

UIRenderer ilObjectCopyGUI::$ui_renderer
protected

Definition at line 75 of file class.ilObjectCopyGUI.php.

◆ $user

ilObjUser ilObjectCopyGUI::$user
protected

Definition at line 66 of file class.ilObjectCopyGUI.php.

◆ SEARCH_SOURCE

const ilObjectCopyGUI::SEARCH_SOURCE = 3

Definition at line 44 of file class.ilObjectCopyGUI.php.

◆ SOURCE_SELECTION

const ilObjectCopyGUI::SOURCE_SELECTION = 1

Definition at line 42 of file class.ilObjectCopyGUI.php.

◆ SUBMODE_COMPLETE

const ilObjectCopyGUI::SUBMODE_COMPLETE = 1

Definition at line 46 of file class.ilObjectCopyGUI.php.

◆ SUBMODE_CONTENT_ONLY

const ilObjectCopyGUI::SUBMODE_CONTENT_ONLY = 2

Definition at line 47 of file class.ilObjectCopyGUI.php.

Referenced by ilObjectCopySelectionTableGUI\__construct().

◆ TAB_GROUP_SC_SELECTION

const ilObjectCopyGUI::TAB_GROUP_SC_SELECTION = 1

Definition at line 55 of file class.ilObjectCopyGUI.php.

◆ TAB_SELECTION_MEMBERSHIP

const ilObjectCopyGUI::TAB_SELECTION_MEMBERSHIP = 3

Definition at line 52 of file class.ilObjectCopyGUI.php.

◆ TAB_SELECTION_SOURCE_TREE

const ilObjectCopyGUI::TAB_SELECTION_SOURCE_TREE = 2

Definition at line 51 of file class.ilObjectCopyGUI.php.

◆ TAB_SELECTION_TARGET_TREE

const ilObjectCopyGUI::TAB_SELECTION_TARGET_TREE = 1

Definition at line 50 of file class.ilObjectCopyGUI.php.

◆ TARGET_SELECTION

const ilObjectCopyGUI::TARGET_SELECTION = 2

Definition at line 43 of file class.ilObjectCopyGUI.php.


The documentation for this class was generated from the following file: