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"];
137 $lng = $DIC->language();
140 $this->lng->loadLanguageModule(
'search');
141 $this->lng->loadLanguageModule(
'obj');
143 $this->parent_obj = $a_parent_gui;
159 $next_class =
$ilCtrl->getNextClass($this);
162 switch ($next_class) {
177 if ((
int) $_REQUEST[
'smode']) {
184 if ($_REQUEST[
'source_ids']) {
185 $this->
setSource(explode(
'_', $_REQUEST[
'source_ids']));
189 if ($_REQUEST[
'source_id']) {
190 $this->
setSource(array((
int) $_REQUEST[
'source_id']));
201 if ($_REQUEST[
'new_type']) {
202 $this->
setMode(self::SEARCH_SOURCE);
203 $this->
setType($_REQUEST[
'new_type']);
215 elseif ($_REQUEST[
'selectMode'] == self::SOURCE_SELECTION) {
216 $this->
setMode(self::SOURCE_SELECTION);
218 $ilCtrl->setParameterByClass(get_class($this->parent_obj),
'selectMode', self::SOURCE_SELECTION);
220 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
223 } elseif ($_REQUEST[
'selectMode'] == self::TARGET_SELECTION) {
224 $this->
setMode(self::TARGET_SELECTION);
225 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
231 if ($_REQUEST[
'target_ids']) {
232 $this->
setTargets(explode(
'_', $_REQUEST[
'target_ids']));
247 $lng->loadLanguageModule(
'cntr');
248 $ilTabs->clearTargets();
249 $ilTabs->setBackTarget(
250 $lng->txt(
'tab_back_to_repository'),
251 $ilCtrl->getParentReturn($this->parent_obj)
260 protected function setTabs($a_tab_group, $a_active_tab)
266 if ($a_tab_group == self::TAB_GROUP_SC_SELECTION) {
267 if ($this->
getSubMode() == self::SUBMODE_CONTENT_ONLY) {
268 if ($this->
getMode() == self::SOURCE_SELECTION) {
270 self::TAB_SELECTION_SOURCE_TREE,
271 $lng->txt(
'cntr_copy_repo_tree'),
272 $ilCtrl->getLinkTarget($this,
'initSourceSelection')
275 self::TAB_SELECTION_MEMBERSHIP,
276 $lng->txt(
'cntr_copy_crs_grp'),
277 $ilCtrl->getLinkTarget($this,
'showSourceSelectionMembership')
282 $ilTabs->activateTab($a_active_tab);
294 $ilCtrl->setParameter($this,
'smode', self::SUBMODE_CONTENT_ONLY);
295 $ilCtrl->setParameter($this,
'selectMode', self::SOURCE_SELECTION);
298 $this->
setSubMode(self::SUBMODE_CONTENT_ONLY);
299 $this->
setMode(self::SOURCE_SELECTION);
314 $ilCtrl->setParameter($this,
'selectMode', self::TARGET_SELECTION);
316 $_SESSION[
'paste_copy_repexpand'] = array();
330 foreach ((array)
$path as $node_id) {
331 if (!in_array($node_id,
$_SESSION[
'paste_copy_repexpand'])) {
332 $_SESSION[
'paste_copy_repexpand'][] = $node_id;
338 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
352 $_SESSION[
'paste_copy_repexpand'] = array();
357 $this->
setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_SOURCE_TREE);
362 foreach ($this->
getTargets() as $target_ref_id) {
364 foreach ((array)
$path as $node_id) {
365 if (!in_array($node_id,
$_SESSION[
'paste_copy_repexpand'])) {
366 $_SESSION[
'paste_copy_repexpand'][] = $node_id;
371 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
385 $this->
setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_MEMBERSHIP);
387 include_once
'./Services/Object/classes/class.ilObjectCopyCourseGroupSelectionTableGUI.php';
398 $tpl->setContent($cgs->getHTML());
417 if ($objDefinition->isContainer($this->getType())) {
424 include_once(
"./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
426 $exp->setTypeWhiteList(array(
"root",
"cat",
"grp",
"crs",
"fold",
"lso",
"prg"));
427 $exp->setSelectMode(
"target",
true);
428 if ($exp->handleCommand()) {
435 $t->setFormAction(
$ilCtrl->getFormAction($this,
"saveTarget"));
436 if ($objDefinition->isContainer($this->getType())) {
438 $btn->setCaption(
'btn_next');
439 $btn->setCommand(
'saveTarget');
440 $btn->setPrimary(
true);
441 $t->addButtonInstance($btn);
444 $btn->setCaption(
'paste');
445 $btn->setCommand(
'saveTarget');
446 $btn->setPrimary(
true);
447 $t->addButtonInstance($btn);
451 $clipboard_btn->setCaption(
'obj_insert_into_clipboard');
452 $clipboard_btn->setCommand(
'keepObjectsInClipboard');
453 $t->addButtonInstance($clipboard_btn);
455 $cancel_btn->setCaption(
'cancel');
456 $cancel_btn->setCommand(
'cancel');
457 $t->addButtonInstance($cancel_btn);
458 $t->setCloseFormTag(
false);
462 $t->setCloseFormTag(
true);
463 $t->setOpenFormTag(
false);
466 $this->tpl->setContent(
$output);
484 $this->tpl->addBlockfile(
487 'tpl.paste_into_multiple_objects.html',
492 include_once
'./Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
495 'ilias.php?baseClass=ilRepositoryGUI&cmd=goto',
496 'paste_copy_repexpand' 498 $exp->setRequiredFormItemPermission(
'visible,read,copy');
500 $ilCtrl->setParameter($this,
'selectMode', self::SOURCE_SELECTION);
501 $exp->setExpandTarget(
$ilCtrl->getLinkTarget($this,
'showSourceSelectionTree'));
502 $exp->setTargetGet(
'ref_id');
503 $exp->setPostVar(
'source');
507 foreach (array(
'cat',
'root',
'fold') as
$container) {
508 $exp->removeFormItemForType($container);
512 if (
$_GET[
'paste_copy_repexpand'] ==
'') {
513 $expanded =
$tree->readRootId();
515 $expanded =
$_GET[
'paste_copy_repexpand'];
518 $this->tpl->setVariable(
'FORM_TARGET',
'_self');
519 $this->tpl->setVariable(
'FORM_ACTION',
$ilCtrl->getFormAction($this,
'copySelection'));
521 $exp->setExpand($expanded);
526 $this->tpl->setVariable(
'OBJECT_TREE',
$output);
528 $this->tpl->setVariable(
'CMD_SUBMIT',
'saveSource');
529 $this->tpl->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'btn_next'));
531 $ilToolbar->addButton($this->lng->txt(
'cancel'),
$ilCtrl->getLinkTarget($this,
'cancel'));
546 if (is_array($_REQUEST[
'target'])
and $_REQUEST[
'target']) {
551 elseif ((
int) $_REQUEST[
'target']) {
557 $ilCtrl->setParameter($this,
'selectMode', self::TARGET_SELECTION);
564 foreach ($this->
getSources() as $source_ref_id) {
565 foreach ((array) $this->
getTargets() as $target_ref_id) {
568 $target_object =
new $target_class_name($target_ref_id);
569 $possible_subtypes = $target_object->getPossibleSubObjects();
573 if (!array_key_exists($source_type, (array) $possible_subtypes)) {
576 $this->lng->txt(
'msg_obj_may_not_contain_objects_of_type'),
578 $this->lng->txt(
'obj_' . $source_type)
587 if (count($this->
getSources()) == 1 && $objDefinition->isContainer($this->getType())) {
591 foreach ($this->
getTargets() as $target_ref_id) {
592 if (
$tree->isGrandChild($this->getFirstSource(), $target_ref_id)) {
600 if (count($is_child) > 0) {
623 $this->mode = $a_mode;
637 $this->sub_mode = $a_mode;
682 $this->sources = $a_source_ids;
696 if (count($this->sources)) {
697 return $this->sources[0];
721 $this->targets = $a_target;
739 if (array_key_exists(0, $this->
getTargets())) {
753 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'cancel');
754 $ilCtrl->returnToParent($this);
762 ilUtil::sendSuccess($this->lng->txt(
"obj_inserted_clipboard"),
true);
766 $ilCtrl->returnToParent($this);
782 if (isset(
$_POST[
'tit'])) {
790 $this->form->setValuesByPost();
792 if (!$this->form->checkInput()) {
794 $ilCtrl->returnToParent($this);
798 include_once
'./Services/Search/classes/class.ilQueryParser.php';
799 $query_parser =
new ilQueryParser($this->form->getInput(
'tit'));
802 $query_parser->parse();
803 if (!$query_parser->validate()) {
805 $ilCtrl->returnToParent($this);
809 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
811 $object_search->setFilter(array($_REQUEST[
'new_type']));
812 $res = $object_search->performSearch();
813 $res->setRequiredPermission(
'copy');
814 $res->filter(ROOT_FOLDER_ID,
true);
818 $ilCtrl->returnToParent($this);
822 include_once
'./Services/Object/classes/class.ilObjectCopySearchResultTableGUI.php';
839 if (isset(
$_POST[
'source'])) {
840 $this->
setSource(array((
int) $_REQUEST[
'source']));
842 $ilCtrl->setParameter($this,
'source_id', (
int) $_REQUEST[
'source']);
850 foreach ($this->
getSources() as $source_ref_id) {
851 foreach ((array) $this->
getTargets() as $target_ref_id) {
854 $target_object =
new $target_class_name($target_ref_id);
855 $possible_subtypes = $target_object->getPossibleSubObjects();
859 if (!array_key_exists($source_type, $possible_subtypes)) {
860 #ilLoggerFactory::getLogger('obj')->debug('Source type: '. $source_type); 861 #ilLoggerFactory::getLogger('obj')->debug('Target type: '. $target_type); 862 #ilLoggerFactory::getLogger('obj')->debug('Submode: '. $this->getSubMode()); 871 $this->lng->txt(
'msg_obj_may_not_contain_objects_of_type'),
873 $this->lng->txt(
'obj_' . $source_type)
884 if ($objDefinition->isContainer($this->getType())) {
899 if (!isset($_REQUEST[
'source'])) {
901 $ilCtrl->redirect($this,
'showSourceSelectionMembership');
905 $this->
setSource(array((
int) $_REQUEST[
'source']));
907 $ilCtrl->setParameter($this,
'source_id', (
int) $_REQUEST[
'source']);
909 if ($objDefinition->isContainer($this->getType())) {
934 include_once
'./Services/Object/classes/class.ilObjectCopySelectionTableGUI.php';
936 $tpl->addJavaScript(
'./Services/CopyWizard/js/ilContainer.js');
937 $tpl->setVariable(
'BODY_ATTRIBUTES',
'onload="ilDisableChilds(\'cmd\');"');
940 case self::SOURCE_SELECTION:
941 $back_cmd =
'showSourceSelectionTree';
944 case self::TARGET_SELECTION:
945 $back_cmd =
'showTargetSelectionTree';
948 case self::SEARCH_SOURCE:
949 $back_cmd =
'searchSource';
965 include_once(
'./Services/Link/classes/class.ilLink.php');
966 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
978 $ilCtrl->returnToParent($this);
1000 include_once(
'./Services/Link/classes/class.ilLink.php');
1001 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
1004 foreach ($a_sources as $source_ref_id) {
1009 foreach ($this->
getTargets() as $target_ref_id) {
1010 if (!
$rbacsystem->checkAccess(
'create', $target_ref_id, $source_type)) {
1011 $this->log->notice(
'Permission denied for target_id: ' . $target_ref_id .
' source_type: ' . $source_type .
' CREATE');
1013 $ilCtrl->returnToParent($this);
1018 if (!$ilAccess->checkAccess(
'copy',
'', $source_ref_id)) {
1019 $this->log->notice(
'Permission denied for source_ref_id: ' . $source_ref_id .
' COPY');
1021 $ilCtrl->returnToParent($this);
1025 if ($objDefinition->isContainer($source_type)
and $this->
getSubMode() != self::SUBMODE_CONTENT_ONLY) {
1027 $ilCtrl->returnToParent($this);
1037 foreach ($a_sources as $source_ref_id) {
1041 foreach ($this->
getTargets() as $target_ref_id) {
1045 $wizard_options->saveOwner(
$ilUser->getId());
1046 $wizard_options->saveRoot((
int) $source_ref_id);
1047 $wizard_options->read();
1050 $new_obj = $orig->cloneObject($target_ref_id, $copy_id);
1053 $wizard_options->deleteAll();
1056 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
1058 $rbac_log_roles =
$rbacreview->getParentRoleIds($new_obj->getRefId(),
false);
1065 unset(
$_SESSION[
"clipboard"][
"ref_ids"]);
1068 if (count($a_sources) == 1) {
1070 ilUtil::sendSuccess($this->lng->txt(
"object_duplicated"),
true);
1071 $ref_id = $new_obj->getRefId();
1074 ilUtil::sendSuccess($this->lng->txt(
"objects_duplicated"),
true);
1078 ilUtil::sendSuccess($this->lng->txt(
"objects_duplicated"),
true);
1103 foreach ($this->
getTargets() as $target_ref_id) {
1105 $last_target = $target_ref_id;
1108 unset(
$_SESSION[
"clipboard"][
"ref_ids"]);
1111 include_once
'./Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1114 ilUtil::sendSuccess($this->lng->txt(
"object_duplicated"),
true);
1115 if ($this->
getSubMode() == self::SUBMODE_CONTENT_ONLY) {
1117 return $this->ctrl->returnToParent($this);
1121 $ilCtrl->redirectToUrl($link);
1137 include_once
'./Services/Object/classes/class.ilObjectCopyProgressTableGUI.php';
1141 (
int)
$_GET[
'ref_id']
1143 $progress->setObjectInfo($this->targets_copy_id);
1146 $progress->setRedirectionUrl(
$ilCtrl->getParentReturn($this->parent_obj));
1148 $tpl->setContent($progress->getHTML());
1157 $json->percentage = null;
1158 $json->performed_steps = null;
1160 include_once
'./Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1162 $json->required_steps =
$options->getRequiredSteps();
1163 $json->id = (int) $_REQUEST[
'copy_id'];
1167 echo json_encode($json);
1181 include_once(
'./Services/Link/classes/class.ilLink.php');
1182 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
1196 if ($this->
getSubMode() != self::SUBMODE_CONTENT_ONLY) {
1197 if (!
$rbacsystem->checkAccess(
'create', $a_target, $this->getType())) {
1198 $this->log->notice(
'Permission denied for target: ' . $a_target .
' type: ' . $this->
getType() .
' CREATE');
1200 $ilCtrl->returnToParent($this);
1205 $ilCtrl->returnToParent($this);
1215 $result = $orig->cloneAllObject(
1226 $this->targets_copy_id[$a_target] =
$result[
'copy_id'];
1245 #if(!$this->sourceExists()) 1254 $tpl->setVariable($a_tplvar, $this->form->getHTML());
1281 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
1283 $this->form->setTableWidth(
'600px');
1287 #$ilCtrl->setParameter($this, 'cp_mode', self::SOURCE_SELECTION); 1288 $this->form->setFormAction(
$ilCtrl->getFormAction($this));
1289 $this->form->setTitle(
$lng->txt($this->getType() .
'_copy'));
1291 $this->form->addCommandButton(
'searchSource',
$lng->txt(
'btn_next'));
1292 $this->form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
1296 $tit->setMaxLength(70);
1297 $tit->setRequired(
true);
1298 $tit->setInfo(
$lng->txt(
'wizard_title_info'));
1299 $this->form->addItem($tit);
GUI class for the workflow of copying objects.
static getClassByType($a_obj_type)
Get class by type.
adoptContent()
Adopt content (crs in crs, grp in grp, crs in grp or grp in crs)
setTargets(array $a_target)
Set target id.
__construct($a_parent_gui)
Constructor.
updateProgress()
Update progress.
Explorer for selecting repository items.
Presentation of search results.
GUI class for the workflow of copying objects.
setMode($a_mode)
set copy mode
initSourceSelection()
Init source selection.
initTargetSelection()
Init copy from repository/search list commands.
saveSource()
select source object
setTarget($a_ref_id)
Set single object target.
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
static _getObjectsByOperations($a_obj_type, $a_operation, $a_usr_id=0, $limit=0)
Get all objects of a specific type and check access This function is not recursive, instead it parses the serialized rbac_pa entries.
initFormSearch()
Init search form.
keepObjectsInClipboard()
Keep objects in clipboard.
showCopyProgress()
Show progress for copying.
copyContainer($a_target)
Copy a container.
static _lookupTitle($a_id)
lookup object title
saveSourceMembership()
Save selected source from membership screen.
getFirstTarget()
Get first target.
const TAB_SELECTION_TARGET_TREE
const TAB_GROUP_SC_SELECTION
setSource(array $a_source_ids)
Set source id.
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _isFinished($a_copy_id)
check if copy is finished
initTabs()
Init tabs General.
getParentObject()
Get parent gui object.
Table gui for copy progress.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
foreach($_POST as $key=> $value) $res
if(isset($_POST['submit'])) $form
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
setSize($a_size)
Set Size.
unsetSession()
Unset session variables.
This class represents a text property in a property form.
static _allocateCopyId()
Allocate a copy for further entries.
setTabs($a_tab_group, $a_active_tab)
Set tabs.
copySingleObject()
Start cloning a single (not container) object.
getTargets()
Get copy target.
static _lookupType($a_id, $a_reference=false)
lookup object type
executeCommand()
Control class handling.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const TAB_SELECTION_MEMBERSHIP
showTargetSelectionTree()
Show target selection.
showSourceSelectionTree()
Show target selection.
copyContainerToTargets()
Copy to multiple targets.
copyMultipleNonContainer($a_sources)
Copy multiple non container.
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
const TAB_SELECTION_SOURCE_TREE
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static getLogger($a_component_id)
Get component logger.
if(empty($password)) $table
saveTarget()
Save target selection.
setMinWordLength($a_length, $a_force=false)
sourceExists()
Check if there is any source object.
showSourceSearch($a_tplvar)
Show init screen Normally shown below the create and import form when creating a new object...
static redirect($a_script)
showSourceSelectionMembership()
show target selection membership
searchSource()
Search source.
const SUBMODE_CONTENT_ONLY
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
setType($type)
Sets $type.