40 $this->lng->loadLanguageModule(
'search');
42 $this->parent_obj = $a_parent_gui;
55 $next_class = $ilCtrl->getNextClass($this);
56 $cmd = $ilCtrl->getCmd();
77 $this->
setMode(self::SEARCH_SOURCE);
79 $ilCtrl->setParameter($this,
'new_type',$this->
getType());
80 $ilCtrl->setParameterByClass(get_class($this->parent_obj),
'new_type', $this->
getType());
81 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'create');
83 elseif(
$_REQUEST[
'selectMode'] == self::SOURCE_SELECTION)
85 $this->
setMode(self::SOURCE_SELECTION);
87 $ilCtrl->setParameterByClass(get_class($this->parent_obj),
'selectMode', self::SOURCE_SELECTION);
89 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
93 $this->
setMode(self::TARGET_SELECTION);
94 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
111 $_SESSION[
'paste_copy_repexpand'] = array();
117 $path = $tree->getPathId((
int)
$_GET[
'source_id']);
118 foreach((array)
$path as $node_id)
120 if(!in_array($node_id,
$_SESSION[
'paste_copy_repexpand']))
121 $_SESSION[
'paste_copy_repexpand'][] = $node_id;
124 $this->
setMode(self::TARGET_SELECTION);
125 $this->
setSource((
int) $_GET[
'source_id']);
131 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
145 $_SESSION[
'paste_copy_repexpand'] = array();
150 $this->
setMode(self::SOURCE_SELECTION);
156 foreach((array)
$path as $node_id)
158 if(!in_array($node_id,
$_SESSION[
'paste_copy_repexpand']))
159 $_SESSION[
'paste_copy_repexpand'][] = $node_id;
162 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
172 global $ilTabs, $ilToolbar,
$ilCtrl, $tree,
$tpl, $objDefinition;
175 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paste_into_multiple_objects.html');
179 include_once
'classes/class.ilPasteIntoMultipleItemsExplorer.php';
182 'repository.php?cmd=goto',
'paste_copy_repexpand');
183 $exp->setExpandTarget($ilCtrl->getLinkTarget($this,
'showTargetSelectionTree'));
184 $exp->setTargetGet(
'ref_id');
185 $exp->setPostVar(
'target');
186 $exp->setCheckedItems(array((
int)
$_POST[
'target']));
189 foreach(array(
'cat',
'root',
'crs',
'grp',
'fold') as $container)
197 $sub = $objDefinition->getSubObjects($container);
198 if(!isset($sub[$this->
getType()]))
200 $exp->removeFormItemForType($container);
204 if(
$_GET[
'paste_copy_repexpand'] ==
'')
206 $expanded = $tree->readRootId();
210 $expanded =
$_GET[
'paste_copy_repexpand'];
213 $this->tpl->setVariable(
'FORM_TARGET',
'_self');
214 $this->tpl->setVariable(
'FORM_ACTION', $ilCtrl->getFormAction($this,
'copySelection'));
216 $exp->setExpand($expanded);
219 $output = $exp->getOutput();
221 $this->tpl->setVariable(
'OBJECT_TREE', $output);
223 $this->tpl->setVariable(
'CMD_SUBMIT',
'saveTarget');
225 if($objDefinition->isContainer($this->getType()))
227 $this->tpl->setVariable(
'TXT_SUBMIT',$this->lng->txt(
'btn_next'));
231 $this->tpl->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'obj_'.$this->getType().
'_duplicate'));
234 $ilToolbar->addButton($this->lng->txt(
'back'), $ilCtrl->getLinkTarget($this,
'cancel'));
243 global $ilTabs, $ilToolbar,
$ilCtrl, $tree,
$tpl, $objDefinition;
246 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paste_into_multiple_objects.html');
250 include_once
'classes/class.ilPasteIntoMultipleItemsExplorer.php';
253 'repository.php?cmd=goto',
'paste_copy_repexpand');
255 $ilCtrl->setParameter($this,
'selectMode', self::SOURCE_SELECTION);
256 $exp->setExpandTarget($ilCtrl->getLinkTarget($this,
'showSourceSelectionTree'));
257 $exp->setTargetGet(
'ref_id');
258 $exp->setPostVar(
'source');
259 $exp->setCheckedItems(array($this->
getSource()));
260 $exp->setNotSelectableItems(array($this->
getTarget()));
263 foreach(array(
'cat',
'root',
'grp',
'fold') as $container)
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',
'saveSource');
289 $this->tpl->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'btn_next'));
291 $ilToolbar->addButton($this->lng->txt(
'back'), $ilCtrl->getLinkTarget($this,
'cancel'));
300 global $objDefinition;
302 if(isset(
$_POST[
'target']))
313 if($objDefinition->isContainer($this->getType()))
330 $this->mode = $a_mode;
417 $ilCtrl->returnToParent($this);
439 $this->form->setValuesByPost();
441 if(!$this->form->checkInput())
444 $ilCtrl->returnToParent($this);
448 include_once
'./Services/Search/classes/class.ilQueryParser.php';
449 $query_parser =
new ilQueryParser($this->form->getInput(
'tit'));
452 $query_parser->parse();
453 if(!$query_parser->validate())
456 $ilCtrl->returnToParent($this);
460 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
462 $object_search->setFilter(array(
$_REQUEST[
'new_type']));
463 $res = $object_search->performSearch();
464 $res->setRequiredPermission(
'copy');
465 $res->filter(ROOT_FOLDER_ID,
true);
470 $ilCtrl->returnToParent($this);
473 include_once
'./Services/Object/classes/class.ilObjectCopySearchResultTableGUI.php';
475 $table->setSelectedReference($this->
getSource());
476 $table->parseSearchResults(
$results);
477 $tpl->setContent($table->getHTML());
486 global $objDefinition;
488 if(isset(
$_POST[
'source']))
499 if($objDefinition->isContainer($this->getType()))
527 include_once
'./Services/Object/classes/class.ilObjectCopySelectionTableGUI.php';
529 $tpl->addJavaScript(
'./Services/CopyWizard/js/ilContainer.js');
530 $tpl->setVariable(
'BODY_ATTRIBUTES',
'onload="ilDisableChilds(\'cmd\');"');
534 case self::SOURCE_SELECTION:
535 $back_cmd =
'showSourceSelectionTree';
538 case self::TARGET_SELECTION:
539 $back_cmd =
'showTargetSelectionTree';
542 case self::SEARCH_SOURCE:
543 $back_cmd =
'searchSource';
550 $tpl->setContent($table->getHTML());
559 include_once(
'classes/class.ilLink.php');
560 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
562 global $ilAccess,
$ilErr,$rbacsystem,$ilUser,
$ilCtrl,$rbacreview;
565 if(!$rbacsystem->checkAccess(
'create', $this->getTarget(), $this->
getType()))
568 $ilCtrl->returnToParent($this);
574 $ilCtrl->returnToParent($this);
577 if(!$ilAccess->checkAccess(
'copy',
'',$this->getSource()))
580 $ilCtrl->returnToParent($this);
586 $wizard_options->saveOwner($ilUser->getId());
587 $wizard_options->saveRoot((
int) $this->
getSource());
597 $wizard_options->read();
600 $new_obj = $orig->cloneObject($this->
getTarget(),$copy_id);
603 $wizard_options->deleteAll();
606 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
609 $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(),
false);
626 include_once(
'classes/class.ilLink.php');
627 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
638 if(!$rbacsystem->checkAccess(
'create', $this->getTarget(),$this->
getType()))
641 $ilCtrl->returnToParent($this);
647 $ilCtrl->returnToParent($this);
651 $options =
$_POST[
'cp_options'] ?
$_POST[
'cp_options'] : array();
689 $tpl->setVariable($a_tplvar,$this->form->getHTML());
712 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
714 $this->form->setTableWidth(
'600px');
715 $ilCtrl->setParameter($this,
'new_type',$this->
getType());
716 #$ilCtrl->setParameter($this, 'cp_mode', self::SOURCE_SELECTION);
717 $this->form->setFormAction($ilCtrl->getFormAction($this));
718 $this->form->setTitle($lng->txt($this->getType().
'_copy'));
720 $this->form->addCommandButton(
'searchSource', $lng->txt(
'btn_next'));
724 $tit->setMaxLength(70);
725 $tit->setRequired(
true);
726 $tit->setInfo($lng->txt(
'wizard_title_info'));
727 $this->form->addItem($tit);