39 $this->lng->loadLanguageModule(
'search');
41 $this->parent_obj = $a_parent_gui;
54 $next_class = $ilCtrl->getNextClass($this);
55 $cmd = $ilCtrl->getCmd();
74 if($_REQUEST[
'new_type'])
76 $this->
setMode(self::SOURCE_SELECTION);
78 $ilCtrl->setParameter($this,
'new_type',$this->
getType());
79 $ilCtrl->setParameterByClass(get_class($this->parent_obj),
'new_type', $this->
getType());
80 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'create');
82 elseif($_REQUEST[
'selectMode'] == self::SOURCE_SELECTION)
84 $ilCtrl->setParameterByClass(get_class($this->parent_obj),
'selectMode', self::SOURCE_SELECTION);
86 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
90 $this->
setMode(self::TARGET_SELECTION);
91 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
108 $_SESSION[
'paste_copy_repexpand'] = array();
114 $path = $tree->getPathId((
int)
$_GET[
'source_id']);
115 foreach((array)$path as $node_id)
117 if(!in_array($node_id,
$_SESSION[
'paste_copy_repexpand']))
118 $_SESSION[
'paste_copy_repexpand'][] = $node_id;
121 $this->
setMode(self::TARGET_SELECTION);
122 $this->
setSource((
int) $_GET[
'source_id']);
127 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
140 $this->
setMode(self::SOURCE_SELECTION);
143 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
153 global $ilTabs, $ilToolbar,
$ilCtrl, $tree,
$tpl, $objDefinition;
156 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paste_into_multiple_objects.html');
160 include_once
'classes/class.ilPasteIntoMultipleItemsExplorer.php';
163 'repository.php?cmd=goto',
'paste_copy_repexpand');
164 $exp->setExpandTarget($ilCtrl->getLinkTarget($this,
'showTargetSelectionTree'));
165 $exp->setTargetGet(
'ref_id');
166 $exp->setPostVar(
'target');
167 $exp->setCheckedItems(array((
int)
$_POST[
'target']));
170 foreach(array(
'cat',
'root',
'crs',
'grp',
'fold') as $container)
178 $sub = $objDefinition->getSubObjects($container);
179 if(!isset($sub[$this->
getType()]))
181 $exp->removeFormItemForType($container);
185 if(
$_GET[
'paste_copy_repexpand'] ==
'')
187 $expanded = $tree->readRootId();
191 $expanded =
$_GET[
'paste_copy_repexpand'];
194 $this->tpl->setVariable(
'FORM_TARGET',
'_self');
195 $this->tpl->setVariable(
'FORM_ACTION', $ilCtrl->getFormAction($this,
'copySelection'));
197 $exp->setExpand($expanded);
200 $output = $exp->getOutput();
202 $this->tpl->setVariable(
'OBJECT_TREE', $output);
204 $this->tpl->setVariable(
'CMD_SUBMIT',
'saveTarget');
206 if($objDefinition->isContainer($this->getType()))
208 $this->tpl->setVariable(
'TXT_SUBMIT',$this->lng->txt(
'btn_next'));
212 $this->tpl->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'obj_'.$this->getType().
'_duplicate'));
215 $ilToolbar->addButton($this->lng->txt(
'back'), $ilCtrl->getLinkTarget($this,
'cancel'));
224 global $ilTabs, $ilToolbar,
$ilCtrl, $tree,
$tpl, $objDefinition;
227 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paste_into_multiple_objects.html');
231 include_once
'classes/class.ilPasteIntoMultipleItemsExplorer.php';
234 'repository.php?cmd=goto',
'paste_copy_repexpand');
236 $ilCtrl->setParameter($this,
'selectMode', self::SOURCE_SELECTION);
237 $exp->setExpandTarget($ilCtrl->getLinkTarget($this,
'showSourceSelectionTree'));
238 $exp->setTargetGet(
'ref_id');
239 $exp->setPostVar(
'source');
240 $exp->setCheckedItems(array((
int)
$_POST[
'source']));
243 foreach(array(
'cat',
'root',
'grp',
'fold') as $container)
245 $exp->removeFormItemForType($container);
249 if(
$_GET[
'paste_copy_repexpand'] ==
'')
251 $expanded = $tree->readRootId();
255 $expanded =
$_GET[
'paste_copy_repexpand'];
258 $this->tpl->setVariable(
'FORM_TARGET',
'_self');
259 $this->tpl->setVariable(
'FORM_ACTION', $ilCtrl->getFormAction($this,
'copySelection'));
261 $exp->setExpand($expanded);
264 $output = $exp->getOutput();
266 $this->tpl->setVariable(
'OBJECT_TREE', $output);
268 $this->tpl->setVariable(
'CMD_SUBMIT',
'saveSource');
269 $this->tpl->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'btn_next'));
271 $ilToolbar->addButton($this->lng->txt(
'back'), $ilCtrl->getLinkTarget($this,
'cancel'));
280 global $objDefinition;
282 if(isset(
$_POST[
'target']))
284 $this->
setTarget((
int) $_REQUEST[
'target']);
293 if($objDefinition->isContainer($this->getType()))
310 $this->mode = $a_mode;
397 $ilCtrl->returnToParent($this);
419 $this->form->setValuesByPost();
421 if(!$this->form->checkInput())
424 $ilCtrl->returnToParent($this);
428 include_once
'./Services/Search/classes/class.ilQueryParser.php';
429 $query_parser =
new ilQueryParser($this->form->getInput(
'tit'));
432 $query_parser->parse();
433 if(!$query_parser->validate())
436 $ilCtrl->returnToParent($this);
440 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
442 $object_search->setFilter(array($_REQUEST[
'new_type']));
443 $res = $object_search->performSearch();
444 $res->setRequiredPermission(
'copy');
445 $res->filter(ROOT_FOLDER_ID,
true);
450 $ilCtrl->returnToParent($this);
453 include_once
'./Services/Object/classes/class.ilObjectCopySearchResultTableGUI.php';
455 $table->setSelectedReference($this->
getSource());
456 $table->parseSearchResults(
$results);
457 $tpl->setContent($table->getHTML());
466 global $objDefinition;
468 if(isset(
$_POST[
'source']))
479 if($objDefinition->isContainer($this->getType()))
507 include_once
'./Services/Object/classes/class.ilObjectCopySelectionTableGUI.php';
509 $tpl->addJavaScript(
'./Services/CopyWizard/js/ilContainer.js');
510 $tpl->setVariable(
'BODY_ATTRIBUTES',
'onload="ilDisableChilds(\'cmd\');"');
512 $back_cmd = $this->
getMode() == self::SOURCE_SELECTION ?
'searchSource' :
'showTargetSelectionTree';
516 $tpl->setContent($table->getHTML());
525 include_once(
'classes/class.ilLink.php');
526 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
531 if(!$rbacsystem->checkAccess(
'create', $this->getTarget(), $this->
getType()))
534 $ilCtrl->returnToParent($this);
540 $ilCtrl->returnToParent($this);
543 if(!$ilAccess->checkAccess(
'copy',
'',$this->getSource()))
546 $ilCtrl->returnToParent($this);
552 $wizard_options->saveOwner($ilUser->getId());
553 $wizard_options->saveRoot((
int) $this->
getSource());
563 $wizard_options->read();
566 $new_obj = $orig->cloneObject($this->
getTarget(),$copy_id);
569 $wizard_options->deleteAll();
583 include_once(
'classes/class.ilLink.php');
584 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
595 if(!$rbacsystem->checkAccess(
'create', $this->getTarget(),$this->
getType()))
598 $ilCtrl->returnToParent($this);
604 $ilCtrl->returnToParent($this);
608 $options =
$_POST[
'cp_options'] ?
$_POST[
'cp_options'] : array();
646 $tpl->setVariable($a_tplvar,$this->form->getHTML());
669 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
671 $this->form->setTableWidth(
'60%');
672 $ilCtrl->setParameter($this,
'new_type',$this->
getType());
673 #$ilCtrl->setParameter($this, 'cp_mode', self::SOURCE_SELECTION);
674 $this->form->setFormAction($ilCtrl->getFormAction($this));
675 $this->form->setTitle($lng->txt($this->getType().
'_copy'));
677 $this->form->addCommandButton(
'searchSource', $lng->txt(
'btn_next'));
681 $tit->setMaxLength(70);
682 $tit->setRequired(
true);
683 $tit->setInfo($lng->txt(
'wizard_title_info'));
684 $this->form->addItem($tit);