ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjectCopyGUI Class Reference

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

+ Collaboration diagram for ilObjectCopyGUI:

Public Member Functions

 __construct (ImplementsCreationCallback $parent_gui)
 
 executeCommand ()
 
 showTargetSelectionTree ()
 
 showSourceSelectionTree ()
 
 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...
 
 saveTarget ()
 
 cancel ()
 
 searchSource ()
 
 saveSource ()
 
 saveSourceMembership ()
 Save selected source from membership screen. More...
 
 showItemSelection ()
 
 copySingleObject ()
 Start cloning a single (not container) object. More...
 
 copyContainerToTargets ()
 
 showCopyProgress ()
 
 updateProgress ()
 
 copyContainer (int $target_ref_id)
 
 sourceExists ()
 Check if there is any source object. More...
 
 initFormSearch ()
 
 unsetSession ()
 Unset session variables. More...
 

Protected Attributes

ilCtrl $ctrl
 
ilTree $tree
 
ilTabsGUI $tabs
 
ilToolbarGUI $toolbar
 
ilGlobalTemplateInterface $tpl
 
ilObjectDefinition $obj_definition
 
ilObjectDataCache $obj_data_cache
 
ilAccessHandler $access
 
ilErrorHandling $error
 
ilRbacSystem $rbacsystem
 
ilObjUser $user
 
ilRbacReview $rbacreview
 
ilLogger $log
 
ilLanguage $lng
 
ILIAS HTTP Wrapper RequestWrapper $request_wrapper
 
ILIAS HTTP Wrapper ArrayBasedRequestWrapper $post_wrapper
 
ILIAS Refinery Factory $refinery
 
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 Attributes

ilObjectRequestRetriever $retriever
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjectCopyGUI::__construct ( ImplementsCreationCallback  $parent_gui)

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

References $DIC, $refinery, ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilLoggerFactory\getLogger(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\tabs(), ILIAS\Repository\toolbar(), and ILIAS\Repository\user().

79  {
80  global $DIC;
81 
82  $this->ctrl = $DIC->ctrl();
83  $this->tree = $DIC->repositoryTree();
84  $this->tabs = $DIC->tabs();
85  $this->toolbar = $DIC->toolbar();
86  $this->tpl = $DIC["tpl"];
87  $this->obj_definition = $DIC["objDefinition"];
88  $this->obj_data_cache = $DIC["ilObjDataCache"];
89  $this->access = $DIC->access();
90  $this->error = $DIC["ilErr"];
91  $this->rbacsystem = $DIC->rbac()->system();
92  $this->user = $DIC->user();
93  $this->rbacreview = $DIC->rbac()->review();
94  $this->log = ilLoggerFactory::getLogger('obj');
95  $this->lng = $DIC->language();
96  $this->request_wrapper = $DIC->http()->wrapper()->query();
97  $this->post_wrapper = $DIC->http()->wrapper()->post();
98  $this->refinery = $DIC->refinery();
99  $this->retriever = new ilObjectRequestRetriever($DIC->http()->wrapper(), $this->refinery);
100 
101  $this->parent_obj = $parent_gui;
102 
103  $this->lng->loadLanguageModule('search');
104  $this->lng->loadLanguageModule('obj');
105  $this->ctrl->saveParameter($this, "crtcb");
106 
107  $this->clipboard = $DIC
108  ->repository()
109  ->internal()
110  ->domain()
111  ->clipboard()
112  ;
113  }
static getLogger(string $a_component_id)
Get component logger.
global $DIC
Definition: feed.php:28
ILIAS Refinery Factory $refinery
Base class for all sub item list gui's.
+ Here is the call graph for this function:

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

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

221  : void
222  {
223  $this->ctrl->setParameter($this, 'smode', self::SUBMODE_CONTENT_ONLY);
224  $this->ctrl->setParameter($this, 'selectMode', self::SOURCE_SELECTION);
225 
226  $this->setSubMode(self::SUBMODE_CONTENT_ONLY);
227  $this->setMode(self::SOURCE_SELECTION);
228  $this->setTarget($this->request_wrapper->retrieve("ref_id", $this->refinery->kindlyTo()->int()));
229 
230  $this->initSourceSelection();
231  }
+ Here is the call graph for this function:

◆ cancel()

ilObjectCopyGUI::cancel ( )
protected

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

References $ctrl, and ilCtrl\setReturnByClass().

574  : void
575  {
576  $ilCtrl = $this->ctrl;
577  $ilCtrl->setReturnByClass(get_class($this->parent_obj), 'cancel');
578  $ilCtrl->returnToParent($this);
579  }
setReturnByClass(string $a_class, string $a_cmd=null)
+ Here is the call graph for this function:

◆ copyContainer()

ilObjectCopyGUI::copyContainer ( int  $target_ref_id)
protected

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

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().

939  : array
940  {
941  if ($this->getSubMode() != self::SUBMODE_CONTENT_ONLY) {
942  if (!$this->rbacsystem->checkAccess('create', $target_ref_id, $this->getType())) {
943  $this->log->notice(
944  'Permission denied for target: ' .
945  $target_ref_id .
946  ' type: ' .
947  $this->getType() .
948  ' CREATE'
949  );
950  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
951  $this->ctrl->returnToParent($this);
952  }
953  }
954 
955  if (!$this->getFirstSource()) {
956  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
957  $this->ctrl->returnToParent($this);
958  }
959 
960  $options = [];
961  if ($this->post_wrapper->has("cp_options")) {
962  $options = $this->post_wrapper->retrieve(
963  "cp_options",
964  $this->refinery->kindlyTo()->dictOf(
965  $this->refinery->kindlyTo()->dictOf($this->refinery->kindlyTo()->string())
966  )
967  );
968  }
969 
970  $this->log->debug('Copy container (sources): ' . print_r($this->getSources(), true));
971 
973  $result = $orig->cloneAllObject(
974  $_COOKIE[session_name()],
975  CLIENT_ID,
976  $this->getType(),
977  $target_ref_id,
978  $this->getFirstSource(),
979  $options,
980  false,
981  $this->getSubMode()
982  );
983 
984  $this->targets_copy_id[$target_ref_id] = $result['copy_id'];
985 
986  $new_ref_id = (int) $result['ref_id'];
987  if ($new_ref_id > 0) {
988  $new_obj = ilObjectFactory::getInstanceByRefId((int) $result['ref_id'], false);
989  if ($new_obj instanceof ilObject) {
990  $this->parent_obj->callCreationCallback(
991  $new_obj,
992  $this->obj_definition,
993  $this->retriever->getMaybeInt('crtcb', 0)
994  );
995  }
996  }
997  return $result;
998  }
const CLIENT_ID
Definition: constants.php:41
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
$_COOKIE[session_name()]
Definition: xapitoken.php:54
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyContainerToTargets()

ilObjectCopyGUI::copyContainerToTargets ( )
protected

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

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

856  : void
857  {
858  $this->log->debug('Copy container to targets: ' . print_r($_REQUEST, true));
859  $this->log->debug('Source(s): ' . print_r($this->getSources(), true));
860  $this->log->debug('Target(s): ' . print_r($this->getTargets(), true));
861 
862  $result = 1;
863  foreach ($this->getTargets() as $target_ref_id) {
864  $result = $this->copyContainer((int) $target_ref_id);
865  }
866 
867  $this->clipboard->clear();
868 
869  if (ilCopyWizardOptions::_isFinished($result['copy_id'])) {
870  $this->log->info('Object copy completed.');
871  $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_duplicated"), true);
872  if ($this->getSubMode() == self::SUBMODE_CONTENT_ONLY) {
873  $this->ctrl->returnToParent($this);
874  }
875  $link = ilLink::_getLink($result['ref_id']);
876  $this->ctrl->redirectToURL($link);
877  } else {
878  $this->log->debug('Object copy in progress.');
879  $this->showCopyProgress();
880  }
881  }
static _isFinished(int $a_copy_id)
copyContainer(int $target_ref_id)
+ 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 767 of file class.ilObjectCopyGUI.php.

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

Referenced by copySingleObject(), and saveTarget().

767  : void
768  {
769  // check permissions
770  foreach ($sources as $source_ref_id) {
771  $source_type = ilObject::_lookupType($source_ref_id, true);
772 
773  // Create permission
774  // begin-patch mc
775  foreach ($this->getTargets() as $target_ref_id) {
776  if (!$this->rbacsystem->checkAccess('create', $target_ref_id, $source_type)) {
777  $this->log->notice(
778  'Permission denied for target_id: ' .
779  $target_ref_id .
780  ' source_type: ' .
781  $source_type .
782  ' CREATE'
783  );
784  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
785  $this->ctrl->returnToParent($this);
786  }
787  }
788 
789  // Copy permission
790  if (!$this->access->checkAccess('copy', '', $source_ref_id)) {
791  $this->log->notice('Permission denied for source_ref_id: ' . $source_ref_id . ' COPY');
792  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
793  $this->ctrl->returnToParent($this);
794  }
795 
796  // check that these objects are really not containers
797  if ($this->obj_definition->isContainer($source_type) and $this->getSubMode() != self::SUBMODE_CONTENT_ONLY) {
798  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('cntr_container_only_on_their_own'), true);
799  $this->ctrl->returnToParent($this);
800  }
801  }
802 
803  reset($sources);
804 
805 
806  ilLoggerFactory::getLogger('obj')->debug('Copy multiple non containers. Sources: ' . print_r($sources, true));
807 
808  $new_obj = null;
809  // clone
810  foreach ($sources as $source_ref_id) {
811  ilLoggerFactory::getLogger('obj')->debug('Copying source ref_id : ' . $source_ref_id);
812 
813  // begin-patch mc
814  foreach ($this->getTargets() as $target_ref_id) {
815  // Save wizard options
817  $wizard_options = ilCopyWizardOptions::_getInstance($copy_id);
818  $wizard_options->saveOwner($this->user->getId());
819  $wizard_options->saveRoot((int) $source_ref_id);
820  $wizard_options->read();
821 
822  $orig = ilObjectFactory::getInstanceByRefId((int) $source_ref_id);
823  $new_obj = $orig->cloneObject($target_ref_id, $copy_id);
824 
825  // Delete wizard options
826  $wizard_options->deleteAll();
827  $this->parent_obj->callCreationCallback(
828  $new_obj,
829  $this->obj_definition,
830  $this->retriever->getMaybeInt('crtcb', 0)
831  );
832 
833  // rbac log
834  if (ilRbacLog::isActive()) {
835  $rbac_log_roles = $this->rbacreview->getParentRoleIds($new_obj->getRefId());
836  $rbac_log = ilRbacLog::gatherFaPa($new_obj->getRefId(), array_keys($rbac_log_roles), true);
837  ilRbacLog::add(ilRbacLog::COPY_OBJECT, $new_obj->getRefId(), $rbac_log, (bool) $source_ref_id);
838  }
839  }
840  }
841 
842  $this->clipboard->clear();
843  $this->log->info('Object copy completed.');
844  if (count($sources) == 1) {
845  $this->tpl->setOnScreenMessage('success', $this->lng->txt("object_duplicated"), true);
846  $ref_id = $new_obj->getRefId();
847  } else {
848  $this->tpl->setOnScreenMessage('success', $this->lng->txt("objects_duplicated"), true);
849  $ref_id = $this->getFirstTarget();
850  }
851 
852  $this->tpl->setOnScreenMessage('success', $this->lng->txt("objects_duplicated"), true);
854  }
static gatherFaPa(int $a_ref_id, array $a_role_ids, bool $a_add_action=false)
static getLogger(string $a_component_id)
Get component logger.
static isActive()
$ref_id
Definition: ltiauth.php:67
static add(int $a_action, int $a_ref_id, array $a_diff, bool $a_source_ref_id=false)
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
const COPY_OBJECT
static _allocateCopyId()
Allocate a copy for further entries.
static redirect(string $a_script)
static _getInstance(int $a_copy_id)
static _lookupType(int $id, bool $reference=false)
+ 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 751 of file class.ilObjectCopyGUI.php.

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

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

751  : void
752  {
753  // Source defined
754  if (!count($this->getSources())) {
755  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
756  $this->ctrl->returnToParent($this);
757  }
758 
759  $this->copyMultipleNonContainer($this->getSources());
760  }
copyMultipleNonContainer(array $sources)
Copy multiple non container.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjectCopyGUI::executeCommand ( )

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

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

115  : void
116  {
117  $this->init();
118  $this->initTabs();
119 
120  $this->ctrl->getNextClass($this);
121  $cmd = $this->ctrl->getCmd();
122 
123  $this->$cmd();
124  }
+ Here is the call graph for this function:

◆ getFirstSource()

ilObjectCopyGUI::getFirstSource ( )

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

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

538  : int
539  {
540  if (count($this->sources)) {
541  return (int) $this->sources[0];
542  }
543  return 0;
544  }
+ Here is the caller graph for this function:

◆ getFirstTarget()

ilObjectCopyGUI::getFirstTarget ( )

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

References getTargets().

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

564  : int
565  {
566  if (array_key_exists(0, $this->getTargets())) {
567  $targets = $this->getTargets();
568  return (int) $targets[0];
569  }
570  return 0;
571  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMode()

ilObjectCopyGUI::getMode ( )

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

References $mode.

Referenced by setTabs(), and showItemSelection().

493  : int
494  {
495  return $this->mode;
496  }
+ Here is the caller graph for this function:

◆ getParentObject()

ilObjectCopyGUI::getParentObject ( )

Get parent gui object.

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

References $parent_obj.

Referenced by init().

511  : ?ilObjectGUI
512  {
513  return $this->parent_obj;
514  }
Class ilObjectGUI Basic methods of all Output classes.
ImplementsCreationCallback $parent_obj
+ Here is the caller graph for this function:

◆ getSources()

ilObjectCopyGUI::getSources ( )

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

References $sources.

Referenced by copyContainer(), copyContainerToTargets(), copySingleObject(), init(), initTargetSelection(), keepObjectsInClipboard(), saveSource(), saveTarget(), showItemSelection(), and showSourceSelectionTree().

533  : array
534  {
535  return $this->sources;
536  }
+ Here is the caller graph for this function:

◆ getSubMode()

ilObjectCopyGUI::getSubMode ( )

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

References $sub_mode.

Referenced by copyContainer(), copyContainerToTargets(), copyMultipleNonContainer(), init(), saveSource(), and setTabs().

503  : int
504  {
505  return $this->sub_mode;
506  }
+ Here is the caller graph for this function:

◆ getTargets()

ilObjectCopyGUI::getTargets ( )

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

References $targets.

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

559  : array
560  {
561  return $this->targets;
562  }
+ Here is the caller graph for this function:

◆ getType()

ilObjectCopyGUI::getType ( )

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

References $type.

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

516  : string
517  {
518  return $this->type;
519  }
+ Here is the caller graph for this function:

◆ init()

ilObjectCopyGUI::init ( )
protected

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

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().

126  : void
127  {
128  if ($this->retriever->has('smode')) {
129  $this->setSubMode($this->retriever->getMaybeInt('smode') ?? 0);
130  $this->ctrl->setParameter($this, 'smode', $this->getSubMode());
131  ilLoggerFactory::getLogger('obj')->debug('Submode is: ' . $this->getSubMode());
132  }
133 
134  // save sources
135  if ($this->retriever->has('source_ids')) {
136  $this->setSource(explode('_', $this->retriever->getMaybeString('source_ids')));
137  $this->ctrl->setParameter($this, 'source_ids', implode('_', $this->getSources()));
138  ilLoggerFactory::getLogger('obj')->debug('Multiple sources: ' . implode('_', $this->getSources()));
139  }
140  if ($this->retriever->has('source_id')) {
141  $this->setSource([$this->retriever->getMaybeInt('source_id')]);
142  $this->ctrl->setParameter($this, 'source_ids', implode('_', $this->getSources()));
143  ilLoggerFactory::getLogger('obj')->debug('source_id is set: ' . implode('_', $this->getSources()));
144  }
145  if ($this->getFirstSource()) {
146  $this->setType(
148  );
149  }
150 
151  // creation screen: copy section
152  if ($this->retriever->has('new_type')) {
153  $this->setMode(self::SEARCH_SOURCE);
154  $this->setType($this->retriever->getMaybeString('new_type'));
155  $this->setTarget($this->request_wrapper->retrieve("ref_id", $this->refinery->kindlyTo()->int()));
156 
157  $this->ctrl->setParameter($this, 'new_type', $this->getType());
158  $this->ctrl->setParameterByClass(get_class($this->getParentObject()), 'new_type', $this->getType());
159  $this->ctrl->setParameterByClass(get_class($this->getParentObject()), 'cpfl', 1);
160  $this->ctrl->setReturnByClass(get_class($this->getParentObject()), 'create');
161 
162  ilLoggerFactory::getLogger('obj')->debug('Copy from object creation for type: ' . $this->getType());
163  return;
164  }
165  // adopt content, and others?
166  elseif ($this->retriever->getMaybeInt('selectMode') === self::SOURCE_SELECTION) {
167  $this->setMode(self::SOURCE_SELECTION);
168 
169  $this->ctrl->setParameterByClass(get_class($this->parent_obj), 'selectMode', self::SOURCE_SELECTION);
170  $this->setTarget($this->request_wrapper->retrieve("ref_id", $this->refinery->kindlyTo()->int()));
171  $this->ctrl->setReturnByClass(get_class($this->parent_obj), '');
172 
173  ilLoggerFactory::getLogger('obj')->debug('Source selection mode. Target is: ' . $this->getFirstTarget());
174  } elseif ($this->retriever->getMaybeInt('selectMode') === self::TARGET_SELECTION) {
175  $this->setMode(self::TARGET_SELECTION);
176  $this->ctrl->setReturnByClass(get_class($this->parent_obj), '');
177  ilLoggerFactory::getLogger('obj')->debug('Target selection mode.');
178  }
179 
180  // save targets
181  if ($this->retriever->has('target_ids')) {
182  $this->setTargets(explode('_', $this->retriever->getMaybeString('target_ids')));
183  ilLoggerFactory::getLogger('obj')->debug('targets are: ' . print_r($this->getTargets(), true));
184  }
185  }
static getLogger(string $a_component_id)
Get component logger.
static _lookupObjId(int $ref_id)
getParentObject()
Get parent gui object.
setSource(array $source_ids)
static _lookupType(int $id, bool $reference=false)
setTargets(array $targets)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormSearch()

ilObjectCopyGUI::initFormSearch ( )
protected

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

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

Referenced by searchSource(), and showSourceSearch().

1027  : void
1028  {
1029  $this->form = new ilPropertyFormGUI();
1030  $this->form->setTableWidth('600px');
1031  $this->ctrl->setParameter($this, 'new_type', $this->getType());
1032  $this->form->setFormAction($this->ctrl->getFormAction($this));
1033  $this->form->setTitle($this->lng->txt($this->getType() . '_copy'));
1034  $this->form->addCommandButton('searchSource', $this->lng->txt('search_for'));
1035  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
1036 
1037  $tit = new ilTextInputGUI($this->lng->txt('title'), 'tit');
1038  $tit->setSize(40);
1039  $tit->setMaxLength(70);
1040  $tit->setRequired(true);
1041  $tit->setInfo($this->lng->txt('wizard_title_info'));
1042  $this->form->addItem($tit);
1043  }
form( $class_path, string $cmd)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSourceSelection()

ilObjectCopyGUI::initSourceSelection ( )
protected

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

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

Referenced by adoptContent().

265  : void
266  {
267  // copy opened nodes from repository explorer
268  $node_ids = is_array(ilSession::get('repexpand')) ? ilSession::get('repexpand') : [];
269 
270  $this->setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_SOURCE_TREE);
271 
272  // open current position
273  // begin-patch mc
274  foreach ($this->getTargets() as $target_ref_id) {
275  $path = $this->tree->getPathId($target_ref_id);
276  foreach ($path as $node_id) {
277  if (!in_array($node_id, $node_ids)) {
278  $node_ids[] = $node_id;
279  }
280  }
281  }
282  // end-patch multi copy
283 
284  ilSession::set('paste_copy_repexpand', $node_ids);
285 
286  $this->ctrl->setReturnByClass(get_class($this->parent_obj), '');
287  $this->showSourceSelectionTree();
288  }
static get(string $a_var)
setTabs(int $tab_group, int $active_tab)
$path
Definition: ltiservices.php:32
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTabs()

ilObjectCopyGUI::initTabs ( )
protected

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

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

Referenced by executeCommand().

187  : void
188  {
189  $this->lng->loadLanguageModule('cntr');
190  $this->tabs->clearTargets();
191  $this->tabs->setBackTarget(
192  $this->lng->txt('tab_back_to_repository'),
193  (string) $this->ctrl->getParentReturn($this->parent_obj)
194  );
195  }
+ 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 236 of file class.ilObjectCopyGUI.php.

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

236  : void
237  {
238  $this->ctrl->setParameter($this, 'selectMode', self::TARGET_SELECTION);
239 
240  // copy opened nodes from repository explorer
241  $node_ids = is_array(ilSession::get('repexpand')) ? ilSession::get('repexpand') : [];
242 
243  // begin-patch mc
244  $this->setTargets([]);
245  // cognos-blu-patch: end
246 
247  // open current position
248  foreach ($this->getSources() as $source_id) {
249  if ($source_id) {
250  $path = $this->tree->getPathId($source_id);
251  foreach ($path as $node_id) {
252  if (!in_array($node_id, $node_ids)) {
253  $node_ids[] = $node_id;
254  }
255  }
256  }
257  }
258 
259  ilSession::set('paste_copy_repexpand', $node_ids);
260 
261  $this->ctrl->setReturnByClass(get_class($this->parent_obj), '');
262  $this->showTargetSelectionTree();
263  }
static get(string $a_var)
$path
Definition: ltiservices.php:32
static set(string $a_var, $a_val)
Set a value.
setTargets(array $targets)
+ Here is the call graph for this function:

◆ keepObjectsInClipboard()

ilObjectCopyGUI::keepObjectsInClipboard ( )

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

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

581  : void
582  {
583  $this->tpl->setOnScreenMessage('success', $this->lng->txt("obj_inserted_clipboard"), true);
584  $ilCtrl = $this->ctrl;
585  $this->clipboard->setCmd("copy");
586  $this->clipboard->setRefIds($this->getSources());
587  $ilCtrl->returnToParent($this);
588  }
setCmd(?string $a_cmd)
+ Here is the call graph for this function:

◆ saveSource()

ilObjectCopyGUI::saveSource ( )
protected

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

References $source, $target_type, ilObject\_lookupType(), copySingleObject(), ILIAS\Repository\ctrl(), ilObjectFactory\getClassByType(), getSources(), getSubMode(), getTargets(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), searchSource(), setSource(), setType(), and showItemSelection().

639  : void
640  {
641  if ($this->post_wrapper->has("source")) {
642  $source = $this->post_wrapper->retrieve("source", $this->refinery->kindlyTo()->int());
643  $this->setSource([$source]);
644  $this->setType(ilObject::_lookupType($source, true));
645  $this->ctrl->setParameter($this, 'source_id', $source);
646  } else {
647  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
648  $this->searchSource();
649  return;
650  }
651 
652  // validate allowed subtypes
653  foreach ($this->getSources() as $source_ref_id) {
654  foreach ($this->getTargets() as $target_ref_id) {
655  $target_type = ilObject::_lookupType($target_ref_id, true);
656  $target_class_name = ilObjectFactory::getClassByType($target_type);
657  $target_object = new $target_class_name($target_ref_id);
658  $possible_subtypes = $target_object->getPossibleSubObjects();
659 
660  $source_type = ilObject::_lookupType($source_ref_id, true);
661 
662  if (!array_key_exists($source_type, $possible_subtypes)) {
663  // adopt content mode
664  if (
665  $this->getSubMode() != self::SUBMODE_CONTENT_ONLY and
666  ($source_type != 'crs' or $target_type != 'crs')
667  ) {
668  $this->tpl->setOnScreenMessage('failure', sprintf(
669  $this->lng->txt('msg_obj_may_not_contain_objects_of_type'),
670  $this->lng->txt('obj_' . $target_type),
671  $this->lng->txt('obj_' . $source_type)
672  ));
673  $this->searchSource();
674  return;
675  }
676  }
677  }
678  }
679 
680  if ($this->obj_definition->isContainer($this->getType())) {
681  $this->showItemSelection();
682  return;
683  }
684 
685  $this->copySingleObject();
686  }
$target_type
Definition: goto.php:51
copySingleObject()
Start cloning a single (not container) object.
static getClassByType(string $obj_type)
setSource(array $source_ids)
static _lookupType(int $id, bool $reference=false)
$source
Definition: metadata.php:93
+ Here is the call graph for this function:

◆ saveSourceMembership()

ilObjectCopyGUI::saveSourceMembership ( )
protected

Save selected source from membership screen.

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

References $source, ilObject\_lookupType(), copySingleObject(), ILIAS\Repository\ctrl(), getFirstSource(), ILIAS\Repository\lng(), setSource(), setType(), and showItemSelection().

691  : void
692  {
693  $source = $this->retriever->getMaybeInt('source');
694  if ($source === null) {
695  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
696  $this->ctrl->redirect($this, 'showSourceSelectionMembership');
697  return;
698  }
699 
700  $this->setSource([$source]);
701  $this->setType(ilObject::_lookupType($this->getFirstSource(), true));
702  $this->ctrl->setParameter($this, 'source_id', $source);
703 
704  if ($this->obj_definition->isContainer($this->getType())) {
705  $this->showItemSelection();
706  return;
707  }
708 
709  $this->copySingleObject();
710  }
copySingleObject()
Start cloning a single (not container) object.
setSource(array $source_ids)
static _lookupType(int $id, bool $reference=false)
$source
Definition: metadata.php:93
+ Here is the call graph for this function:

◆ saveTarget()

ilObjectCopyGUI::saveTarget ( )
protected

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

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

413  : void
414  {
415  // begin-patch mc
416  $target = $_REQUEST['target'] ?? null; // TODO PHP8 Review: Remove/Replace SuperGlobals
417  if (is_array($target) && $target) {
418  $this->setTargets($target);
419  $this->ctrl->setParameter($this, 'target_ids', implode('_', $this->getTargets()));
420  }
421  // paste from clipboard
422  elseif ((int) $target) {
423  $this->setTarget((int) $target);
424  $this->ctrl->setParameter($this, 'target_ids', implode('_', $this->getTargets()));
425  }
426  // end-patch multi copy
427  else {
428  $this->ctrl->setParameter($this, 'selectMode', self::TARGET_SELECTION);
429  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
430  $this->showTargetSelectionTree();
431  return;
432  }
433 
434  // validate allowed subtypes
435  foreach ($this->getSources() as $source_ref_id) {
436  foreach ($this->getTargets() as $target_ref_id) {
437  $target_type = ilObject::_lookupType((int) $target_ref_id, true);
438  $target_class_name = ilObjectFactory::getClassByType($target_type);
439  $target_object = new $target_class_name((int) $target_ref_id);
440  $possible_subtypes = $target_object->getPossibleSubObjects();
441 
442  $source_type = ilObject::_lookupType((int) $source_ref_id, true);
443 
444  if (!array_key_exists($source_type, (array) $possible_subtypes)) {
445  $this->tpl->setOnScreenMessage('failure', sprintf(
446  $this->lng->txt('msg_obj_may_not_contain_objects_of_type'),
447  $this->lng->txt('obj_' . $target_type),
448  $this->lng->txt('obj_' . $source_type)
449  ));
450  $this->showTargetSelectionTree();
451  return;
452  }
453  }
454  }
455 
456  if (count($this->getSources()) == 1 && $this->obj_definition->isContainer($this->getType())) {
457  // check, if object should be copied into itself
458  // begin-patch mc
459  $is_child = [];
460  foreach ($this->getTargets() as $target_ref_id) {
461  if ($this->tree->isGrandChild($this->getFirstSource(), (int) $target_ref_id)) {
463  }
464  if ($this->getFirstSource() == (int) $target_ref_id) {
466  }
467  }
468  // end-patch multi copy
469  if (count($is_child) > 0) {
470  $this->tpl->setOnScreenMessage(
471  'failure',
472  $this->lng->txt("msg_not_in_itself") . " " . implode(',', $is_child)
473  );
474  $this->showTargetSelectionTree();
475  return;
476  }
477 
478  $this->showItemSelection();
479  } else {
480  if (count($this->getSources()) == 1) {
481  $this->copySingleObject();
482  } else {
483  $this->copyMultipleNonContainer($this->getSources());
484  }
485  }
486  }
$target_type
Definition: goto.php:51
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
copySingleObject()
Start cloning a single (not container) object.
static getClassByType(string $obj_type)
copyMultipleNonContainer(array $sources)
Copy multiple non container.
static _lookupType(int $id, bool $reference=false)
setTargets(array $targets)
+ Here is the call graph for this function:

◆ searchSource()

ilObjectCopyGUI::searchSource ( )
protected

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

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().

590  : void
591  {
592  if ($this->post_wrapper->has('tit')) {
593  $this->tpl->setOnScreenMessage('info', $this->lng->txt('wizard_search_list'));
594  ilSession::set('source_query', $this->post_wrapper->retrieve("tit", $this->refinery->kindlyTo()->string()));
595  }
596 
597  $tit = ilSession::get('source_query', '');
598  if ($tit === "") {
599  $this->initFormSearch();
600  $this->form->setValuesByPost();
601 
602  if (!$this->form->checkInput()) {
603  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('msg_no_search_string'), true);
604  $this->ctrl->returnToParent($this);
605  return;
606  }
607 
608  $tit = $this->form->getInput('tit');
609  }
610 
611  $query_parser = new ilQueryParser($tit);
612  $query_parser->setMinWordLength(1);
613  $query_parser->setCombination(ilQueryParser::QP_COMBINATION_AND);
614  $query_parser->parse();
615  if (!$query_parser->validate()) {
616  $this->tpl->setOnScreenMessage('failure', $query_parser->getMessage(), true);
617  $this->ctrl->returnToParent($this);
618  }
619 
620  // only like search since fulltext does not support search with less than 3 characters
621  $object_search = new ilLikeObjectSearch($query_parser);
622  $object_search->setFilter([$this->retriever->getMaybeString('new_type')]);
623  $res = $object_search->performSearch();
624  $res->setRequiredPermission('copy');
625  $res->filter(ROOT_FOLDER_ID, true);
626 
627  if (!count($results = $res->getResultsByObjId())) {
628  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('search_no_match'), true);
629  $this->ctrl->returnToParent($this);
630  }
631 
632  $table = new ilObjectCopySearchResultTableGUI($this, 'searchSource', $this->getType());
633  $table->setFormAction($this->ctrl->getFormAction($this));
634  $table->setSelectedReference($this->getFirstSource());
635  $table->parseSearchResults($results);
636  $this->tpl->setContent($table->getHTML());
637  }
static get(string $a_var)
$res
Definition: ltiservices.php:69
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ROOT_FOLDER_ID
Definition: constants.php:32
$results
form( $class_path, string $cmd)
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMode()

ilObjectCopyGUI::setMode ( int  $mode)

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

References $mode.

Referenced by adoptContent(), and init().

488  : void
489  {
490  $this->mode = $mode;
491  }
+ Here is the caller graph for this function:

◆ setSource()

ilObjectCopyGUI::setSource ( array  $source_ids)

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

References ILIAS\Repository\refinery().

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

526  : void
527  {
528  $this->sources = $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())->transform(
529  $source_ids
530  );
531  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSubMode()

ilObjectCopyGUI::setSubMode ( int  $mode)

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

References $mode.

Referenced by adoptContent(), and init().

498  : void
499  {
500  $this->sub_mode = $mode;
501  }
+ Here is the caller graph for this function:

◆ setTabs()

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

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

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

Referenced by initSourceSelection(), and showSourceSelectionMembership().

197  : void
198  {
199  if ($tab_group == self::TAB_GROUP_SC_SELECTION) {
200  if ($this->getSubMode() == self::SUBMODE_CONTENT_ONLY) {
201  if ($this->getMode() == self::SOURCE_SELECTION) {
202  $this->tabs->addTab(
203  (string) self::TAB_SELECTION_SOURCE_TREE,
204  $this->lng->txt('cntr_copy_repo_tree'),
205  $this->ctrl->getLinkTarget($this, 'initSourceSelection')
206  );
207  $this->tabs->addTab(
208  (string) self::TAB_SELECTION_MEMBERSHIP,
209  $this->lng->txt('cntr_copy_crs_grp'),
210  $this->ctrl->getLinkTarget($this, 'showSourceSelectionMembership')
211  );
212  }
213  }
214  }
215  $this->tabs->activateTab((string) $active_tab);
216  }
+ 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 547 of file class.ilObjectCopyGUI.php.

References setTargets().

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

547  : void
548  {
549  $this->setTargets([$ref_id]);
550  }
$ref_id
Definition: ltiauth.php:67
setTargets(array $targets)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTargets()

ilObjectCopyGUI::setTargets ( array  $targets)

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

References ILIAS\Repository\refinery().

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

552  : void
553  {
554  $this->targets = $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int())->transform(
555  $targets
556  );
557  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setType()

ilObjectCopyGUI::setType ( string  $type)

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

References $type.

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

521  : void
522  {
523  $this->type = $type;
524  }
+ Here is the caller graph for this function:

◆ showCopyProgress()

ilObjectCopyGUI::showCopyProgress ( )
protected

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

References $ref_id, ilLink\_getLink(), ILIAS\Repository\refinery(), and ROOT_FOLDER_ID.

Referenced by copyContainerToTargets().

883  : void
884  {
886  if ($this->request_wrapper->has('ref_id')) {
887  $ref_id = $this->request_wrapper->retrieve(
888  'ref_id',
889  $this->refinery->kindlyTo()->int()
890  );
891  }
892 
893  $progress = new ilObjectCopyProgressTableGUI(
894  $this,
895  'showCopyProgress',
896  $ref_id
897  );
898  $progress->setObjectInfo($this->targets_copy_id);
899  $progress->parse();
900  $progress->init();
901  $link = ilLink::_getLink($ref_id);
902  $progress->setRedirectionUrl($link);
903 
904  $this->tpl->setContent($progress->getHTML());
905  }
const ROOT_FOLDER_ID
Definition: constants.php:32
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showItemSelection()

ilObjectCopyGUI::showItemSelection ( )
protected

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

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

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

712  : void
713  {
714  if (!count($this->getSources())) {
715  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
716  $this->searchSource();
717  return;
718  }
719 
720  $this->log->debug('Source(s): ' . print_r($this->getSources(), true));
721  $this->log->debug('Target(s): ' . print_r($this->getTargets(), true));
722 
723  $this->tpl->setOnScreenMessage('info', $this->lng->txt($this->getType() . '_copy_threads_info'));
724  $this->tpl->addJavaScript('./Services/CopyWizard/js/ilContainer.js');
725  $this->tpl->setVariable('BODY_ATTRIBUTES', 'onload="ilDisableChilds(\'cmd\');"');
726 
727  $back_cmd = "";
728  switch ($this->getMode()) {
729  case self::SOURCE_SELECTION:
730  $back_cmd = 'adoptContent';
731  break;
732 
733  case self::TARGET_SELECTION:
734  $back_cmd = 'showTargetSelectionTree';
735  break;
736 
737  case self::SEARCH_SOURCE:
738  $back_cmd = 'searchSource';
739  break;
740  }
741 
742  $table = new ilObjectCopySelectionTableGUI($this, 'showItemSelection', $this->getType(), $back_cmd);
743  $table->parseSource($this->getFirstSource());
744 
745  $this->tpl->setContent($table->getHTML());
746  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ 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 1006 of file class.ilObjectCopyGUI.php.

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

1007  {
1008  $this->unsetSession();
1009  $this->initFormSearch();
1010 
1011  if ($tpl_var) {
1012  $this->tpl->setVariable($tpl_var, $this->form->getHTML());
1013  return null;
1014  }
1015 
1016  return $this->form;
1017  }
unsetSession()
Unset session variables.
form( $class_path, string $cmd)
ilPropertyFormGUI $form
+ Here is the call graph for this function:

◆ showSourceSelectionMembership()

ilObjectCopyGUI::showSourceSelectionMembership ( )
protected

show target selection membership

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

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

294  : void
295  {
296  $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_copy_clipboard_source'));
297  $this->setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_MEMBERSHIP);
298 
300  $this,
301  'showSourceSelectionMembership',
302  'copy_selection_mmbrs'
303  );
304  $cgs->init();
305  $cgs->setObjects(
306  array_merge(
307  ilParticipants::_getMembershipByType($this->user->getId(), ['crs']),
308  ilParticipants::_getMembershipByType($this->user->getId(), ['grp'])
309  )
310  );
311  $cgs->parse();
312 
313  $this->tpl->setContent($cgs->getHTML());
314  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTabs(int $tab_group, int $active_tab)
static _getMembershipByType(int $a_usr_id, array $a_type, bool $a_only_member_role=false)
get membership by type Get course or group membership
+ Here is the call graph for this function:

◆ showSourceSelectionTree()

ilObjectCopyGUI::showSourceSelectionTree ( )

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

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

Referenced by initSourceSelection().

363  : void
364  {
365  $this->tpl->addBlockFile(
366  'ADM_CONTENT',
367  'adm_content',
368  'tpl.paste_into_multiple_objects.html',
369  "Services/Object"
370  );
371 
372  $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_copy_clipboard_source'));
375  'ilias.php?baseClass=ilRepositoryGUI&cmd=goto',
376  'paste_copy_repexpand'
377  );
378  $exp->setRequiredFormItemPermission('visible,read,copy');
379 
380  $this->ctrl->setParameter($this, 'selectMode', self::SOURCE_SELECTION);
381  $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showSourceSelectionTree'));
382  $exp->setTargetGet('ref_id');
383  $exp->setPostVar('source');
384  $exp->setCheckedItems($this->getSources());
385  $exp->highlightNode((string) $this->getFirstTarget());
386 
387  // Filter to container
388  foreach (['cat', 'root', 'fold'] as $container) {
389  $exp->removeFormItemForType($container);
390  }
391 
392  if (!$this->request_wrapper->has("paste_copy_repexpand")) {
393  $expanded = $this->tree->readRootId();
394  } else {
395  $expanded = $this->request_wrapper->retrieve("paste_copy_repexpand", $this->refinery->kindlyTo()->int());
396  }
397 
398  $this->tpl->setVariable('FORM_TARGET', '_self');
399  $this->tpl->setVariable('FORM_ACTION', $this->ctrl->getFormAction($this, 'copySelection'));
400 
401  $exp->setExpand($expanded);
402  // build html-output
403  $exp->setOutput(0);
404  $output = $exp->getOutput();
405 
406  $this->tpl->setVariable('OBJECT_TREE', $output);
407  $this->tpl->setVariable('CMD_SUBMIT', 'saveSource');
408  $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('btn_next'));
409 
410  $this->toolbar->addButton($this->lng->txt('cancel'), $this->ctrl->getLinkTarget($this, 'cancel'));
411  }
ilPasteIntoMultipleItemsExplorer Explorer
$container
Definition: wac.php:14
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showTargetSelectionTree()

ilObjectCopyGUI::showTargetSelectionTree ( )

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

References ILIAS\Repository\ctrl(), ilUtil\getImagePath(), ilSubmitButton\getInstance(), and ILIAS\Repository\lng().

Referenced by initTargetSelection(), and saveTarget().

316  : void
317  {
318  if ($this->obj_definition->isContainer($this->getType())) {
319  $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_copy_clipboard_container'));
320  } else {
321  $this->tpl->setOnScreenMessage('info', $this->lng->txt('msg_copy_clipboard'));
322  }
323 
324  $exp = new ilRepositorySelectorExplorerGUI($this, "showTargetSelectionTree");
325  $exp->setTypeWhiteList(["root", "cat", "grp", "crs", "fold", "lso", "prg"]);
326  $exp->setSelectMode("target", true);
327  if ($exp->handleCommand()) {
328  return;
329  }
330  $output = $exp->getHTML();
331 
332  $t = new ilToolbarGUI();
333  $t->setFormAction($this->ctrl->getFormAction($this, "saveTarget"));
335  if ($this->obj_definition->isContainer($this->getType())) {
336  $btn->setCaption('btn_next');
337  } else {
338  $btn->setCaption('paste');
339  }
340  $btn->setCommand('saveTarget');
341  $btn->setPrimary(true);
342  $t->addButtonInstance($btn);
343  $t->addSeparator();
344  $clipboard_btn = ilSubmitButton::getInstance();
345  $clipboard_btn->setCaption('obj_insert_into_clipboard');
346  $clipboard_btn->setCommand('keepObjectsInClipboard');
347  $t->addButtonInstance($clipboard_btn);
348  $cancel_btn = ilSubmitButton::getInstance();
349  $cancel_btn->setCaption('cancel');
350  $cancel_btn->setCommand('cancel');
351  $t->addButtonInstance($cancel_btn);
352  $t->setCloseFormTag(false);
353  $t->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " ");
354  $output = $t->getHTML() . $output;
355  $t->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " ");
356  $t->setCloseFormTag(true);
357  $t->setOpenFormTag(false);
358  $output .= "<br />" . $t->getHTML();
359 
360  $this->tpl->setContent($output);
361  }
Explorer for selecting repository items.
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sourceExists()

ilObjectCopyGUI::sourceExists ( )
protected

Check if there is any source object.

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

References ilUtil\_getObjectsByOperations(), getType(), and ILIAS\Repository\user().

1022  : bool
1023  {
1024  return (bool) ilUtil::_getObjectsByOperations($this->getType(), 'copy', $this->user->getId(), 1);
1025  }
static _getObjectsByOperations( $a_obj_type, string $a_operation, int $a_usr_id=0, int $limit=0)
Get all objects of a specific type and check access This function is not recursive, instead it parses the serialized rbac_pa entries.
+ Here is the call graph for this function:

◆ unsetSession()

ilObjectCopyGUI::unsetSession ( )
protected

Unset session variables.

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

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

Referenced by showSourceSearch().

1048  : void
1049  {
1050  ilSession::clear('source_query');
1051  $this->setSource([]);
1052  }
setSource(array $source_ids)
static clear(string $a_var)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateProgress()

ilObjectCopyGUI::updateProgress ( )
protected

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

References ilCopyWizardOptions\_getInstance(), and exit.

907  : void
908  {
909  $json = new stdClass();
910  $json->percentage = null;
911  $json->performed_steps = null;
912 
913  $copy_id = $this->retriever->getMaybeInt('_copy_id');
914  $options = ilCopyWizardOptions::_getInstance($copy_id);
915  $node = $options->fetchFirstNode();
916  $json->current_node_id = 0;
917  $json->current_node_title = "";
918  $json->in_dependencies = false;
919  if (is_array($node)) {
920  $json->current_node_id = $node['obj_id'];
921  $json->current_node_title = $node['title'];
922  } else {
923  $node = $options->fetchFirstDependenciesNode();
924  if (is_array($node)) {
925  $json->current_node_id = $node['obj_id'];
926  $json->current_node_title = $node['title'];
927  $json->in_dependencies = true;
928  }
929  }
930  $json->required_steps = $options->getRequiredSteps();
931  $json->id = $copy_id;
932 
933  $this->log->debug('Update copy progress: ' . json_encode($json));
934 
935  echo json_encode($json);
936  exit;
937  }
exit
Definition: login.php:28
static _getInstance(int $a_copy_id)
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilAccessHandler ilObjectCopyGUI::$access
protected

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

◆ $clipboard

ClipboardManager ilObjectCopyGUI::$clipboard
protected

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

◆ $ctrl

ilCtrl ilObjectCopyGUI::$ctrl
protected

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

Referenced by cancel(), and keepObjectsInClipboard().

◆ $error

ilErrorHandling ilObjectCopyGUI::$error
protected

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

◆ $form

ilPropertyFormGUI ilObjectCopyGUI::$form
protected

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

Referenced by showSourceSearch().

◆ $lng

ilLanguage ilObjectCopyGUI::$lng
protected

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

◆ $log

ilLogger ilObjectCopyGUI::$log
protected

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

◆ $mode

int ilObjectCopyGUI::$mode = 0
protected

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

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

◆ $obj_data_cache

ilObjectDataCache ilObjectCopyGUI::$obj_data_cache
protected

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

◆ $obj_definition

ilObjectDefinition ilObjectCopyGUI::$obj_definition
protected

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

◆ $parent_obj

ImplementsCreationCallback ilObjectCopyGUI::$parent_obj = null
protected

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

Referenced by getParentObject().

◆ $post_wrapper

ILIAS HTTP Wrapper ArrayBasedRequestWrapper ilObjectCopyGUI::$post_wrapper
protected

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

◆ $rbacreview

ilRbacReview ilObjectCopyGUI::$rbacreview
protected

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

◆ $rbacsystem

ilRbacSystem ilObjectCopyGUI::$rbacsystem
protected

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

◆ $refinery

ILIAS Refinery Factory ilObjectCopyGUI::$refinery
protected

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

Referenced by __construct().

◆ $request_wrapper

ILIAS HTTP Wrapper RequestWrapper ilObjectCopyGUI::$request_wrapper
protected

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

◆ $retriever

ilObjectRequestRetriever ilObjectCopyGUI::$retriever
private

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

◆ $sources

array ilObjectCopyGUI::$sources = []
protected

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

Referenced by getSources().

◆ $sub_mode

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

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

Referenced by getSubMode().

◆ $tabs

ilTabsGUI ilObjectCopyGUI::$tabs
protected

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

◆ $targets

array ilObjectCopyGUI::$targets = []
protected

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

Referenced by getTargets().

◆ $targets_copy_id

array ilObjectCopyGUI::$targets_copy_id = []
protected

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

◆ $toolbar

ilToolbarGUI ilObjectCopyGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilObjectCopyGUI::$tpl
protected

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

◆ $tree

ilTree ilObjectCopyGUI::$tree
protected

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

◆ $type

string ilObjectCopyGUI::$type = ''
protected

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

Referenced by getType(), and setType().

◆ $user

ilObjUser ilObjectCopyGUI::$user
protected

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

◆ SEARCH_SOURCE

const ilObjectCopyGUI::SEARCH_SOURCE = 3

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

◆ SOURCE_SELECTION

const ilObjectCopyGUI::SOURCE_SELECTION = 1

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

◆ SUBMODE_COMPLETE

const ilObjectCopyGUI::SUBMODE_COMPLETE = 1

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

◆ SUBMODE_CONTENT_ONLY

const ilObjectCopyGUI::SUBMODE_CONTENT_ONLY = 2

◆ TAB_GROUP_SC_SELECTION

const ilObjectCopyGUI::TAB_GROUP_SC_SELECTION = 1

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

◆ TAB_SELECTION_MEMBERSHIP

const ilObjectCopyGUI::TAB_SELECTION_MEMBERSHIP = 3

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

◆ TAB_SELECTION_SOURCE_TREE

const ilObjectCopyGUI::TAB_SELECTION_SOURCE_TREE = 2

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

◆ TAB_SELECTION_TARGET_TREE

const ilObjectCopyGUI::TAB_SELECTION_TARGET_TREE = 1

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

◆ TARGET_SELECTION

const ilObjectCopyGUI::TARGET_SELECTION = 2

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


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