40 $this->lng->loadLanguageModule(
'search');
41 $this->lng->loadLanguageModule(
'obj');
43 $this->parent_obj = $a_parent_gui;
46 $ilCtrl->saveParameter($this, array(
"source_ids"));
59 $next_class = $ilCtrl->getNextClass($this);
60 $cmd = $ilCtrl->getCmd();
81 $this->
setMode(self::SEARCH_SOURCE);
83 $ilCtrl->setParameter($this,
'new_type',$this->
getType());
84 $ilCtrl->setParameterByClass(get_class($this->parent_obj),
'new_type', $this->
getType());
85 $ilCtrl->setParameterByClass(get_class($this->parent_obj),
'cpfl', 1);
86 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'create');
88 elseif(
$_REQUEST[
'selectMode'] == self::SOURCE_SELECTION)
90 $this->
setMode(self::SOURCE_SELECTION);
92 $ilCtrl->setParameterByClass(get_class($this->parent_obj),
'selectMode', self::SOURCE_SELECTION);
94 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
98 $this->
setMode(self::TARGET_SELECTION);
99 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
101 if (
$_GET[
"source_ids"] ==
"")
119 $_SESSION[
'paste_copy_repexpand'] = array();
125 $this->
setMode(self::TARGET_SELECTION);
129 if (
$_GET[
'source_id'] > 0)
132 $path = $tree->getPathId((
int)
$_GET[
'source_id']);
133 foreach((array)
$path as $node_id)
135 if(!in_array($node_id,
$_SESSION[
'paste_copy_repexpand']))
136 $_SESSION[
'paste_copy_repexpand'][] = $node_id;
139 $this->
setSource((
int) $_GET[
'source_id']);
146 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
160 $_SESSION[
'paste_copy_repexpand'] = array();
165 $this->
setMode(self::SOURCE_SELECTION);
171 foreach((array)
$path as $node_id)
173 if(!in_array($node_id,
$_SESSION[
'paste_copy_repexpand']))
174 $_SESSION[
'paste_copy_repexpand'][] = $node_id;
177 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
186 global $ilTabs, $ilToolbar,
$ilCtrl, $tree,
$tpl, $objDefinition,
$lng;
190 if($objDefinition->isContainer($this->getType()))
200 include_once(
"./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
202 $exp->setTypeWhiteList(array(
"root",
"cat",
"grp",
"crs",
"fold"));
203 $exp->setSelectMode(
"target",
false);
204 if ($exp->handleCommand())
208 $output = $exp->getHTML();
212 $t->setFormAction($ilCtrl->getFormAction($this,
"saveTarget"));
213 if($objDefinition->isContainer($this->getType()))
215 $t->addFormButton($lng->txt(
"btn_next"),
"saveTarget");
219 $t->addFormButton($lng->txt(
"paste"),
"saveTarget");
222 $t->addFormButton($lng->txt(
"obj_insert_into_clipboard"),
"keepObjectsInClipboard");
223 $t->addFormButton($lng->txt(
"cancel"),
"cancel");
224 $t->setCloseFormTag(
false);
226 $output =
$t->getHTML().$output;
228 $t->setCloseFormTag(
true);
229 $t->setOpenFormTag(
false);
230 $output.=
"<br />".$t->getHTML();
232 $this->tpl->setContent($output);
238 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paste_into_multiple_objects.html',
241 include_once
'./Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
244 'ilias.php?baseClass=ilRepositoryGUI&cmd=goto',
'paste_copy_repexpand');
247 $required_perm =
'visible';
248 $create_perm =
'create_'.ilObject::_lookupType($this->
getSource(),
true);
251 $required_perm .= (
','.$create_perm);
253 $exp->setRequiredFormItemPermission($required_perm);
254 $exp->setExpandTarget($ilCtrl->getLinkTarget($this,
'showTargetSelectionTree'));
255 $exp->setTargetGet(
'ref_id');
256 $exp->setPostVar(
'target');
257 $exp->highlightNode(
$_GET[
'ref_id']);
258 $exp->setCheckedItems(array((
int)
$_POST[
'target']));
261 foreach(array(
'cat',
'root',
'crs',
'grp',
'fold') as $container)
269 $sub = $objDefinition->getSubObjects($container);
270 if(!isset($sub[$this->
getType()]))
272 $exp->removeFormItemForType($container);
276 if(
$_GET[
'paste_copy_repexpand'] ==
'')
278 $expanded = $tree->readRootId();
282 $expanded =
$_GET[
'paste_copy_repexpand'];
285 $this->tpl->setVariable(
'FORM_TARGET',
'_self');
286 $this->tpl->setVariable(
'FORM_ACTION', $ilCtrl->getFormAction($this,
'copySelection'));
288 $exp->setExpand($expanded);
291 $output = $exp->getOutput();
293 $this->tpl->setVariable(
'OBJECT_TREE', $output);
295 $this->tpl->setVariable(
'CMD_SUBMIT',
'saveTarget');
297 if($objDefinition->isContainer($this->getType()))
299 $this->tpl->setVariable(
'TXT_SUBMIT',$this->lng->txt(
'btn_next'));
303 if(!$objDefinition->isPlugin($this->getType()))
305 $submit = $this->lng->txt(
'obj_'.$this->
getType().
'_duplicate');
310 include_once
"Services/Component/classes/class.ilPlugin.php";
313 $submit = $plugin->txt(
'obj_'.$this->
getType().
'_duplicate');
315 $this->tpl->setVariable(
'TXT_SUBMIT', $submit);
318 $ilToolbar->addButton($this->lng->txt(
'cancel'), $ilCtrl->getLinkTarget($this,
'cancel'));
326 global $ilTabs, $ilToolbar,
$ilCtrl, $tree,
$tpl, $objDefinition;
329 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paste_into_multiple_objects.html',
333 include_once
'./Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
336 'ilias.php?baseClass=ilRepositoryGUI&cmd=goto',
'paste_copy_repexpand');
337 $exp->setRequiredFormItemPermission(
'visible,read,copy');
339 $ilCtrl->setParameter($this,
'selectMode', self::SOURCE_SELECTION);
340 $exp->setExpandTarget($ilCtrl->getLinkTarget($this,
'showSourceSelectionTree'));
341 $exp->setTargetGet(
'ref_id');
342 $exp->setPostVar(
'source');
343 $exp->setCheckedItems(array($this->
getSource()));
344 #$exp->setNotSelectableItems(array($this->getTarget()));
347 foreach(array(
'cat',
'root',
'grp',
'fold') as $container)
349 $exp->removeFormItemForType($container);
353 if(
$_GET[
'paste_copy_repexpand'] ==
'')
355 $expanded = $tree->readRootId();
359 $expanded =
$_GET[
'paste_copy_repexpand'];
362 $this->tpl->setVariable(
'FORM_TARGET',
'_self');
363 $this->tpl->setVariable(
'FORM_ACTION', $ilCtrl->getFormAction($this,
'copySelection'));
365 $exp->setExpand($expanded);
368 $output = $exp->getOutput();
370 $this->tpl->setVariable(
'OBJECT_TREE', $output);
372 $this->tpl->setVariable(
'CMD_SUBMIT',
'saveSource');
373 $this->tpl->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'btn_next'));
375 $ilToolbar->addButton($this->lng->txt(
'cancel'), $ilCtrl->getLinkTarget($this,
'cancel'));
384 global $objDefinition, $tree;
398 if(
$_GET[
"source_ids"] ==
"" && $objDefinition->isContainer($this->getType()))
402 if ($tree->isGrandChild($this->getSource(), $this->
getTarget()))
410 if (count($is_child) > 0)
421 if (
$_GET[
"source_ids"] ==
"")
427 $source_ids = explode(
"_",
$_GET[
"source_ids"]);
440 $this->mode = $a_mode;
498 if (
$_GET[
"source_ids"] !=
"")
530 $ilCtrl->returnToParent($this);
540 if (
$_GET[
"source_ids"] ==
"")
546 $_SESSION[
'clipboard'][
'ref_ids'] = explode(
"_",
$_GET[
"source_ids"]);
548 $ilCtrl->returnToParent($this);
571 $this->form->setValuesByPost();
573 if(!$this->form->checkInput())
576 $ilCtrl->returnToParent($this);
580 include_once
'./Services/Search/classes/class.ilQueryParser.php';
581 $query_parser =
new ilQueryParser($this->form->getInput(
'tit'));
584 $query_parser->parse();
585 if(!$query_parser->validate())
588 $ilCtrl->returnToParent($this);
592 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
594 $object_search->setFilter(array(
$_REQUEST[
'new_type']));
595 $res = $object_search->performSearch();
596 $res->setRequiredPermission(
'copy');
597 $res->filter(ROOT_FOLDER_ID,
true);
602 $ilCtrl->returnToParent($this);
605 include_once
'./Services/Object/classes/class.ilObjectCopySearchResultTableGUI.php';
607 $table->setSelectedReference($this->
getSource());
608 $table->parseSearchResults(
$results);
609 $tpl->setContent($table->getHTML());
618 global $objDefinition;
620 if(isset(
$_POST[
'source']))
631 if($objDefinition->isContainer($this->getType()))
659 include_once
'./Services/Object/classes/class.ilObjectCopySelectionTableGUI.php';
661 $tpl->addJavaScript(
'./Services/CopyWizard/js/ilContainer.js');
662 $tpl->setVariable(
'BODY_ATTRIBUTES',
'onload="ilDisableChilds(\'cmd\');"');
666 case self::SOURCE_SELECTION:
667 $back_cmd =
'showSourceSelectionTree';
670 case self::TARGET_SELECTION:
671 $back_cmd =
'showTargetSelectionTree';
674 case self::SEARCH_SOURCE:
675 $back_cmd =
'searchSource';
682 $tpl->setContent($table->getHTML());
691 include_once(
'./Services/Link/classes/class.ilLink.php');
692 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
700 $ilCtrl->returnToParent($this);
712 if(!$rbacsystem->checkAccess(
'create', $this->getTarget(), $this->
getType()))
715 $ilCtrl->returnToParent($this);
721 $ilCtrl->returnToParent($this);
724 if(!$ilAccess->checkAccess(
'copy',
'',$this->getSource()))
727 $ilCtrl->returnToParent($this);
733 $wizard_options->saveOwner($ilUser->getId());
734 $wizard_options->saveRoot((
int) $this->
getSource());
744 $wizard_options->read();
747 $new_obj = $orig->cloneObject($this->
getTarget(),$copy_id);
750 $wizard_options->deleteAll();
753 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
756 $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(),
false);
772 global $ilAccess,$objDefinition,$rbacsystem,
$ilUser,
$ilCtrl,$rbacreview;
775 include_once(
'./Services/Link/classes/class.ilLink.php');
776 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
779 foreach ($a_sources as $source_ref_id)
784 if(!$rbacsystem->checkAccess(
'create', $this->getTarget(), $source_type))
787 $ilCtrl->returnToParent($this);
791 if(!$ilAccess->checkAccess(
'copy',
'',$source_ref_id))
794 $ilCtrl->returnToParent($this);
798 if($objDefinition->isContainer($source_type))
801 $ilCtrl->returnToParent($this);
808 foreach ($a_sources as $source_ref_id)
813 $wizard_options->saveOwner($ilUser->getId());
814 $wizard_options->saveRoot((
int) $source_ref_id);
816 $wizard_options->read();
819 $new_obj = $orig->cloneObject($this->
getTarget(),$copy_id);
822 $wizard_options->deleteAll();
825 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
828 $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(),
false);
834 unset(
$_SESSION[
"clipboard"][
"ref_ids"]);
837 if (count($a_sources) == 1)
859 include_once(
'./Services/Link/classes/class.ilLink.php');
860 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
871 if(!$rbacsystem->checkAccess(
'create', $this->getTarget(),$this->
getType()))
874 $ilCtrl->returnToParent($this);
880 $ilCtrl->returnToParent($this);
889 unset(
$_SESSION[
"clipboard"][
"ref_ids"]);
896 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
898 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
903 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
905 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
923 #if(!$this->sourceExists())
933 $tpl->setVariable($a_tplvar,$this->form->getHTML());
961 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
963 $this->form->setTableWidth(
'600px');
964 $ilCtrl->setParameter($this,
'new_type',$this->
getType());
965 #$ilCtrl->setParameter($this, 'cp_mode', self::SOURCE_SELECTION);
966 $this->form->setFormAction($ilCtrl->getFormAction($this));
967 $this->form->setTitle($lng->txt($this->getType().
'_copy'));
969 $this->form->addCommandButton(
'searchSource', $lng->txt(
'btn_next'));
973 $tit->setMaxLength(70);
974 $tit->setRequired(
true);
975 $tit->setInfo($lng->txt(
'wizard_title_info'));
976 $this->form->addItem($tit);