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();
111 if($_REQUEST[
'source_ids'])
113 $this->
setSource(explode(
'_',$_REQUEST[
'source_ids']));
114 $GLOBALS[
'ilCtrl']->setParameter($this,
'source_ids', implode(
'_', $this->
getSources()));
117 if($_REQUEST[
'source_id'])
119 $this->
setSource(array((
int) $_REQUEST[
'source_id']));
120 $GLOBALS[
'ilCtrl']->setParameter($this,
'source_ids', implode(
'_', $this->
getSource()));
131 if($_REQUEST[
'new_type'])
133 $this->
setMode(self::SEARCH_SOURCE);
134 $this->
setType($_REQUEST[
'new_type']);
146 elseif($_REQUEST[
'selectMode'] == self::SOURCE_SELECTION)
148 $this->
setMode(self::SOURCE_SELECTION);
150 $ilCtrl->setParameterByClass(get_class($this->parent_obj),
'selectMode', self::SOURCE_SELECTION);
152 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
156 elseif($_REQUEST[
'selectMode'] == self::TARGET_SELECTION)
158 $this->
setMode(self::TARGET_SELECTION);
159 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
165 if($_REQUEST[
'target_ids'])
167 $this->
setTargets(explode(
'_',$_REQUEST[
'target_ids']));
179 $GLOBALS[
'lng']->loadLanguageModule(
'cntr');
182 $GLOBALS[
'lng']->txt(
'tab_back_to_repository'),
183 $GLOBALS[
'ilCtrl']->getParentReturn($this->parent_obj)
192 protected function setTabs($a_tab_group, $a_active_tab)
194 if($a_tab_group == self::TAB_GROUP_SC_SELECTION)
196 if($this->
getSubMode() == self::SUBMODE_CONTENT_ONLY)
198 if($this->
getMode() == self::SOURCE_SELECTION)
201 self::TAB_SELECTION_SOURCE_TREE,
202 $GLOBALS[
'lng']->txt(
'cntr_copy_repo_tree'),
203 $GLOBALS[
'ilCtrl']->getLinkTarget($this,
'initSourceSelection')
206 self::TAB_SELECTION_MEMBERSHIP,
207 $GLOBALS[
'lng']->txt(
'cntr_copy_crs_grp'),
208 $GLOBALS[
'ilCtrl']->getLinkTarget($this,
'showSourceSelectionMembership')
213 $GLOBALS[
'ilTabs']->activateTab($a_active_tab);
223 $GLOBALS[
'ilCtrl']->setParameter($this,
'smode',self::SUBMODE_CONTENT_ONLY);
224 $GLOBALS[
'ilCtrl']->setParameter($this,
'selectMode',self::SOURCE_SELECTION);
227 $this->
setSubMode(self::SUBMODE_CONTENT_ONLY);
228 $this->
setMode(self::SOURCE_SELECTION);
242 $ilCtrl->setParameter($this,
'selectMode', self::TARGET_SELECTION);
244 $_SESSION[
'paste_copy_repexpand'] = array();
255 foreach($this->
getSource() as $source_id)
259 $path = $tree->getPathId($source_id);
260 foreach((array)
$path as $node_id)
262 if(!in_array($node_id,
$_SESSION[
'paste_copy_repexpand']))
264 $_SESSION[
'paste_copy_repexpand'][] = $node_id;
271 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
284 $_SESSION[
'paste_copy_repexpand'] = array();
289 $this->
setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_SOURCE_TREE);
294 foreach($this->
getTargets() as $target_ref_id)
296 $path = $tree->getPathId($target_ref_id);
297 foreach((array)
$path as $node_id)
299 if(!in_array($node_id,
$_SESSION[
'paste_copy_repexpand']))
301 $_SESSION[
'paste_copy_repexpand'][] = $node_id;
306 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
317 $this->
setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_MEMBERSHIP);
319 include_once
'./Services/Object/classes/class.ilObjectCopyCourseGroupSelectionTableGUI.php';
330 $GLOBALS[
'tpl']->setContent($cgs->getHTML());
339 global $ilTabs, $ilToolbar,
$ilCtrl, $tree,
$tpl, $objDefinition,
$lng;
343 if($objDefinition->isContainer($this->getType()))
353 include_once(
"./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
355 $exp->setTypeWhiteList(array(
"root",
"cat",
"grp",
"crs",
"fold"));
357 $exp->setSelectMode(
"target", TRUE);
359 if ($exp->handleCommand())
363 $output = $exp->getHTML();
367 $t->setFormAction($ilCtrl->getFormAction($this,
"saveTarget"));
368 if($objDefinition->isContainer($this->getType()))
370 $t->addFormButton($lng->txt(
"btn_next"),
"saveTarget");
374 $t->addFormButton($lng->txt(
"paste"),
"saveTarget");
377 $t->addFormButton($lng->txt(
"obj_insert_into_clipboard"),
"keepObjectsInClipboard");
378 $t->addFormButton($lng->txt(
"cancel"),
"cancel");
379 $t->setCloseFormTag(
false);
381 $output =
$t->getHTML().$output;
383 $t->setCloseFormTag(
true);
384 $t->setOpenFormTag(
false);
385 $output.=
"<br />".$t->getHTML();
387 $this->tpl->setContent($output);
397 global $ilTabs, $ilToolbar,
$ilCtrl, $tree,
$tpl, $objDefinition;
400 $this->tpl->addBlockfile(
'ADM_CONTENT',
'adm_content',
'tpl.paste_into_multiple_objects.html',
404 include_once
'./Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
407 'ilias.php?baseClass=ilRepositoryGUI&cmd=goto',
'paste_copy_repexpand');
408 $exp->setRequiredFormItemPermission(
'visible,read,copy');
410 $ilCtrl->setParameter($this,
'selectMode', self::SOURCE_SELECTION);
411 $exp->setExpandTarget($ilCtrl->getLinkTarget($this,
'showSourceSelectionTree'));
412 $exp->setTargetGet(
'ref_id');
413 $exp->setPostVar(
'source');
414 $exp->setCheckedItems($this->
getSource());
417 foreach(array(
'cat',
'root',
'fold') as $container)
419 $exp->removeFormItemForType($container);
423 if(
$_GET[
'paste_copy_repexpand'] ==
'')
425 $expanded = $tree->readRootId();
429 $expanded =
$_GET[
'paste_copy_repexpand'];
432 $this->tpl->setVariable(
'FORM_TARGET',
'_self');
433 $this->tpl->setVariable(
'FORM_ACTION', $ilCtrl->getFormAction($this,
'copySelection'));
435 $exp->setExpand($expanded);
438 $output = $exp->getOutput();
440 $this->tpl->setVariable(
'OBJECT_TREE', $output);
442 $this->tpl->setVariable(
'CMD_SUBMIT',
'saveSource');
443 $this->tpl->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'btn_next'));
445 $ilToolbar->addButton($this->lng->txt(
'cancel'), $ilCtrl->getLinkTarget($this,
'cancel'));
454 global $objDefinition, $tree,
$ilCtrl;
461 $GLOBALS[
'ilCtrl']->setParameter($this,
'target_ids', implode(
'_', $this->
getTargets()));
464 elseif((
int) $_REQUEST[
'target'])
467 $GLOBALS[
'ilCtrl']->setParameter($this,
'target_ids', implode(
'_', $this->
getTargets()));
472 $ilCtrl->setParameter($this,
'selectMode', self::TARGET_SELECTION);
479 foreach($this->
getSources() as $source_ref_id)
481 foreach((array) $this->
getTargets() as $target_ref_id)
485 $target_object =
new $target_class_name($target_ref_id);
486 $possible_subtypes = $target_object->getPossibleSubObjects();
490 if(!array_key_exists($source_type, (array) $possible_subtypes))
494 $this->lng->txt(
'msg_obj_may_not_contain_objects_of_type'),
496 $this->lng->txt(
'obj_'.$source_type))
504 if(count($this->
getSource() == 1) && $objDefinition->isContainer($this->getType()))
509 foreach($this->
getTargets() as $target_ref_id)
511 if ($tree->isGrandChild($this->getFirstSource(), $target_ref_id))
521 if (count($is_child) > 0)
550 $this->mode = $a_mode;
564 $this->sub_mode = $a_mode;
609 $this->sources = $a_source_ids;
633 if(count($this->sources))
635 return $this->sources[0];
659 $this->targets = $a_target;
692 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'cancel');
693 $ilCtrl->returnToParent($this);
704 $ilCtrl->returnToParent($this);
727 $this->form->setValuesByPost();
729 if(!$this->form->checkInput())
732 $ilCtrl->returnToParent($this);
736 include_once
'./Services/Search/classes/class.ilQueryParser.php';
737 $query_parser =
new ilQueryParser($this->form->getInput(
'tit'));
740 $query_parser->parse();
741 if(!$query_parser->validate())
744 $ilCtrl->returnToParent($this);
748 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
750 $object_search->setFilter(array(
$_REQUEST[
'new_type']));
751 $res = $object_search->performSearch();
752 $res->setRequiredPermission(
'copy');
753 $res->filter(ROOT_FOLDER_ID,
true);
758 $ilCtrl->returnToParent($this);
763 include_once
'./Services/Object/classes/class.ilObjectCopySearchResultTableGUI.php';
765 $table->setFormAction(
$GLOBALS[
'ilCtrl']->getFormAction($this));
767 $table->parseSearchResults(
$results);
768 $tpl->setContent($table->getHTML());
777 global $objDefinition;
779 if(isset(
$_POST[
'source']))
783 $GLOBALS[
'ilCtrl']->setParameter($this,
'source_id',(
int) $_REQUEST[
'source']);
793 foreach($this->
getSources() as $source_ref_id)
795 foreach((array) $this->
getTargets() as $target_ref_id)
799 $target_object =
new $target_class_name($target_ref_id);
800 $possible_subtypes = $target_object->getPossibleSubObjects();
804 if(!array_key_exists($source_type, $possible_subtypes))
806 #ilLoggerFactory::getLogger('obj')->debug('Source type: '. $source_type); 807 #ilLoggerFactory::getLogger('obj')->debug('Target type: '. $target_type); 808 #ilLoggerFactory::getLogger('obj')->debug('Submode: '. $this->getSubMode()); 812 $this->
getSubMode() != self::SUBMODE_CONTENT_ONLY and
818 $this->lng->txt(
'msg_obj_may_not_contain_objects_of_type'),
820 $this->lng->txt(
'obj_'.$source_type))
831 if($objDefinition->isContainer($this->getType()))
846 global $objDefinition;
851 $GLOBALS[
'ilCtrl']->redirect($this,
'showSourceSelectionMembership');
857 $GLOBALS[
'ilCtrl']->setParameter($this,
'source_id',(
int) $_REQUEST[
'source']);
859 if($objDefinition->isContainer($this->getType()))
888 include_once
'./Services/Object/classes/class.ilObjectCopySelectionTableGUI.php';
890 $tpl->addJavaScript(
'./Services/CopyWizard/js/ilContainer.js');
891 $tpl->setVariable(
'BODY_ATTRIBUTES',
'onload="ilDisableChilds(\'cmd\');"');
895 case self::SOURCE_SELECTION:
896 $back_cmd =
'showSourceSelectionTree';
899 case self::TARGET_SELECTION:
900 $back_cmd =
'showTargetSelectionTree';
903 case self::SEARCH_SOURCE:
904 $back_cmd =
'searchSource';
911 $tpl->setContent($table->getHTML());
920 include_once(
'./Services/Link/classes/class.ilLink.php');
921 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
929 $ilCtrl->returnToParent($this);
943 global $ilAccess,$objDefinition,$rbacsystem,
$ilUser,
$ilCtrl,$rbacreview;
946 include_once(
'./Services/Link/classes/class.ilLink.php');
947 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
950 foreach ($a_sources as $source_ref_id)
956 foreach($this->
getTargets() as $target_ref_id)
958 if(!$rbacsystem->checkAccess(
'create', $target_ref_id, $source_type))
960 $this->log->notice(
'Permission denied for target_id: ' . $target_ref_id.
' source_type: ' . $source_type.
' CREATE');
962 $ilCtrl->returnToParent($this);
965 foreach($this->
getTargets() as $target_ref_id)
967 if(!$rbacsystem->checkAccess(
'create', $target_ref_id, $source_type))
969 $this->log->notice(
'Permission denied for target_id: ' . $target_ref_id.
' source_type: ' . $source_type.
' CREATE');
971 $ilCtrl->returnToParent($this);
976 if(!$ilAccess->checkAccess(
'copy',
'',$source_ref_id))
978 $this->log->notice(
'Permission denied for source_ref_id: ' . $source_ref_id.
' COPY');
980 $ilCtrl->returnToParent($this);
984 if($objDefinition->isContainer($source_type) and $this->
getSubMode() != self::SUBMODE_CONTENT_ONLY)
987 $ilCtrl->returnToParent($this);
997 foreach ($a_sources as $source_ref_id)
1002 foreach($this->
getTargets() as $target_ref_id)
1007 $wizard_options->saveOwner($ilUser->getId());
1008 $wizard_options->saveRoot((
int) $source_ref_id);
1009 $wizard_options->read();
1012 $new_obj = $orig->cloneObject($target_ref_id,$copy_id);
1015 $wizard_options->deleteAll();
1018 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
1021 $rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(),
false);
1028 unset(
$_SESSION[
"clipboard"][
"ref_ids"]);
1031 if (count($a_sources) == 1)
1060 foreach($this->
getTargets() as $target_ref_id)
1063 $last_target = $target_ref_id;
1066 unset(
$_SESSION[
"clipboard"][
"ref_ids"]);
1069 include_once
'./Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1074 $ilCtrl->setParameterByClass(
1079 $ilCtrl->redirectByClass(
"ilrepositorygui",
"");
1094 include_once
'./Services/Object/classes/class.ilObjectCopyProgressTableGUI.php';
1098 (
int)
$_GET[
'ref_id']
1100 $progress->setObjectInfo($this->targets_copy_id);
1103 $progress->setRedirectionUrl(
$GLOBALS[
'ilCtrl']->getParentReturn($this->parent_obj));
1105 $GLOBALS[
'tpl']->setContent($progress->getHTML());
1113 $json =
new stdClass();
1114 $json->percentage = null;
1115 $json->performed_steps = null;
1117 include_once
'./Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1119 $json->required_steps =
$options->getRequiredSteps();
1120 $json->id = (int) $_REQUEST[
'copy_id'];
1124 echo json_encode($json);
1137 include_once(
'./Services/Link/classes/class.ilLink.php');
1138 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
1147 if($this->
getSubMode() != self::SUBMODE_CONTENT_ONLY)
1149 if(!$rbacsystem->checkAccess(
'create', $a_target,$this->getType()))
1151 $this->log->notice(
'Permission denied for target: '. $a_target.
' type: ' . $this->getType().
' CREATE');
1153 $ilCtrl->returnToParent($this);
1159 $ilCtrl->returnToParent($this);
1169 $result = $orig->cloneAllObject(
1180 $this->targets_copy_id[$a_target] =
$result[
'copy_id'];
1199 #if(!$this->sourceExists()) 1209 $tpl->setVariable($a_tplvar,$this->form->getHTML());
1237 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
1239 $this->form->setTableWidth(
'600px');
1241 $ilCtrl->setParameter($this,
'new_type',$this->
getType());
1243 #$ilCtrl->setParameter($this, 'cp_mode', self::SOURCE_SELECTION); 1244 $this->form->setFormAction($ilCtrl->getFormAction($this));
1245 $this->form->setTitle($lng->txt($this->getType().
'_copy'));
1247 $this->form->addCommandButton(
'searchSource', $lng->txt(
'btn_next'));
1248 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
1252 $tit->setMaxLength(70);
1253 $tit->setRequired(
true);
1254 $tit->setInfo($lng->txt(
'wizard_title_info'));
1255 $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.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
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.
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.
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.
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 getLogger($a_component_id)
Get component logger.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
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.