ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 

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

GUI class for the workflow of copying objects.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Stefan Hecken stefa.nosp@m.n.he.nosp@m.cken@.nosp@m.conc.nosp@m.epts-.nosp@m.and-.nosp@m.train.nosp@m.ing..nosp@m.de
Version
$Id$

@ilCtrl_Calls ilObjectCopyGUI:

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

Constructor & Destructor Documentation

◆ __construct()

ilObjectCopyGUI::__construct (   $a_parent_gui)

Constructor.

Returns

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

120 {
121 global $DIC;
122
123 $this->ctrl = $DIC->ctrl();
124 $this->tree = $DIC->repositoryTree();
125 $this->tabs = $DIC->tabs();
126 $this->toolbar = $DIC->toolbar();
127 $this->tpl = $DIC["tpl"];
128 $this->obj_definition = $DIC["objDefinition"];
129 $this->obj_data_cache = $DIC["ilObjDataCache"];
130 $this->access = $DIC->access();
131 $this->error = $DIC["ilErr"];
132 $this->rbacsystem = $DIC->rbac()->system();
133 $this->user = $DIC->user();
134 $this->rbacreview = $DIC->rbac()->review();
135 $this->log = $DIC["ilLog"];
136 $ilCtrl = $DIC->ctrl();
137 $lng = $DIC->language();
138
139 $this->lng = $lng;
140 $this->lng->loadLanguageModule('search');
141 $this->lng->loadLanguageModule('obj');
142
143 $this->parent_obj = $a_parent_gui;
144
145 $this->log = ilLoggerFactory::getLogger('obj');
146 }
user()
Definition: user.php:4
error($a_errmsg)
set error message @access public
static getLogger($a_component_id)
Get component logger.
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7

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

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

283 {
284 $GLOBALS['ilCtrl']->setParameter($this, 'smode', self::SUBMODE_CONTENT_ONLY);
285 $GLOBALS['ilCtrl']->setParameter($this, 'selectMode', self::SOURCE_SELECTION);
286
287
288 $this->setSubMode(self::SUBMODE_CONTENT_ONLY);
289 $this->setMode(self::SOURCE_SELECTION);
290 $this->setTarget((int) $_GET['ref_id']);
291
292
293 return $this->initSourceSelection();
294 }
$_GET["client_id"]
setMode($a_mode)
set copy mode
initSourceSelection()
Init source selection.
setTarget($a_ref_id)
Set single object target.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

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

+ Here is the call graph for this function:

◆ cancel()

ilObjectCopyGUI::cancel ( )
protected

Cancel workflow.

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

736 {
738 $ilCtrl->setReturnByClass(get_class($this->parent_obj), 'cancel');
739 $ilCtrl->returnToParent($this);
740 }

References $ctrl, and $ilCtrl.

◆ copyContainer()

ilObjectCopyGUI::copyContainer (   $a_target)
protected

Copy a container.

Returns

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

1142 {
1145
1146 include_once('./Services/Link/classes/class.ilLink.php');
1147 include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
1148
1149 $ilAccess = $this->access;
1155
1156 // Workaround for course in course copy
1157
1160
1161 if ($this->getSubMode() != self::SUBMODE_CONTENT_ONLY) {
1162 if (!$rbacsystem->checkAccess('create', $a_target, $this->getType())) {
1163 $this->log->notice('Permission denied for target: ' . $a_target . ' type: ' . $this->getType() . ' CREATE');
1164 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1165 $ilCtrl->returnToParent($this);
1166 }
1167 }
1168 if (!$this->getFirstSource()) {
1169 ilUtil::sendFailure($this->lng->txt('select_one'), true);
1170 $ilCtrl->returnToParent($this);
1171 return false;
1172 }
1173
1174 $options = $_POST['cp_options'] ? $_POST['cp_options'] : array();
1175
1176
1177 ilLoggerFactory::getLogger('obj')->debug('Copy container (sources): ' . print_r($this->getSources(), true));
1178
1180 $result = $orig->cloneAllObject(
1181 $_COOKIE['PHPSESSID'],
1182 $_COOKIE['ilClientId'],
1183 $this->getType(),
1184 $a_target,
1185 $this->getFirstSource(),
1186 $options,
1187 false,
1188 $this->getSubMode()
1189 );
1190
1191 $this->targets_copy_id[$a_target] = $result['copy_id'];
1192
1193 return $result;
1194 }
$result
$_COOKIE['client_id']
Definition: server.php:9
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
$_POST["username"]
getType()
Returns $type.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
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.
$target_type
Definition: goto.php:48
global $ilErr
Definition: raiseError.php:16
$ilUser
Definition: imgupload.php:18

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

Referenced by copyContainerToTargets().

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

1066 {
1068
1069 ilLoggerFactory::getLogger('obj')->debug('Copy container to targets: ' . print_r($_REQUEST, true));
1070 ilLoggerFactory::getLogger('obj')->debug('Source(s): ' . print_r($this->getSources(), true));
1071 ilLoggerFactory::getLogger('obj')->debug('Target(s): ' . print_r($this->getTargets(), true));
1072
1073
1074 $last_target = 0;
1075 $result = 1;
1076 foreach ($this->getTargets() as $target_ref_id) {
1077 $result = $this->copyContainer($target_ref_id);
1078 $last_target = $target_ref_id;
1079 }
1080
1081 unset($_SESSION["clipboard"]["ref_ids"]);
1082 unset($_SESSION["clipboard"]["cmd"]);
1083
1084 include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1085 if (ilCopyWizardOptions::_isFinished($result['copy_id'])) {
1086 ilLoggerFactory::getLogger('obj')->info('Object copy completed.');
1087 ilUtil::sendSuccess($this->lng->txt("object_duplicated"), true);
1088 $link = ilLink::_getLink($result['ref_id']);
1089 $GLOBALS['DIC']->ctrl()->redirectToUrl($link);
1090 } else {
1091 // show progress
1092 ilLoggerFactory::getLogger('obj')->debug('Object copy in progress.');
1093 return $this->showCopyProgress();
1094 }
1095 }
$_SESSION["AccountId"]
static _isFinished($a_copy_id)
check if copy is finished
showCopyProgress()
Show progress for copying.
getTargets()
Get copy target.
copyContainer($a_target)
Copy a container.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

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

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

974 {
975 $ilAccess = $this->access;
976 $objDefinition = $this->obj_definition;
981
982
983 include_once('./Services/Link/classes/class.ilLink.php');
984 include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
985
986 // check permissions
987 foreach ($a_sources as $source_ref_id) {
988 $source_type = ilObject::_lookupType($source_ref_id, true);
989
990 // Create permission
991 // begin-patch mc
992 foreach ($this->getTargets() as $target_ref_id) {
993 if (!$rbacsystem->checkAccess('create', $target_ref_id, $source_type)) {
994 $this->log->notice('Permission denied for target_id: ' . $target_ref_id . ' source_type: ' . $source_type . ' CREATE');
995 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
996 $ilCtrl->returnToParent($this);
997 }
998 }
999
1000 // Copy permission
1001 if (!$ilAccess->checkAccess('copy', '', $source_ref_id)) {
1002 $this->log->notice('Permission denied for source_ref_id: ' . $source_ref_id . ' COPY');
1003 ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
1004 $ilCtrl->returnToParent($this);
1005 }
1006
1007 // check that these objects are really not containers
1008 if ($objDefinition->isContainer($source_type) and $this->getSubMode() != self::SUBMODE_CONTENT_ONLY) {
1009 ilUtil::sendFailure($this->lng->txt('cntr_container_only_on_their_own'), true);
1010 $ilCtrl->returnToParent($this);
1011 }
1012 }
1013
1014 reset($a_sources);
1015
1016
1017 ilLoggerFactory::getLogger('obj')->debug('Copy multiple non containers. Sources: ' . print_r($a_sources, true));
1018
1019 // clone
1020 foreach ($a_sources as $source_ref_id) {
1021 ilLoggerFactory::getLogger('obj')->debug('Copying source ref_id : ' . $source_ref_id);
1022
1023 // begin-patch mc
1024 foreach ($this->getTargets() as $target_ref_id) {
1025 // Save wizard options
1027 $wizard_options = ilCopyWizardOptions::_getInstance($copy_id);
1028 $wizard_options->saveOwner($ilUser->getId());
1029 $wizard_options->saveRoot((int) $source_ref_id);
1030 $wizard_options->read();
1031
1032 $orig = ilObjectFactory::getInstanceByRefId((int) $source_ref_id);
1033 $new_obj = $orig->cloneObject($target_ref_id, $copy_id);
1034
1035 // Delete wizard options
1036 $wizard_options->deleteAll();
1037
1038 // rbac log
1039 include_once "Services/AccessControl/classes/class.ilRbacLog.php";
1040 if (ilRbacLog::isActive()) {
1041 $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(), false);
1042 $rbac_log = ilRbacLog::gatherFaPa($new_obj->getRefId(), array_keys($rbac_log_roles), true);
1043 ilRbacLog::add(ilRbacLog::COPY_OBJECT, $new_obj->getRefId(), $rbac_log, (int) $source_ref_id);
1044 }
1045 }
1046 }
1047
1048 unset($_SESSION["clipboard"]["ref_ids"]);
1049 unset($_SESSION["clipboard"]["cmd"]);
1050
1051 if (count($a_sources) == 1) {
1052 ilLoggerFactory::getLogger('obj')->info('Object copy completed.');
1053 ilUtil::sendSuccess($this->lng->txt("object_duplicated"), true);
1054 ilUtil::redirect(ilLink::_getLink($new_obj->getRefId()));
1055 } else {
1056 ilLoggerFactory::getLogger('obj')->info('Object copy completed.');
1057 ilUtil::sendSuccess($this->lng->txt("objects_duplicated"), true);
1059 }
1060 }
static _allocateCopyId()
Allocate a copy for further entries.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
getFirstTarget()
Get first target.
const COPY_OBJECT
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
static isActive()
static redirect($a_script)

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

Referenced by copySingleObject(), and saveTarget().

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

947 {
948 include_once('./Services/Link/classes/class.ilLink.php');
949 include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
950
951 $ilAccess = $this->access;
957
958 // Source defined
959 if (!count($this->getSources())) {
960 ilUtil::sendFailure($this->lng->txt('select_one'), true);
961 $ilCtrl->returnToParent($this);
962 }
963
964 $this->copyMultipleNonContainer($this->getSources());
965 return;
966 }
copyMultipleNonContainer($a_sources)
Copy multiple non container.

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

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

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

153 {
155
156 $this->init();
157 $this->initTabs();
158
159 $next_class = $ilCtrl->getNextClass($this);
160 $cmd = $ilCtrl->getCmd();
161
162 switch ($next_class) {
163 default:
164 $this->$cmd();
165 break;
166 }
167 }
initTabs()
Init tabs General.
init()
Init return, mode.

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

+ Here is the call graph for this function:

◆ getFirstSource()

ilObjectCopyGUI::getFirstSource ( )

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

680 {
681 if (count($this->sources)) {
682 return $this->sources[0];
683 }
684 return 0;
685 }

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

+ Here is the caller graph for this function:

◆ getFirstTarget()

ilObjectCopyGUI::getFirstTarget ( )

Get first target.

Returns
int

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

723 {
724 if (array_key_exists(0, $this->getTargets())) {
725 $targets = $this->getTargets();
726 return $targets[0];
727 }
728 return 0;
729 }

References $targets, and getTargets().

Referenced by copyMultipleNonContainer(), and init().

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

606 {
607 return $this->mode;
608 }

References $mode.

Referenced by setTabs(), and showItemSelection().

+ Here is the caller graph for this function:

◆ getParentObject()

ilObjectCopyGUI::getParentObject ( )

Get parent gui object.

Returns
object parent gui

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

625 {
626 return $this->parent_obj;
627 }

References $parent_obj.

Referenced by init().

+ Here is the caller graph for this function:

◆ getSource()

ilObjectCopyGUI::getSource ( )

Get source id.

Returns
array
Deprecated:
since version 5.1

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

666 {
667 return $this->getSources();
668 }

References getSources().

+ Here is the call graph for this function:

◆ getSources()

ilObjectCopyGUI::getSources ( )

Get sources.

Returns
type

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

675 {
676 return (array) $this->sources;
677 }

References $sources.

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

+ Here is the caller graph for this function:

◆ getSubMode()

ilObjectCopyGUI::getSubMode ( )

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

616 {
617 return $this->sub_mode;
618 }

References $sub_mode.

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

+ Here is the caller graph for this function:

◆ getTargets()

ilObjectCopyGUI::getTargets ( )

Get copy target.

Returns

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

714 {
715 return (array) $this->targets;
716 }

References $targets.

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

+ Here is the caller graph for this function:

◆ getType()

ilObjectCopyGUI::getType ( )

Returns $type.

See also
ilObjectCopyGUI::$type

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

635 {
636 return $this->type;
637 }

References $type.

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

+ Here is the caller graph for this function:

◆ init()

ilObjectCopyGUI::init ( )
protected

Init return, mode.

Returns

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

174 {
176
177 if ((int) $_REQUEST['smode']) {
178 $this->setSubMode((int) $_REQUEST['smode']);
179 $GLOBALS['ilCtrl']->setParameter($this, 'smode', $this->getSubMode());
180 ilLoggerFactory::getLogger('obj')->debug('Submode is: ' . $this->getSubMode());
181 }
182
183 // save sources
184 if ($_REQUEST['source_ids']) {
185 $this->setSource(explode('_', $_REQUEST['source_ids']));
186 $GLOBALS['ilCtrl']->setParameter($this, 'source_ids', implode('_', $this->getSources()));
187 ilLoggerFactory::getLogger('obj')->debug('Multiple sources: ' . implode('_', $this->getSources()));
188 }
189 if ($_REQUEST['source_id']) {
190 $this->setSource(array((int) $_REQUEST['source_id']));
191 $GLOBALS['ilCtrl']->setParameter($this, 'source_ids', implode('_', $this->getSources()));
192 ilLoggerFactory::getLogger('obj')->debug('source_id is set: ' . implode('_', $this->getSources()));
193 }
194 if ($this->getFirstSource()) {
195 $this->setType(
197 );
198 }
199
200 // creation screen: copy section
201 if ($_REQUEST['new_type']) {
202 $this->setMode(self::SEARCH_SOURCE);
203 $this->setType($_REQUEST['new_type']);
204 $this->setTarget((int) $_GET['ref_id']);
205
206 $GLOBALS['ilCtrl']->setParameter($this, 'new_type', $this->getType());
207 $GLOBALS['ilCtrl']->setParameterByClass(get_class($this->getParentObject()), 'new_type', $this->getType());
208 $GLOBALS['ilCtrl']->setParameterByClass(get_class($this->getParentObject()), 'cpfl', 1);
209 $GLOBALS['ilCtrl']->setReturnByClass(get_class($this->getParentObject()), 'create');
210
211 ilLoggerFactory::getLogger('obj')->debug('Copy from object creation for type: ' . $this->getType());
212 return true;
213 }
214 // adopt content, and others?
215 elseif ($_REQUEST['selectMode'] == self::SOURCE_SELECTION) {
216 $this->setMode(self::SOURCE_SELECTION);
217
218 $ilCtrl->setParameterByClass(get_class($this->parent_obj), 'selectMode', self::SOURCE_SELECTION);
219 $this->setTarget((int) $_GET['ref_id']);
220 $ilCtrl->setReturnByClass(get_class($this->parent_obj), '');
221
222 ilLoggerFactory::getLogger('obj')->debug('Source selection mode. Target is: ' . $this->getFirstTarget());
223 } elseif ($_REQUEST['selectMode'] == self::TARGET_SELECTION) {
224 $this->setMode(self::TARGET_SELECTION);
225 $ilCtrl->setReturnByClass(get_class($this->parent_obj), '');
226 ilLoggerFactory::getLogger('obj')->debug('Target selection mode.');
227 }
228
229
230 // save targets
231 if ($_REQUEST['target_ids']) {
232 $this->setTargets(explode('_', $_REQUEST['target_ids']));
233 ilLoggerFactory::getLogger('obj')->debug('targets are: ' . print_r($this->getTargets(), true));
234 }
235 }
setType($type)
Sets $type.
getParentObject()
Get parent gui object.
setSource(array $a_source_ids)
Set source id.
setTargets(array $a_target)
Set target id.

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

Referenced by executeCommand().

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

◆ initFormSearch()

ilObjectCopyGUI::initFormSearch ( )
protected

Init search form.

Returns

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

1242 {
1243 $lng = $this->lng;
1245
1246 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1247 $this->form = new ilPropertyFormGUI();
1248 $this->form->setTableWidth('600px');
1249
1250 $ilCtrl->setParameter($this, 'new_type', $this->getType());
1251
1252 #$ilCtrl->setParameter($this, 'cp_mode', self::SOURCE_SELECTION);
1253 $this->form->setFormAction($ilCtrl->getFormAction($this));
1254 $this->form->setTitle($lng->txt($this->getType() . '_copy'));
1255
1256 $this->form->addCommandButton('searchSource', $lng->txt('btn_next'));
1257 $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
1258
1259 $tit = new ilTextInputGUI($lng->txt('title'), 'tit');
1260 $tit->setSize(40);
1261 $tit->setMaxLength(70);
1262 $tit->setRequired(true);
1263 $tit->setInfo($lng->txt('wizard_title_info'));
1264 $this->form->addItem($tit);
1265 }
This class represents a property form user interface.
This class represents a text property in a property form.

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

Referenced by searchSource(), and showSourceSearch().

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

◆ initSourceSelection()

ilObjectCopyGUI::initSourceSelection ( )
protected

Init source selection.

Returns

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

337 {
340
341 // empty session on init
342 $_SESSION['paste_copy_repexpand'] = array();
343
344 // copy opened nodes from repository explorer
345 $_SESSION['paste_copy_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
346
347 $this->setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_SOURCE_TREE);
348
349
350 // open current position
351 // begin-patch mc
352 foreach ($this->getTargets() as $target_ref_id) {
353 $path = $tree->getPathId($target_ref_id);
354 foreach ((array) $path as $node_id) {
355 if (!in_array($node_id, $_SESSION['paste_copy_repexpand'])) {
356 $_SESSION['paste_copy_repexpand'][] = $node_id;
357 }
358 }
359 }
360 // end-patch multi copy
361 $ilCtrl->setReturnByClass(get_class($this->parent_obj), '');
363 }
setTabs($a_tab_group, $a_active_tab)
Set tabs.
showSourceSelectionTree()
Show target selection.

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

Referenced by adoptContent().

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

◆ initTabs()

ilObjectCopyGUI::initTabs ( )
protected

Init tabs General.

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

242 {
243 $GLOBALS['lng']->loadLanguageModule('cntr');
244 $GLOBALS['ilTabs']->clearTargets();
245 $GLOBALS['ilTabs']->setBackTarget(
246 $GLOBALS['lng']->txt('tab_back_to_repository'),
247 $GLOBALS['ilCtrl']->getParentReturn($this->parent_obj)
248 );
249 }

References $GLOBALS.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ initTargetSelection()

ilObjectCopyGUI::initTargetSelection ( )
protected

Init copy from repository/search list commands.

Returns

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

301 {
304 $ilCtrl->setParameter($this, 'selectMode', self::TARGET_SELECTION);
305 // empty session on init
306 $_SESSION['paste_copy_repexpand'] = array();
307
308 // copy opened nodes from repository explorer
309 $_SESSION['paste_copy_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
310
311 // begin-patch mc
312 $this->setTargets(array());
313 // cognos-blu-patch: end
314
315 // open current position
316
317 foreach ($this->getSources() as $source_id) {
318 if ($source_id) {
319 $path = $tree->getPathId($source_id);
320 foreach ((array) $path as $node_id) {
321 if (!in_array($node_id, $_SESSION['paste_copy_repexpand'])) {
322 $_SESSION['paste_copy_repexpand'][] = $node_id;
323 }
324 }
325 }
326 }
327
328 $ilCtrl->setReturnByClass(get_class($this->parent_obj), '');
330 }
showTargetSelectionTree()
Show target selection.

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

+ Here is the call graph for this function:

◆ keepObjectsInClipboard()

ilObjectCopyGUI::keepObjectsInClipboard ( )

Keep objects in clipboard.

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

746 {
747 ilUtil::sendSuccess($this->lng->txt("obj_inserted_clipboard"), true);
749 $_SESSION['clipboard']['cmd'] = "copy";
750 $_SESSION['clipboard']['ref_ids'] = $this->getSources();
751 $ilCtrl->returnToParent($this);
752 }

References $_SESSION, $ctrl, $ilCtrl, getSources(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ saveSource()

ilObjectCopyGUI::saveSource ( )
protected

select source object

Returns

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

820 {
821 $objDefinition = $this->obj_definition;
822
823 if (isset($_POST['source'])) {
824 $this->setSource(array((int) $_REQUEST['source']));
825 $this->setType(ilObject::_lookupType((int) $_REQUEST['source'], true));
826 $GLOBALS['ilCtrl']->setParameter($this, 'source_id', (int) $_REQUEST['source']);
827 } else {
828 ilUtil::sendFailure($this->lng->txt('select_one'));
829 $this->searchSource();
830 return false;
831 }
832
833 // validate allowed subtypes
834 foreach ($this->getSources() as $source_ref_id) {
835 foreach ((array) $this->getTargets() as $target_ref_id) {
836 $target_type = ilObject::_lookupType($target_ref_id, true);
837 $target_class_name = ilObjectFactory::getClassByType($target_type);
838 $target_object = new $target_class_name($target_ref_id);
839 $possible_subtypes = $target_object->getPossibleSubObjects();
840
841 $source_type = ilObject::_lookupType($source_ref_id, true);
842
843 if (!array_key_exists($source_type, $possible_subtypes)) {
844 #ilLoggerFactory::getLogger('obj')->debug('Source type: '. $source_type);
845 #ilLoggerFactory::getLogger('obj')->debug('Target type: '. $target_type);
846 #ilLoggerFactory::getLogger('obj')->debug('Submode: '. $this->getSubMode());
847
848 // adopt content mode
849 if (
850 $this->getSubMode() != self::SUBMODE_CONTENT_ONLY and
851 ($source_type != 'crs' or $target_type != 'crs')
852 ) {
854 sprintf(
855 $this->lng->txt('msg_obj_may_not_contain_objects_of_type'),
856 $this->lng->txt('obj_' . $target_type),
857 $this->lng->txt('obj_' . $source_type)
858 )
859 );
860 $this->searchSource();
861 return false;
862 }
863 }
864 }
865 }
866
867
868 if ($objDefinition->isContainer($this->getType())) {
869 $this->showItemSelection();
870 } else {
871 $this->copySingleObject();
872 }
873 }
sprintf('%.4f', $callTime)
searchSource()
Search source.
copySingleObject()
Start cloning a single (not container) object.
static getClassByType($a_obj_type)
Get class by type.

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

+ Here is the call graph for this function:

◆ saveSourceMembership()

ilObjectCopyGUI::saveSourceMembership ( )
protected

Save selected source from membership screen.

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

879 {
880 $objDefinition = $this->obj_definition;
881
882 if (!isset($_REQUEST['source'])) {
883 ilUtil::sendFailure($this->lng->txt('select_one'));
884 $GLOBALS['ilCtrl']->redirect($this, 'showSourceSelectionMembership');
885 return false;
886 }
887
888 $this->setSource(array((int) $_REQUEST['source']));
889 $this->setType(ilObject::_lookupType((int) $this->getFirstSource(), true));
890 $GLOBALS['ilCtrl']->setParameter($this, 'source_id', (int) $_REQUEST['source']);
891
892 if ($objDefinition->isContainer($this->getType())) {
893 $this->showItemSelection();
894 } else {
895 $this->copySingleObject();
896 }
897 }

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

+ Here is the call graph for this function:

◆ saveTarget()

ilObjectCopyGUI::saveTarget ( )
protected

Save target selection.

Returns

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

514 {
515 $objDefinition = $this->obj_definition;
518
519
520 // begin-patch mc
521 if (is_array($_REQUEST['target']) and $_REQUEST['target']) {
522 $this->setTargets($_REQUEST['target']);
523 $GLOBALS['ilCtrl']->setParameter($this, 'target_ids', implode('_', $this->getTargets()));
524 }
525 // paste from clipboard
526 elseif ((int) $_REQUEST['target']) {
527 $this->setTarget($_REQUEST['target']);
528 $GLOBALS['ilCtrl']->setParameter($this, 'target_ids', implode('_', $this->getTargets()));
529 }
530 // end-patch multi copy
531 else {
532 $ilCtrl->setParameter($this, 'selectMode', self::TARGET_SELECTION);
533 ilUtil::sendFailure($this->lng->txt('select_one'));
535 return false;
536 }
537
538 // validate allowed subtypes
539 foreach ($this->getSources() as $source_ref_id) {
540 foreach ((array) $this->getTargets() as $target_ref_id) {
541 $target_type = ilObject::_lookupType($target_ref_id, true);
542 $target_class_name = ilObjectFactory::getClassByType($target_type);
543 $target_object = new $target_class_name($target_ref_id);
544 $possible_subtypes = $target_object->getPossibleSubObjects();
545
546 $source_type = ilObject::_lookupType($source_ref_id, true);
547
548 if (!array_key_exists($source_type, (array) $possible_subtypes)) {
550 sprintf(
551 $this->lng->txt('msg_obj_may_not_contain_objects_of_type'),
552 $this->lng->txt('obj_' . $target_type),
553 $this->lng->txt('obj_' . $source_type)
554 )
555 );
557 return false;
558 }
559 }
560 }
561
562 if ((count($this->getSources()) == 1) && $objDefinition->isContainer($this->getType())) {
563 // check, if object should be copied into itself
564 // begin-patch mc
565 $is_child = array();
566 foreach ($this->getTargets() as $target_ref_id) {
567 if ($tree->isGrandChild($this->getFirstSource(), $target_ref_id)) {
569 }
570 if ($this->getFirstSource() == $target_ref_id) {
572 }
573 }
574 // end-patch multi copy
575 if (count($is_child) > 0) {
576 ilUtil::sendFailure($this->lng->txt("msg_not_in_itself") . " " . implode(',', $is_child));
578 return false;
579 }
580
581 $this->showItemSelection();
582 } else {
583 if (count($this->getSources()) == 1) {
584 $this->copySingleObject();
585 } else {
586 $this->copyMultipleNonContainer($this->getSources());
587 }
588 }
589 }
static _lookupTitle($a_id)
lookup object title

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

+ Here is the call graph for this function:

◆ searchSource()

ilObjectCopyGUI::searchSource ( )
protected

Search source.

Returns

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

760 {
762 $ilObjDataCache = $this->obj_data_cache;
766
767 if (isset($_POST['tit'])) {
768 ilUtil::sendInfo($this->lng->txt('wizard_search_list'));
769 $_SESSION['source_query'] = $_POST['tit'];
770 } else {
771 $_POST['tit'] = $_SESSION['source_query'];
772 }
773
774 $this->initFormSearch();
775 $this->form->setValuesByPost();
776
777 if (!$this->form->checkInput()) {
778 ilUtil::sendFailure($lng->txt('msg_no_search_string'), true);
779 $ilCtrl->returnToParent($this);
780 return false;
781 }
782
783 include_once './Services/Search/classes/class.ilQueryParser.php';
784 $query_parser = new ilQueryParser($this->form->getInput('tit'));
785 $query_parser->setMinWordLength(1, true);
786 $query_parser->setCombination(QP_COMBINATION_AND);
787 $query_parser->parse();
788 if (!$query_parser->validate()) {
789 ilUtil::sendFailure($query_parser->getMessage(), true);
790 $ilCtrl->returnToParent($this);
791 }
792
793 // only like search since fulltext does not support search with less than 3 characters
794 include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
795 $object_search = new ilLikeObjectSearch($query_parser);
796 $object_search->setFilter(array($_REQUEST['new_type']));
797 $res = $object_search->performSearch();
798 $res->setRequiredPermission('copy');
799 $res->filter(ROOT_FOLDER_ID, true);
800
801 if (!count($results = $res->getResultsByObjId())) {
802 ilUtil::sendFailure($this->lng->txt('search_no_match'), true);
803 $ilCtrl->returnToParent($this);
804 }
805
806
807 include_once './Services/Object/classes/class.ilObjectCopySearchResultTableGUI.php';
808 $table = new ilObjectCopySearchResultTableGUI($this, 'searchSource', $this->getType());
809 $table->setFormAction($GLOBALS['ilCtrl']->getFormAction($this));
810 $table->setSelectedReference($this->getFirstSource());
811 $table->parseSearchResults($results);
812 $tpl->setContent($table->getHTML());
813 }
const QP_COMBINATION_AND
initFormSearch()
Init search form.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(empty($password)) $table
Definition: pwgen.php:24
foreach($_POST as $key=> $value) $res
$results
Definition: svg-scanner.php:47

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

Referenced by saveSource(), and showItemSelection().

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

597 {
598 $this->mode = $a_mode;
599 }

Referenced by adoptContent(), and init().

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

656 {
657 $this->sources = $a_source_ids;
658 }

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

+ Here is the caller graph for this function:

◆ setSubMode()

ilObjectCopyGUI::setSubMode (   $a_mode)

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

611 {
612 $this->sub_mode = $a_mode;
613 }

Referenced by adoptContent(), and init().

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

257 {
258 if ($a_tab_group == self::TAB_GROUP_SC_SELECTION) {
259 if ($this->getSubMode() == self::SUBMODE_CONTENT_ONLY) {
260 if ($this->getMode() == self::SOURCE_SELECTION) {
261 $GLOBALS['ilTabs']->addTab(
262 self::TAB_SELECTION_SOURCE_TREE,
263 $GLOBALS['lng']->txt('cntr_copy_repo_tree'),
264 $GLOBALS['ilCtrl']->getLinkTarget($this, 'initSourceSelection')
265 );
266 $GLOBALS['ilTabs']->addTab(
267 self::TAB_SELECTION_MEMBERSHIP,
268 $GLOBALS['lng']->txt('cntr_copy_crs_grp'),
269 $GLOBALS['ilCtrl']->getLinkTarget($this, 'showSourceSelectionMembership')
270 );
271 }
272 }
273 }
274 $GLOBALS['ilTabs']->activateTab($a_active_tab);
275 }

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

Referenced by initSourceSelection(), and showSourceSelectionMembership().

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

694 {
695 $this->setTargets(array($a_ref_id));
696 }

References setTargets().

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

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

◆ setTargets()

ilObjectCopyGUI::setTargets ( array  $a_target)

Set target id.

Parameters
int$a_target
Returns

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

705 {
706 $this->targets = $a_target;
707 }

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

+ Here is the caller graph for this function:

◆ setType()

ilObjectCopyGUI::setType (   $type)

Sets $type.

Parameters
object$type
See also
ilObjectCopyGUI::$type

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

646 {
647 $this->type = $type;
648 }

References $type.

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

+ Here is the caller graph for this function:

◆ showCopyProgress()

ilObjectCopyGUI::showCopyProgress ( )
protected

Show progress for copying.

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

1101 {
1102 include_once './Services/Object/classes/class.ilObjectCopyProgressTableGUI.php';
1103 $progress = new ilObjectCopyProgressTableGUI(
1104 $this,
1105 'showCopyProgress',
1106 (int) $_GET['ref_id']
1107 );
1108 $progress->setObjectInfo($this->targets_copy_id);
1109 $progress->parse();
1110 $progress->init();
1111 $progress->setRedirectionUrl($GLOBALS['ilCtrl']->getParentReturn($this->parent_obj));
1112
1113 $GLOBALS['tpl']->setContent($progress->getHTML());
1114 }

References $_GET, and $GLOBALS.

Referenced by copyContainerToTargets().

+ Here is the caller graph for this function:

◆ showItemSelection()

ilObjectCopyGUI::showItemSelection ( )
protected
Returns

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

904 {
906
907 if (!count($this->getSources())) {
908 ilUtil::sendFailure($this->lng->txt('select_one'));
909 $this->searchSource();
910 return false;
911 }
912
913 ilLoggerFactory::getLogger('obj')->debug('Source(s): ' . print_r($this->getSources(), true));
914 ilLoggerFactory::getLogger('obj')->debug('Target(s): ' . print_r($this->getTargets(), true));
915
916 ilUtil::sendInfo($this->lng->txt($this->getType() . '_copy_threads_info'));
917 include_once './Services/Object/classes/class.ilObjectCopySelectionTableGUI.php';
918
919 $tpl->addJavaScript('./Services/CopyWizard/js/ilContainer.js');
920 $tpl->setVariable('BODY_ATTRIBUTES', 'onload="ilDisableChilds(\'cmd\');"');
921
922 switch ($this->getMode()) {
924 $back_cmd = 'showSourceSelectionTree';
925 break;
926
928 $back_cmd = 'showTargetSelectionTree';
929 break;
930
932 $back_cmd = 'searchSource';
933 break;
934 }
935
936 $table = new ilObjectCopySelectionTableGUI($this, 'showItemSelection', $this->getType(), $back_cmd);
937 $table->parseSource($this->getFirstSource());
938
939 $tpl->setContent($table->getHTML());
940 }

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

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

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

1206 {
1207 $tpl = $this->tpl;
1208
1209 // Disabled for performance
1210 #if(!$this->sourceExists())
1211 #{
1212 # return false;
1213 #}
1214
1215 $this->unsetSession();
1216 $this->initFormSearch();
1217
1218 if ($a_tplvar) {
1219 $tpl->setVariable($a_tplvar, $this->form->getHTML());
1220 } else {
1221 return $this->form;
1222 }
1223 }
unsetSession()
Unset session variables.
if(isset($_POST['submit'])) $form

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

+ Here is the call graph for this function:

◆ showSourceSelectionMembership()

ilObjectCopyGUI::showSourceSelectionMembership ( )
protected

show target selection membership

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

370 {
371 ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard_source'));
372 $this->setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_MEMBERSHIP);
373
374 include_once './Services/Object/classes/class.ilObjectCopyCourseGroupSelectionTableGUI.php';
375 $cgs = new ilObjectCopyCourseGroupSelectionTableGUI($this, 'showSourceSelectionMembership', 'copy_selection_membership');
376 $cgs->init();
377 $cgs->setObjects(
378 array_merge(
379 ilParticipants::_getMembershipByType($GLOBALS['ilUser']->getId(), 'crs', false),
380 ilParticipants::_getMembershipByType($GLOBALS['ilUser']->getId(), 'grp', false)
381 )
382 );
383 $cgs->parse();
384
385 $GLOBALS['tpl']->setContent($cgs->getHTML());
386 }
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership

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

+ Here is the call graph for this function:

◆ showSourceSelectionTree()

ilObjectCopyGUI::showSourceSelectionTree ( )

Show target selection.

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

450 {
451 $ilTabs = $this->tabs;
452 $ilToolbar = $this->toolbar;
456 $objDefinition = $this->obj_definition;
457
458 $this->tpl = $tpl;
459 $this->tpl->addBlockfile(
460 'ADM_CONTENT',
461 'adm_content',
462 'tpl.paste_into_multiple_objects.html',
463 "Services/Object"
464 );
465
466 ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard_source'));
467 include_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
470 'ilias.php?baseClass=ilRepositoryGUI&cmd=goto',
471 'paste_copy_repexpand'
472 );
473 $exp->setRequiredFormItemPermission('visible,read,copy');
474
475 $ilCtrl->setParameter($this, 'selectMode', self::SOURCE_SELECTION);
476 $exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'showSourceSelectionTree'));
477 $exp->setTargetGet('ref_id');
478 $exp->setPostVar('source');
479 $exp->setCheckedItems($this->getSources());
480
481 // Filter to container
482 foreach (array('cat','root','fold') as $container) {
483 $exp->removeFormItemForType($container);
484 }
485
486
487 if ($_GET['paste_copy_repexpand'] == '') {
488 $expanded = $tree->readRootId();
489 } else {
490 $expanded = $_GET['paste_copy_repexpand'];
491 }
492
493 $this->tpl->setVariable('FORM_TARGET', '_self');
494 $this->tpl->setVariable('FORM_ACTION', $ilCtrl->getFormAction($this, 'copySelection'));
495
496 $exp->setExpand($expanded);
497 // build html-output
498 $exp->setOutput(0);
499 $output = $exp->getOutput();
500
501 $this->tpl->setVariable('OBJECT_TREE', $output);
502
503 $this->tpl->setVariable('CMD_SUBMIT', 'saveSource');
504 $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('btn_next'));
505
506 $ilToolbar->addButton($this->lng->txt('cancel'), $ilCtrl->getLinkTarget($this, 'cancel'));
507 }
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
$container
Definition: wac.php:13

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

Referenced by initSourceSelection().

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

393 {
394 $ilTabs = $this->tabs;
395 $ilToolbar = $this->toolbar;
399 $objDefinition = $this->obj_definition;
401
402 $this->tpl = $tpl;
403
404 if ($objDefinition->isContainer($this->getType())) {
405 ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard_container'));
406 } else {
407 ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard'));
408 }
409
410 //
411 include_once("./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
412 $exp = new ilRepositorySelectorExplorerGUI($this, "showTargetSelectionTree");
413 $exp->setTypeWhiteList(array("root", "cat", "grp", "crs", "fold"));
414 // begin-patch mc
415 $exp->setSelectMode("target", true);
416 // end-patch multi copy
417 if ($exp->handleCommand()) {
418 return;
419 }
420 $output = $exp->getHTML();
421
422 // toolbars
423 $t = new ilToolbarGUI();
424 $t->setFormAction($ilCtrl->getFormAction($this, "saveTarget"));
425 if ($objDefinition->isContainer($this->getType())) {
426 $t->addFormButton($lng->txt("btn_next"), "saveTarget");
427 } else {
428 $t->addFormButton($lng->txt("paste"), "saveTarget");
429 }
430 $t->addSeparator();
431 $t->addFormButton($lng->txt("obj_insert_into_clipboard"), "keepObjectsInClipboard");
432 $t->addFormButton($lng->txt("cancel"), "cancel");
433 $t->setCloseFormTag(false);
434 $t->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " ");
435 $output = $t->getHTML() . $output;
436 $t->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " ");
437 $t->setCloseFormTag(true);
438 $t->setOpenFormTag(false);
439 $output.= "<br />" . $t->getHTML();
440
441 $this->tpl->setContent($output);
442
443 return;
444 }
Explorer for selecting repository items.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $ctrl, $ilCtrl, $lng, $obj_definition, $output, $t, $tabs, $toolbar, $tpl, $tree, ilUtil\getImagePath(), and ilUtil\sendInfo().

Referenced by initTargetSelection(), and saveTarget().

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

1231 {
1233
1234 return (bool) ilUtil::_getObjectsByOperations($this->getType(), 'copy', $ilUser->getId(), 1);
1235 }
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,...

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

+ Here is the call graph for this function:

◆ unsetSession()

ilObjectCopyGUI::unsetSession ( )
protected

Unset session variables.

Returns

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

1272 {
1273 unset($_SESSION['source_query']);
1274 $this->setSource(array());
1275 }

References $_SESSION, and setSource().

Referenced by showSourceSearch().

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

◆ updateProgress()

ilObjectCopyGUI::updateProgress ( )
protected

Update progress.

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

1120 {
1121 $json = new stdClass();
1122 $json->percentage = null;
1123 $json->performed_steps = null;
1124
1125 include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1126 $options = ilCopyWizardOptions::_getInstance((int) $_REQUEST['copy_id']);
1127 $json->required_steps = $options->getRequiredSteps();
1128 $json->id = (int) $_REQUEST['copy_id'];
1129
1130 ilLoggerFactory::getLogger('obj')->debug('Update copy progress: ' . json_encode($json));
1131
1132 echo json_encode($json);
1133 exit;
1134 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $access

ilObjectCopyGUI::$access
protected

◆ $ctrl

◆ $error

ilObjectCopyGUI::$error
protected

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

Referenced by copyContainer(), and copySingleObject().

◆ $lng

ilObjectCopyGUI::$lng
private

◆ $log

ilObjectCopyGUI::$log = null
private

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

Referenced by copyContainer().

◆ $mode

ilObjectCopyGUI::$mode = 0
private

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

Referenced by getMode().

◆ $obj_data_cache

ilObjectCopyGUI::$obj_data_cache
protected

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

Referenced by searchSource().

◆ $obj_definition

ilObjectCopyGUI::$obj_definition
protected

◆ $parent_obj

ilObjectCopyGUI::$parent_obj = null
private

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

Referenced by getParentObject().

◆ $rbacreview

ilObjectCopyGUI::$rbacreview
protected

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

Referenced by copyMultipleNonContainer(), and copySingleObject().

◆ $rbacsystem

ilObjectCopyGUI::$rbacsystem
protected

◆ $sources

ilObjectCopyGUI::$sources = array()
private

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

Referenced by getSources().

◆ $sub_mode

ilObjectCopyGUI::$sub_mode = self::SUBMODE_COMPLETE
private

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

Referenced by getSubMode().

◆ $tabs

ilObjectCopyGUI::$tabs
protected

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

Referenced by showSourceSelectionTree(), and showTargetSelectionTree().

◆ $targets

ilObjectCopyGUI::$targets = array()
private

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

Referenced by getFirstTarget(), and getTargets().

◆ $targets_copy_id

ilObjectCopyGUI::$targets_copy_id = array()
private

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

◆ $toolbar

ilObjectCopyGUI::$toolbar
protected

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

Referenced by showSourceSelectionTree(), and showTargetSelectionTree().

◆ $tpl

ilObjectCopyGUI::$tpl
protected

◆ $tree

◆ $type

ilObjectCopyGUI::$type = ''
private

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

Referenced by getType(), and setType().

◆ $user

ilObjectCopyGUI::$user
protected

◆ SEARCH_SOURCE

const ilObjectCopyGUI::SEARCH_SOURCE = 3

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

Referenced by showItemSelection().

◆ SOURCE_SELECTION

const ilObjectCopyGUI::SOURCE_SELECTION = 1

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

Referenced by showItemSelection().

◆ SUBMODE_COMPLETE

const ilObjectCopyGUI::SUBMODE_COMPLETE = 1

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

◆ SUBMODE_CONTENT_ONLY

const ilObjectCopyGUI::SUBMODE_CONTENT_ONLY = 2

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

Referenced by ilContainer\cloneAllObject().

◆ TAB_GROUP_SC_SELECTION

const ilObjectCopyGUI::TAB_GROUP_SC_SELECTION = 1

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

◆ TAB_SELECTION_MEMBERSHIP

const ilObjectCopyGUI::TAB_SELECTION_MEMBERSHIP = 3

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

◆ TAB_SELECTION_SOURCE_TREE

const ilObjectCopyGUI::TAB_SELECTION_SOURCE_TREE = 2

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

◆ TAB_SELECTION_TARGET_TREE

const ilObjectCopyGUI::TAB_SELECTION_TARGET_TREE = 1

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

◆ TARGET_SELECTION

const ilObjectCopyGUI::TARGET_SELECTION = 2

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

Referenced by showItemSelection().


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