ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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

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

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 }
static getLogger($a_component_id)
Get component logger.
global $ilCtrl
Definition: ilias.php:18

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

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

222 {
223 $GLOBALS['ilCtrl']->setParameter($this,'smode',self::SUBMODE_CONTENT_ONLY);
224 $GLOBALS['ilCtrl']->setParameter($this,'selectMode',self::SOURCE_SELECTION);
225
226
227 $this->setSubMode(self::SUBMODE_CONTENT_ONLY);
228 $this->setMode(self::SOURCE_SELECTION);
229 $this->setTarget((int) $_GET['ref_id']);
230
231
232 return $this->initSourceSelection();
233 }
$_GET["client_id"]
setMode($a_mode)
set copy mode
initSourceSelection()
Init source selection.
setTarget($a_ref_id)
Set single object target.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

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

690 {
691 global $ilCtrl;
692 $ilCtrl->setReturnByClass(get_class($this->parent_obj),'cancel');
693 $ilCtrl->returnToParent($this);
694 }

References $ilCtrl.

◆ copyContainer()

ilObjectCopyGUI::copyContainer (   $a_target)
protected

Copy a container.

Returns

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

1134 {
1135 global $ilLog, $ilCtrl;
1136
1137 include_once('./Services/Link/classes/class.ilLink.php');
1138 include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
1139
1140 global $ilAccess,$ilErr,$rbacsystem,$tree,$ilUser,$ilCtrl;
1141
1142 // Workaround for course in course copy
1143
1146
1147 if($this->getSubMode() != self::SUBMODE_CONTENT_ONLY)
1148 {
1149 if(!$rbacsystem->checkAccess('create', $a_target,$this->getType()))
1150 {
1151 $this->log->notice('Permission denied for target: '. $a_target.' type: ' . $this->getType().' CREATE');
1152 ilUtil::sendFailure($this->lng->txt('permission_denied'),true);
1153 $ilCtrl->returnToParent($this);
1154 }
1155 }
1156 if(!$this->getFirstSource())
1157 {
1158 ilUtil::sendFailure($this->lng->txt('select_one'),true);
1159 $ilCtrl->returnToParent($this);
1160 return false;
1161 }
1162
1163 $options = $_POST['cp_options'] ? $_POST['cp_options'] : array();
1164
1165
1166 ilLoggerFactory::getLogger('obj')->debug('Copy container (sources): '. print_r($this->getSources(),TRUE));
1167
1169 $result = $orig->cloneAllObject(
1170 $_COOKIE['PHPSESSID'],
1171 $_COOKIE['ilClientId'],
1172 $this->getType(),
1173 $a_target,
1174 $this->getFirstSource(),
1175 $options,
1176 FALSE,
1177 $this->getSubMode()
1178 );
1179
1180 $this->targets_copy_id[$a_target] = $result['copy_id'];
1181
1182 return $result;
1183 }
$result
getType()
Returns $type.
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.
$_POST['username']
Definition: cron.php:12
$_COOKIE["ilClientId"]
Definition: cron.php:11
$target_type
Definition: goto.php:87
if(!is_array($argv)) $options
global $ilUser
Definition: imgupload.php:15

References $_COOKIE, $_POST, $ilCtrl, $ilErr, $ilLog, $ilUser, $options, $result, $target_type, 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 1049 of file class.ilObjectCopyGUI.php.

1050 {
1051 global $ilCtrl;
1052
1053 ilLoggerFactory::getLogger('obj')->debug('Copy container to targets: '. print_r($_REQUEST,TRUE));
1054 ilLoggerFactory::getLogger('obj')->debug('Source(s): '. print_r($this->getSources(),TRUE));
1055 ilLoggerFactory::getLogger('obj')->debug('Target(s): '. print_r($this->getTargets(),TRUE));
1056
1057
1058 $last_target = 0;
1059 $result = 1;
1060 foreach($this->getTargets() as $target_ref_id)
1061 {
1062 $result = $this->copyContainer($target_ref_id);
1063 $last_target = $target_ref_id;
1064 }
1065
1066 unset($_SESSION["clipboard"]["ref_ids"]);
1067 unset($_SESSION["clipboard"]["cmd"]);
1068
1069 include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1071 {
1072 ilLoggerFactory::getLogger('obj')->info('Object copy completed.');
1073 ilUtil::sendSuccess($this->lng->txt("object_duplicated"),true);
1074 $ilCtrl->setParameterByClass(
1075 "ilrepositorygui",
1076 "ref_id",
1077 $result['ref_id']
1078 );
1079 $ilCtrl->redirectByClass("ilrepositorygui", "");
1080 }
1081 else
1082 {
1083 // show progress
1084 ilLoggerFactory::getLogger('obj')->debug('Object copy in progress.');
1085 return $this->showCopyProgress();
1086 }
1087 }
$_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.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7

References $_REQUEST, $_SESSION, $ilCtrl, $result, 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 941 of file class.ilObjectCopyGUI.php.

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

References $_SESSION, $ilCtrl, $ilUser, 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 918 of file class.ilObjectCopyGUI.php.

919 {
920 include_once('./Services/Link/classes/class.ilLink.php');
921 include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
922
923 global $ilAccess,$ilErr,$rbacsystem,$ilUser,$ilCtrl,$rbacreview;
924
925 // Source defined
926 if(!count($this->getSource()))
927 {
928 ilUtil::sendFailure($this->lng->txt('select_one'),true);
929 $ilCtrl->returnToParent($this);
930 }
931
932 $this->copyMultipleNonContainer($this->getSource());
933 return;
934 }
copyMultipleNonContainer($a_sources)
Copy multiple non container.
getSource()
Get source id.

References $ilCtrl, $ilErr, $ilUser, copyMultipleNonContainer(), getSource(), 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 76 of file class.ilObjectCopyGUI.php.

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

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

+ Here is the call graph for this function:

◆ getFirstSource()

ilObjectCopyGUI::getFirstSource ( )

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

632 {
633 if(count($this->sources))
634 {
635 return $this->sources[0];
636 }
637 return 0;
638 }

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

676 {
677 if(array_key_exists(0, $this->getTargets()))
678 {
679 $targets = $this->getTargets();
680 return $targets[0];
681 }
682 return 0;
683 }

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

558 {
559 return $this->mode;
560 }

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

577 {
578 return $this->parent_obj;
579 }

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

618 {
619 return $this->getSources();
620 }

References getSources().

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

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

627 {
628 return (array) $this->sources;
629 }

References $sources.

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

+ Here is the caller graph for this function:

◆ getSubMode()

ilObjectCopyGUI::getSubMode ( )

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

568 {
569 return $this->sub_mode;
570 }

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

667 {
668 return (array) $this->targets;
669 }

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

587 {
588 return $this->type;
589 }

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

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

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

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

280 {
281 global $ilCtrl,$tree;
282
283 // empty session on init
284 $_SESSION['paste_copy_repexpand'] = array();
285
286 // copy opened nodes from repository explorer
287 $_SESSION['paste_copy_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
288
289 $this->setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_SOURCE_TREE);
290
291
292 // open current position
293 // begin-patch mc
294 foreach($this->getTargets() as $target_ref_id)
295 {
296 $path = $tree->getPathId($target_ref_id);
297 foreach((array) $path as $node_id)
298 {
299 if(!in_array($node_id, $_SESSION['paste_copy_repexpand']))
300 {
301 $_SESSION['paste_copy_repexpand'][] = $node_id;
302 }
303 }
304 }
305 // end-patch multi copy
306 $ilCtrl->setReturnByClass(get_class($this->parent_obj),'');
307 $this->showSourceSelectionTree();
308 }
setTabs($a_tab_group, $a_active_tab)
Set tabs.
showSourceSelectionTree()
Show target selection.
$path
Definition: index.php:22

References $_SESSION, $ilCtrl, $path, 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 177 of file class.ilObjectCopyGUI.php.

178 {
179 $GLOBALS['lng']->loadLanguageModule('cntr');
180 $GLOBALS['ilTabs']->clearTargets();
181 $GLOBALS['ilTabs']->setBackTarget(
182 $GLOBALS['lng']->txt('tab_back_to_repository'),
183 $GLOBALS['ilCtrl']->getParentReturn($this->parent_obj)
184 );
185 }

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

240 {
241 global $ilCtrl, $tree;
242 $ilCtrl->setParameter($this, 'selectMode', self::TARGET_SELECTION);
243 // empty session on init
244 $_SESSION['paste_copy_repexpand'] = array();
245
246 // copy opened nodes from repository explorer
247 $_SESSION['paste_copy_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
248
249 // begin-patch mc
250 $this->setTargets(array());
251 // cognos-blu-patch: end
252
253 // open current position
254
255 foreach($this->getSource() as $source_id)
256 {
257 if($source_id)
258 {
259 $path = $tree->getPathId($source_id);
260 foreach((array) $path as $node_id)
261 {
262 if(!in_array($node_id, $_SESSION['paste_copy_repexpand']))
263 {
264 $_SESSION['paste_copy_repexpand'][] = $node_id;
265 }
266 }
267
268 }
269 }
270
271 $ilCtrl->setReturnByClass(get_class($this->parent_obj),'');
273 }
showTargetSelectionTree()
Show target selection.

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

+ Here is the call graph for this function:

◆ keepObjectsInClipboard()

ilObjectCopyGUI::keepObjectsInClipboard ( )

Keep objects in clipboard.

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

700 {
701 global $ilCtrl;
702 $_SESSION['clipboard']['cmd'] = "copy";
703 $_SESSION['clipboard']['ref_ids'] = $this->getSource();
704 $ilCtrl->returnToParent($this);
705 }

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

+ Here is the call graph for this function:

◆ saveSource()

ilObjectCopyGUI::saveSource ( )
protected

select source object

Returns

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

776 {
777 global $objDefinition;
778
779 if(isset($_POST['source']))
780 {
781 $this->setSource(array((int) $_REQUEST['source']));
782 $this->setType(ilObject::_lookupType((int) $_REQUEST['source'], TRUE));
783 $GLOBALS['ilCtrl']->setParameter($this,'source_id',(int) $_REQUEST['source']);
784 }
785 else
786 {
787 ilUtil::sendFailure($this->lng->txt('select_one'));
788 $this->searchSource();
789 return false;
790 }
791
792 // validate allowed subtypes
793 foreach($this->getSources() as $source_ref_id)
794 {
795 foreach((array) $this->getTargets() as $target_ref_id)
796 {
797 $target_type = ilObject::_lookupType($target_ref_id, TRUE);
798 $target_class_name = ilObjectFactory::getClassByType($target_type);
799 $target_object = new $target_class_name($target_ref_id);
800 $possible_subtypes = $target_object->getPossibleSubObjects();
801
802 $source_type = ilObject::_lookupType($source_ref_id, TRUE);
803
804 if(!array_key_exists($source_type, $possible_subtypes))
805 {
806 #ilLoggerFactory::getLogger('obj')->debug('Source type: '. $source_type);
807 #ilLoggerFactory::getLogger('obj')->debug('Target type: '. $target_type);
808 #ilLoggerFactory::getLogger('obj')->debug('Submode: '. $this->getSubMode());
809
810 // adopt content mode
811 if(
812 $this->getSubMode() != self::SUBMODE_CONTENT_ONLY and
813 ($source_type != 'crs' or $target_type != 'crs')
814 )
815 {
817 sprintf(
818 $this->lng->txt('msg_obj_may_not_contain_objects_of_type'),
819 $this->lng->txt('obj_'.$target_type),
820 $this->lng->txt('obj_'.$source_type))
821 );
822 $this->searchSource();
823 return FALSE;
824
825 }
826 }
827 }
828 }
829
830
831 if($objDefinition->isContainer($this->getType()))
832 {
833 $this->showItemSelection();
834 }
835 else
836 {
837 $this->copySingleObject();
838 }
839 }
searchSource()
Search source.
copySingleObject()
Start cloning a single (not container) object.
static getClassByType($a_obj_type)
Get class by type.

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

+ Here is the call graph for this function:

◆ saveSourceMembership()

ilObjectCopyGUI::saveSourceMembership ( )
protected

Save selected source from membership screen.

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

845 {
846 global $objDefinition;
847
848 if(!isset($_REQUEST['source']))
849 {
850 ilUtil::sendFailure($this->lng->txt('select_one'));
851 $GLOBALS['ilCtrl']->redirect($this,'showSourceSelectionMembership');
852 return FALSE;
853 }
854
855 $this->setSource(array((int) $_REQUEST['source']));
856 $this->setType(ilObject::_lookupType((int) $this->getFirstSource(), TRUE));
857 $GLOBALS['ilCtrl']->setParameter($this,'source_id',(int) $_REQUEST['source']);
858
859 if($objDefinition->isContainer($this->getType()))
860 {
861 $this->showItemSelection();
862 }
863 else
864 {
865 $this->copySingleObject();
866 }
867 }

References $_REQUEST, $GLOBALS, 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 452 of file class.ilObjectCopyGUI.php.

453 {
454 global $objDefinition, $tree, $ilCtrl;
455
456
457 // begin-patch mc
458 if(is_array($_REQUEST['target']) and $_REQUEST['target'])
459 {
460 $this->setTargets($_REQUEST['target']);
461 $GLOBALS['ilCtrl']->setParameter($this,'target_ids', implode('_', $this->getTargets()));
462 }
463 // paste from clipboard
464 elseif((int) $_REQUEST['target'])
465 {
466 $this->setTarget($_REQUEST['target']);
467 $GLOBALS['ilCtrl']->setParameter($this,'target_ids', implode('_', $this->getTargets()));
468 }
469 // end-patch multi copy
470 else
471 {
472 $ilCtrl->setParameter($this, 'selectMode', self::TARGET_SELECTION);
473 ilUtil::sendFailure($this->lng->txt('select_one'));
475 return false;
476 }
477
478 // validate allowed subtypes
479 foreach($this->getSources() as $source_ref_id)
480 {
481 foreach((array) $this->getTargets() as $target_ref_id)
482 {
483 $target_type = ilObject::_lookupType($target_ref_id, TRUE);
484 $target_class_name = ilObjectFactory::getClassByType($target_type);
485 $target_object = new $target_class_name($target_ref_id);
486 $possible_subtypes = $target_object->getPossibleSubObjects();
487
488 $source_type = ilObject::_lookupType($source_ref_id, TRUE);
489
490 if(!array_key_exists($source_type, (array) $possible_subtypes))
491 {
493 sprintf(
494 $this->lng->txt('msg_obj_may_not_contain_objects_of_type'),
495 $this->lng->txt('obj_'.$target_type),
496 $this->lng->txt('obj_'.$source_type))
497 );
499 return FALSE;
500 }
501 }
502 }
503
504 if(count($this->getSource() == 1) && $objDefinition->isContainer($this->getType()))
505 {
506 // check, if object should be copied into itself
507 // begin-patch mc
508 $is_child = array();
509 foreach($this->getTargets() as $target_ref_id)
510 {
511 if ($tree->isGrandChild($this->getFirstSource(), $target_ref_id))
512 {
514 }
515 if ($this->getFirstSource() == $target_ref_id)
516 {
518 }
519 }
520 // end-patch multi copy
521 if (count($is_child) > 0)
522 {
523 ilUtil::sendFailure($this->lng->txt("msg_not_in_itself")." ".implode(',',$is_child));
525 return false;
526 }
527
528 $this->showItemSelection();
529 }
530 else
531 {
532 if(count($this->getSource()) == 1)
533 {
534 $this->copySingleObject();
535 }
536 else
537 {
538 $this->copyMultipleNonContainer($this->getSource());
539 }
540 }
541 }
static _lookupTitle($a_id)
lookup object title

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

+ Here is the call graph for this function:

◆ searchSource()

ilObjectCopyGUI::searchSource ( )
protected

Search source.

Returns

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

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

References $_POST, $_REQUEST, $_SESSION, $GLOBALS, $ilCtrl, $lng, $res, $results, $tpl, 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 548 of file class.ilObjectCopyGUI.php.

549 {
550 $this->mode = $a_mode;
551 }

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

608 {
609 $this->sources = $a_source_ids;
610 }

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

+ Here is the caller graph for this function:

◆ setSubMode()

ilObjectCopyGUI::setSubMode (   $a_mode)

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

563 {
564 $this->sub_mode = $a_mode;
565 }

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

193 {
194 if($a_tab_group == self::TAB_GROUP_SC_SELECTION)
195 {
196 if($this->getSubMode() == self::SUBMODE_CONTENT_ONLY)
197 {
198 if($this->getMode() == self::SOURCE_SELECTION)
199 {
200 $GLOBALS['ilTabs']->addTab(
201 self::TAB_SELECTION_SOURCE_TREE,
202 $GLOBALS['lng']->txt('cntr_copy_repo_tree'),
203 $GLOBALS['ilCtrl']->getLinkTarget($this,'initSourceSelection')
204 );
205 $GLOBALS['ilTabs']->addTab(
206 self::TAB_SELECTION_MEMBERSHIP,
207 $GLOBALS['lng']->txt('cntr_copy_crs_grp'),
208 $GLOBALS['ilCtrl']->getLinkTarget($this,'showSourceSelectionMembership')
209 );
210 }
211 }
212 }
213 $GLOBALS['ilTabs']->activateTab($a_active_tab);
214 }

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

647 {
648 $this->setTargets(array($a_ref_id));
649 }

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

658 {
659 $this->targets = $a_target;
660 }

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

598 {
599 $this->type = $type;
600 }

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

1093 {
1094 include_once './Services/Object/classes/class.ilObjectCopyProgressTableGUI.php';
1095 $progress = new ilObjectCopyProgressTableGUI(
1096 $this,
1097 'showCopyProgress',
1098 (int) $_GET['ref_id']
1099 );
1100 $progress->setObjectInfo($this->targets_copy_id);
1101 $progress->parse();
1102 $progress->init();
1103 $progress->setRedirectionUrl($GLOBALS['ilCtrl']->getParentReturn($this->parent_obj));
1104
1105 $GLOBALS['tpl']->setContent($progress->getHTML());
1106 }

References $_GET, and $GLOBALS.

Referenced by copyContainerToTargets().

+ Here is the caller graph for this function:

◆ showItemSelection()

ilObjectCopyGUI::showItemSelection ( )
protected
Returns

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

874 {
875 global $tpl;
876
877 if(!count($this->getSource()))
878 {
879 ilUtil::sendFailure($this->lng->txt('select_one'));
880 $this->searchSource();
881 return false;
882 }
883
884 ilLoggerFactory::getLogger('obj')->debug('Source(s): '. print_r($this->getSources(),TRUE));
885 ilLoggerFactory::getLogger('obj')->debug('Target(s): '. print_r($this->getTargets(),TRUE));
886
887 ilUtil::sendInfo($this->lng->txt($this->getType().'_copy_threads_info'));
888 include_once './Services/Object/classes/class.ilObjectCopySelectionTableGUI.php';
889
890 $tpl->addJavaScript('./Services/CopyWizard/js/ilContainer.js');
891 $tpl->setVariable('BODY_ATTRIBUTES','onload="ilDisableChilds(\'cmd\');"');
892
893 switch($this->getMode())
894 {
896 $back_cmd = 'showSourceSelectionTree';
897 break;
898
900 $back_cmd = 'showTargetSelectionTree';
901 break;
902
904 $back_cmd = 'searchSource';
905 break;
906 }
907
908 $table = new ilObjectCopySelectionTableGUI($this,'showItemSelection',$this->getType(),$back_cmd);
909 $table->parseSource($this->getFirstSource());
910
911 $tpl->setContent($table->getHTML());
912 }

References $tpl, getFirstSource(), ilLoggerFactory\getLogger(), getMode(), getSource(), 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 1194 of file class.ilObjectCopyGUI.php.

1195 {
1196 global $tpl;
1197
1198 // Disabled for performance
1199 #if(!$this->sourceExists())
1200 #{
1201 # return false;
1202 #}
1203
1204 $this->unsetSession();
1205 $this->initFormSearch();
1206
1207 if($a_tplvar)
1208 {
1209 $tpl->setVariable($a_tplvar,$this->form->getHTML());
1210 }
1211 else
1212 {
1213 return $this->form;
1214 }
1215 }
unsetSession()
Unset session variables.

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

+ Here is the call graph for this function:

◆ showSourceSelectionMembership()

ilObjectCopyGUI::showSourceSelectionMembership ( )
protected

show target selection membership

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

315 {
316 ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard_source'));
317 $this->setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_MEMBERSHIP);
318
319 include_once './Services/Object/classes/class.ilObjectCopyCourseGroupSelectionTableGUI.php';
320 $cgs = new ilObjectCopyCourseGroupSelectionTableGUI($this, 'showSourceSelectionMembership','copy_selection_membership');
321 $cgs->init();
322 $cgs->setObjects(
323 array_merge(
324 ilParticipants::_getMembershipByType($GLOBALS['ilUser']->getId(), 'crs', FALSE),
325 ilParticipants::_getMembershipByType($GLOBALS['ilUser']->getId(), 'grp', FALSE)
326 )
327 );
328 $cgs->parse();
329
330 $GLOBALS['tpl']->setContent($cgs->getHTML());
331 }
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 395 of file class.ilObjectCopyGUI.php.

396 {
397 global $ilTabs, $ilToolbar, $ilCtrl, $tree, $tpl, $objDefinition;
398
399 $this->tpl = $tpl;
400 $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.paste_into_multiple_objects.html',
401 "Services/Object");
402
403 ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard_source'));
404 include_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
407 'ilias.php?baseClass=ilRepositoryGUI&cmd=goto', 'paste_copy_repexpand');
408 $exp->setRequiredFormItemPermission('visible,read,copy');
409
410 $ilCtrl->setParameter($this, 'selectMode', self::SOURCE_SELECTION);
411 $exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'showSourceSelectionTree'));
412 $exp->setTargetGet('ref_id');
413 $exp->setPostVar('source');
414 $exp->setCheckedItems($this->getSource());
415
416 // Filter to container
417 foreach(array('cat','root','fold') as $container)
418 {
419 $exp->removeFormItemForType($container);
420 }
421
422
423 if($_GET['paste_copy_repexpand'] == '')
424 {
425 $expanded = $tree->readRootId();
426 }
427 else
428 {
429 $expanded = $_GET['paste_copy_repexpand'];
430 }
431
432 $this->tpl->setVariable('FORM_TARGET', '_self');
433 $this->tpl->setVariable('FORM_ACTION', $ilCtrl->getFormAction($this, 'copySelection'));
434
435 $exp->setExpand($expanded);
436 // build html-output
437 $exp->setOutput(0);
438 $output = $exp->getOutput();
439
440 $this->tpl->setVariable('OBJECT_TREE', $output);
441
442 $this->tpl->setVariable('CMD_SUBMIT', 'saveSource');
443 $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('btn_next'));
444
445 $ilToolbar->addButton($this->lng->txt('cancel'), $ilCtrl->getLinkTarget($this,'cancel'));
446 }

References $_GET, $ilCtrl, $tpl, getSource(), 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 337 of file class.ilObjectCopyGUI.php.

338 {
339 global $ilTabs, $ilToolbar, $ilCtrl, $tree, $tpl, $objDefinition, $lng;
340
341 $this->tpl = $tpl;
342
343 if($objDefinition->isContainer($this->getType()))
344 {
345 ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard_container'));
346 }
347 else
348 {
349 ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard'));
350 }
351
352 //
353 include_once("./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
354 $exp = new ilRepositorySelectorExplorerGUI($this, "showTargetSelectionTree");
355 $exp->setTypeWhiteList(array("root", "cat", "grp", "crs", "fold"));
356 // begin-patch mc
357 $exp->setSelectMode("target", TRUE);
358 // end-patch multi copy
359 if ($exp->handleCommand())
360 {
361 return;
362 }
363 $output = $exp->getHTML();
364
365 // toolbars
366 $t = new ilToolbarGUI();
367 $t->setFormAction($ilCtrl->getFormAction($this, "saveTarget"));
368 if($objDefinition->isContainer($this->getType()))
369 {
370 $t->addFormButton($lng->txt("btn_next"), "saveTarget");
371 }
372 else
373 {
374 $t->addFormButton($lng->txt("paste"), "saveTarget");
375 }
376 $t->addSeparator();
377 $t->addFormButton($lng->txt("obj_insert_into_clipboard"), "keepObjectsInClipboard");
378 $t->addFormButton($lng->txt("cancel"), "cancel");
379 $t->setCloseFormTag(false);
380 $t->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " ");
381 $output = $t->getHTML().$output;
382 $t->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " ");
383 $t->setCloseFormTag(true);
384 $t->setOpenFormTag(false);
385 $output.= "<br />".$t->getHTML();
386
387 $this->tpl->setContent($output);
388
389 return;
390 }
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 $ilCtrl, $lng, $t, $tpl, 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 1222 of file class.ilObjectCopyGUI.php.

1223 {
1224 global $ilUser;
1225
1226 return (bool) ilUtil::_getObjectsByOperations($this->getType(),'copy',$ilUser->getId(),1);
1227 }
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, ilUtil\_getObjectsByOperations(), and getType().

+ Here is the call graph for this function:

◆ unsetSession()

ilObjectCopyGUI::unsetSession ( )
protected

Unset session variables.

Returns

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

1263 {
1264 unset($_SESSION['source_query']);
1265 $this->setSource(array());
1266 }

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

1112 {
1113 $json = new stdClass();
1114 $json->percentage = null;
1115 $json->performed_steps = null;
1116
1117 include_once './Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1119 $json->required_steps = $options->getRequiredSteps();
1120 $json->id = (int) $_REQUEST['copy_id'];
1121
1122 ilLoggerFactory::getLogger('obj')->debug('Update copy progress: '. json_encode($json));
1123
1124 echo json_encode($json);
1125 exit;
1126 }
exit
Definition: login.php:54

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

+ 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.

Referenced by showItemSelection().

◆ SOURCE_SELECTION

const ilObjectCopyGUI::SOURCE_SELECTION = 1

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

Referenced by showItemSelection().

◆ 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.

Referenced by showItemSelection().


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