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;
193 include_once(
"./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
195 $exp->setTypeWhiteList(array(
"root",
"cat",
"grp",
"crs",
"fold"));
196 $exp->setSelectMode(
"target",
false);
197 if ($exp->handleCommand())
201 $output = $exp->getHTML();
205 $t->setFormAction($ilCtrl->getFormAction($this,
"saveTarget"));
206 if($objDefinition->isContainer($this->getType()))
208 $t->addFormButton($lng->txt(
"btn_next"),
"saveTarget");
212 $t->addFormButton($lng->txt(
"copy"),
"saveTarget");
215 $t->addFormButton($lng->txt(
"obj_insert_into_clipboard"),
"keepObjectsInClipboard");
216 $t->addFormButton($lng->txt(
"cancel"),
"cancel");
217 $t->setCloseFormTag(
false);
219 $output =
$t->getHTML().$output;
221 $t->setCloseFormTag(
true);
222 $t->setOpenFormTag(
false);
223 $output.=
"<br />".$t->getHTML();
225 $this->tpl->setContent($output);
231 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paste_into_multiple_objects.html',
234 include_once
'./Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
237 'ilias.php?baseClass=ilRepositoryGUI&cmd=goto',
'paste_copy_repexpand');
240 $required_perm =
'visible';
241 $create_perm =
'create_'.ilObject::_lookupType($this->
getSource(),
true);
244 $required_perm .= (
','.$create_perm);
246 $exp->setRequiredFormItemPermission($required_perm);
247 $exp->setExpandTarget($ilCtrl->getLinkTarget($this,
'showTargetSelectionTree'));
248 $exp->setTargetGet(
'ref_id');
249 $exp->setPostVar(
'target');
250 $exp->highlightNode(
$_GET[
'ref_id']);
251 $exp->setCheckedItems(array((
int)
$_POST[
'target']));
254 foreach(array(
'cat',
'root',
'crs',
'grp',
'fold') as $container)
262 $sub = $objDefinition->getSubObjects($container);
263 if(!isset($sub[$this->
getType()]))
265 $exp->removeFormItemForType($container);
269 if(
$_GET[
'paste_copy_repexpand'] ==
'')
271 $expanded = $tree->readRootId();
275 $expanded =
$_GET[
'paste_copy_repexpand'];
278 $this->tpl->setVariable(
'FORM_TARGET',
'_self');
279 $this->tpl->setVariable(
'FORM_ACTION', $ilCtrl->getFormAction($this,
'copySelection'));
281 $exp->setExpand($expanded);
284 $output = $exp->getOutput();
286 $this->tpl->setVariable(
'OBJECT_TREE', $output);
288 $this->tpl->setVariable(
'CMD_SUBMIT',
'saveTarget');
290 if($objDefinition->isContainer($this->getType()))
292 $this->tpl->setVariable(
'TXT_SUBMIT',$this->lng->txt(
'btn_next'));
296 if(!$objDefinition->isPlugin($this->getType()))
298 $submit = $this->lng->txt(
'obj_'.$this->
getType().
'_duplicate');
303 include_once
"Services/Component/classes/class.ilPlugin.php";
306 $submit = $plugin->txt(
'obj_'.$this->
getType().
'_duplicate');
308 $this->tpl->setVariable(
'TXT_SUBMIT', $submit);
311 $ilToolbar->addButton($this->lng->txt(
'cancel'), $ilCtrl->getLinkTarget($this,
'cancel'));
319 global $ilTabs, $ilToolbar,
$ilCtrl, $tree,
$tpl, $objDefinition;
322 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paste_into_multiple_objects.html',
326 include_once
'./Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
329 'ilias.php?baseClass=ilRepositoryGUI&cmd=goto',
'paste_copy_repexpand');
330 $exp->setRequiredFormItemPermission(
'visible,read,copy');
332 $ilCtrl->setParameter($this,
'selectMode', self::SOURCE_SELECTION);
333 $exp->setExpandTarget($ilCtrl->getLinkTarget($this,
'showSourceSelectionTree'));
334 $exp->setTargetGet(
'ref_id');
335 $exp->setPostVar(
'source');
336 $exp->setCheckedItems(array($this->
getSource()));
337 #$exp->setNotSelectableItems(array($this->getTarget()));
340 foreach(array(
'cat',
'root',
'grp',
'fold') as $container)
342 $exp->removeFormItemForType($container);
346 if(
$_GET[
'paste_copy_repexpand'] ==
'')
348 $expanded = $tree->readRootId();
352 $expanded =
$_GET[
'paste_copy_repexpand'];
355 $this->tpl->setVariable(
'FORM_TARGET',
'_self');
356 $this->tpl->setVariable(
'FORM_ACTION', $ilCtrl->getFormAction($this,
'copySelection'));
358 $exp->setExpand($expanded);
361 $output = $exp->getOutput();
363 $this->tpl->setVariable(
'OBJECT_TREE', $output);
365 $this->tpl->setVariable(
'CMD_SUBMIT',
'saveSource');
366 $this->tpl->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'btn_next'));
368 $ilToolbar->addButton($this->lng->txt(
'cancel'), $ilCtrl->getLinkTarget($this,
'cancel'));
377 global $objDefinition, $tree;
391 if(
$_GET[
"source_ids"] ==
"" && $objDefinition->isContainer($this->getType()))
395 if ($tree->isGrandChild($this->getSource(), $this->
getTarget()))
403 if (count($is_child) > 0)
414 if (
$_GET[
"source_ids"] ==
"")
420 $source_ids = explode(
"_",
$_GET[
"source_ids"]);
433 $this->mode = $a_mode;
491 if (
$_GET[
"source_ids"] !=
"")
523 $ilCtrl->returnToParent($this);
533 if (
$_GET[
"source_ids"] ==
"")
539 $_SESSION[
'clipboard'][
'ref_ids'] = explode(
"_",
$_GET[
"source_ids"]);
541 $ilCtrl->returnToParent($this);
564 $this->form->setValuesByPost();
566 if(!$this->form->checkInput())
569 $ilCtrl->returnToParent($this);
573 include_once
'./Services/Search/classes/class.ilQueryParser.php';
574 $query_parser =
new ilQueryParser($this->form->getInput(
'tit'));
577 $query_parser->parse();
578 if(!$query_parser->validate())
581 $ilCtrl->returnToParent($this);
585 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
587 $object_search->setFilter(array(
$_REQUEST[
'new_type']));
588 $res = $object_search->performSearch();
589 $res->setRequiredPermission(
'copy');
590 $res->filter(ROOT_FOLDER_ID,
true);
595 $ilCtrl->returnToParent($this);
598 include_once
'./Services/Object/classes/class.ilObjectCopySearchResultTableGUI.php';
600 $table->setSelectedReference($this->
getSource());
601 $table->parseSearchResults(
$results);
602 $tpl->setContent($table->getHTML());
611 global $objDefinition;
613 if(isset(
$_POST[
'source']))
624 if($objDefinition->isContainer($this->getType()))
652 include_once
'./Services/Object/classes/class.ilObjectCopySelectionTableGUI.php';
654 $tpl->addJavaScript(
'./Services/CopyWizard/js/ilContainer.js');
655 $tpl->setVariable(
'BODY_ATTRIBUTES',
'onload="ilDisableChilds(\'cmd\');"');
659 case self::SOURCE_SELECTION:
660 $back_cmd =
'showSourceSelectionTree';
663 case self::TARGET_SELECTION:
664 $back_cmd =
'showTargetSelectionTree';
667 case self::SEARCH_SOURCE:
668 $back_cmd =
'searchSource';
675 $tpl->setContent($table->getHTML());
684 include_once(
'./Services/Link/classes/class.ilLink.php');
685 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
693 $ilCtrl->returnToParent($this);
705 if(!$rbacsystem->checkAccess(
'create', $this->getTarget(), $this->
getType()))
708 $ilCtrl->returnToParent($this);
714 $ilCtrl->returnToParent($this);
717 if(!$ilAccess->checkAccess(
'copy',
'',$this->getSource()))
720 $ilCtrl->returnToParent($this);
726 $wizard_options->saveOwner($ilUser->getId());
727 $wizard_options->saveRoot((
int) $this->
getSource());
737 $wizard_options->read();
740 $new_obj = $orig->cloneObject($this->
getTarget(),$copy_id);
743 $wizard_options->deleteAll();
746 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
749 $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(),
false);
765 global $ilAccess,$objDefinition,$rbacsystem,
$ilUser,
$ilCtrl,$rbacreview;
768 include_once(
'./Services/Link/classes/class.ilLink.php');
769 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
772 foreach ($a_sources as $source_ref_id)
777 if(!$rbacsystem->checkAccess(
'create', $this->getTarget(), $source_type))
780 $ilCtrl->returnToParent($this);
784 if(!$ilAccess->checkAccess(
'copy',
'',$source_ref_id))
787 $ilCtrl->returnToParent($this);
791 if($objDefinition->isContainer($source_type))
794 $ilCtrl->returnToParent($this);
801 foreach ($a_sources as $source_ref_id)
806 $wizard_options->saveOwner($ilUser->getId());
807 $wizard_options->saveRoot((
int) $source_ref_id);
809 $wizard_options->read();
812 $new_obj = $orig->cloneObject($this->
getTarget(),$copy_id);
815 $wizard_options->deleteAll();
818 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
821 $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(),
false);
827 unset(
$_SESSION[
"clipboard"][
"ref_ids"]);
830 if (count($a_sources) == 1)
852 include_once(
'./Services/Link/classes/class.ilLink.php');
853 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
864 if(!$rbacsystem->checkAccess(
'create', $this->getTarget(),$this->
getType()))
867 $ilCtrl->returnToParent($this);
873 $ilCtrl->returnToParent($this);
882 unset(
$_SESSION[
"clipboard"][
"ref_ids"]);
889 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
891 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
896 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
898 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
916 #if(!$this->sourceExists())
926 $tpl->setVariable($a_tplvar,$this->form->getHTML());
954 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
956 $this->form->setTableWidth(
'600px');
957 $ilCtrl->setParameter($this,
'new_type',$this->
getType());
958 #$ilCtrl->setParameter($this, 'cp_mode', self::SOURCE_SELECTION);
959 $this->form->setFormAction($ilCtrl->getFormAction($this));
960 $this->form->setTitle($lng->txt($this->getType().
'_copy'));
962 $this->form->addCommandButton(
'searchSource', $lng->txt(
'btn_next'));
966 $tit->setMaxLength(70);
967 $tit->setRequired(
true);
968 $tit->setInfo($lng->txt(
'wizard_title_info'));
969 $this->form->addItem($tit);