ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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
 
GlobalHttpState $http
 
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 244 of file class.ilObjectCopyGUI.php.

244 : void
245 {
246 $this->ctrl->setParameter($this, 'smode', self::SUBMODE_CONTENT_ONLY);
247 $this->ctrl->setParameter($this, 'selectMode', self::SOURCE_SELECTION);
248
249 $this->setSubMode(self::SUBMODE_CONTENT_ONLY);
250 $this->setMode(self::SOURCE_SELECTION);
251 $this->setTarget($this->request_wrapper->retrieve("ref_id", $this->refinery->kindlyTo()->int()));
252
253 $this->initSourceSelection();
254 }

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

+ Here is the call graph for this function:

◆ buildCopyPageSelectionForm()

ilObjectCopyGUI::buildCopyPageSelectionForm ( )
private

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

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

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 619 of file class.ilObjectCopyGUI.php.

619 : void
620 {
621 $ilCtrl = $this->ctrl;
622 $ilCtrl->setReturnByClass(get_class($this->parent_obj), 'cancel');
623 $ilCtrl->returnToParent($this);
624 }
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 1064 of file class.ilObjectCopyGUI.php.

1064 : array
1065 {
1066 if ($this->getSubMode() != self::SUBMODE_CONTENT_ONLY) {
1067 if (!$this->rbacsystem->checkAccess('create', $target_ref_id, $this->getType())) {
1068 $this->log->notice(
1069 'Permission denied for target: ' .
1070 $target_ref_id .
1071 ' type: ' .
1072 $this->getType() .
1073 ' CREATE'
1074 );
1075 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
1076 $this->ctrl->returnToParent($this);
1077 }
1078 }
1079
1080 if (!$this->getFirstSource()) {
1081 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
1082 $this->ctrl->returnToParent($this);
1083 }
1084
1085 $options = [];
1086 if ($this->post_wrapper->has("cp_options")) {
1087 $options = $this->post_wrapper->retrieve(
1088 "cp_options",
1089 $this->refinery->kindlyTo()->dictOf(
1090 $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
1091 )
1092 );
1093 }
1094
1095 $this->log->debug('Copy container (sources): ' . print_r($this->getSources(), true));
1096
1098 $result = $orig->cloneAllObject(
1099 $_COOKIE[session_name()],
1100 CLIENT_ID,
1101 $this->getType(),
1102 $target_ref_id,
1103 $this->getFirstSource(),
1104 $options,
1105 false,
1106 $this->getSubMode()
1107 );
1108
1109 $this->targets_copy_id[$target_ref_id] = $result['copy_id'];
1110
1111 $new_ref_id = (int) $result['ref_id'];
1112 if ($new_ref_id > 0) {
1113 $new_obj = ilObjectFactory::getInstanceByRefId((int) $result['ref_id'], false);
1114 if ($new_obj instanceof ilObject) {
1115 $this->parent_obj->callCreationCallback(
1116 $new_obj,
1117 $this->obj_definition,
1118 $this->retriever->getMaybeInt('crtcb', 0)
1119 );
1120 }
1121 }
1122 return $result;
1123 }
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:52

References $_COOKIE, ILIAS\UI\Implementation\Component\Input\Field\$options, 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 934 of file class.ilObjectCopyGUI.php.

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

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

971 : void
972 {
973 $source_object = ilObjectFactory::getInstanceByRefId($this->getFirstSource());
974 $target_object = $this->getParentObject()->getObject();
976 "cont",
977 $source_object->getId()
978 )) {
979 $orig_page = new ilContainerPage($source_object->getId());
980 $orig_page->copy($target_object->getId(), "cont", $target_object->getId());
981 }
982
983 $style_id = ilObjStyleSheet::lookupObjectStyle($source_object->getId());
984 if ($style_id <= 0) {
985 return;
986 }
987 if (ilObjStyleSheet::_lookupStandard($style_id)) {
988 ilObjStyleSheet::writeStyleUsage($target_object->getId(), $style_id);
989 return;
990 }
991 $style_obj = ilObjectFactory::getInstanceByObjId($style_id);
992 $new_id = $style_obj->ilClone();
993 ilObjStyleSheet::writeStyleUsage($target_object->getId(), $new_id);
994 ilObjStyleSheet::writeOwner($target_object->getId(), $new_id);
995 $reuse = $this->container_repo->readReuse($source_object->getRefId());
996 $this->container_repo->updateReuse($target_object->getRefId(), $reuse);
997 }
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 829 of file class.ilObjectCopyGUI.php.

829 : void
830 {
831 // Source defined
832 if ($this->getSources() === []) {
833 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
834 $this->ctrl->returnToParent($this);
835 }
836
837 $this->copyMultipleNonContainer($this->getSources());
838 }
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 138 of file class.ilObjectCopyGUI.php.

138 : void
139 {
140 $this->init();
141 $this->initTabs();
142
143 $this->ctrl->getNextClass($this);
144 $cmd = $this->ctrl->getCmd();
145
146 $this->$cmd();
147 }

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

+ Here is the call graph for this function:

◆ executeNextStepAfterSourceSelection()

ilObjectCopyGUI::executeNextStepAfterSourceSelection ( )
private

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

751 : void
752 {
753 if (!$this->obj_definition->isContainer($this->getType())) {
754 $this->copySingleObject();
755 return;
756 }
757
758 if (count($this->getSources()) === 1
760 'cont',
762 )
763 ) {
764 $this->showCopyPageSelection();
765 return;
766 }
767
768 $this->showItemSelection();
769 }
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 707 of file class.ilObjectCopyGUI.php.

707 : string
708 {
709 foreach ($this->getTargets() as $target_ref_id) {
710 $target_type = ilObject::_lookupType($target_ref_id, true);
711 $target_class_name = ilObjectFactory::getClassByType($target_type);
712 $target_object = new $target_class_name($target_ref_id);
713 $possible_subtypes = $target_object->getPossibleSubObjects();
714
715 $source_type = ilObject::_lookupType($ref_id, true);
716
717 if (!array_key_exists($source_type, $possible_subtypes)
718 && $this->getSubMode() != self::SUBMODE_CONTENT_ONLY
719 && ($source_type !== 'crs' || $target_type !== 'crs')
720 ) {
721 return sprintf(
722 $this->lng->txt('msg_obj_may_not_contain_objects_of_type'),
723 $this->lng->txt('obj_' . $target_type),
724 $this->lng->txt('obj_' . $source_type)
725 );
726 }
727 }
728
729 return '';
730 }
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 583 of file class.ilObjectCopyGUI.php.

583 : int
584 {
585 if (count($this->sources)) {
586 return (int) $this->sources[0];
587 }
588 return 0;
589 }

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 609 of file class.ilObjectCopyGUI.php.

609 : int
610 {
611 if (array_key_exists(0, $this->getTargets())) {
612 $targets = $this->getTargets();
613 return (int) $targets[0];
614 }
615 return 0;
616 }

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 538 of file class.ilObjectCopyGUI.php.

538 : int
539 {
540 return $this->mode;
541 }

References $mode.

Referenced by setTabs().

+ Here is the caller graph for this function:

◆ getOnLoadCode()

ilObjectCopyGUI::getOnLoadCode ( string  $cmd)
private

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

396 : Closure
397 {
398 return function ($id) use ($cmd) {
399 return "document.getElementById('$id')"
400 . '.addEventListener("click", '
401 . '(e) => {e.preventDefault();'
402 . 'e.target.setAttribute("name", "cmd[' . $cmd . ']");'
403 . 'e.target.form.requestSubmit(e.target);});';
404 };
405 }
$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 556 of file class.ilObjectCopyGUI.php.

556 : ?ilObjectGUI
557 {
558 return $this->parent_obj;
559 }
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 387 of file class.ilObjectCopyGUI.php.

387 : string
388 {
389 if ($this->obj_definition->isContainer($this->getType())) {
390 return $this->lng->txt('btn_next');
391 }
392
393 return $this->lng->txt('paste');
394 }

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 548 of file class.ilObjectCopyGUI.php.

548 : int
549 {
550 return $this->sub_mode;
551 }

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 604 of file class.ilObjectCopyGUI.php.

604 : array
605 {
606 return $this->targets;
607 }

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 561 of file class.ilObjectCopyGUI.php.

561 : string
562 {
563 return $this->type;
564 }

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 149 of file class.ilObjectCopyGUI.php.

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

1144 : void
1145 {
1146 $this->form = new ilPropertyFormGUI();
1147 $this->form->setTableWidth('600px');
1148 $this->ctrl->setParameter($this, 'new_type', $this->getType());
1149 $this->form->setFormAction($this->ctrl->getFormAction($this));
1150 $this->form->setTitle($this->lng->txt($this->getType() . '_copy'));
1151 $this->form->addCommandButton('searchSource', $this->lng->txt('search_for'));
1152 $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
1153
1154 $tit = new ilTextInputGUI($this->lng->txt('title'), 'tit');
1155 $tit->setSize(40);
1156 $tit->setMaxLength(70);
1157 $tit->setRequired(true);
1158 $tit->setInfo($this->lng->txt('wizard_title_info'));
1159 $this->form->addItem($tit);
1160 }
This class represents a property form user interface.
This class represents a text property in a property form.
form(?array $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 288 of file class.ilObjectCopyGUI.php.

288 : void
289 {
290 // copy opened nodes from repository explorer
291 $node_ids = is_array(ilSession::get('repexpand')) ? ilSession::get('repexpand') : [];
292
293 $this->setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_SOURCE_TREE);
294
295 // open current position
296 // begin-patch mc
297 foreach ($this->getTargets() as $target_ref_id) {
298 $path = $this->tree->getPathId($target_ref_id);
299 foreach ($path as $node_id) {
300 if (!in_array($node_id, $node_ids)) {
301 $node_ids[] = $node_id;
302 }
303 }
304 }
305 // end-patch multi copy
306
307 ilSession::set('paste_copy_repexpand', $node_ids);
308
309 $this->ctrl->setReturnByClass(get_class($this->parent_obj), '');
311 }
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 210 of file class.ilObjectCopyGUI.php.

210 : void
211 {
212 $this->lng->loadLanguageModule('cntr');
213 $this->tabs->clearTargets();
214 $this->tabs->setBackTarget(
215 $this->lng->txt('cancel'),
216 (string) $this->ctrl->getParentReturn($this->parent_obj)
217 );
218 }

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 259 of file class.ilObjectCopyGUI.php.

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

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 965 of file class.ilObjectCopyGUI.php.

965 : bool
966 {
967 return $this->post_wrapper->has('copy_page')
968 && $this->post_wrapper->retrieve('copy_page', $this->refinery->kindlyTo()->bool());
969 }

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 626 of file class.ilObjectCopyGUI.php.

626 : void
627 {
628 $this->tpl->setOnScreenMessage('success', $this->lng->txt("obj_inserted_clipboard"), true);
629 $ilCtrl = $this->ctrl;
630 $this->clipboard->setCmd("copy");
631 $this->clipboard->setRefIds($this->getSources());
632 $ilCtrl->returnToParent($this);
633 }
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 777 of file class.ilObjectCopyGUI.php.

777 : void
778 {
780 $data = $form->withRequest($this->request)->getData();
781
782 $this->showItemSelection($data['copy_page']);
783 }
ilPropertyFormGUI $form

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

+ Here is the call graph for this function:

◆ saveSource()

ilObjectCopyGUI::saveSource ( )
protected

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

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

References 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 735 of file class.ilObjectCopyGUI.php.

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

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 455 of file class.ilObjectCopyGUI.php.

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

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

533 : void
534 {
535 $this->mode = $mode;
536 }

References $mode.

Referenced by adoptContent(), and init().

+ Here is the caller graph for this function:

◆ setSource()

ilObjectCopyGUI::setSource ( array  $source_ids)

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

571 : void
572 {
573 $this->sources = $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())->transform(
574 $source_ids
575 );
576 }

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 543 of file class.ilObjectCopyGUI.php.

543 : void
544 {
545 $this->sub_mode = $mode;
546 }

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 220 of file class.ilObjectCopyGUI.php.

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

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 592 of file class.ilObjectCopyGUI.php.

592 : void
593 {
594 $this->setTargets([$ref_id]);
595 }

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 597 of file class.ilObjectCopyGUI.php.

597 : void
598 {
599 $this->targets = $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())->transform(
601 );
602 }

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 566 of file class.ilObjectCopyGUI.php.

566 : void
567 {
568 $this->type = $type;
569 }

References $type.

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

+ Here is the caller graph for this function:

◆ showCopyPageSelection()

ilObjectCopyGUI::showCopyPageSelection ( )
protected

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

771 : void
772 {
774 $this->tpl->setContent($this->ui_renderer->render($form));
775 }

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 999 of file class.ilObjectCopyGUI.php.

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

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 805 of file class.ilObjectCopyGUI.php.

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

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 1131 of file class.ilObjectCopyGUI.php.

1132 {
1133 $this->unsetSession();
1134 $this->initFormSearch();
1135
1136 if ($tpl_var) {
1137 $this->tpl->setVariable($tpl_var, $this->form->getHTML());
1138 return null;
1139 }
1140
1141 return $this->form;
1142 }
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 317 of file class.ilObjectCopyGUI.php.

317 : void
318 {
319 $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_copy_clipboard_source'));
320 $this->setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_MEMBERSHIP);
321
323 $this,
324 'showSourceSelectionMembership',
325 'copy_selection_mmbrs'
326 );
327 $cgs->init();
328 $cgs->setObjects(
329 array_merge(
330 ilParticipants::_getMembershipByType($this->user->getId(), ['crs']),
331 ilParticipants::_getMembershipByType($this->user->getId(), ['grp'])
332 )
333 );
334 $cgs->parse();
335
336 $this->tpl->setContent($cgs->getHTML());
337 }
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 407 of file class.ilObjectCopyGUI.php.

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

339 : void
340 {
341 if ($this->obj_definition->isContainer($this->getType())) {
342 $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_copy_clipboard_container'));
343 } else {
344 $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_copy_clipboard'));
345 }
346
347 $exp = new ilRepositorySelectorExplorerGUI($this, "showTargetSelectionTree");
348 $exp->setTypeWhiteList(["root", "cat", "grp", "crs", "fold", "lso", "prg"]);
349 $exp->setSelectMode("target", true);
350 if ($exp->handleCommand()) {
351 return;
352 }
353 $output = $exp->getHTML();
354
355 $t = new ilToolbarGUI();
356 $t->setFormAction($this->ctrl->getFormAction($this, "saveTarget"));
357 $primary_button = $this->ui_factory->button()->primary(
358 $this->getPrimaryButtonLabel(),
359 ''
360 )->withOnLoadCode($this->getOnLoadCode('saveTarget'));
361 $t->addComponent($primary_button);
362 $t->addSeparator();
363
364 $clipboard_btn = $this->ui_factory->button()->standard(
365 $this->lng->txt('obj_insert_into_clipboard'),
366 ''
367 )->withOnLoadCode($this->getOnLoadCode('keepObjectsInClipboard'));
368 $t->addComponent($clipboard_btn);
369
370 $cancel_btn = $this->ui_factory->button()->standard(
371 $this->lng->txt('cancel'),
372 ''
373 )->withOnLoadCode($this->getOnLoadCode('cancel'));
374 $t->addComponent($cancel_btn);
375
376 $t->setCloseFormTag(false);
377 $t->setLeadingImage(ilUtil::getImagePath("nav/arrow_upright.svg"), " ");
378 $output = $t->getHTML() . $output;
379 $t->setLeadingImage(ilUtil::getImagePath("nav/arrow_downright.svg"), " ");
380 $t->setCloseFormTag(true);
381 $t->setOpenFormTag(false);
382 $output .= "<br />" . $t->getHTML();
383
384 $this->tpl->setContent($output);
385 }
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 1165 of file class.ilObjectCopyGUI.php.

1165 : void
1166 {
1167 ilSession::clear('source_query');
1168 $this->setSource([]);
1169 }
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 1031 of file class.ilObjectCopyGUI.php.

1031 : void
1032 {
1033 $max_steps = $this->retriever->getMaybeInt('_max_steps');
1034 $copy_id = $this->retriever->getMaybeInt('_copy_id');
1036 $required_steps = $options->getRequiredSteps();
1037
1038 if ($required_steps === 0) {
1039 $state = $this->ui_factory->progress()->state()->bar()
1040 ->success($this->lng->txt('obj_copy_progress_success'));
1041 $this->log->debug('Update copy progress: 100%');
1042 } else {
1043 $completed_steps = $max_steps - $required_steps;
1044 $percentage = (int) min(
1045 floor(($completed_steps / $max_steps) * 100),
1046 99
1047 );
1048 $state = $this->ui_factory->progress()->state()->bar()
1049 ->determinate($percentage);
1050 $this->log->debug("Update copy progress: {$percentage}%");
1051 }
1052
1053 $html = $this->ui_renderer->renderAsync($state);
1054
1055 $this->http->saveResponse(
1056 $this->http->response()
1057 ->withHeader('Content-Type', 'text/html; charset=utf-8')
1058 ->withBody(Streams::ofString($html))
1059 );
1060 $this->http->sendResponse();
1061 $this->http->close();
1062 }
static http()
Fetches the global http state from ILIAS.

References ILIAS\UI\Implementation\Component\Input\Field\$options, ilCopyWizardOptions\_getInstance(), ILIAS\FileDelivery\http(), ILIAS\Repository\int(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilObjectCopyGUI::$access
protected

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

◆ $clipboard

ClipboardManager ilObjectCopyGUI::$clipboard
protected

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

◆ $container_repo

ContainerDBRepository ilObjectCopyGUI::$container_repo
protected

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

◆ $ctrl

ilCtrl ilObjectCopyGUI::$ctrl
protected

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

Referenced by cancel(), and keepObjectsInClipboard().

◆ $error

ilErrorHandling ilObjectCopyGUI::$error
protected

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

◆ $form

ilPropertyFormGUI ilObjectCopyGUI::$form
protected

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

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

◆ $http

GlobalHttpState ilObjectCopyGUI::$http
protected

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

◆ $lng

ilLanguage ilObjectCopyGUI::$lng
protected

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

◆ $log

ilLogger ilObjectCopyGUI::$log
protected

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

◆ $mode

int ilObjectCopyGUI::$mode = 0
protected

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

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

◆ $obj_data_cache

ilObjectDataCache ilObjectCopyGUI::$obj_data_cache
protected

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

◆ $obj_definition

ilObjectDefinition ilObjectCopyGUI::$obj_definition
protected

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

◆ $parent_obj

ImplementsCreationCallback ilObjectCopyGUI::$parent_obj = null
protected

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

Referenced by getParentObject().

◆ $post_wrapper

ArrayBasedRequestWrapper ilObjectCopyGUI::$post_wrapper
protected

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

◆ $rbacreview

ilRbacReview ilObjectCopyGUI::$rbacreview
protected

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

◆ $rbacsystem

ilRbacSystem ilObjectCopyGUI::$rbacsystem
protected

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

◆ $refinery

Refinery ilObjectCopyGUI::$refinery
protected

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

◆ $request

ServerRequestInterface ilObjectCopyGUI::$request
protected

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

◆ $request_wrapper

RequestWrapper ilObjectCopyGUI::$request_wrapper
protected

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

◆ $retriever

ilObjectRequestRetriever ilObjectCopyGUI::$retriever
private

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

◆ $sources

array ilObjectCopyGUI::$sources = []
protected

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

Referenced by copyMultipleNonContainer(), and getSources().

◆ $sub_mode

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

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

Referenced by getSubMode().

◆ $tabs

ilTabsGUI ilObjectCopyGUI::$tabs
protected

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

◆ $targets

array ilObjectCopyGUI::$targets = []
protected

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

Referenced by getTargets(), and saveTarget().

◆ $targets_copy_id

array ilObjectCopyGUI::$targets_copy_id = []
protected

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

◆ $tpl

ilGlobalTemplateInterface ilObjectCopyGUI::$tpl
protected

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

◆ $tree

ilTree ilObjectCopyGUI::$tree
protected

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

◆ $type

string ilObjectCopyGUI::$type = ''
protected

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

Referenced by getType(), and setType().

◆ $ui_factory

UIFactory ilObjectCopyGUI::$ui_factory
protected

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

◆ $ui_renderer

UIRenderer ilObjectCopyGUI::$ui_renderer
protected

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

◆ $user

ilObjUser ilObjectCopyGUI::$user
protected

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

◆ SEARCH_SOURCE

const ilObjectCopyGUI::SEARCH_SOURCE = 3

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

◆ SOURCE_SELECTION

const ilObjectCopyGUI::SOURCE_SELECTION = 1

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

◆ SUBMODE_COMPLETE

const ilObjectCopyGUI::SUBMODE_COMPLETE = 1

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

◆ SUBMODE_CONTENT_ONLY

const ilObjectCopyGUI::SUBMODE_CONTENT_ONLY = 2

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

Referenced by ilObjectCopySelectionTableGUI\__construct().

◆ TAB_GROUP_SC_SELECTION

const ilObjectCopyGUI::TAB_GROUP_SC_SELECTION = 1

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

◆ TAB_SELECTION_MEMBERSHIP

const ilObjectCopyGUI::TAB_SELECTION_MEMBERSHIP = 3

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

◆ TAB_SELECTION_SOURCE_TREE

const ilObjectCopyGUI::TAB_SELECTION_SOURCE_TREE = 2

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

◆ TAB_SELECTION_TARGET_TREE

const ilObjectCopyGUI::TAB_SELECTION_TARGET_TREE = 1

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

◆ TARGET_SELECTION

const ilObjectCopyGUI::TARGET_SELECTION = 2

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


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