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"];
 
  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']) {
 
  190            $this->
setSource(array((
int) $_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);
 
  306        $_SESSION[
'paste_copy_repexpand'] = array();
 
  320                foreach ((array) 
$path as $node_id) {
 
  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), 
'');
 
  342        $_SESSION[
'paste_copy_repexpand'] = array();
 
  347        $this->
setTabs(self::TAB_GROUP_SC_SELECTION, self::TAB_SELECTION_SOURCE_TREE);
 
  352        foreach ($this->
getTargets() as $target_ref_id) {
 
  354            foreach ((array) 
$path as $node_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');
 
  482        foreach (array(
'cat',
'root',
'fold') as 
$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) {
 
  540            foreach ((array) $this->
getTargets() as $target_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'));
 
  785        $query_parser->setMinWordLength(1, 
true);
 
  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'])) {
 
  824            $this->
setSource(array((
int) $_REQUEST[
'source']));
 
  826            $GLOBALS[
'ilCtrl']->setParameter($this, 
'source_id', (
int) $_REQUEST[
'source']);
 
  834        foreach ($this->
getSources() as $source_ref_id) {
 
  835            foreach ((array) $this->
getTargets() as $target_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');
 
  888        $this->
setSource(array((
int) $_REQUEST[
'source']));
 
  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\');"');
 
  924                $back_cmd = 
'showSourceSelectionTree';
 
  928                $back_cmd = 
'showTargetSelectionTree';
 
  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);
 
sprintf('%.4f', $callTime)
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
An exception for terminatinating execution or to throw for unit testing.
error($a_errmsg)
set error message @access public
static _allocateCopyId()
Allocate a copy for further entries.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static _isFinished($a_copy_id)
check if copy is finished
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
static getLogger($a_component_id)
Get component logger.
GUI class for the workflow of copying objects.
GUI class for the workflow of copying objects.
const TAB_SELECTION_MEMBERSHIP
sourceExists()
Check if there is any source object.
setTabs($a_tab_group, $a_active_tab)
Set tabs.
unsetSession()
Unset session variables.
copyMultipleNonContainer($a_sources)
Copy multiple non container.
setMode($a_mode)
set copy mode
initTabs()
Init tabs General.
searchSource()
Search source.
getFirstTarget()
Get first target.
initTargetSelection()
Init copy from repository/search list commands.
initFormSearch()
Init search form.
const TAB_SELECTION_SOURCE_TREE
showCopyProgress()
Show progress for copying.
updateProgress()
Update progress.
setType($type)
Sets $type.
getParentObject()
Get parent gui object.
const SUBMODE_CONTENT_ONLY
copySingleObject()
Start cloning a single (not container) object.
const TAB_GROUP_SC_SELECTION
showSourceSelectionTree()
Show target selection.
saveSourceMembership()
Save selected source from membership screen.
getTargets()
Get copy target.
saveTarget()
Save target selection.
setSource(array $a_source_ids)
Set source id.
keepObjectsInClipboard()
Keep objects in clipboard.
saveSource()
select source object
__construct($a_parent_gui)
Constructor.
executeCommand()
Control class handling.
setTargets(array $a_target)
Set target id.
initSourceSelection()
Init source selection.
setTarget($a_ref_id)
Set single object target.
showSourceSearch($a_tplvar)
Show init screen Normally shown below the create and import form when creating a new object.
copyContainerToTargets()
Copy to multiple targets.
adoptContent()
Adopt content (crs in crs, grp in grp, crs in grp or grp in crs)
showSourceSelectionMembership()
show target selection membership
copyContainer($a_target)
Copy a container.
showTargetSelectionTree()
Show target selection.
getSource()
Get source id.
const TAB_SELECTION_TARGET_TREE
Table gui for copy progress.
Presentation of search results.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static getClassByType($a_obj_type)
Get class by type.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupType($a_id, $a_reference=false)
lookup object type
static _getMembershipByType($a_usr_id, $a_type, $a_only_member_role=false)
get membership by type Get course or group membership
static add($a_action, $a_ref_id, array $a_diff, $a_source_ref_id=false)
static gatherFaPa($a_ref_id, array $a_role_ids, $a_add_action=false)
Explorer for selecting repository items.
This class represents a text property in a property form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
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,...
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(empty($password)) $table
if(isset($_POST['submit'])) $form
foreach($_POST as $key=> $value) $res