ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilObjectCopyGUI Class Reference

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

+ Collaboration diagram for ilObjectCopyGUI:

Public Member Functions

 __construct ($a_parent_gui)
 Constructor. More...
 
 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...
 
 getSource ()
 Get 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...
 

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 (   $a_parent_gui)

Constructor.

Returns

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

References $ilCtrl, $lng, and ilLoggerFactory\getLogger().

60  {
61  global $ilCtrl,$lng;
62 
63  $this->lng = $lng;
64  $this->lng->loadLanguageModule('search');
65  $this->lng->loadLanguageModule('obj');
66 
67  $this->parent_obj = $a_parent_gui;
68 
69  $this->log = ilLoggerFactory::getLogger('obj');
70  }
global $ilCtrl
Definition: ilias.php:18
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 220 of file class.ilObjectCopyGUI.php.

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

221  {
222  $GLOBALS['ilCtrl']->setParameter($this,'smode',self::SUBMODE_CONTENT_ONLY);
223  $GLOBALS['ilCtrl']->setParameter($this,'selectMode',self::SOURCE_SELECTION);
224 
225 
226  $this->setSubMode(self::SUBMODE_CONTENT_ONLY);
227  $this->setMode(self::SOURCE_SELECTION);
228  $this->setTarget((int) $_GET['ref_id']);
229 
230 
231  return $this->initSourceSelection();
232  }
setMode($a_mode)
set copy mode
initSourceSelection()
Init source selection.
$_GET["client_id"]
setTarget($a_ref_id)
Set single object target.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
+ Here is the call graph for this function:

◆ cancel()

ilObjectCopyGUI::cancel ( )
protected

Cancel workflow.

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

References $ilCtrl.

689  {
690  global $ilCtrl;
691  $ilCtrl->setReturnByClass(get_class($this->parent_obj),'cancel');
692  $ilCtrl->returnToParent($this);
693  }
global $ilCtrl
Definition: ilias.php:18

◆ copyContainer()

ilObjectCopyGUI::copyContainer (   $a_target)
protected

Copy a container.

Returns

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

References $_COOKIE, $_POST, $ilCtrl, $ilErr, $ilLog, $ilUser, $options, $orig, $result, $target_type, ilObject\_lookupObjId(), ilObject\_lookupType(), array, getFirstSource(), ilObjectFactory\getInstanceByRefId(), ilLoggerFactory\getLogger(), getSources(), getSubMode(), getType(), and ilUtil\sendFailure().

Referenced by copyContainerToTargets().

1123  {
1124  global $ilLog, $ilCtrl;
1125 
1126  include_once('./Services/Link/classes/class.ilLink.php');
1127  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
1128 
1129  global $ilAccess,$ilErr,$rbacsystem,$tree,$ilUser,$ilCtrl;
1130 
1131  // Workaround for course in course copy
1132 
1135 
1136  if($this->getSubMode() != self::SUBMODE_CONTENT_ONLY)
1137  {
1138  if(!$rbacsystem->checkAccess('create', $a_target,$this->getType()))
1139  {
1140  $this->log->notice('Permission denied for target: '. $a_target.' type: ' . $this->getType().' CREATE');
1141  ilUtil::sendFailure($this->lng->txt('permission_denied'),true);
1142  $ilCtrl->returnToParent($this);
1143  }
1144  }
1145  if(!$this->getFirstSource())
1146  {
1147  ilUtil::sendFailure($this->lng->txt('select_one'),true);
1148  $ilCtrl->returnToParent($this);
1149  return false;
1150  }
1151 
1152  $options = $_POST['cp_options'] ? $_POST['cp_options'] : array();
1153 
1154 
1155  ilLoggerFactory::getLogger('obj')->debug('Copy container (sources): '. print_r($this->getSources(),TRUE));
1156 
1158  $result = $orig->cloneAllObject(
1159  $_COOKIE['PHPSESSID'],
1160  $_COOKIE['ilClientId'],
1161  $this->getType(),
1162  $a_target,
1163  $this->getFirstSource(),
1164  $options,
1165  FALSE,
1166  $this->getSubMode()
1167  );
1168 
1169  $this->targets_copy_id[$a_target] = $result['copy_id'];
1170 
1171  return $result;
1172  }
global $ilErr
Definition: raiseError.php:16
getSources()
Get sources.
$target_type
Definition: goto.php:50
$result
getType()
Returns $type.
global $ilCtrl
Definition: ilias.php:18
if(!is_array($argv)) $options
static _lookupObjId($a_id)
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_COOKIE['ilClientId']
Definition: BPMN2Parser.php:15
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.
$_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 1038 of file class.ilObjectCopyGUI.php.

References $_SESSION, $ilCtrl, $result, ilCopyWizardOptions\_isFinished(), copyContainer(), ilLoggerFactory\getLogger(), getSources(), getTargets(), ilUtil\sendSuccess(), and showCopyProgress().

1039  {
1040  global $ilCtrl;
1041 
1042  ilLoggerFactory::getLogger('obj')->debug('Copy container to targets: '. print_r($_REQUEST,TRUE));
1043  ilLoggerFactory::getLogger('obj')->debug('Source(s): '. print_r($this->getSources(),TRUE));
1044  ilLoggerFactory::getLogger('obj')->debug('Target(s): '. print_r($this->getTargets(),TRUE));
1045 
1046 
1047  $last_target = 0;
1048  $result = 1;
1049  foreach($this->getTargets() as $target_ref_id)
1050  {
1051  $result = $this->copyContainer($target_ref_id);
1052  $last_target = $target_ref_id;
1053  }
1054 
1055  unset($_SESSION["clipboard"]["ref_ids"]);
1056  unset($_SESSION["clipboard"]["cmd"]);
1057 
1058  include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1060  {
1061  ilLoggerFactory::getLogger('obj')->info('Object copy completed.');
1062  ilUtil::sendSuccess($this->lng->txt("object_duplicated"),true);
1063  $ilCtrl->setParameterByClass(
1064  "ilrepositorygui",
1065  "ref_id",
1066  $result['ref_id']
1067  );
1068  $ilCtrl->redirectByClass("ilrepositorygui", "");
1069  }
1070  else
1071  {
1072  // show progress
1073  ilLoggerFactory::getLogger('obj')->debug('Object copy in progress.');
1074  return $this->showCopyProgress();
1075  }
1076  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
getSources()
Get sources.
$_SESSION["AccountId"]
$result
showCopyProgress()
Show progress for copying.
copyContainer($a_target)
Copy a container.
global $ilCtrl
Definition: ilias.php:18
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 939 of file class.ilObjectCopyGUI.php.

References $_SESSION, $ilCtrl, $ilUser, $orig, 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(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

Referenced by copySingleObject(), and saveTarget().

940  {
941  global $ilAccess,$objDefinition,$rbacsystem,$ilUser,$ilCtrl,$rbacreview;
942 
943 
944  include_once('./Services/Link/classes/class.ilLink.php');
945  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
946 
947  // check permissions
948  foreach ($a_sources as $source_ref_id)
949  {
950  $source_type = ilObject::_lookupType($source_ref_id, true);
951 
952  // Create permission
953  // begin-patch mc
954  foreach($this->getTargets() as $target_ref_id)
955  {
956  if(!$rbacsystem->checkAccess('create', $target_ref_id, $source_type))
957  {
958  $this->log->notice('Permission denied for target_id: ' . $target_ref_id.' source_type: ' . $source_type.' CREATE');
959  ilUtil::sendFailure($this->lng->txt('permission_denied'),true);
960  $ilCtrl->returnToParent($this);
961  }
962  }
963 
964  // Copy permission
965  if(!$ilAccess->checkAccess('copy','',$source_ref_id))
966  {
967  $this->log->notice('Permission denied for source_ref_id: ' . $source_ref_id.' COPY');
968  ilUtil::sendFailure($this->lng->txt('permission_denied'),true);
969  $ilCtrl->returnToParent($this);
970  }
971 
972  // check that these objects are really not containers
973  if($objDefinition->isContainer($source_type) and $this->getSubMode() != self::SUBMODE_CONTENT_ONLY)
974  {
975  ilUtil::sendFailure($this->lng->txt('cntr_container_only_on_their_own'),true);
976  $ilCtrl->returnToParent($this);
977  }
978  }
979 
980  reset($a_sources);
981 
982 
983  ilLoggerFactory::getLogger('obj')->debug('Copy multiple non containers. Sources: ' . print_r($a_sources,TRUE));
984 
985  // clone
986  foreach ($a_sources as $source_ref_id)
987  {
988  ilLoggerFactory::getLogger('obj')->debug('Copying source ref_id : ' . $source_ref_id);
989 
990  // begin-patch mc
991  foreach($this->getTargets() as $target_ref_id)
992  {
993  // Save wizard options
995  $wizard_options = ilCopyWizardOptions::_getInstance($copy_id);
996  $wizard_options->saveOwner($ilUser->getId());
997  $wizard_options->saveRoot((int) $source_ref_id);
998  $wizard_options->read();
999 
1000  $orig = ilObjectFactory::getInstanceByRefId((int) $source_ref_id);
1001  $new_obj = $orig->cloneObject($target_ref_id,$copy_id);
1002 
1003  // Delete wizard options
1004  $wizard_options->deleteAll();
1005 
1006  // rbac log
1007  include_once "Services/AccessControl/classes/class.ilRbacLog.php";
1008  if(ilRbacLog::isActive())
1009  {
1010  $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(), false);
1011  $rbac_log = ilRbacLog::gatherFaPa($new_obj->getRefId(), array_keys($rbac_log_roles), true);
1012  ilRbacLog::add(ilRbacLog::COPY_OBJECT, $new_obj->getRefId(), $rbac_log, (int)$source_ref_id);
1013  }
1014  }
1015  }
1016 
1017  unset($_SESSION["clipboard"]["ref_ids"]);
1018  unset($_SESSION["clipboard"]["cmd"]);
1019 
1020  if (count($a_sources) == 1)
1021  {
1022  ilLoggerFactory::getLogger('obj')->info('Object copy completed.');
1023  ilUtil::sendSuccess($this->lng->txt("object_duplicated"),true);
1024  ilUtil::redirect(ilLink::_getLink($new_obj->getRefId()));
1025  }
1026  else
1027  {
1028  ilLoggerFactory::getLogger('obj')->info('Object copy completed.');
1029  ilUtil::sendSuccess($this->lng->txt("objects_duplicated"),true);
1031  }
1032 
1033  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_SESSION["AccountId"]
static isActive()
getFirstTarget()
Get first target.
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
global $ilCtrl
Definition: ilias.php:18
static _getInstance($a_copy_id)
Get instance of copy wizard options.
const COPY_OBJECT
$ilUser
Definition: imgupload.php:18
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.
static redirect($a_script)
http redirect to other 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 916 of file class.ilObjectCopyGUI.php.

References $ilCtrl, $ilErr, $ilUser, copyMultipleNonContainer(), getSource(), and ilUtil\sendFailure().

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

917  {
918  include_once('./Services/Link/classes/class.ilLink.php');
919  include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
920 
921  global $ilAccess,$ilErr,$rbacsystem,$ilUser,$ilCtrl,$rbacreview;
922 
923  // Source defined
924  if(!count($this->getSource()))
925  {
926  ilUtil::sendFailure($this->lng->txt('select_one'),true);
927  $ilCtrl->returnToParent($this);
928  }
929 
930  $this->copyMultipleNonContainer($this->getSource());
931  return;
932  }
global $ilErr
Definition: raiseError.php:16
getSource()
Get source id.
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
copyMultipleNonContainer($a_sources)
Copy multiple non container.
+ 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 76 of file class.ilObjectCopyGUI.php.

References $cmd, $ilCtrl, init(), and initTabs().

77  {
78  global $ilCtrl;
79 
80  $this->init();
81  $this->initTabs();
82 
83  $next_class = $ilCtrl->getNextClass($this);
84  $cmd = $ilCtrl->getCmd();
85 
86  switch($next_class)
87  {
88  default:
89  $this->$cmd();
90  break;
91  }
92  }
init()
Init return, mode.
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18
initTabs()
Init tabs General.
+ Here is the call graph for this function:

◆ getFirstSource()

ilObjectCopyGUI::getFirstSource ( )

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

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

631  {
632  if(count($this->sources))
633  {
634  return $this->sources[0];
635  }
636  return 0;
637  }
+ Here is the caller graph for this function:

◆ getFirstTarget()

ilObjectCopyGUI::getFirstTarget ( )

Get first target.

Returns
int

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

References $targets, and getTargets().

Referenced by copyMultipleNonContainer(), and init().

675  {
676  if(array_key_exists(0, $this->getTargets()))
677  {
678  $targets = $this->getTargets();
679  return $targets[0];
680  }
681  return 0;
682  }
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 556 of file class.ilObjectCopyGUI.php.

References $mode.

Referenced by setTabs(), and showItemSelection().

557  {
558  return $this->mode;
559  }
+ Here is the caller graph for this function:

◆ getParentObject()

ilObjectCopyGUI::getParentObject ( )

Get parent gui object.

Returns
object parent gui

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

References $parent_obj.

Referenced by init().

576  {
577  return $this->parent_obj;
578  }
+ Here is the caller graph for this function:

◆ getSource()

ilObjectCopyGUI::getSource ( )

Get source id.

Returns
array
Deprecated:
since version 5.1

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

References getSources().

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

617  {
618  return $this->getSources();
619  }
getSources()
Get sources.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSources()

ilObjectCopyGUI::getSources ( )

Get sources.

Returns
type

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

References $sources, and array.

Referenced by copyContainer(), copyContainerToTargets(), getSource(), init(), saveSource(), saveTarget(), and showItemSelection().

626  {
627  return (array) $this->sources;
628  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getSubMode()

ilObjectCopyGUI::getSubMode ( )

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

References $sub_mode.

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

567  {
568  return $this->sub_mode;
569  }
+ Here is the caller graph for this function:

◆ getTargets()

ilObjectCopyGUI::getTargets ( )

Get copy target.

Returns

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

References $targets, and array.

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

666  {
667  return (array) $this->targets;
668  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getType()

ilObjectCopyGUI::getType ( )

Returns $type.

See also
ilObjectCopyGUI::$type

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

References $type.

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

586  {
587  return $this->type;
588  }
+ Here is the caller graph for this function:

◆ init()

ilObjectCopyGUI::init ( )
protected

Init return, mode.

Returns

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

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

Referenced by executeCommand().

99  {
100  global $ilCtrl;
101 
102  if((int) $_REQUEST['smode'])
103  {
104  $this->setSubMode((int) $_REQUEST['smode']);
105  $GLOBALS['ilCtrl']->setParameter($this,'smode',$this->getSubMode());
106  ilLoggerFactory::getLogger('obj')->debug('Submode is: '. $this->getSubMode());
107  }
108 
109  // save sources
110  if($_REQUEST['source_ids'])
111  {
112  $this->setSource(explode('_',$_REQUEST['source_ids']));
113  $GLOBALS['ilCtrl']->setParameter($this,'source_ids', implode('_', $this->getSources()));
114  ilLoggerFactory::getLogger('obj')->debug('Multiple sources: ' . implode('_',$this->getSources()));
115  }
116  if($_REQUEST['source_id'])
117  {
118  $this->setSource(array((int) $_REQUEST['source_id']));
119  $GLOBALS['ilCtrl']->setParameter($this,'source_ids', implode('_', $this->getSource()));
120  ilLoggerFactory::getLogger('obj')->debug('source_id is set: '. implode('_',$this->getSources()));
121  }
122  if($this->getFirstSource())
123  {
124  $this->setType(
126  );
127  }
128 
129  // creation screen: copy section
130  if($_REQUEST['new_type'])
131  {
132  $this->setMode(self::SEARCH_SOURCE);
133  $this->setType($_REQUEST['new_type']);
134  $this->setTarget((int) $_GET['ref_id']);
135 
136  $GLOBALS['ilCtrl']->setParameter($this, 'new_type', $this->getType());
137  $GLOBALS['ilCtrl']->setParameterByClass(get_class($this->getParentObject()),'new_type', $this->getType());
138  $GLOBALS['ilCtrl']->setParameterByClass(get_class($this->getParentObject()),'cpfl', 1);
139  $GLOBALS['ilCtrl']->setReturnByClass(get_class($this->getParentObject()),'create');
140 
141  ilLoggerFactory::getLogger('obj')->debug('Copy from object creation for type: '. $this->getType());
142  return TRUE;
143  }
144  // adopt content, and others?
145  elseif($_REQUEST['selectMode'] == self::SOURCE_SELECTION)
146  {
147  $this->setMode(self::SOURCE_SELECTION);
148 
149  $ilCtrl->setParameterByClass(get_class($this->parent_obj), 'selectMode', self::SOURCE_SELECTION);
150  $this->setTarget((int) $_GET['ref_id']);
151  $ilCtrl->setReturnByClass(get_class($this->parent_obj), '');
152 
153  ilLoggerFactory::getLogger('obj')->debug('Source selection mode. Target is: '. $this->getFirstTarget());
154  }
155  elseif($_REQUEST['selectMode'] == self::TARGET_SELECTION)
156  {
157  $this->setMode(self::TARGET_SELECTION);
158  $ilCtrl->setReturnByClass(get_class($this->parent_obj),'');
159  ilLoggerFactory::getLogger('obj')->debug('Target selection mode.');
160  }
161 
162 
163  // save targets
164  if($_REQUEST['target_ids'])
165  {
166  $this->setTargets(explode('_',$_REQUEST['target_ids']));
167  ilLoggerFactory::getLogger('obj')->debug('targets are: '. print_r($this->getTargets(),TRUE));
168  }
169 
170  }
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.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
getFirstTarget()
Get first target.
getType()
Returns $type.
getSource()
Get source id.
setSource(array $a_source_ids)
Set source id.
global $ilCtrl
Definition: ilias.php:18
getParentObject()
Get parent gui object.
static _lookupObjId($a_id)
getTargets()
Get copy target.
Create styles array
The data for the language used.
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 1222 of file class.ilObjectCopyGUI.php.

References $ilCtrl, $lng, getType(), and ilTextInputGUI\setSize().

Referenced by searchSource(), and showSourceSearch().

1223  {
1224  global $lng,$ilCtrl;
1225 
1226  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1227  $this->form = new ilPropertyFormGUI();
1228  $this->form->setTableWidth('600px');
1229 
1230  $ilCtrl->setParameter($this,'new_type',$this->getType());
1231 
1232  #$ilCtrl->setParameter($this, 'cp_mode', self::SOURCE_SELECTION);
1233  $this->form->setFormAction($ilCtrl->getFormAction($this));
1234  $this->form->setTitle($lng->txt($this->getType().'_copy'));
1235 
1236  $this->form->addCommandButton('searchSource', $lng->txt('btn_next'));
1237  $this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
1238 
1239  $tit = new ilTextInputGUI($lng->txt('title'),'tit');
1240  $tit->setSize(40);
1241  $tit->setMaxLength(70);
1242  $tit->setRequired(true);
1243  $tit->setInfo($lng->txt('wizard_title_info'));
1244  $this->form->addItem($tit);
1245  }
This class represents a property form user interface.
getType()
Returns $type.
global $ilCtrl
Definition: ilias.php:18
setSize($a_size)
Set Size.
This class represents a text property in a property form.
+ 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 278 of file class.ilObjectCopyGUI.php.

References $_SESSION, $ilCtrl, $path, array, getTargets(), setTabs(), and showSourceSelectionTree().

Referenced by adoptContent().

279  {
280  global $ilCtrl,$tree;
281 
282  // empty session on init
283  $_SESSION['paste_copy_repexpand'] = array();
284 
285  // copy opened nodes from repository explorer
286  $_SESSION['paste_copy_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
287 
288  $this->setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_SOURCE_TREE);
289 
290 
291  // open current position
292  // begin-patch mc
293  foreach($this->getTargets() as $target_ref_id)
294  {
295  $path = $tree->getPathId($target_ref_id);
296  foreach((array) $path as $node_id)
297  {
298  if(!in_array($node_id, $_SESSION['paste_copy_repexpand']))
299  {
300  $_SESSION['paste_copy_repexpand'][] = $node_id;
301  }
302  }
303  }
304  // end-patch multi copy
305  $ilCtrl->setReturnByClass(get_class($this->parent_obj),'');
306  $this->showSourceSelectionTree();
307  }
$path
Definition: aliased.php:25
$_SESSION["AccountId"]
global $ilCtrl
Definition: ilias.php:18
setTabs($a_tab_group, $a_active_tab)
Set tabs.
getTargets()
Get copy target.
Create styles array
The data for the language used.
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 176 of file class.ilObjectCopyGUI.php.

References $GLOBALS.

Referenced by executeCommand().

177  {
178  $GLOBALS['lng']->loadLanguageModule('cntr');
179  $GLOBALS['ilTabs']->clearTargets();
180  $GLOBALS['ilTabs']->setBackTarget(
181  $GLOBALS['lng']->txt('tab_back_to_repository'),
182  $GLOBALS['ilCtrl']->getParentReturn($this->parent_obj)
183  );
184  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
+ Here is the caller graph for this function:

◆ initTargetSelection()

ilObjectCopyGUI::initTargetSelection ( )
protected

Init copy from repository/search list commands.

Returns

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

References $_SESSION, $ilCtrl, $path, array, getSource(), setTargets(), and showTargetSelectionTree().

239  {
240  global $ilCtrl, $tree;
241  $ilCtrl->setParameter($this, 'selectMode', self::TARGET_SELECTION);
242  // empty session on init
243  $_SESSION['paste_copy_repexpand'] = array();
244 
245  // copy opened nodes from repository explorer
246  $_SESSION['paste_copy_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
247 
248  // begin-patch mc
249  $this->setTargets(array());
250  // cognos-blu-patch: end
251 
252  // open current position
253 
254  foreach($this->getSource() as $source_id)
255  {
256  if($source_id)
257  {
258  $path = $tree->getPathId($source_id);
259  foreach((array) $path as $node_id)
260  {
261  if(!in_array($node_id, $_SESSION['paste_copy_repexpand']))
262  {
263  $_SESSION['paste_copy_repexpand'][] = $node_id;
264  }
265  }
266 
267  }
268  }
269 
270  $ilCtrl->setReturnByClass(get_class($this->parent_obj),'');
271  $this->showTargetSelectionTree();
272  }
$path
Definition: aliased.php:25
setTargets(array $a_target)
Set target id.
$_SESSION["AccountId"]
getSource()
Get source id.
global $ilCtrl
Definition: ilias.php:18
Create styles array
The data for the language used.
showTargetSelectionTree()
Show target selection.
+ Here is the call graph for this function:

◆ keepObjectsInClipboard()

ilObjectCopyGUI::keepObjectsInClipboard ( )

Keep objects in clipboard.

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

References $_SESSION, $ilCtrl, and getSource().

699  {
700  global $ilCtrl;
701  $_SESSION['clipboard']['cmd'] = "copy";
702  $_SESSION['clipboard']['ref_ids'] = $this->getSource();
703  $ilCtrl->returnToParent($this);
704  }
$_SESSION["AccountId"]
getSource()
Get source id.
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ saveSource()

ilObjectCopyGUI::saveSource ( )
protected

select source object

Returns

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

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

774  {
775  global $objDefinition;
776 
777  if(isset($_POST['source']))
778  {
779  $this->setSource(array((int) $_REQUEST['source']));
780  $this->setType(ilObject::_lookupType((int) $_REQUEST['source'], TRUE));
781  $GLOBALS['ilCtrl']->setParameter($this,'source_id',(int) $_REQUEST['source']);
782  }
783  else
784  {
785  ilUtil::sendFailure($this->lng->txt('select_one'));
786  $this->searchSource();
787  return false;
788  }
789 
790  // validate allowed subtypes
791  foreach($this->getSources() as $source_ref_id)
792  {
793  foreach((array) $this->getTargets() as $target_ref_id)
794  {
795  $target_type = ilObject::_lookupType($target_ref_id, TRUE);
796  $target_class_name = ilObjectFactory::getClassByType($target_type);
797  $target_object = new $target_class_name($target_ref_id);
798  $possible_subtypes = $target_object->getPossibleSubObjects();
799 
800  $source_type = ilObject::_lookupType($source_ref_id, TRUE);
801 
802  if(!array_key_exists($source_type, $possible_subtypes))
803  {
804  #ilLoggerFactory::getLogger('obj')->debug('Source type: '. $source_type);
805  #ilLoggerFactory::getLogger('obj')->debug('Target type: '. $target_type);
806  #ilLoggerFactory::getLogger('obj')->debug('Submode: '. $this->getSubMode());
807 
808  // adopt content mode
809  if(
810  $this->getSubMode() != self::SUBMODE_CONTENT_ONLY and
811  ($source_type != 'crs' or $target_type != 'crs')
812  )
813  {
815  sprintf(
816  $this->lng->txt('msg_obj_may_not_contain_objects_of_type'),
817  $this->lng->txt('obj_'.$target_type),
818  $this->lng->txt('obj_'.$source_type))
819  );
820  $this->searchSource();
821  return FALSE;
822 
823  }
824  }
825  }
826  }
827 
828 
829  if($objDefinition->isContainer($this->getType()))
830  {
831  $this->showItemSelection();
832  }
833  else
834  {
835  $this->copySingleObject();
836  }
837  }
static getClassByType($a_obj_type)
Get class by type.
getSources()
Get sources.
$target_type
Definition: goto.php:50
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
setSource(array $a_source_ids)
Set source id.
copySingleObject()
Start cloning a single (not container) object.
getTargets()
Get copy target.
Create styles array
The data for the language used.
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 842 of file class.ilObjectCopyGUI.php.

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

843  {
844  global $objDefinition;
845 
846  if(!isset($_REQUEST['source']))
847  {
848  ilUtil::sendFailure($this->lng->txt('select_one'));
849  $GLOBALS['ilCtrl']->redirect($this,'showSourceSelectionMembership');
850  return FALSE;
851  }
852 
853  $this->setSource(array((int) $_REQUEST['source']));
854  $this->setType(ilObject::_lookupType((int) $this->getFirstSource(), TRUE));
855  $GLOBALS['ilCtrl']->setParameter($this,'source_id',(int) $_REQUEST['source']);
856 
857  if($objDefinition->isContainer($this->getType()))
858  {
859  $this->showItemSelection();
860  }
861  else
862  {
863  $this->copySingleObject();
864  }
865  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
setSource(array $a_source_ids)
Set source id.
copySingleObject()
Start cloning a single (not container) object.
Create styles array
The data for the language used.
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 451 of file class.ilObjectCopyGUI.php.

References $GLOBALS, $ilCtrl, $target_type, ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), array, copyMultipleNonContainer(), copySingleObject(), ilObjectFactory\getClassByType(), getFirstSource(), getSource(), getSources(), getTargets(), ilUtil\sendFailure(), setTarget(), setTargets(), showItemSelection(), and showTargetSelectionTree().

452  {
453  global $objDefinition, $tree, $ilCtrl;
454 
455 
456  // begin-patch mc
457  if(is_array($_REQUEST['target']) and $_REQUEST['target'])
458  {
459  $this->setTargets($_REQUEST['target']);
460  $GLOBALS['ilCtrl']->setParameter($this,'target_ids', implode('_', $this->getTargets()));
461  }
462  // paste from clipboard
463  elseif((int) $_REQUEST['target'])
464  {
465  $this->setTarget($_REQUEST['target']);
466  $GLOBALS['ilCtrl']->setParameter($this,'target_ids', implode('_', $this->getTargets()));
467  }
468  // end-patch multi copy
469  else
470  {
471  $ilCtrl->setParameter($this, 'selectMode', self::TARGET_SELECTION);
472  ilUtil::sendFailure($this->lng->txt('select_one'));
473  $this->showTargetSelectionTree();
474  return false;
475  }
476 
477  // validate allowed subtypes
478  foreach($this->getSources() as $source_ref_id)
479  {
480  foreach((array) $this->getTargets() as $target_ref_id)
481  {
482  $target_type = ilObject::_lookupType($target_ref_id, TRUE);
483  $target_class_name = ilObjectFactory::getClassByType($target_type);
484  $target_object = new $target_class_name($target_ref_id);
485  $possible_subtypes = $target_object->getPossibleSubObjects();
486 
487  $source_type = ilObject::_lookupType($source_ref_id, TRUE);
488 
489  if(!array_key_exists($source_type, (array) $possible_subtypes))
490  {
492  sprintf(
493  $this->lng->txt('msg_obj_may_not_contain_objects_of_type'),
494  $this->lng->txt('obj_'.$target_type),
495  $this->lng->txt('obj_'.$source_type))
496  );
497  $this->showTargetSelectionTree();
498  return FALSE;
499  }
500  }
501  }
502 
503  if(count($this->getSource() == 1) && $objDefinition->isContainer($this->getType()))
504  {
505  // check, if object should be copied into itself
506  // begin-patch mc
507  $is_child = array();
508  foreach($this->getTargets() as $target_ref_id)
509  {
510  if ($tree->isGrandChild($this->getFirstSource(), $target_ref_id))
511  {
513  }
514  if ($this->getFirstSource() == $target_ref_id)
515  {
517  }
518  }
519  // end-patch multi copy
520  if (count($is_child) > 0)
521  {
522  ilUtil::sendFailure($this->lng->txt("msg_not_in_itself")." ".implode(',',$is_child));
523  $this->showTargetSelectionTree();
524  return false;
525  }
526 
527  $this->showItemSelection();
528  }
529  else
530  {
531  if(count($this->getSource()) == 1)
532  {
533  $this->copySingleObject();
534  }
535  else
536  {
537  $this->copyMultipleNonContainer($this->getSource());
538  }
539  }
540  }
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.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static _lookupTitle($a_id)
lookup object title
getSource()
Get source id.
global $ilCtrl
Definition: ilias.php:18
static _lookupObjId($a_id)
copySingleObject()
Start cloning a single (not container) object.
getTargets()
Get copy target.
Create styles array
The data for the language used.
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 711 of file class.ilObjectCopyGUI.php.

References $_POST, $_SESSION, $GLOBALS, $ilCtrl, $lng, $res, $results, $tpl, array, getFirstSource(), getType(), initFormSearch(), QP_COMBINATION_AND, ilUtil\sendFailure(), ilUtil\sendInfo(), and ilQueryParser\setMinWordLength().

Referenced by saveSource(), and showItemSelection().

712  {
713  global $tree,$ilObjDataCache,$lng,$ilCtrl,$tpl;
714 
715  if(isset($_POST['tit']))
716  {
717  ilUtil::sendInfo($this->lng->txt('wizard_search_list'));
718  $_SESSION['source_query'] = $_POST['tit'];
719  }
720  else
721  {
722  $_POST['tit'] = $_SESSION['source_query'];
723  }
724 
725  $this->initFormSearch();
726  $this->form->setValuesByPost();
727 
728  if(!$this->form->checkInput())
729  {
730  ilUtil::sendFailure($lng->txt('msg_no_search_string'),true);
731  $ilCtrl->returnToParent($this);
732  return false;
733  }
734 
735  include_once './Services/Search/classes/class.ilQueryParser.php';
736  $query_parser = new ilQueryParser($this->form->getInput('tit'));
737  $query_parser->setMinWordLength(1,true);
738  $query_parser->setCombination(QP_COMBINATION_AND);
739  $query_parser->parse();
740  if(!$query_parser->validate())
741  {
742  ilUtil::sendFailure($query_parser->getMessage(),true);
743  $ilCtrl->returnToParent($this);
744  }
745 
746  // only like search since fulltext does not support search with less than 3 characters
747  include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
748  $object_search = new ilLikeObjectSearch($query_parser);
749  $object_search->setFilter(array($_REQUEST['new_type']));
750  $res = $object_search->performSearch();
751  $res->setRequiredPermission('copy');
752  $res->filter(ROOT_FOLDER_ID,true);
753 
754  if(!count($results = $res->getResultsByObjId()))
755  {
756  ilUtil::sendFailure($this->lng->txt('search_no_match'),true);
757  $ilCtrl->returnToParent($this);
758  }
759 
760 
761  include_once './Services/Object/classes/class.ilObjectCopySearchResultTableGUI.php';
762  $table = new ilObjectCopySearchResultTableGUI($this,'searchSource',$this->getType());
763  $table->setFormAction($GLOBALS['ilCtrl']->getFormAction($this));
764  $table->setSelectedReference($this->getFirstSource());
765  $table->parseSearchResults($results);
766  $tpl->setContent($table->getHTML());
767  }
$_SESSION["AccountId"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
initFormSearch()
Init search form.
getType()
Returns $type.
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$results
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const QP_COMBINATION_AND
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 547 of file class.ilObjectCopyGUI.php.

Referenced by adoptContent(), and init().

548  {
549  $this->mode = $a_mode;
550  }
+ 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 606 of file class.ilObjectCopyGUI.php.

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

607  {
608  $this->sources = $a_source_ids;
609  }
+ Here is the caller graph for this function:

◆ setSubMode()

ilObjectCopyGUI::setSubMode (   $a_mode)

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

Referenced by adoptContent(), and init().

562  {
563  $this->sub_mode = $a_mode;
564  }
+ 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 191 of file class.ilObjectCopyGUI.php.

References $GLOBALS, getMode(), and getSubMode().

Referenced by initSourceSelection(), and showSourceSelectionMembership().

192  {
193  if($a_tab_group == self::TAB_GROUP_SC_SELECTION)
194  {
195  if($this->getSubMode() == self::SUBMODE_CONTENT_ONLY)
196  {
197  if($this->getMode() == self::SOURCE_SELECTION)
198  {
199  $GLOBALS['ilTabs']->addTab(
200  self::TAB_SELECTION_SOURCE_TREE,
201  $GLOBALS['lng']->txt('cntr_copy_repo_tree'),
202  $GLOBALS['ilCtrl']->getLinkTarget($this,'initSourceSelection')
203  );
204  $GLOBALS['ilTabs']->addTab(
205  self::TAB_SELECTION_MEMBERSHIP,
206  $GLOBALS['lng']->txt('cntr_copy_crs_grp'),
207  $GLOBALS['ilCtrl']->getLinkTarget($this,'showSourceSelectionMembership')
208  );
209  }
210  }
211  }
212  $GLOBALS['ilTabs']->activateTab($a_active_tab);
213  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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 645 of file class.ilObjectCopyGUI.php.

References array, and setTargets().

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

646  {
647  $this->setTargets(array($a_ref_id));
648  }
setTargets(array $a_target)
Set target id.
Create styles array
The data for the language used.
+ 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 656 of file class.ilObjectCopyGUI.php.

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

657  {
658  $this->targets = $a_target;
659  }
+ Here is the caller graph for this function:

◆ setType()

ilObjectCopyGUI::setType (   $type)

Sets $type.

Parameters
object$type
See also
ilObjectCopyGUI::$type

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

References $type.

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

597  {
598  $this->type = $type;
599  }
+ Here is the caller graph for this function:

◆ showCopyProgress()

ilObjectCopyGUI::showCopyProgress ( )
protected

Show progress for copying.

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

References $_GET, and $GLOBALS.

Referenced by copyContainerToTargets().

1082  {
1083  include_once './Services/Object/classes/class.ilObjectCopyProgressTableGUI.php';
1084  $progress = new ilObjectCopyProgressTableGUI(
1085  $this,
1086  'showCopyProgress',
1087  (int) $_GET['ref_id']
1088  );
1089  $progress->setObjectInfo($this->targets_copy_id);
1090  $progress->parse();
1091  $progress->init();
1092  $progress->setRedirectionUrl($GLOBALS['ilCtrl']->getParentReturn($this->parent_obj));
1093 
1094  $GLOBALS['tpl']->setContent($progress->getHTML());
1095  }
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
+ Here is the caller graph for this function:

◆ showItemSelection()

ilObjectCopyGUI::showItemSelection ( )
protected
Returns

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

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

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

872  {
873  global $tpl;
874 
875  if(!count($this->getSource()))
876  {
877  ilUtil::sendFailure($this->lng->txt('select_one'));
878  $this->searchSource();
879  return false;
880  }
881 
882  ilLoggerFactory::getLogger('obj')->debug('Source(s): '. print_r($this->getSources(),TRUE));
883  ilLoggerFactory::getLogger('obj')->debug('Target(s): '. print_r($this->getTargets(),TRUE));
884 
885  ilUtil::sendInfo($this->lng->txt($this->getType().'_copy_threads_info'));
886  include_once './Services/Object/classes/class.ilObjectCopySelectionTableGUI.php';
887 
888  $tpl->addJavaScript('./Services/CopyWizard/js/ilContainer.js');
889  $tpl->setVariable('BODY_ATTRIBUTES','onload="ilDisableChilds(\'cmd\');"');
890 
891  switch($this->getMode())
892  {
893  case self::SOURCE_SELECTION:
894  $back_cmd = 'showSourceSelectionTree';
895  break;
896 
897  case self::TARGET_SELECTION:
898  $back_cmd = 'showTargetSelectionTree';
899  break;
900 
901  case self::SEARCH_SOURCE:
902  $back_cmd = 'searchSource';
903  break;
904  }
905 
906  $table = new ilObjectCopySelectionTableGUI($this,'showItemSelection',$this->getType(),$back_cmd);
907  $table->parseSource($this->getFirstSource());
908 
909  $tpl->setContent($table->getHTML());
910  }
getSources()
Get sources.
getType()
Returns $type.
getSource()
Get source id.
global $tpl
Definition: ilias.php:8
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 1183 of file class.ilObjectCopyGUI.php.

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

1184  {
1185  global $tpl;
1186 
1187  // Disabled for performance
1188  #if(!$this->sourceExists())
1189  #{
1190  # return false;
1191  #}
1192 
1193  $this->unsetSession();
1194  $this->initFormSearch();
1195 
1196  if($a_tplvar)
1197  {
1198  $tpl->setVariable($a_tplvar,$this->form->getHTML());
1199  }
1200  else
1201  {
1202  return $this->form;
1203  }
1204  }
initFormSearch()
Init search form.
global $tpl
Definition: ilias.php:8
unsetSession()
Unset session variables.
+ Here is the call graph for this function:

◆ showSourceSelectionMembership()

ilObjectCopyGUI::showSourceSelectionMembership ( )
protected

show target selection membership

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

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

314  {
315  ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard_source'));
316  $this->setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_MEMBERSHIP);
317 
318  include_once './Services/Object/classes/class.ilObjectCopyCourseGroupSelectionTableGUI.php';
319  $cgs = new ilObjectCopyCourseGroupSelectionTableGUI($this, 'showSourceSelectionMembership','copy_selection_membership');
320  $cgs->init();
321  $cgs->setObjects(
322  array_merge(
323  ilParticipants::_getMembershipByType($GLOBALS['ilUser']->getId(), 'crs', FALSE),
324  ilParticipants::_getMembershipByType($GLOBALS['ilUser']->getId(), 'grp', FALSE)
325  )
326  );
327  $cgs->parse();
328 
329  $GLOBALS['tpl']->setContent($cgs->getHTML());
330  }
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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 394 of file class.ilObjectCopyGUI.php.

References $_GET, $ilCtrl, $output, $tpl, array, getSource(), ilPasteIntoMultipleItemsExplorer\SEL_TYPE_RADIO, and ilUtil\sendInfo().

Referenced by initSourceSelection().

395  {
396  global $ilTabs, $ilToolbar, $ilCtrl, $tree, $tpl, $objDefinition;
397 
398  $this->tpl = $tpl;
399  $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.paste_into_multiple_objects.html',
400  "Services/Object");
401 
402  ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard_source'));
403  include_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
406  'ilias.php?baseClass=ilRepositoryGUI&cmd=goto', 'paste_copy_repexpand');
407  $exp->setRequiredFormItemPermission('visible,read,copy');
408 
409  $ilCtrl->setParameter($this, 'selectMode', self::SOURCE_SELECTION);
410  $exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'showSourceSelectionTree'));
411  $exp->setTargetGet('ref_id');
412  $exp->setPostVar('source');
413  $exp->setCheckedItems($this->getSource());
414 
415  // Filter to container
416  foreach(array('cat','root','fold') as $container)
417  {
418  $exp->removeFormItemForType($container);
419  }
420 
421 
422  if($_GET['paste_copy_repexpand'] == '')
423  {
424  $expanded = $tree->readRootId();
425  }
426  else
427  {
428  $expanded = $_GET['paste_copy_repexpand'];
429  }
430 
431  $this->tpl->setVariable('FORM_TARGET', '_self');
432  $this->tpl->setVariable('FORM_ACTION', $ilCtrl->getFormAction($this, 'copySelection'));
433 
434  $exp->setExpand($expanded);
435  // build html-output
436  $exp->setOutput(0);
437  $output = $exp->getOutput();
438 
439  $this->tpl->setVariable('OBJECT_TREE', $output);
440 
441  $this->tpl->setVariable('CMD_SUBMIT', 'saveSource');
442  $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('btn_next'));
443 
444  $ilToolbar->addButton($this->lng->txt('cancel'), $ilCtrl->getLinkTarget($this,'cancel'));
445  }
$_GET["client_id"]
getSource()
Get source id.
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
Create styles array
The data for the language used.
+ 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 336 of file class.ilObjectCopyGUI.php.

References $ilCtrl, $lng, $output, $t, $tpl, array, ilUtil\getImagePath(), and ilUtil\sendInfo().

Referenced by initTargetSelection(), and saveTarget().

337  {
338  global $ilTabs, $ilToolbar, $ilCtrl, $tree, $tpl, $objDefinition, $lng;
339 
340  $this->tpl = $tpl;
341 
342  if($objDefinition->isContainer($this->getType()))
343  {
344  ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard_container'));
345  }
346  else
347  {
348  ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard'));
349  }
350 
351  //
352  include_once("./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
353  $exp = new ilRepositorySelectorExplorerGUI($this, "showTargetSelectionTree");
354  $exp->setTypeWhiteList(array("root", "cat", "grp", "crs", "fold"));
355  // begin-patch mc
356  $exp->setSelectMode("target", TRUE);
357  // end-patch multi copy
358  if ($exp->handleCommand())
359  {
360  return;
361  }
362  $output = $exp->getHTML();
363 
364  // toolbars
365  $t = new ilToolbarGUI();
366  $t->setFormAction($ilCtrl->getFormAction($this, "saveTarget"));
367  if($objDefinition->isContainer($this->getType()))
368  {
369  $t->addFormButton($lng->txt("btn_next"), "saveTarget");
370  }
371  else
372  {
373  $t->addFormButton($lng->txt("paste"), "saveTarget");
374  }
375  $t->addSeparator();
376  $t->addFormButton($lng->txt("obj_insert_into_clipboard"), "keepObjectsInClipboard");
377  $t->addFormButton($lng->txt("cancel"), "cancel");
378  $t->setCloseFormTag(false);
379  $t->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " ");
380  $output = $t->getHTML().$output;
381  $t->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " ");
382  $t->setCloseFormTag(true);
383  $t->setOpenFormTag(false);
384  $output.= "<br />".$t->getHTML();
385 
386  $this->tpl->setContent($output);
387 
388  return;
389  }
Explorer for selecting repository items.
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Create styles array
The data for the language used.
+ 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 1211 of file class.ilObjectCopyGUI.php.

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

1212  {
1213  global $ilUser;
1214 
1215  return (bool) ilUtil::_getObjectsByOperations($this->getType(),'copy',$ilUser->getId(),1);
1216  }
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 1251 of file class.ilObjectCopyGUI.php.

References $_SESSION, array, and setSource().

Referenced by showSourceSearch().

1252  {
1253  unset($_SESSION['source_query']);
1254  $this->setSource(array());
1255  }
$_SESSION["AccountId"]
setSource(array $a_source_ids)
Set source id.
Create styles array
The data for the language used.
+ 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 1100 of file class.ilObjectCopyGUI.php.

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

1101  {
1102  $json = new stdClass();
1103  $json->percentage = null;
1104  $json->performed_steps = null;
1105 
1106  include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1107  $options = ilCopyWizardOptions::_getInstance((int) $_REQUEST['copy_id']);
1108  $json->required_steps = $options->getRequiredSteps();
1109  $json->id = (int) $_REQUEST['copy_id'];
1110 
1111  ilLoggerFactory::getLogger('obj')->debug('Update copy progress: '. json_encode($json));
1112 
1113  echo json_encode($json);
1114  exit;
1115  }
static _getInstance($a_copy_id)
Get instance of copy wizard options.
if(!is_array($argv)) $options
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilObjectCopyGUI::$lng
private

◆ $log

ilObjectCopyGUI::$log = null
private

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

◆ $mode

ilObjectCopyGUI::$mode = 0
private

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

Referenced by getMode().

◆ $parent_obj

ilObjectCopyGUI::$parent_obj = null
private

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

Referenced by getParentObject().

◆ $sources

ilObjectCopyGUI::$sources = array()
private

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

Referenced by getSources().

◆ $sub_mode

ilObjectCopyGUI::$sub_mode = self::SUBMODE_COMPLETE
private

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

Referenced by getSubMode().

◆ $targets

ilObjectCopyGUI::$targets = array()
private

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

Referenced by getFirstTarget(), and getTargets().

◆ $targets_copy_id

ilObjectCopyGUI::$targets_copy_id = array()
private

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

◆ $type

ilObjectCopyGUI::$type = ''
private

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

Referenced by getType(), and setType().

◆ SEARCH_SOURCE

const ilObjectCopyGUI::SEARCH_SOURCE = 3

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

◆ SOURCE_SELECTION

const ilObjectCopyGUI::SOURCE_SELECTION = 1

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

◆ SUBMODE_COMPLETE

const ilObjectCopyGUI::SUBMODE_COMPLETE = 1

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

◆ SUBMODE_CONTENT_ONLY

const ilObjectCopyGUI::SUBMODE_CONTENT_ONLY = 2

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

Referenced by ilContainer\cloneAllObject().

◆ TAB_GROUP_SC_SELECTION

const ilObjectCopyGUI::TAB_GROUP_SC_SELECTION = 1

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

◆ TAB_SELECTION_MEMBERSHIP

const ilObjectCopyGUI::TAB_SELECTION_MEMBERSHIP = 3

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

◆ TAB_SELECTION_SOURCE_TREE

const ilObjectCopyGUI::TAB_SELECTION_SOURCE_TREE = 2

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

◆ TAB_SELECTION_TARGET_TREE

const ilObjectCopyGUI::TAB_SELECTION_TARGET_TREE = 1

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

◆ TARGET_SELECTION

const ilObjectCopyGUI::TARGET_SELECTION = 2

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


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