39 $this->lng->loadLanguageModule(
'search');
41 $this->parent_obj = $a_parent_gui;
54 $next_class = $ilCtrl->getNextClass($this);
55 $cmd = $ilCtrl->getCmd();
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']))
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');
528 global $ilAccess,
$ilErr,$rbacsystem,$ilUser,
$ilCtrl,$rbacreview;
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();
572 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
575 $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(),
false);
592 include_once(
'classes/class.ilLink.php');
593 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
604 if(!$rbacsystem->checkAccess(
'create', $this->getTarget(),$this->
getType()))
607 $ilCtrl->returnToParent($this);
613 $ilCtrl->returnToParent($this);
617 $options =
$_POST[
'cp_options'] ?
$_POST[
'cp_options'] : array();
655 $tpl->setVariable($a_tplvar,$this->form->getHTML());
678 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
680 $this->form->setTableWidth(
'600px');
681 $ilCtrl->setParameter($this,
'new_type',$this->
getType());
682 #$ilCtrl->setParameter($this, 'cp_mode', self::SOURCE_SELECTION);
683 $this->form->setFormAction($ilCtrl->getFormAction($this));
684 $this->form->setTitle($lng->txt($this->getType().
'_copy'));
686 $this->form->addCommandButton(
'searchSource', $lng->txt(
'btn_next'));
690 $tit->setMaxLength(70);
691 $tit->setRequired(
true);
692 $tit->setInfo($lng->txt(
'wizard_title_info'));
693 $this->form->addItem($tit);