ILIAS  release_7 Revision v7.30-3-g800a261c036
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 $a_parent_gui)
 
 executeCommand ()
 Control class handling. More...
 
 showTargetSelectionTree ()
 Show target selection. More...
 
 showSourceSelectionTree ()
 Show target selection. More...
 
 setMode ($a_mode)
 set copy mode More...
 
 getMode ()
 get copy mode More...
 
 setSubMode ($a_mode)
 
 getSubMode ()
 
 getParentObject ()
 Get parent gui object. More...
 
 getType ()
 Returns $type. More...
 
 setType ($type)
 Sets $type. More...
 
 setSource (array $a_source_ids)
 Set source id. More...
 
 getSources ()
 Get sources. More...
 
 getFirstSource ()
 
 setTarget ($a_ref_id)
 Set single object target. More...
 
 setTargets (array $a_target)
 Set target id. More...
 
 getTargets ()
 Get copy target. More...
 
 getFirstTarget ()
 Get first target. More...
 
 keepObjectsInClipboard ()
 Keep objects in clipboard. More...
 
 copyMultipleNonContainer ($a_sources)
 Copy multiple non container. More...
 
 showSourceSearch ($a_tplvar)
 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 ()
 Init return, mode. More...
 
 initTabs ()
 Init tabs General. More...
 
 setTabs ($a_tab_group, $a_active_tab)
 Set tabs. More...
 
 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 ()
 Init source selection. More...
 
 showSourceSelectionMembership ()
 show target selection membership More...
 
 saveTarget ()
 Save target selection. More...
 
 cancel ()
 Cancel workflow. More...
 
 searchSource ()
 Search source. More...
 
 saveSource ()
 select source object More...
 
 saveSourceMembership ()
 Save selected source from membership screen. More...
 
 showItemSelection ()
 
 copySingleObject ()
 Start cloning a single (not container) object. More...
 
 copyContainerToTargets ()
 Copy to multiple targets. More...
 
 showCopyProgress ()
 Show progress for copying. More...
 
 updateProgress ()
 Update progress. More...
 
 copyContainer ($a_target)
 Copy a container. More...
 
 sourceExists ()
 Check if there is any source object. More...
 
 initFormSearch ()
 Init search form. More...
 
 unsetSession ()
 Unset session variables. More...
 

Protected Attributes

 $ctrl
 
 $tree
 
 $tabs
 
 $toolbar
 
 $tpl
 
 $obj_definition
 
 $obj_data_cache
 
 $access
 
 $error
 
 $rbacsystem
 
 $user
 
 $rbacreview
 

Private Attributes

 $mode = 0
 
 $sub_mode = self::SUBMODE_COMPLETE
 
 $lng
 
 $parent_obj = null
 
 $type = ''
 
 $sources = array()
 
 $targets = array()
 
 $targets_copy_id = array()
 
 $log = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilObjectCopyGUI::__construct ( ImplementsCreationCallback  $a_parent_gui)

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

References $DIC, $lng, ilLoggerFactory\getLogger(), and user().

132  {
133  global $DIC;
134 
135  $this->ctrl = $DIC->ctrl();
136  $this->tree = $DIC->repositoryTree();
137  $this->tabs = $DIC->tabs();
138  $this->toolbar = $DIC->toolbar();
139  $this->tpl = $DIC["tpl"];
140  $this->obj_definition = $DIC["objDefinition"];
141  $this->obj_data_cache = $DIC["ilObjDataCache"];
142  $this->access = $DIC->access();
143  $this->error = $DIC["ilErr"];
144  $this->rbacsystem = $DIC->rbac()->system();
145  $this->user = $DIC->user();
146  $this->rbacreview = $DIC->rbac()->review();
147  $this->log = $DIC["ilLog"];
148  $ilCtrl = $DIC->ctrl();
149  $lng = $DIC->language();
150 
151  $this->lng = $lng;
152  $this->lng->loadLanguageModule('search');
153  $this->lng->loadLanguageModule('obj');
154  $this->ctrl->saveParameter($this, "crtcb");
155 
156  $this->parent_obj = $a_parent_gui;
157 
158  $this->log = ilLoggerFactory::getLogger('obj');
159  }
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24
static getLogger($a_component_id)
Get component logger.
+ 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)

Returns
type

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

References $_GET, $ctrl, initSourceSelection(), setMode(), setSubMode(), and setTarget().

304  {
305  $ilCtrl = $this->ctrl;
306 
307  $ilCtrl->setParameter($this, 'smode', self::SUBMODE_CONTENT_ONLY);
308  $ilCtrl->setParameter($this, 'selectMode', self::SOURCE_SELECTION);
309 
310 
311  $this->setSubMode(self::SUBMODE_CONTENT_ONLY);
312  $this->setMode(self::SOURCE_SELECTION);
313  $this->setTarget((int) $_GET['ref_id']);
314 
315 
316  return $this->initSourceSelection();
317  }
setMode($a_mode)
set copy mode
initSourceSelection()
Init source selection.
$_GET["client_id"]
setTarget($a_ref_id)
Set single object target.
+ Here is the call graph for this function:

◆ cancel()

ilObjectCopyGUI::cancel ( )
protected

Cancel workflow.

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

References $ctrl.

762  {
763  $ilCtrl = $this->ctrl;
764  $ilCtrl->setReturnByClass(get_class($this->parent_obj), 'cancel');
765  $ilCtrl->returnToParent($this);
766  }

◆ copyContainer()

ilObjectCopyGUI::copyContainer (   $a_target)
protected

Copy a container.

Returns

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

References $_COOKIE, $_GET, $_POST, $access, $ctrl, $error, $ilErr, $ilUser, $log, $rbacsystem, $result, $target_type, $tree, $user, ilObject\_lookupObjId(), ilObject\_lookupType(), getFirstSource(), ilObjectFactory\getInstanceByRefId(), ilLoggerFactory\getLogger(), getSources(), getSubMode(), getType(), and ilUtil\sendFailure().

Referenced by copyContainerToTargets().

1187  {
1188  $ilLog = $this->log;
1189  $ilCtrl = $this->ctrl;
1190 
1191  include_once('./Services/Link/classes/class.ilLink.php');
1192  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
1193 
1194  $ilAccess = $this->access;
1195  $ilErr = $this->error;
1197  $tree = $this->tree;
1198  $ilUser = $this->user;
1199  $ilCtrl = $this->ctrl;
1200 
1201  // Workaround for course in course copy
1202 
1205 
1206  if ($this->getSubMode() != self::SUBMODE_CONTENT_ONLY) {
1207  if (!$rbacsystem->checkAccess('create', $a_target, $this->getType())) {
1208  $this->log->notice('Permission denied for target: ' . $a_target . ' type: ' . $this->getType() . ' CREATE');
1209  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1210  $ilCtrl->returnToParent($this);
1211  }
1212  }
1213  if (!$this->getFirstSource()) {
1214  ilUtil::sendFailure($this->lng->txt('select_one'), true);
1215  $ilCtrl->returnToParent($this);
1216  return false;
1217  }
1218 
1219  $options = $_POST['cp_options'] ? $_POST['cp_options'] : array();
1220 
1221 
1222  ilLoggerFactory::getLogger('obj')->debug('Copy container (sources): ' . print_r($this->getSources(), true));
1223 
1225  $result = $orig->cloneAllObject(
1226  $_COOKIE[session_name()],
1227  $_COOKIE['ilClientId'],
1228  $this->getType(),
1229  $a_target,
1230  $this->getFirstSource(),
1231  $options,
1232  false,
1233  $this->getSubMode()
1234  );
1235  $this->targets_copy_id[$a_target] = $result['copy_id'];
1236  $new_ref_id = (int) $result['ref_id'];
1237  if ($new_ref_id > 0) {
1238  $new_obj = ilObjectFactory::getInstanceByRefId((int) $result['ref_id'], false);
1239  if ($new_obj instanceof ilObject) {
1240  $this->parent_obj->callCreationCallback(
1241  $new_obj,
1242  $this->obj_definition,
1243  $_GET['crtcb'] ?? 0
1244  );
1245  }
1246  }
1247  return $result;
1248  }
getSources()
Get sources.
$target_type
Definition: goto.php:50
$result
$_GET["client_id"]
getType()
Returns $type.
$ilErr
Definition: raiseError.php:18
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static getLogger($a_component_id)
Get component logger.
$ilUser
Definition: imgupload.php:18
$_COOKIE[session_name()]
Definition: xapitoken.php:37
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copyContainerToTargets()

ilObjectCopyGUI::copyContainerToTargets ( )
protected

Copy to multiple targets.

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

References $_SESSION, $ctrl, $result, ilLink\_getLink(), ilCopyWizardOptions\_isFinished(), copyContainer(), ilLoggerFactory\getLogger(), getSources(), getSubMode(), getTargets(), and showCopyProgress().

1103  {
1104  $ilCtrl = $this->ctrl;
1105 
1106  ilLoggerFactory::getLogger('obj')->debug('Copy container to targets: ' . print_r($_REQUEST, true));
1107  ilLoggerFactory::getLogger('obj')->debug('Source(s): ' . print_r($this->getSources(), true));
1108  ilLoggerFactory::getLogger('obj')->debug('Target(s): ' . print_r($this->getTargets(), true));
1109 
1110 
1111  $last_target = 0;
1112  $result = 1;
1113  foreach ($this->getTargets() as $target_ref_id) {
1114  $result = $this->copyContainer($target_ref_id);
1115  $last_target = $target_ref_id;
1116  }
1117 
1118  unset($_SESSION["clipboard"]["ref_ids"]);
1119  unset($_SESSION["clipboard"]["cmd"]);
1120 
1121  include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1122  if (ilCopyWizardOptions::_isFinished($result['copy_id'])) {
1123  ilLoggerFactory::getLogger('obj')->info('Object copy completed.');
1124  ilUtil::sendSuccess($this->lng->txt("object_duplicated"), true);
1125  if ($this->getSubMode() == self::SUBMODE_CONTENT_ONLY) {
1126  // return to parent container
1127  return $this->ctrl->returnToParent($this);
1128  }
1129  // return to last target
1130  $link = ilLink::_getLink($result['ref_id']);
1131  $ilCtrl->redirectToUrl($link);
1132  } else {
1133  // show progress
1134  ilLoggerFactory::getLogger('obj')->debug('Object copy in progress.');
1135  return $this->showCopyProgress();
1136  }
1137  }
getSources()
Get sources.
$_SESSION["AccountId"]
$result
showCopyProgress()
Show progress for copying.
copyContainer($a_target)
Copy a container.
static _isFinished($a_copy_id)
check if copy is finished
getTargets()
Get copy target.
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

◆ copyMultipleNonContainer()

ilObjectCopyGUI::copyMultipleNonContainer (   $a_sources)

Copy multiple non container.

Parameters
array$a_sourcesarray of source ref ids

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

References $_GET, $_SESSION, $access, $ctrl, $ilUser, $obj_definition, $rbacreview, $rbacsystem, $user, ilCopyWizardOptions\_allocateCopyId(), ilCopyWizardOptions\_getInstance(), ilLink\_getLink(), ilObject\_lookupType(), ilRbacLog\add(), ilRbacLog\COPY_OBJECT, ilRbacLog\gatherFaPa(), getFirstTarget(), ilObjectFactory\getInstanceByRefId(), ilLoggerFactory\getLogger(), getSubMode(), getTargets(), ilRbacLog\isActive(), ilUtil\redirect(), and ilUtil\sendFailure().

Referenced by copySingleObject(), and saveTarget().

1002  {
1003  $ilAccess = $this->access;
1006  $ilUser = $this->user;
1007  $ilCtrl = $this->ctrl;
1009 
1010  // check permissions
1011  foreach ($a_sources as $source_ref_id) {
1012  $source_type = ilObject::_lookupType($source_ref_id, true);
1013 
1014  // Create permission
1015  // begin-patch mc
1016  foreach ($this->getTargets() as $target_ref_id) {
1017  if (!$rbacsystem->checkAccess('create', $target_ref_id, $source_type)) {
1018  $this->log->notice('Permission denied for target_id: ' . $target_ref_id . ' source_type: ' . $source_type . ' CREATE');
1019  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1020  $ilCtrl->returnToParent($this);
1021  }
1022  }
1023 
1024  // Copy permission
1025  if (!$ilAccess->checkAccess('copy', '', $source_ref_id)) {
1026  $this->log->notice('Permission denied for source_ref_id: ' . $source_ref_id . ' COPY');
1027  ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1028  $ilCtrl->returnToParent($this);
1029  }
1030 
1031  // check that these objects are really not containers
1032  if ($objDefinition->isContainer($source_type) and $this->getSubMode() != self::SUBMODE_CONTENT_ONLY) {
1033  ilUtil::sendFailure($this->lng->txt('cntr_container_only_on_their_own'), true);
1034  $ilCtrl->returnToParent($this);
1035  }
1036  }
1037 
1038  reset($a_sources);
1039 
1040  ilLoggerFactory::getLogger('obj')->debug('Copy multiple non containers. Sources: ' . print_r($a_sources, true));
1041 
1042  // clone
1043  foreach ($a_sources as $source_ref_id) {
1044  ilLoggerFactory::getLogger('obj')->debug('Copying source ref_id : ' . $source_ref_id);
1045 
1046  // begin-patch mc
1047  foreach ($this->getTargets() as $target_ref_id) {
1048  // Save wizard options
1050  $wizard_options = ilCopyWizardOptions::_getInstance($copy_id);
1051  $wizard_options->saveOwner($ilUser->getId());
1052  $wizard_options->saveRoot((int) $source_ref_id);
1053  $wizard_options->read();
1054 
1055  $orig = ilObjectFactory::getInstanceByRefId((int) $source_ref_id);
1056  $new_obj = $orig->cloneObject($target_ref_id, $copy_id);
1057 
1058  // Delete wizard options
1059  $wizard_options->deleteAll();
1060  $this->parent_obj->callCreationCallback(
1061  $new_obj,
1062  $this->obj_definition,
1063  $_GET['crtcb'] ?? 0
1064  );
1065 
1066  // rbac log
1067  if (ilRbacLog::isActive()) {
1068  $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(), false);
1069  $rbac_log = ilRbacLog::gatherFaPa($new_obj->getRefId(), array_keys($rbac_log_roles), true);
1070  ilRbacLog::add(ilRbacLog::COPY_OBJECT, $new_obj->getRefId(), $rbac_log, (int) $source_ref_id);
1071  }
1072  }
1073  }
1074 
1075  unset($_SESSION["clipboard"]["ref_ids"]);
1076  unset($_SESSION["clipboard"]["cmd"]);
1077 
1078  if (count($a_sources) == 1) {
1079  ilLoggerFactory::getLogger('obj')->info('Object copy completed.');
1080  ilUtil::sendSuccess($this->lng->txt("object_duplicated"), true);
1081  $ref_id = $new_obj->getRefId();
1082  } else {
1083  ilLoggerFactory::getLogger('obj')->info('Object copy completed.');
1084  ilUtil::sendSuccess($this->lng->txt("objects_duplicated"), true);
1085  $ref_id = $this->getFirstTarget();
1086  }
1087 
1088  ilUtil::sendSuccess($this->lng->txt("objects_duplicated"), true);
1090 
1091  // see bug discussion 24472
1092  /*
1093  $gui_fac = new ilObjectGUIFactory();
1094  $obj_gui = $gui_fac->getInstanceByRefId($ref_id);
1095  $obj_gui->redirectAfterCreation();
1096  */
1097  }
$_SESSION["AccountId"]
$_GET["client_id"]
static isActive()
getFirstTarget()
Get first target.
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
static _getInstance($a_copy_id)
Get instance of copy wizard options.
const COPY_OBJECT
static _allocateCopyId()
Allocate a copy for further entries.
getTargets()
Get copy target.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static getLogger($a_component_id)
Get component logger.
$ilUser
Definition: imgupload.php:18
static redirect($a_script)
+ 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.

Returns

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

References $access, $ctrl, $error, $ilErr, $ilUser, $rbacreview, $rbacsystem, $user, copyMultipleNonContainer(), getSources(), and ilUtil\sendFailure().

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

975  {
976  include_once('./Services/Link/classes/class.ilLink.php');
977  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
978 
979  $ilAccess = $this->access;
983  $ilCtrl = $this->ctrl;
985 
986  // Source defined
987  if (!count($this->getSources())) {
988  ilUtil::sendFailure($this->lng->txt('select_one'), true);
989  $ilCtrl->returnToParent($this);
990  }
991 
992  $this->copyMultipleNonContainer($this->getSources());
993  return;
994  }
getSources()
Get sources.
$ilErr
Definition: raiseError.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
copyMultipleNonContainer($a_sources)
Copy multiple non container.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilObjectCopyGUI::executeCommand ( )

Control class handling.

Returns

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

References $ctrl, init(), and initTabs().

166  {
167  $ilCtrl = $this->ctrl;
168 
169  $this->init();
170  $this->initTabs();
171 
172  $next_class = $ilCtrl->getNextClass($this);
173  $cmd = $ilCtrl->getCmd();
174 
175  switch ($next_class) {
176  default:
177  $this->$cmd();
178  break;
179  }
180  }
init()
Init return, mode.
initTabs()
Init tabs General.
+ Here is the call graph for this function:

◆ getFirstSource()

ilObjectCopyGUI::getFirstSource ( )

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

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

706  {
707  if (count($this->sources)) {
708  return $this->sources[0];
709  }
710  return 0;
711  }
+ Here is the caller graph for this function:

◆ getFirstTarget()

ilObjectCopyGUI::getFirstTarget ( )

Get first target.

Returns
int

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

References $targets, and getTargets().

Referenced by copyMultipleNonContainer(), and init().

749  {
750  if (array_key_exists(0, $this->getTargets())) {
751  $targets = $this->getTargets();
752  return $targets[0];
753  }
754  return 0;
755  }
getTargets()
Get copy target.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMode()

ilObjectCopyGUI::getMode ( )

get copy mode

Returns

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

References $mode.

Referenced by setTabs(), and showItemSelection().

642  {
643  return $this->mode;
644  }
+ Here is the caller graph for this function:

◆ getParentObject()

ilObjectCopyGUI::getParentObject ( )

Get parent gui object.

Returns
object parent gui

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

References $parent_obj.

Referenced by init().

661  {
662  return $this->parent_obj;
663  }
+ Here is the caller graph for this function:

◆ getSources()

ilObjectCopyGUI::getSources ( )

Get sources.

Returns
array

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

References $sources.

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

701  {
702  return (array) $this->sources;
703  }
+ Here is the caller graph for this function:

◆ getSubMode()

ilObjectCopyGUI::getSubMode ( )

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

References $sub_mode.

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

652  {
653  return $this->sub_mode;
654  }
+ Here is the caller graph for this function:

◆ getTargets()

ilObjectCopyGUI::getTargets ( )

Get copy target.

Returns

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

References $targets.

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

740  {
741  return (array) $this->targets;
742  }
+ Here is the caller graph for this function:

◆ getType()

ilObjectCopyGUI::getType ( )

Returns $type.

See also
ilObjectCopyGUI::$type

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

References $type.

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

671  {
672  return $this->type;
673  }
+ Here is the caller graph for this function:

◆ init()

ilObjectCopyGUI::init ( )
protected

Init return, mode.

Returns

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

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

Referenced by executeCommand().

187  {
188  $ilCtrl = $this->ctrl;
189 
190  if ((int) $_REQUEST['smode']) {
191  $this->setSubMode((int) $_REQUEST['smode']);
192  $ilCtrl->setParameter($this, 'smode', $this->getSubMode());
193  ilLoggerFactory::getLogger('obj')->debug('Submode is: ' . $this->getSubMode());
194  }
195 
196  // save sources
197  if ($_REQUEST['source_ids']) {
198  $this->setSource(explode('_', $_REQUEST['source_ids']));
199  $ilCtrl->setParameter($this, 'source_ids', implode('_', $this->getSources()));
200  ilLoggerFactory::getLogger('obj')->debug('Multiple sources: ' . implode('_', $this->getSources()));
201  }
202  if ($_REQUEST['source_id']) {
203  $this->setSource(array((int) $_REQUEST['source_id']));
204  $ilCtrl->setParameter($this, 'source_ids', implode('_', $this->getSources()));
205  ilLoggerFactory::getLogger('obj')->debug('source_id is set: ' . implode('_', $this->getSources()));
206  }
207  if ($this->getFirstSource()) {
208  $this->setType(
210  );
211  }
212 
213  // creation screen: copy section
214  if ($_REQUEST['new_type']) {
215  $this->setMode(self::SEARCH_SOURCE);
216  $this->setType($_REQUEST['new_type']);
217  $this->setTarget((int) $_GET['ref_id']);
218 
219  $ilCtrl->setParameter($this, 'new_type', $this->getType());
220  $ilCtrl->setParameterByClass(get_class($this->getParentObject()), 'new_type', $this->getType());
221  $ilCtrl->setParameterByClass(get_class($this->getParentObject()), 'cpfl', 1);
222  $ilCtrl->setReturnByClass(get_class($this->getParentObject()), 'create');
223 
224  ilLoggerFactory::getLogger('obj')->debug('Copy from object creation for type: ' . $this->getType());
225  return true;
226  }
227  // adopt content, and others?
228  elseif ($_REQUEST['selectMode'] == self::SOURCE_SELECTION) {
229  $this->setMode(self::SOURCE_SELECTION);
230 
231  $ilCtrl->setParameterByClass(get_class($this->parent_obj), 'selectMode', self::SOURCE_SELECTION);
232  $this->setTarget((int) $_GET['ref_id']);
233  $ilCtrl->setReturnByClass(get_class($this->parent_obj), '');
234 
235  ilLoggerFactory::getLogger('obj')->debug('Source selection mode. Target is: ' . $this->getFirstTarget());
236  } elseif ($_REQUEST['selectMode'] == self::TARGET_SELECTION) {
237  $this->setMode(self::TARGET_SELECTION);
238  $ilCtrl->setReturnByClass(get_class($this->parent_obj), '');
239  ilLoggerFactory::getLogger('obj')->debug('Target selection mode.');
240  }
241 
242 
243  // save targets
244  if ($_REQUEST['target_ids']) {
245  $this->setTargets(explode('_', $_REQUEST['target_ids']));
246  ilLoggerFactory::getLogger('obj')->debug('targets are: ' . print_r($this->getTargets(), true));
247  }
248  }
getSources()
Get sources.
setTargets(array $a_target)
Set target id.
setMode($a_mode)
set copy mode
$_GET["client_id"]
setTarget($a_ref_id)
Set single object target.
getFirstTarget()
Get first target.
getType()
Returns $type.
setSource(array $a_source_ids)
Set source id.
getParentObject()
Get parent gui object.
static _lookupObjId($a_id)
getTargets()
Get copy target.
static _lookupType($a_id, $a_reference=false)
lookup object type
static getLogger($a_component_id)
Get component logger.
setType($type)
Sets $type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormSearch()

ilObjectCopyGUI::initFormSearch ( )
protected

Init search form.

Returns

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

References $ctrl, $lng, and getType().

Referenced by searchSource(), and showSourceSearch().

1296  {
1297  $lng = $this->lng;
1298  $ilCtrl = $this->ctrl;
1299 
1300  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1301  $this->form = new ilPropertyFormGUI();
1302  $this->form->setTableWidth('600px');
1303 
1304  $ilCtrl->setParameter($this, 'new_type', $this->getType());
1305 
1306  #$ilCtrl->setParameter($this, 'cp_mode', self::SOURCE_SELECTION);
1307  $this->form->setFormAction($ilCtrl->getFormAction($this));
1308  $this->form->setTitle($lng->txt($this->getType() . '_copy'));
1309 
1310  $this->form->addCommandButton('searchSource', $lng->txt('btn_next'));
1311  $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
1312 
1313  $tit = new ilTextInputGUI($lng->txt('title'), 'tit');
1314  $tit->setSize(40);
1315  $tit->setMaxLength(70);
1316  $tit->setRequired(true);
1317  $tit->setInfo($lng->txt('wizard_title_info'));
1318  $this->form->addItem($tit);
1319  }
This class represents a property form user interface.
getType()
Returns $type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSourceSelection()

ilObjectCopyGUI::initSourceSelection ( )
protected

Init source selection.

Returns

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

References $_SESSION, $ctrl, $tree, getTargets(), setTabs(), and showSourceSelectionTree().

Referenced by adoptContent().

360  {
361  $ilCtrl = $this->ctrl;
362  $tree = $this->tree;
363 
364  // empty session on init
365  $_SESSION['paste_copy_repexpand'] = array();
366 
367  // copy opened nodes from repository explorer
368  $_SESSION['paste_copy_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
369 
370  $this->setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_SOURCE_TREE);
371 
372 
373  // open current position
374  // begin-patch mc
375  foreach ($this->getTargets() as $target_ref_id) {
376  $path = $tree->getPathId($target_ref_id);
377  foreach ((array) $path as $node_id) {
378  if (!in_array($node_id, $_SESSION['paste_copy_repexpand'])) {
379  $_SESSION['paste_copy_repexpand'][] = $node_id;
380  }
381  }
382  }
383  // end-patch multi copy
384  $ilCtrl->setReturnByClass(get_class($this->parent_obj), '');
385  $this->showSourceSelectionTree();
386  }
$_SESSION["AccountId"]
setTabs($a_tab_group, $a_active_tab)
Set tabs.
getTargets()
Get copy target.
showSourceSelectionTree()
Show target selection.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initTabs()

ilObjectCopyGUI::initTabs ( )
protected

Init tabs General.

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

References $ctrl, $lng, and $tabs.

Referenced by executeCommand().

255  {
256  $lng = $this->lng;
257  $ilTabs = $this->tabs;
258  $ilCtrl = $this->ctrl;
259 
260  $lng->loadLanguageModule('cntr');
261  $ilTabs->clearTargets();
262  $ilTabs->setBackTarget(
263  $lng->txt('tab_back_to_repository'),
264  $ilCtrl->getParentReturn($this->parent_obj)
265  );
266  }
+ Here is the caller graph for this function:

◆ initTargetSelection()

ilObjectCopyGUI::initTargetSelection ( )
protected

Init copy from repository/search list commands.

Returns

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

References $_SESSION, $ctrl, $tree, getSources(), setTargets(), and showTargetSelectionTree().

324  {
325  $ilCtrl = $this->ctrl;
326  $tree = $this->tree;
327  $ilCtrl->setParameter($this, 'selectMode', self::TARGET_SELECTION);
328  // empty session on init
329  $_SESSION['paste_copy_repexpand'] = array();
330 
331  // copy opened nodes from repository explorer
332  $_SESSION['paste_copy_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
333 
334  // begin-patch mc
335  $this->setTargets(array());
336  // cognos-blu-patch: end
337 
338  // open current position
339 
340  foreach ($this->getSources() as $source_id) {
341  if ($source_id) {
342  $path = $tree->getPathId($source_id);
343  foreach ((array) $path as $node_id) {
344  if (!in_array($node_id, $_SESSION['paste_copy_repexpand'])) {
345  $_SESSION['paste_copy_repexpand'][] = $node_id;
346  }
347  }
348  }
349  }
350 
351  $ilCtrl->setReturnByClass(get_class($this->parent_obj), '');
352  $this->showTargetSelectionTree();
353  }
getSources()
Get sources.
setTargets(array $a_target)
Set target id.
$_SESSION["AccountId"]
showTargetSelectionTree()
Show target selection.
+ Here is the call graph for this function:

◆ keepObjectsInClipboard()

ilObjectCopyGUI::keepObjectsInClipboard ( )

Keep objects in clipboard.

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

References $_SESSION, $ctrl, and getSources().

772  {
773  ilUtil::sendSuccess($this->lng->txt("obj_inserted_clipboard"), true);
774  $ilCtrl = $this->ctrl;
775  $_SESSION['clipboard']['cmd'] = "copy";
776  $_SESSION['clipboard']['ref_ids'] = $this->getSources();
777  $ilCtrl->returnToParent($this);
778  }
getSources()
Get sources.
$_SESSION["AccountId"]
+ Here is the call graph for this function:

◆ saveSource()

ilObjectCopyGUI::saveSource ( )
protected

select source object

Returns

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

References $_POST, $ctrl, $obj_definition, $target_type, ilObject\_lookupType(), copySingleObject(), ilObjectFactory\getClassByType(), getSources(), getSubMode(), getTargets(), searchSource(), ilUtil\sendFailure(), setSource(), setType(), and showItemSelection().

846  {
848  $ilCtrl = $this->ctrl;
849 
850  if (isset($_POST['source'])) {
851  $this->setSource(array((int) $_REQUEST['source']));
852  $this->setType(ilObject::_lookupType((int) $_REQUEST['source'], true));
853  $ilCtrl->setParameter($this, 'source_id', (int) $_REQUEST['source']);
854  } else {
855  ilUtil::sendFailure($this->lng->txt('select_one'));
856  $this->searchSource();
857  return false;
858  }
859 
860  // validate allowed subtypes
861  foreach ($this->getSources() as $source_ref_id) {
862  foreach ((array) $this->getTargets() as $target_ref_id) {
863  $target_type = ilObject::_lookupType($target_ref_id, true);
864  $target_class_name = ilObjectFactory::getClassByType($target_type);
865  $target_object = new $target_class_name($target_ref_id);
866  $possible_subtypes = $target_object->getPossibleSubObjects();
867 
868  $source_type = ilObject::_lookupType($source_ref_id, true);
869 
870  if (!array_key_exists($source_type, $possible_subtypes)) {
871  #ilLoggerFactory::getLogger('obj')->debug('Source type: '. $source_type);
872  #ilLoggerFactory::getLogger('obj')->debug('Target type: '. $target_type);
873  #ilLoggerFactory::getLogger('obj')->debug('Submode: '. $this->getSubMode());
874 
875  // adopt content mode
876  if (
877  $this->getSubMode() != self::SUBMODE_CONTENT_ONLY and
878  ($source_type != 'crs' or $target_type != 'crs')
879  ) {
881  sprintf(
882  $this->lng->txt('msg_obj_may_not_contain_objects_of_type'),
883  $this->lng->txt('obj_' . $target_type),
884  $this->lng->txt('obj_' . $source_type)
885  )
886  );
887  $this->searchSource();
888  return false;
889  }
890  }
891  }
892  }
893 
894 
895  if ($objDefinition->isContainer($this->getType())) {
896  $this->showItemSelection();
897  } else {
898  $this->copySingleObject();
899  }
900  }
static getClassByType($a_obj_type)
Get class by type.
getSources()
Get sources.
$target_type
Definition: goto.php:50
setSource(array $a_source_ids)
Set source id.
copySingleObject()
Start cloning a single (not container) object.
getTargets()
Get copy target.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
searchSource()
Search source.
$_POST["username"]
setType($type)
Sets $type.
+ Here is the call graph for this function:

◆ saveSourceMembership()

ilObjectCopyGUI::saveSourceMembership ( )
protected

Save selected source from membership screen.

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

References $ctrl, $obj_definition, ilObject\_lookupType(), copySingleObject(), getFirstSource(), ilUtil\sendFailure(), setSource(), setType(), and showItemSelection().

906  {
908  $ilCtrl = $this->ctrl;
909 
910  if (!isset($_REQUEST['source'])) {
911  ilUtil::sendFailure($this->lng->txt('select_one'));
912  $ilCtrl->redirect($this, 'showSourceSelectionMembership');
913  return false;
914  }
915 
916  $this->setSource(array((int) $_REQUEST['source']));
917  $this->setType(ilObject::_lookupType((int) $this->getFirstSource(), true));
918  $ilCtrl->setParameter($this, 'source_id', (int) $_REQUEST['source']);
919 
920  if ($objDefinition->isContainer($this->getType())) {
921  $this->showItemSelection();
922  } else {
923  $this->copySingleObject();
924  }
925  }
setSource(array $a_source_ids)
Set source id.
copySingleObject()
Start cloning a single (not container) object.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
setType($type)
Sets $type.
+ Here is the call graph for this function:

◆ saveTarget()

ilObjectCopyGUI::saveTarget ( )
protected

Save target selection.

Returns

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

References $ctrl, $obj_definition, $target_type, $tree, ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), copyMultipleNonContainer(), copySingleObject(), ilObjectFactory\getClassByType(), getFirstSource(), getSources(), getTargets(), ilUtil\sendFailure(), setTarget(), setTargets(), showItemSelection(), and showTargetSelectionTree().

550  {
552  $tree = $this->tree;
553  $ilCtrl = $this->ctrl;
554 
555 
556  // begin-patch mc
557  if (is_array($_REQUEST['target']) and $_REQUEST['target']) {
558  $this->setTargets($_REQUEST['target']);
559  $ilCtrl->setParameter($this, 'target_ids', implode('_', $this->getTargets()));
560  }
561  // paste from clipboard
562  elseif ((int) $_REQUEST['target']) {
563  $this->setTarget($_REQUEST['target']);
564  $ilCtrl->setParameter($this, 'target_ids', implode('_', $this->getTargets()));
565  }
566  // end-patch multi copy
567  else {
568  $ilCtrl->setParameter($this, 'selectMode', self::TARGET_SELECTION);
569  ilUtil::sendFailure($this->lng->txt('select_one'));
570  $this->showTargetSelectionTree();
571  return false;
572  }
573 
574  // validate allowed subtypes
575  foreach ($this->getSources() as $source_ref_id) {
576  foreach ((array) $this->getTargets() as $target_ref_id) {
577  $target_type = ilObject::_lookupType($target_ref_id, true);
578  $target_class_name = ilObjectFactory::getClassByType($target_type);
579  $target_object = new $target_class_name($target_ref_id);
580  $possible_subtypes = $target_object->getPossibleSubObjects();
581 
582  $source_type = ilObject::_lookupType($source_ref_id, true);
583 
584  if (!array_key_exists($source_type, (array) $possible_subtypes)) {
586  sprintf(
587  $this->lng->txt('msg_obj_may_not_contain_objects_of_type'),
588  $this->lng->txt('obj_' . $target_type),
589  $this->lng->txt('obj_' . $source_type)
590  )
591  );
592  $this->showTargetSelectionTree();
593  return false;
594  }
595  }
596  }
597 
598  if (count($this->getSources()) == 1 && $objDefinition->isContainer($this->getType())) {
599  // check, if object should be copied into itself
600  // begin-patch mc
601  $is_child = array();
602  foreach ($this->getTargets() as $target_ref_id) {
603  if ($tree->isGrandChild($this->getFirstSource(), $target_ref_id)) {
605  }
606  if ($this->getFirstSource() == $target_ref_id) {
608  }
609  }
610  // end-patch multi copy
611  if (count($is_child) > 0) {
612  ilUtil::sendFailure($this->lng->txt("msg_not_in_itself") . " " . implode(',', $is_child));
613  $this->showTargetSelectionTree();
614  return false;
615  }
616 
617  $this->showItemSelection();
618  } else {
619  if (count($this->getSources()) == 1) {
620  $this->copySingleObject();
621  } else {
622  $this->copyMultipleNonContainer($this->getSources());
623  }
624  }
625  }
static getClassByType($a_obj_type)
Get class by type.
getSources()
Get sources.
setTargets(array $a_target)
Set target id.
$target_type
Definition: goto.php:50
setTarget($a_ref_id)
Set single object target.
static _lookupTitle($a_id)
lookup object title
static _lookupObjId($a_id)
copySingleObject()
Start cloning a single (not container) object.
getTargets()
Get copy target.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
showTargetSelectionTree()
Show target selection.
copyMultipleNonContainer($a_sources)
Copy multiple non container.
+ Here is the call graph for this function:

◆ searchSource()

ilObjectCopyGUI::searchSource ( )
protected

Search source.

Returns

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

References $_POST, $_SESSION, $ctrl, $lng, $obj_data_cache, $res, $results, $tpl, $tree, getFirstSource(), getType(), initFormSearch(), QP_COMBINATION_AND, ROOT_FOLDER_ID, ilUtil\sendFailure(), ilUtil\sendInfo(), and ilQueryParser\setMinWordLength().

Referenced by saveSource(), and showItemSelection().

786  {
787  $tree = $this->tree;
788  $ilObjDataCache = $this->obj_data_cache;
789  $lng = $this->lng;
790  $ilCtrl = $this->ctrl;
791  $tpl = $this->tpl;
792 
793  if (isset($_POST['tit'])) {
794  ilUtil::sendInfo($this->lng->txt('wizard_search_list'));
795  $_SESSION['source_query'] = $_POST['tit'];
796  } else {
797  $_POST['tit'] = $_SESSION['source_query'];
798  }
799 
800  $this->initFormSearch();
801  $this->form->setValuesByPost();
802 
803  if (!$this->form->checkInput()) {
804  ilUtil::sendFailure($lng->txt('msg_no_search_string'), true);
805  $ilCtrl->returnToParent($this);
806  return false;
807  }
808 
809  include_once './Services/Search/classes/class.ilQueryParser.php';
810  $query_parser = new ilQueryParser($this->form->getInput('tit'));
811  $query_parser->setMinWordLength(1, true);
812  $query_parser->setCombination(QP_COMBINATION_AND);
813  $query_parser->parse();
814  if (!$query_parser->validate()) {
815  ilUtil::sendFailure($query_parser->getMessage(), true);
816  $ilCtrl->returnToParent($this);
817  }
818 
819  // only like search since fulltext does not support search with less than 3 characters
820  include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
821  $object_search = new ilLikeObjectSearch($query_parser);
822  $object_search->setFilter(array($_REQUEST['new_type']));
823  $res = $object_search->performSearch();
824  $res->setRequiredPermission('copy');
825  $res->filter(ROOT_FOLDER_ID, true);
826 
827  if (!count($results = $res->getResultsByObjId())) {
828  ilUtil::sendFailure($this->lng->txt('search_no_match'), true);
829  $ilCtrl->returnToParent($this);
830  }
831 
832 
833  include_once './Services/Object/classes/class.ilObjectCopySearchResultTableGUI.php';
834  $table = new ilObjectCopySearchResultTableGUI($this, 'searchSource', $this->getType());
835  $table->setFormAction($ilCtrl->getFormAction($this));
836  $table->setSelectedReference($this->getFirstSource());
837  $table->parseSearchResults($results);
838  $tpl->setContent($table->getHTML());
839  }
$_SESSION["AccountId"]
const ROOT_FOLDER_ID
Definition: constants.php:30
initFormSearch()
Init search form.
getType()
Returns $type.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
foreach($_POST as $key=> $value) $res
$results
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const QP_COMBINATION_AND
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setMinWordLength($a_length, $a_force=false)
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMode()

ilObjectCopyGUI::setMode (   $a_mode)

set copy mode

Parameters
int$a_mode
Returns

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

Referenced by adoptContent(), and init().

633  {
634  $this->mode = $a_mode;
635  }
+ Here is the caller graph for this function:

◆ setSource()

ilObjectCopyGUI::setSource ( array  $a_source_ids)

Set source id.

Parameters
array$a_source_id
Returns

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

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

692  {
693  $this->sources = $a_source_ids;
694  }
+ Here is the caller graph for this function:

◆ setSubMode()

ilObjectCopyGUI::setSubMode (   $a_mode)

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

Referenced by adoptContent(), and init().

647  {
648  $this->sub_mode = $a_mode;
649  }
+ Here is the caller graph for this function:

◆ setTabs()

ilObjectCopyGUI::setTabs (   $a_tab_group,
  $a_active_tab 
)
protected

Set tabs.

Parameters
type$a_tab_group
type$a_active_tab

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

References $ctrl, $lng, $tabs, getMode(), and getSubMode().

Referenced by initSourceSelection(), and showSourceSelectionMembership().

274  {
275  $lng = $this->lng;
276  $ilTabs = $this->tabs;
277  $ilCtrl = $this->ctrl;
278 
279  if ($a_tab_group == self::TAB_GROUP_SC_SELECTION) {
280  if ($this->getSubMode() == self::SUBMODE_CONTENT_ONLY) {
281  if ($this->getMode() == self::SOURCE_SELECTION) {
282  $ilTabs->addTab(
283  self::TAB_SELECTION_SOURCE_TREE,
284  $lng->txt('cntr_copy_repo_tree'),
285  $ilCtrl->getLinkTarget($this, 'initSourceSelection')
286  );
287  $ilTabs->addTab(
288  self::TAB_SELECTION_MEMBERSHIP,
289  $lng->txt('cntr_copy_crs_grp'),
290  $ilCtrl->getLinkTarget($this, 'showSourceSelectionMembership')
291  );
292  }
293  }
294  }
295  $ilTabs->activateTab($a_active_tab);
296  }
getMode()
get copy mode
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTarget()

ilObjectCopyGUI::setTarget (   $a_ref_id)

Set single object target.

Parameters
type$a_ref_id

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

References setTargets().

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

720  {
721  $this->setTargets(array($a_ref_id));
722  }
setTargets(array $a_target)
Set target id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTargets()

ilObjectCopyGUI::setTargets ( array  $a_target)

Set target id.

Parameters
int$a_target
Returns

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

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

731  {
732  $this->targets = $a_target;
733  }
+ Here is the caller graph for this function:

◆ setType()

ilObjectCopyGUI::setType (   $type)

Sets $type.

Parameters
object$type
See also
ilObjectCopyGUI::$type

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

References $type.

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

682  {
683  $this->type = $type;
684  }
+ Here is the caller graph for this function:

◆ showCopyProgress()

ilObjectCopyGUI::showCopyProgress ( )
protected

Show progress for copying.

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

References $_GET, $ctrl, and $tpl.

Referenced by copyContainerToTargets().

1143  {
1144  $ilCtrl = $this->ctrl;
1145  $tpl = $this->tpl;
1146 
1147  include_once './Services/Object/classes/class.ilObjectCopyProgressTableGUI.php';
1148  $progress = new ilObjectCopyProgressTableGUI(
1149  $this,
1150  'showCopyProgress',
1151  (int) $_GET['ref_id']
1152  );
1153  $progress->setObjectInfo($this->targets_copy_id);
1154  $progress->parse();
1155  $progress->init();
1156  $progress->setRedirectionUrl($ilCtrl->getParentReturn($this->parent_obj));
1157 
1158  $tpl->setContent($progress->getHTML());
1159  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ showItemSelection()

ilObjectCopyGUI::showItemSelection ( )
protected
Returns

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

References $tpl, getFirstSource(), ilLoggerFactory\getLogger(), getMode(), getSources(), getTargets(), getType(), searchSource(), ilUtil\sendFailure(), and ilUtil\sendInfo().

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

932  {
933  $tpl = $this->tpl;
934 
935  if (!count($this->getSources())) {
936  ilUtil::sendFailure($this->lng->txt('select_one'));
937  $this->searchSource();
938  return false;
939  }
940 
941  ilLoggerFactory::getLogger('obj')->debug('Source(s): ' . print_r($this->getSources(), true));
942  ilLoggerFactory::getLogger('obj')->debug('Target(s): ' . print_r($this->getTargets(), true));
943 
944  ilUtil::sendInfo($this->lng->txt($this->getType() . '_copy_threads_info'));
945  include_once './Services/Object/classes/class.ilObjectCopySelectionTableGUI.php';
946 
947  $tpl->addJavaScript('./Services/CopyWizard/js/ilContainer.js');
948  $tpl->setVariable('BODY_ATTRIBUTES', 'onload="ilDisableChilds(\'cmd\');"');
949 
950  switch ($this->getMode()) {
951  case self::SOURCE_SELECTION:
952  $back_cmd = 'adoptContent';
953  break;
954 
955  case self::TARGET_SELECTION:
956  $back_cmd = 'showTargetSelectionTree';
957  break;
958 
959  case self::SEARCH_SOURCE:
960  $back_cmd = 'searchSource';
961  break;
962  }
963 
964  $table = new ilObjectCopySelectionTableGUI($this, 'showItemSelection', $this->getType(), $back_cmd);
965  $table->parseSource($this->getFirstSource());
966 
967  $tpl->setContent($table->getHTML());
968  }
getSources()
Get sources.
getType()
Returns $type.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
getMode()
get copy mode
getTargets()
Get copy target.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static getLogger($a_component_id)
Get component logger.
searchSource()
Search source.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showSourceSearch()

ilObjectCopyGUI::showSourceSearch (   $a_tplvar)

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

Parameters
string$a_tplvarThe tpl variable to fill
Returns

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

References $tpl, initFormSearch(), and unsetSession().

1260  {
1261  $tpl = $this->tpl;
1262 
1263  // Disabled for performance
1264  #if(!$this->sourceExists())
1265  #{
1266  # return false;
1267  #}
1268 
1269  $this->unsetSession();
1270  $this->initFormSearch();
1271 
1272  if ($a_tplvar) {
1273  $tpl->setVariable($a_tplvar, $this->form->getHTML());
1274  } else {
1275  return $this->form;
1276  }
1277  }
initFormSearch()
Init search form.
unsetSession()
Unset session variables.
+ Here is the call graph for this function:

◆ showSourceSelectionMembership()

ilObjectCopyGUI::showSourceSelectionMembership ( )
protected

show target selection membership

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

References $tpl, $user, ilParticipants\_getMembershipByType(), ilUtil\sendInfo(), and setTabs().

393  {
394  $user = $this->user;
395  $tpl = $this->tpl;
396 
397  ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard_source'));
398  $this->setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_MEMBERSHIP);
399 
400  include_once './Services/Object/classes/class.ilObjectCopyCourseGroupSelectionTableGUI.php';
401  $cgs = new ilObjectCopyCourseGroupSelectionTableGUI($this, 'showSourceSelectionMembership', 'copy_selection_membership');
402  $cgs->init();
403  $cgs->setObjects(
404  array_merge(
405  ilParticipants::_getMembershipByType($user->getId(), 'crs', false),
406  ilParticipants::_getMembershipByType($user->getId(), 'grp', false)
407  )
408  );
409  $cgs->parse();
410 
411  $tpl->setContent($cgs->getHTML());
412  }
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
setTabs($a_tab_group, $a_active_tab)
Set tabs.
+ Here is the call graph for this function:

◆ showSourceSelectionTree()

ilObjectCopyGUI::showSourceSelectionTree ( )

Show target selection.

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

References $_GET, $container, $ctrl, $toolbar, $tpl, $tree, getSources(), ilPasteIntoMultipleItemsExplorer\SEL_TYPE_RADIO, and ilUtil\sendInfo().

Referenced by initSourceSelection().

488  {
489  $ilToolbar = $this->toolbar;
490  $ilCtrl = $this->ctrl;
491  $tree = $this->tree;
492  $tpl = $this->tpl;
493 
494  $this->tpl = $tpl;
495  $this->tpl->addBlockfile(
496  'ADM_CONTENT',
497  'adm_content',
498  'tpl.paste_into_multiple_objects.html',
499  "Services/Object"
500  );
501 
502  ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard_source'));
503  include_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
506  'ilias.php?baseClass=ilRepositoryGUI&cmd=goto',
507  'paste_copy_repexpand'
508  );
509  $exp->setRequiredFormItemPermission('visible,read,copy');
510 
511  $ilCtrl->setParameter($this, 'selectMode', self::SOURCE_SELECTION);
512  $exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'showSourceSelectionTree'));
513  $exp->setTargetGet('ref_id');
514  $exp->setPostVar('source');
515  $exp->setCheckedItems($this->getSources());
516 
517  // Filter to container
518  foreach (array('cat','root','fold') as $container) {
519  $exp->removeFormItemForType($container);
520  }
521 
522 
523  if ($_GET['paste_copy_repexpand'] == '') {
524  $expanded = $tree->readRootId();
525  } else {
526  $expanded = $_GET['paste_copy_repexpand'];
527  }
528 
529  $this->tpl->setVariable('FORM_TARGET', '_self');
530  $this->tpl->setVariable('FORM_ACTION', $ilCtrl->getFormAction($this, 'copySelection'));
531 
532  $exp->setExpand($expanded);
533  // build html-output
534  $exp->setOutput(0);
535  $output = $exp->getOutput();
536 
537  $this->tpl->setVariable('OBJECT_TREE', $output);
538 
539  $this->tpl->setVariable('CMD_SUBMIT', 'saveSource');
540  $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('btn_next'));
541 
542  $ilToolbar->addButton($this->lng->txt('cancel'), $ilCtrl->getLinkTarget($this, 'cancel'));
543  }
getSources()
Get sources.
$_GET["client_id"]
$container
Definition: wac.php:13
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showTargetSelectionTree()

ilObjectCopyGUI::showTargetSelectionTree ( )

Show target selection.

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

References $ctrl, $lng, $obj_definition, $tabs, $toolbar, $tpl, $tree, ilUtil\getImagePath(), ilSubmitButton\getInstance(), and ilUtil\sendInfo().

Referenced by initTargetSelection(), and saveTarget().

419  {
420  $ilTabs = $this->tabs;
421  $ilToolbar = $this->toolbar;
422  $ilCtrl = $this->ctrl;
423  $tree = $this->tree;
424  $tpl = $this->tpl;
426  $lng = $this->lng;
427 
428  $this->tpl = $tpl;
429 
430  if ($objDefinition->isContainer($this->getType())) {
431  ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard_container'));
432  } else {
433  ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard'));
434  }
435 
436  //
437  include_once("./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
438  $exp = new ilRepositorySelectorExplorerGUI($this, "showTargetSelectionTree");
439  $exp->setTypeWhiteList(array("root", "cat", "grp", "crs", "fold", "lso", "prg"));
440  $exp->setSelectMode("target", true);
441  if ($exp->handleCommand()) {
442  return;
443  }
444  $output = $exp->getHTML();
445 
446  // toolbars
447  $t = new ilToolbarGUI();
448  $t->setFormAction($ilCtrl->getFormAction($this, "saveTarget"));
449  if ($objDefinition->isContainer($this->getType())) {
451  $btn->setCaption('btn_next');
452  $btn->setCommand('saveTarget');
453  $btn->setPrimary(true);
454  $t->addButtonInstance($btn);
455  } else {
457  $btn->setCaption('paste');
458  $btn->setCommand('saveTarget');
459  $btn->setPrimary(true);
460  $t->addButtonInstance($btn);
461  }
462  $t->addSeparator();
463  $clipboard_btn = ilSubmitButton::getInstance();
464  $clipboard_btn->setCaption('obj_insert_into_clipboard');
465  $clipboard_btn->setCommand('keepObjectsInClipboard');
466  $t->addButtonInstance($clipboard_btn);
467  $cancel_btn = ilSubmitButton::getInstance();
468  $cancel_btn->setCaption('cancel');
469  $cancel_btn->setCommand('cancel');
470  $t->addButtonInstance($cancel_btn);
471  $t->setCloseFormTag(false);
472  $t->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " ");
473  $output = $t->getHTML() . $output;
474  $t->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " ");
475  $t->setCloseFormTag(true);
476  $t->setOpenFormTag(false);
477  $output .= "<br />" . $t->getHTML();
478 
479  $this->tpl->setContent($output);
480 
481  return;
482  }
Explorer for selecting repository items.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $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.

Returns
bool

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

References $ilUser, $user, ilUtil\_getObjectsByOperations(), and getType().

1285  {
1286  $ilUser = $this->user;
1287 
1288  return (bool) ilUtil::_getObjectsByOperations($this->getType(), 'copy', $ilUser->getId(), 1);
1289  }
static _getObjectsByOperations($a_obj_type, $a_operation, $a_usr_id=0, $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.
getType()
Returns $type.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ unsetSession()

ilObjectCopyGUI::unsetSession ( )
protected

Unset session variables.

Returns

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

References $_SESSION, and setSource().

Referenced by showSourceSearch().

1326  {
1327  unset($_SESSION['source_query']);
1328  $this->setSource(array());
1329  }
$_SESSION["AccountId"]
setSource(array $a_source_ids)
Set source id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateProgress()

ilObjectCopyGUI::updateProgress ( )
protected

Update progress.

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

References ilCopyWizardOptions\_getInstance(), exit, and ilLoggerFactory\getLogger().

1165  {
1166  $json = new stdClass();
1167  $json->percentage = null;
1168  $json->performed_steps = null;
1169 
1170  include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1171  $options = ilCopyWizardOptions::_getInstance((int) $_REQUEST['copy_id']);
1172  $json->required_steps = $options->getRequiredSteps();
1173  $json->id = (int) $_REQUEST['copy_id'];
1174 
1175  ilLoggerFactory::getLogger('obj')->debug('Update copy progress: ' . json_encode($json));
1176 
1177  echo json_encode($json);
1178  exit;
1179  }
exit
Definition: login.php:29
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

Field Documentation

◆ $access

ilObjectCopyGUI::$access
protected

◆ $ctrl

◆ $error

ilObjectCopyGUI::$error
protected

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

Referenced by copyContainer(), and copySingleObject().

◆ $lng

ilObjectCopyGUI::$lng
private

◆ $log

ilObjectCopyGUI::$log = null
private

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

Referenced by copyContainer().

◆ $mode

ilObjectCopyGUI::$mode = 0
private

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

Referenced by getMode().

◆ $obj_data_cache

ilObjectCopyGUI::$obj_data_cache
protected

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

Referenced by searchSource().

◆ $obj_definition

ilObjectCopyGUI::$obj_definition
protected

◆ $parent_obj

ilObjectCopyGUI::$parent_obj = null
private

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

Referenced by getParentObject().

◆ $rbacreview

ilObjectCopyGUI::$rbacreview
protected

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

Referenced by copyMultipleNonContainer(), and copySingleObject().

◆ $rbacsystem

ilObjectCopyGUI::$rbacsystem
protected

◆ $sources

ilObjectCopyGUI::$sources = array()
private

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

Referenced by getSources().

◆ $sub_mode

ilObjectCopyGUI::$sub_mode = self::SUBMODE_COMPLETE
private

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

Referenced by getSubMode().

◆ $tabs

ilObjectCopyGUI::$tabs
protected

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

Referenced by initTabs(), setTabs(), and showTargetSelectionTree().

◆ $targets

ilObjectCopyGUI::$targets = array()
private

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

Referenced by getFirstTarget(), and getTargets().

◆ $targets_copy_id

ilObjectCopyGUI::$targets_copy_id = array()
private

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

◆ $toolbar

ilObjectCopyGUI::$toolbar
protected

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

Referenced by showSourceSelectionTree(), and showTargetSelectionTree().

◆ $tpl

◆ $tree

◆ $type

ilObjectCopyGUI::$type = ''
private

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

Referenced by getType(), and setType().

◆ $user

ilObjectCopyGUI::$user
protected

◆ SEARCH_SOURCE

const ilObjectCopyGUI::SEARCH_SOURCE = 3

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

◆ SOURCE_SELECTION

const ilObjectCopyGUI::SOURCE_SELECTION = 1

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

◆ SUBMODE_COMPLETE

const ilObjectCopyGUI::SUBMODE_COMPLETE = 1

Definition at line 98 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 107 of file class.ilObjectCopyGUI.php.

◆ TAB_SELECTION_MEMBERSHIP

const ilObjectCopyGUI::TAB_SELECTION_MEMBERSHIP = 3

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

◆ TAB_SELECTION_SOURCE_TREE

const ilObjectCopyGUI::TAB_SELECTION_SOURCE_TREE = 2

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

◆ TAB_SELECTION_TARGET_TREE

const ilObjectCopyGUI::TAB_SELECTION_TARGET_TREE = 1

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

◆ TARGET_SELECTION

const ilObjectCopyGUI::TARGET_SELECTION = 2

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


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