123 $this->ctrl = $DIC->ctrl();
124 $this->tree = $DIC->repositoryTree();
125 $this->tabs = $DIC->tabs();
126 $this->toolbar = $DIC->toolbar();
127 $this->tpl = $DIC[
"tpl"];
128 $this->obj_definition = $DIC[
"objDefinition"];
129 $this->obj_data_cache = $DIC[
"ilObjDataCache"];
130 $this->access = $DIC->access();
131 $this->error = $DIC[
"ilErr"];
132 $this->rbacsystem = $DIC->rbac()->system();
133 $this->
user = $DIC->user();
134 $this->rbacreview = $DIC->rbac()->review();
135 $this->log = $DIC[
"ilLog"];
137 $lng = $DIC->language();
140 $this->lng->loadLanguageModule(
'search');
141 $this->lng->loadLanguageModule(
'obj');
143 $this->parent_obj = $a_parent_gui;
159 $next_class =
$ilCtrl->getNextClass($this);
162 switch ($next_class) {
177 if ((
int) $_REQUEST[
'smode']) {
184 if ($_REQUEST[
'source_ids']) {
185 $this->
setSource(explode(
'_', $_REQUEST[
'source_ids']));
186 $GLOBALS[
'ilCtrl']->setParameter($this,
'source_ids', implode(
'_', $this->
getSources()));
189 if ($_REQUEST[
'source_id']) {
191 $GLOBALS[
'ilCtrl']->setParameter($this,
'source_ids', implode(
'_', $this->
getSources()));
201 if ($_REQUEST[
'new_type']) {
202 $this->
setMode(self::SEARCH_SOURCE);
203 $this->
setType($_REQUEST[
'new_type']);
215 elseif ($_REQUEST[
'selectMode'] == self::SOURCE_SELECTION) {
216 $this->
setMode(self::SOURCE_SELECTION);
218 $ilCtrl->setParameterByClass(get_class($this->parent_obj),
'selectMode', self::SOURCE_SELECTION);
220 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
223 } elseif ($_REQUEST[
'selectMode'] == self::TARGET_SELECTION) {
224 $this->
setMode(self::TARGET_SELECTION);
225 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
231 if ($_REQUEST[
'target_ids']) {
232 $this->
setTargets(explode(
'_', $_REQUEST[
'target_ids']));
243 $GLOBALS[
'lng']->loadLanguageModule(
'cntr');
246 $GLOBALS[
'lng']->txt(
'tab_back_to_repository'),
247 $GLOBALS[
'ilCtrl']->getParentReturn($this->parent_obj)
256 protected function setTabs($a_tab_group, $a_active_tab)
258 if ($a_tab_group == self::TAB_GROUP_SC_SELECTION) {
259 if ($this->
getSubMode() == self::SUBMODE_CONTENT_ONLY) {
260 if ($this->
getMode() == self::SOURCE_SELECTION) {
262 self::TAB_SELECTION_SOURCE_TREE,
263 $GLOBALS[
'lng']->txt(
'cntr_copy_repo_tree'),
264 $GLOBALS[
'ilCtrl']->getLinkTarget($this,
'initSourceSelection')
267 self::TAB_SELECTION_MEMBERSHIP,
268 $GLOBALS[
'lng']->txt(
'cntr_copy_crs_grp'),
269 $GLOBALS[
'ilCtrl']->getLinkTarget($this,
'showSourceSelectionMembership')
274 $GLOBALS[
'ilTabs']->activateTab($a_active_tab);
284 $GLOBALS[
'ilCtrl']->setParameter($this,
'smode', self::SUBMODE_CONTENT_ONLY);
285 $GLOBALS[
'ilCtrl']->setParameter($this,
'selectMode', self::SOURCE_SELECTION);
288 $this->
setSubMode(self::SUBMODE_CONTENT_ONLY);
289 $this->
setMode(self::SOURCE_SELECTION);
304 $ilCtrl->setParameter($this,
'selectMode', self::TARGET_SELECTION);
321 if (!in_array($node_id,
$_SESSION[
'paste_copy_repexpand'])) {
322 $_SESSION[
'paste_copy_repexpand'][] = $node_id;
328 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
347 $this->
setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_SOURCE_TREE);
352 foreach ($this->
getTargets() as $target_ref_id) {
355 if (!in_array($node_id,
$_SESSION[
'paste_copy_repexpand'])) {
356 $_SESSION[
'paste_copy_repexpand'][] = $node_id;
361 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'');
372 $this->
setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_MEMBERSHIP);
374 include_once
'./Services/Object/classes/class.ilObjectCopyCourseGroupSelectionTableGUI.php';
385 $GLOBALS[
'tpl']->setContent($cgs->getHTML());
404 if ($objDefinition->isContainer($this->getType())) {
411 include_once(
"./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
413 $exp->setTypeWhiteList(
array(
"root",
"cat",
"grp",
"crs",
"fold"));
415 $exp->setSelectMode(
"target",
true);
417 if ($exp->handleCommand()) {
424 $t->setFormAction(
$ilCtrl->getFormAction($this,
"saveTarget"));
425 if ($objDefinition->isContainer($this->getType())) {
426 $t->addFormButton(
$lng->txt(
"btn_next"),
"saveTarget");
428 $t->addFormButton(
$lng->txt(
"paste"),
"saveTarget");
431 $t->addFormButton(
$lng->txt(
"obj_insert_into_clipboard"),
"keepObjectsInClipboard");
432 $t->addFormButton(
$lng->txt(
"cancel"),
"cancel");
433 $t->setCloseFormTag(
false);
437 $t->setCloseFormTag(
true);
438 $t->setOpenFormTag(
false);
441 $this->tpl->setContent(
$output);
459 $this->tpl->addBlockfile(
462 'tpl.paste_into_multiple_objects.html',
467 include_once
'./Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
470 'ilias.php?baseClass=ilRepositoryGUI&cmd=goto',
471 'paste_copy_repexpand' 473 $exp->setRequiredFormItemPermission(
'visible,read,copy');
475 $ilCtrl->setParameter($this,
'selectMode', self::SOURCE_SELECTION);
476 $exp->setExpandTarget(
$ilCtrl->getLinkTarget($this,
'showSourceSelectionTree'));
477 $exp->setTargetGet(
'ref_id');
478 $exp->setPostVar(
'source');
483 $exp->removeFormItemForType($container);
487 if (
$_GET[
'paste_copy_repexpand'] ==
'') {
488 $expanded =
$tree->readRootId();
490 $expanded =
$_GET[
'paste_copy_repexpand'];
493 $this->tpl->setVariable(
'FORM_TARGET',
'_self');
494 $this->tpl->setVariable(
'FORM_ACTION',
$ilCtrl->getFormAction($this,
'copySelection'));
496 $exp->setExpand($expanded);
501 $this->tpl->setVariable(
'OBJECT_TREE',
$output);
503 $this->tpl->setVariable(
'CMD_SUBMIT',
'saveSource');
504 $this->tpl->setVariable(
'TXT_SUBMIT', $this->lng->txt(
'btn_next'));
506 $ilToolbar->addButton($this->lng->txt(
'cancel'),
$ilCtrl->getLinkTarget($this,
'cancel'));
521 if (is_array($_REQUEST[
'target']) and $_REQUEST[
'target']) {
523 $GLOBALS[
'ilCtrl']->setParameter($this,
'target_ids', implode(
'_', $this->
getTargets()));
526 elseif ((
int) $_REQUEST[
'target']) {
528 $GLOBALS[
'ilCtrl']->setParameter($this,
'target_ids', implode(
'_', $this->
getTargets()));
532 $ilCtrl->setParameter($this,
'selectMode', self::TARGET_SELECTION);
539 foreach ($this->
getSources() as $source_ref_id) {
543 $target_object =
new $target_class_name($target_ref_id);
544 $possible_subtypes = $target_object->getPossibleSubObjects();
548 if (!array_key_exists($source_type, (
array) $possible_subtypes)) {
551 $this->lng->txt(
'msg_obj_may_not_contain_objects_of_type'),
553 $this->lng->txt(
'obj_' . $source_type)
562 if ((count($this->
getSources()) == 1) && $objDefinition->isContainer($this->getType())) {
566 foreach ($this->
getTargets() as $target_ref_id) {
567 if (
$tree->isGrandChild($this->getFirstSource(), $target_ref_id)) {
575 if (count($is_child) > 0) {
598 $this->mode = $a_mode;
612 $this->sub_mode = $a_mode;
657 $this->sources = $a_source_ids;
681 if (count($this->sources)) {
682 return $this->sources[0];
706 $this->targets = $a_target;
724 if (array_key_exists(0, $this->
getTargets())) {
738 $ilCtrl->setReturnByClass(get_class($this->parent_obj),
'cancel');
739 $ilCtrl->returnToParent($this);
751 $ilCtrl->returnToParent($this);
767 if (isset(
$_POST[
'tit'])) {
775 $this->form->setValuesByPost();
777 if (!$this->form->checkInput()) {
779 $ilCtrl->returnToParent($this);
783 include_once
'./Services/Search/classes/class.ilQueryParser.php';
784 $query_parser =
new ilQueryParser($this->form->getInput(
'tit'));
787 $query_parser->parse();
788 if (!$query_parser->validate()) {
790 $ilCtrl->returnToParent($this);
794 include_once
'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
796 $object_search->setFilter(
array($_REQUEST[
'new_type']));
797 $res = $object_search->performSearch();
798 $res->setRequiredPermission(
'copy');
799 $res->filter(ROOT_FOLDER_ID,
true);
803 $ilCtrl->returnToParent($this);
807 include_once
'./Services/Object/classes/class.ilObjectCopySearchResultTableGUI.php';
823 if (isset(
$_POST[
'source'])) {
826 $GLOBALS[
'ilCtrl']->setParameter($this,
'source_id', (
int) $_REQUEST[
'source']);
834 foreach ($this->
getSources() as $source_ref_id) {
838 $target_object =
new $target_class_name($target_ref_id);
839 $possible_subtypes = $target_object->getPossibleSubObjects();
843 if (!array_key_exists($source_type, $possible_subtypes)) {
844 #ilLoggerFactory::getLogger('obj')->debug('Source type: '. $source_type); 845 #ilLoggerFactory::getLogger('obj')->debug('Target type: '. $target_type); 846 #ilLoggerFactory::getLogger('obj')->debug('Submode: '. $this->getSubMode()); 850 $this->
getSubMode() != self::SUBMODE_CONTENT_ONLY and
855 $this->lng->txt(
'msg_obj_may_not_contain_objects_of_type'),
857 $this->lng->txt(
'obj_' . $source_type)
868 if ($objDefinition->isContainer($this->getType())) {
882 if (!isset($_REQUEST[
'source'])) {
884 $GLOBALS[
'ilCtrl']->redirect($this,
'showSourceSelectionMembership');
890 $GLOBALS[
'ilCtrl']->setParameter($this,
'source_id', (
int) $_REQUEST[
'source']);
892 if ($objDefinition->isContainer($this->getType())) {
917 include_once
'./Services/Object/classes/class.ilObjectCopySelectionTableGUI.php';
919 $tpl->addJavaScript(
'./Services/CopyWizard/js/ilContainer.js');
920 $tpl->setVariable(
'BODY_ATTRIBUTES',
'onload="ilDisableChilds(\'cmd\');"');
923 case self::SOURCE_SELECTION:
924 $back_cmd =
'showSourceSelectionTree';
927 case self::TARGET_SELECTION:
928 $back_cmd =
'showTargetSelectionTree';
931 case self::SEARCH_SOURCE:
932 $back_cmd =
'searchSource';
948 include_once(
'./Services/Link/classes/class.ilLink.php');
949 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
961 $ilCtrl->returnToParent($this);
983 include_once(
'./Services/Link/classes/class.ilLink.php');
984 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
987 foreach ($a_sources as $source_ref_id) {
992 foreach ($this->
getTargets() as $target_ref_id) {
993 if (!
$rbacsystem->checkAccess(
'create', $target_ref_id, $source_type)) {
994 $this->log->notice(
'Permission denied for target_id: ' . $target_ref_id .
' source_type: ' . $source_type .
' CREATE');
996 $ilCtrl->returnToParent($this);
1001 if (!$ilAccess->checkAccess(
'copy',
'', $source_ref_id)) {
1002 $this->log->notice(
'Permission denied for source_ref_id: ' . $source_ref_id .
' COPY');
1004 $ilCtrl->returnToParent($this);
1008 if ($objDefinition->isContainer($source_type) and $this->
getSubMode() != self::SUBMODE_CONTENT_ONLY) {
1010 $ilCtrl->returnToParent($this);
1020 foreach ($a_sources as $source_ref_id) {
1024 foreach ($this->
getTargets() as $target_ref_id) {
1028 $wizard_options->saveOwner(
$ilUser->getId());
1029 $wizard_options->saveRoot((
int) $source_ref_id);
1030 $wizard_options->read();
1033 $new_obj =
$orig->cloneObject($target_ref_id, $copy_id);
1036 $wizard_options->deleteAll();
1039 include_once
"Services/AccessControl/classes/class.ilRbacLog.php";
1041 $rbac_log_roles =
$rbacreview->getParentRoleIds($new_obj->getRefId(),
false);
1048 unset(
$_SESSION[
"clipboard"][
"ref_ids"]);
1051 if (count($a_sources) == 1) {
1076 foreach ($this->
getTargets() as $target_ref_id) {
1078 $last_target = $target_ref_id;
1081 unset(
$_SESSION[
"clipboard"][
"ref_ids"]);
1084 include_once
'./Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1089 $GLOBALS[
'DIC']->ctrl()->redirectToUrl($link);
1102 include_once
'./Services/Object/classes/class.ilObjectCopyProgressTableGUI.php';
1106 (
int)
$_GET[
'ref_id']
1108 $progress->setObjectInfo($this->targets_copy_id);
1111 $progress->setRedirectionUrl(
$GLOBALS[
'ilCtrl']->getParentReturn($this->parent_obj));
1113 $GLOBALS[
'tpl']->setContent($progress->getHTML());
1121 $json =
new stdClass();
1122 $json->percentage = null;
1123 $json->performed_steps = null;
1125 include_once
'./Services/CopyWizard/classes/class.ilCopyWizardOptions.php';
1127 $json->required_steps =
$options->getRequiredSteps();
1128 $json->id = (int) $_REQUEST[
'copy_id'];
1132 echo json_encode($json);
1146 include_once(
'./Services/Link/classes/class.ilLink.php');
1147 include_once(
'Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
1161 if ($this->
getSubMode() != self::SUBMODE_CONTENT_ONLY) {
1162 if (!
$rbacsystem->checkAccess(
'create', $a_target, $this->getType())) {
1163 $this->log->notice(
'Permission denied for target: ' . $a_target .
' type: ' . $this->
getType() .
' CREATE');
1165 $ilCtrl->returnToParent($this);
1170 $ilCtrl->returnToParent($this);
1191 $this->targets_copy_id[$a_target] =
$result[
'copy_id'];
1210 #if(!$this->sourceExists()) 1219 $tpl->setVariable($a_tplvar, $this->form->getHTML());
1246 include_once
'./Services/Form/classes/class.ilPropertyFormGUI.php';
1248 $this->form->setTableWidth(
'600px');
1252 #$ilCtrl->setParameter($this, 'cp_mode', self::SOURCE_SELECTION); 1253 $this->form->setFormAction(
$ilCtrl->getFormAction($this));
1254 $this->form->setTitle(
$lng->txt($this->getType() .
'_copy'));
1256 $this->form->addCommandButton(
'searchSource',
$lng->txt(
'btn_next'));
1257 $this->form->addCommandButton(
'cancel', $this->lng->txt(
'cancel'));
1261 $tit->setMaxLength(70);
1262 $tit->setRequired(
true);
1263 $tit->setInfo(
$lng->txt(
'wizard_title_info'));
1264 $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.
foreach($_POST as $key=> $value) $res
if(isset($_POST['submit'])) $form
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.
if(empty($password)) $table
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)
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.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options