64 $this->lng->loadLanguageModule(
'search');
65 $this->lng->loadLanguageModule(
'obj');
67 $this->parent_obj = $a_parent_gui;
83 $next_class = $ilCtrl->getNextClass($this);
84 $cmd = $ilCtrl->getCmd();
102 if((
int) $_REQUEST[
'smode'])
110 if($_REQUEST[
'source_ids'])
112 $this->
setSource(explode(
'_',$_REQUEST[
'source_ids']));
113 $GLOBALS[
'ilCtrl']->setParameter($this,
'source_ids', implode(
'_', $this->
getSources()));
116 if($_REQUEST[
'source_id'])
119 $GLOBALS[
'ilCtrl']->setParameter($this,
'source_ids', implode(
'_', $this->
getSource()));
130 if($_REQUEST[
'new_type'])
132 $this->
setMode(self::SEARCH_SOURCE);
133 $this->
setType($_REQUEST[
'new_type']);
145 elseif($_REQUEST[
'selectMode'] == self::SOURCE_SELECTION)
147 $this->
setMode(self::SOURCE_SELECTION);
149 $ilCtrl->setParameterByClass(get_class($this->parent_obj),
'selectMode', self::SOURCE_SELECTION);
151 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
155 elseif($_REQUEST[
'selectMode'] == self::TARGET_SELECTION)
157 $this->
setMode(self::TARGET_SELECTION);
158 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
164 if($_REQUEST[
'target_ids'])
166 $this->
setTargets(explode(
'_',$_REQUEST[
'target_ids']));
178 $GLOBALS[
'lng']->loadLanguageModule(
'cntr');
181 $GLOBALS[
'lng']->txt(
'tab_back_to_repository'),
182 $GLOBALS[
'ilCtrl']->getParentReturn($this->parent_obj)
191 protected function setTabs($a_tab_group, $a_active_tab)
193 if($a_tab_group == self::TAB_GROUP_SC_SELECTION)
195 if($this->
getSubMode() == self::SUBMODE_CONTENT_ONLY)
197 if($this->
getMode() == self::SOURCE_SELECTION)
200 self::TAB_SELECTION_SOURCE_TREE,
201 $GLOBALS[
'lng']->txt(
'cntr_copy_repo_tree'),
202 $GLOBALS[
'ilCtrl']->getLinkTarget($this,
'initSourceSelection')
205 self::TAB_SELECTION_MEMBERSHIP,
206 $GLOBALS[
'lng']->txt(
'cntr_copy_crs_grp'),
207 $GLOBALS[
'ilCtrl']->getLinkTarget($this,
'showSourceSelectionMembership')
212 $GLOBALS[
'ilTabs']->activateTab($a_active_tab);
222 $GLOBALS[
'ilCtrl']->setParameter($this,
'smode',self::SUBMODE_CONTENT_ONLY);
223 $GLOBALS[
'ilCtrl']->setParameter($this,
'selectMode',self::SOURCE_SELECTION);
226 $this->
setSubMode(self::SUBMODE_CONTENT_ONLY);
227 $this->
setMode(self::SOURCE_SELECTION);
241 $ilCtrl->setParameter($this,
'selectMode', self::TARGET_SELECTION);
254 foreach($this->
getSource() as $source_id)
258 $path = $tree->getPathId($source_id);
261 if(!in_array($node_id,
$_SESSION[
'paste_copy_repexpand']))
263 $_SESSION[
'paste_copy_repexpand'][] = $node_id;
270 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
288 $this->
setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_SOURCE_TREE);
293 foreach($this->
getTargets() as $target_ref_id)
295 $path = $tree->getPathId($target_ref_id);
298 if(!in_array($node_id,
$_SESSION[
'paste_copy_repexpand']))
300 $_SESSION[
'paste_copy_repexpand'][] = $node_id;
305 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
316 $this->
setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_MEMBERSHIP);
318 include_once
'./Services/Object/classes/class.ilObjectCopyCourseGroupSelectionTableGUI.php';
329 $GLOBALS[
'tpl']->setContent($cgs->getHTML());
338 global $ilTabs, $ilToolbar,
$ilCtrl, $tree,
$tpl, $objDefinition,
$lng;
342 if($objDefinition->isContainer($this->getType()))
352 include_once(
"./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
354 $exp->setTypeWhiteList(
array(
"root",
"cat",
"grp",
"crs",
"fold"));
356 $exp->setSelectMode(
"target", TRUE);
358 if ($exp->handleCommand())
366 $t->setFormAction($ilCtrl->getFormAction($this,
"saveTarget"));
367 if($objDefinition->isContainer($this->getType()))
369 $t->addFormButton($lng->txt(
"btn_next"),
"saveTarget");
373 $t->addFormButton($lng->txt(
"paste"),
"saveTarget");
376 $t->addFormButton($lng->txt(
"obj_insert_into_clipboard"),
"keepObjectsInClipboard");
377 $t->addFormButton($lng->txt(
"cancel"),
"cancel");
378 $t->setCloseFormTag(
false);
382 $t->setCloseFormTag(
true);
383 $t->setOpenFormTag(
false);
384 $output.=
"<br />".$t->getHTML();
386 $this->tpl->setContent(
$output);
396 global $ilTabs, $ilToolbar,
$ilCtrl, $tree,
$tpl, $objDefinition;
399 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paste_into_multiple_objects.html',
403 include_once
'./Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
406 'ilias.php?baseClass=ilRepositoryGUI&cmd=goto',
'paste_copy_repexpand');
407 $exp->setRequiredFormItemPermission(
'visible,read,copy');
409 $ilCtrl->setParameter($this,
'selectMode', self::SOURCE_SELECTION);
410 $exp->setExpandTarget($ilCtrl->getLinkTarget($this,
'showSourceSelectionTree'));
411 $exp->setTargetGet(
'ref_id');
412 $exp->setPostVar(
'source');
413 $exp->setCheckedItems($this->
getSource());
416 foreach(
array(
'cat',
'root',
'fold') as $container)
418 $exp->removeFormItemForType($container);
422 if(
$_GET[
'paste_copy_repexpand'] ==
'')
424 $expanded = $tree->readRootId();
428 $expanded =
$_GET[
'paste_copy_repexpand'];
431 $this->tpl->setVariable(
'FORM_TARGET',
'_self');
432 $this->tpl->setVariable(
'FORM_ACTION', $ilCtrl->getFormAction($this,
'copySelection'));
434 $exp->setExpand($expanded);
439 $this->tpl->setVariable(
'OBJECT_TREE',
$output);
441 $this->tpl->setVariable(
'CMD_SUBMIT',
'saveSource');
442 $this->tpl->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'btn_next'));
444 $ilToolbar->addButton($this->lng->txt(
'cancel'), $ilCtrl->getLinkTarget($this,
'cancel'));
453 global $objDefinition, $tree,
$ilCtrl;
457 if(is_array($_REQUEST[
'target'])
and $_REQUEST[
'target'])
460 $GLOBALS[
'ilCtrl']->setParameter($this,
'target_ids', implode(
'_', $this->
getTargets()));
463 elseif((
int) $_REQUEST[
'target'])
466 $GLOBALS[
'ilCtrl']->setParameter($this,
'target_ids', implode(
'_', $this->
getTargets()));
471 $ilCtrl->setParameter($this,
'selectMode', self::TARGET_SELECTION);
478 foreach($this->
getSources() as $source_ref_id)
484 $target_object =
new $target_class_name($target_ref_id);
485 $possible_subtypes = $target_object->getPossibleSubObjects();
489 if(!array_key_exists($source_type, (
array) $possible_subtypes))
493 $this->lng->txt(
'msg_obj_may_not_contain_objects_of_type'),
495 $this->lng->txt(
'obj_'.$source_type))
503 if(count($this->
getSource() == 1) && $objDefinition->isContainer($this->getType()))
508 foreach($this->
getTargets() as $target_ref_id)
510 if ($tree->isGrandChild($this->getFirstSource(), $target_ref_id))
520 if (count($is_child) > 0)
549 $this->mode = $a_mode;
563 $this->sub_mode = $a_mode;
608 $this->sources = $a_source_ids;
632 if(count($this->sources))
634 return $this->sources[0];
658 $this->targets = $a_target;
691 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'cancel');
692 $ilCtrl->returnToParent($this);
703 $ilCtrl->returnToParent($this);
726 $this->form->setValuesByPost();
728 if(!$this->form->checkInput())
731 $ilCtrl->returnToParent($this);
735 include_once
'./Services/Search/classes/class.ilQueryParser.php';
736 $query_parser =
new ilQueryParser($this->form->getInput(
'tit'));
739 $query_parser->parse();
740 if(!$query_parser->validate())
743 $ilCtrl->returnToParent($this);
747 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
749 $object_search->setFilter(
array($_REQUEST[
'new_type']));
750 $res = $object_search->performSearch();
751 $res->setRequiredPermission(
'copy');
752 $res->filter(ROOT_FOLDER_ID,
true);
757 $ilCtrl->returnToParent($this);
761 include_once
'./Services/Object/classes/class.ilObjectCopySearchResultTableGUI.php';
763 $table->setFormAction(
$GLOBALS[
'ilCtrl']->getFormAction($this));
765 $table->parseSearchResults(
$results);
766 $tpl->setContent($table->getHTML());
775 global $objDefinition;
777 if(isset(
$_POST[
'source']))
781 $GLOBALS[
'ilCtrl']->setParameter($this,
'source_id',(
int) $_REQUEST[
'source']);
791 foreach($this->
getSources() as $source_ref_id)
797 $target_object =
new $target_class_name($target_ref_id);
798 $possible_subtypes = $target_object->getPossibleSubObjects();
802 if(!array_key_exists($source_type, $possible_subtypes))
804 #ilLoggerFactory::getLogger('obj')->debug('Source type: '. $source_type); 805 #ilLoggerFactory::getLogger('obj')->debug('Target type: '. $target_type); 806 #ilLoggerFactory::getLogger('obj')->debug('Submode: '. $this->getSubMode()); 816 $this->lng->txt(
'msg_obj_may_not_contain_objects_of_type'),
818 $this->lng->txt(
'obj_'.$source_type))
829 if($objDefinition->isContainer($this->getType()))
844 global $objDefinition;
846 if(!isset($_REQUEST[
'source']))
849 $GLOBALS[
'ilCtrl']->redirect($this,
'showSourceSelectionMembership');
855 $GLOBALS[
'ilCtrl']->setParameter($this,
'source_id',(
int) $_REQUEST[
'source']);
857 if($objDefinition->isContainer($this->getType()))
886 include_once
'./Services/Object/classes/class.ilObjectCopySelectionTableGUI.php';
888 $tpl->addJavaScript(
'./Services/CopyWizard/js/ilContainer.js');
889 $tpl->setVariable(
'BODY_ATTRIBUTES',
'onload="ilDisableChilds(\'cmd\');"');
893 case self::SOURCE_SELECTION:
894 $back_cmd =
'showSourceSelectionTree';
897 case self::TARGET_SELECTION:
898 $back_cmd =
'showTargetSelectionTree';
901 case self::SEARCH_SOURCE:
902 $back_cmd =
'searchSource';
909 $tpl->setContent($table->getHTML());
918 include_once(
'./Services/Link/classes/class.ilLink.php');
919 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
927 $ilCtrl->returnToParent($this);
941 global $ilAccess,$objDefinition,$rbacsystem,
$ilUser,
$ilCtrl,$rbacreview;
944 include_once(
'./Services/Link/classes/class.ilLink.php');
945 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
948 foreach ($a_sources as $source_ref_id)
954 foreach($this->
getTargets() as $target_ref_id)
956 if(!$rbacsystem->checkAccess(
'create', $target_ref_id, $source_type))
958 $this->log->notice(
'Permission denied for target_id: ' . $target_ref_id.
' source_type: ' . $source_type.
' CREATE');
960 $ilCtrl->returnToParent($this);
965 if(!$ilAccess->checkAccess(
'copy',
'',$source_ref_id))
967 $this->log->notice(
'Permission denied for source_ref_id: ' . $source_ref_id.
' COPY');
969 $ilCtrl->returnToParent($this);
973 if($objDefinition->isContainer($source_type)
and $this->
getSubMode() != self::SUBMODE_CONTENT_ONLY)
976 $ilCtrl->returnToParent($this);
986 foreach ($a_sources as $source_ref_id)
991 foreach($this->
getTargets() as $target_ref_id)
996 $wizard_options->saveOwner($ilUser->getId());
997 $wizard_options->saveRoot((
int) $source_ref_id);
998 $wizard_options->read();
1001 $new_obj =
$orig->cloneObject($target_ref_id,$copy_id);
1004 $wizard_options->deleteAll();
1007 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
1010 $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(),
false);
1017 unset(
$_SESSION[
"clipboard"][
"ref_ids"]);
1020 if (count($a_sources) == 1)
1049 foreach($this->
getTargets() as $target_ref_id)
1052 $last_target = $target_ref_id;
1055 unset(
$_SESSION[
"clipboard"][
"ref_ids"]);
1058 include_once
'./Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1063 $ilCtrl->setParameterByClass(
1068 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
1083 include_once
'./Services/Object/classes/class.ilObjectCopyProgressTableGUI.php';
1087 (
int)
$_GET[
'ref_id']
1089 $progress->setObjectInfo($this->targets_copy_id);
1092 $progress->setRedirectionUrl(
$GLOBALS[
'ilCtrl']->getParentReturn($this->parent_obj));
1094 $GLOBALS[
'tpl']->setContent($progress->getHTML());
1102 $json =
new stdClass();
1103 $json->percentage = null;
1104 $json->performed_steps = null;
1106 include_once
'./Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1108 $json->required_steps =
$options->getRequiredSteps();
1109 $json->id = (int) $_REQUEST[
'copy_id'];
1113 echo json_encode($json);
1126 include_once(
'./Services/Link/classes/class.ilLink.php');
1127 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
1136 if($this->
getSubMode() != self::SUBMODE_CONTENT_ONLY)
1138 if(!$rbacsystem->checkAccess(
'create', $a_target,$this->getType()))
1140 $this->log->notice(
'Permission denied for target: '. $a_target.
' type: ' . $this->getType().
' CREATE');
1142 $ilCtrl->returnToParent($this);
1148 $ilCtrl->returnToParent($this);
1169 $this->targets_copy_id[$a_target] =
$result[
'copy_id'];
1188 #if(!$this->sourceExists()) 1198 $tpl->setVariable($a_tplvar,$this->form->getHTML());
1226 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
1228 $this->form->setTableWidth(
'600px');
1230 $ilCtrl->setParameter($this,
'new_type',$this->
getType());
1232 #$ilCtrl->setParameter($this, 'cp_mode', self::SOURCE_SELECTION); 1233 $this->form->setFormAction($ilCtrl->getFormAction($this));
1234 $this->form->setTitle($lng->txt($this->getType().
'_copy'));
1236 $this->form->addCommandButton(
'searchSource', $lng->txt(
'btn_next'));
1237 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
1241 $tit->setMaxLength(70);
1242 $tit->setRequired(
true);
1243 $tit->setInfo($lng->txt(
'wizard_title_info'));
1244 $this->form->addItem($tit);
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
GUI class for the workflow of copying objects.
static getClassByType($a_obj_type)
Get class by type.
adoptContent()
Adopt content (crs in crs, grp in grp, crs in grp or grp in crs)
setTargets(array $a_target)
Set target id.
__construct($a_parent_gui)
Constructor.
updateProgress()
Update progress.
Explorer for selecting repository items.
Presentation of search results.
GUI class for the workflow of copying objects.
setMode($a_mode)
set copy mode
initSourceSelection()
Init source selection.
initTargetSelection()
Init copy from repository/search list commands.
saveSource()
select source object
setTarget($a_ref_id)
Set single object target.
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
static _getObjectsByOperations($a_obj_type, $a_operation, $a_usr_id=0, $limit=0)
Get all objects of a specific type and check access This function is not recursive, instead it parses the serialized rbac_pa entries.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
initFormSearch()
Init search form.
keepObjectsInClipboard()
Keep objects in clipboard.
showCopyProgress()
Show progress for copying.
copyContainer($a_target)
Copy a container.
static _lookupTitle($a_id)
lookup object title
saveSourceMembership()
Save selected source from membership screen.
getFirstTarget()
Get first target.
const TAB_SELECTION_TARGET_TREE
getSource()
Get source id.
const TAB_GROUP_SC_SELECTION
setSource(array $a_source_ids)
Set source id.
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static _isFinished($a_copy_id)
check if copy is finished
initTabs()
Init tabs General.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
getParentObject()
Get parent gui object.
Table gui for copy progress.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
if(!is_array($argv)) $options
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupObjId($a_id)
setSize($a_size)
Set Size.
unsetSession()
Unset session variables.
This class represents a text property in a property form.
static _allocateCopyId()
Allocate a copy for further entries.
setTabs($a_tab_group, $a_active_tab)
Set tabs.
copySingleObject()
Start cloning a single (not container) object.
getTargets()
Get copy target.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
executeCommand()
Control class handling.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const TAB_SELECTION_MEMBERSHIP
showTargetSelectionTree()
Show target selection.
showSourceSelectionTree()
Show target selection.
copyContainerToTargets()
Copy to multiple targets.
copyMultipleNonContainer($a_sources)
Copy multiple non container.
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
const TAB_SELECTION_SOURCE_TREE
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static getLogger($a_component_id)
Get component logger.
saveTarget()
Save target selection.
setMinWordLength($a_length, $a_force=false)
sourceExists()
Check if there is any source object.
showSourceSearch($a_tplvar)
Show init screen Normally shown below the create and import form when creating a new object...
static redirect($a_script)
http redirect to other script
showSourceSelectionMembership()
show target selection membership
searchSource()
Search source.
const SUBMODE_CONTENT_ONLY
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
setType($type)
Sets $type.