ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjectCopyGUI Class Reference

GUI class for the workflow of copying objects. More...

+ Collaboration diagram for ilObjectCopyGUI:

Public Member Functions

 __construct ($a_parent_gui)
 Constructor.
 executeCommand ()
 Control class handling.
 showTargetSelectionTree ()
 Show target selection.
 showSourceSelectionTree ()
 Show target selection.
 setMode ($a_mode)
 set copy mode
 getMode ()
 get copy mode
 getParentObject ()
 Get parent gui object.
 getType ()
 Returns $type.
 setType ($type)
 Sets $type.
 setSource ($a_source_id)
 Set source id.
 getSource ()
 Get source id.
 setTarget ($a_target)
 Set target id.
 getTarget ()
 Get copy target.
 keepObjectsInClipboard ()
 Keep objects in clipboard.
 copyMultipleNonContainer ($a_sources)
 Copy multiple non container.
 showSourceSearch ($a_tplvar)
 Show init screen Normally shown below the create and import form when creating a new object.

Data Fields

const SOURCE_SELECTION = 1
const TARGET_SELECTION = 2
const SEARCH_SOURCE = 3

Protected Member Functions

 init ()
 Init return, mode.
 initTargetSelection ()
 Init copy from repository/search list commands.
 initSourceSelection ()
 Init source selection.
 saveTarget ()
 Save target selection.
 cancel ()
 Cancel workflow.
 searchSource ()
 Search source.
 saveSource ()
 select source object
 showItemSelection ()
 copySingleObject ()
 Start cloning a single (not container) object.
 copyContainer ()
 Copy a container.
 sourceExists ()
 Check if there is any source object.
 initFormSearch ()
 Init search form.
 unsetSession ()
 Unset session variables.

Private Attributes

 $mode = 0
 $lng
 $parent_obj = null
 $type = ''
 $source = 0
 $target = 0

Detailed Description

GUI class for the workflow of copying objects.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

ilObjectCopyGUI:

Definition at line 14 of file class.ilObjectCopyGUI.php.

Constructor & Destructor Documentation

ilObjectCopyGUI::__construct (   $a_parent_gui)

Constructor.

Returns

Definition at line 35 of file class.ilObjectCopyGUI.php.

References $ilCtrl, and $lng.

{
global $ilCtrl,$lng;
$this->lng = $lng;
$this->lng->loadLanguageModule('search');
$this->lng->loadLanguageModule('obj');
$this->parent_obj = $a_parent_gui;
// this parameter may be filled in "manage" view
$ilCtrl->saveParameter($this, array("source_ids"));
}

Member Function Documentation

ilObjectCopyGUI::cancel ( )
protected

Cancel workflow.

Definition at line 527 of file class.ilObjectCopyGUI.php.

References $ilCtrl.

{
global $ilCtrl;
$ilCtrl->returnToParent($this);
}
ilObjectCopyGUI::copyContainer ( )
protected

Copy a container.

Returns

Definition at line 855 of file class.ilObjectCopyGUI.php.

References $_COOKIE, $_POST, $_SESSION, $ilCtrl, $ilErr, $ilLog, $ilUser, $options, $result, $target_type, ilObject\_lookupObjId(), ilObject\_lookupType(), ilObjectFactory\getInstanceByRefId(), getSource(), getTarget(), getType(), ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\sendSuccess().

{
global $ilLog, $ilCtrl;
include_once('./Services/Link/classes/class.ilLink.php');
include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
global $ilAccess,$ilErr,$rbacsystem,$tree,$ilUser,$ilCtrl;
// Workaround for course in course copy
if($target_type != $source_type or $target_type != 'crs')
{
if(!$rbacsystem->checkAccess('create', $this->getTarget(),$this->getType()))
{
ilUtil::sendFailure($this->lng->txt('permission_denied'),true);
$ilCtrl->returnToParent($this);
}
}
if(!$this->getSource())
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$ilCtrl->returnToParent($this);
return false;
}
$options = $_POST['cp_options'] ? $_POST['cp_options'] : array();
$result = $orig->cloneAllObject($_COOKIE['PHPSESSID'], $_COOKIE['ilClientId'], $this->getType(), $this->getTarget(), $this->getSource(), $options);
unset($_SESSION["clipboard"]["ref_ids"]);
unset($_SESSION["clipboard"]["cmd"]);
// Check if copy is in progress
if ($result == $this->getTarget())
{
ilUtil::sendInfo($this->lng->txt("object_copy_in_progress"),true);
$ilCtrl->setParameterByClass("ilrepositorygui", "ref_id",
$this->getTarget());
$ilCtrl->redirectByClass("ilrepositorygui", "");
}
else
{
ilUtil::sendSuccess($this->lng->txt("object_duplicated"),true);
$ilCtrl->setParameterByClass("ilrepositorygui", "ref_id",
$ilCtrl->redirectByClass("ilrepositorygui", "");
}
}

+ Here is the call graph for this function:

ilObjectCopyGUI::copyMultipleNonContainer (   $a_sources)

Copy multiple non container.

Parameters
array$a_sourcesarray of source ref ids

Definition at line 770 of file class.ilObjectCopyGUI.php.

References $_SESSION, $ilCtrl, $ilUser, ilCopyWizardOptions\_allocateCopyId(), ilCopyWizardOptions\_getInstance(), ilLink\_getLink(), ilObject\_lookupType(), ilRbacLog\add(), ilRbacLog\COPY_OBJECT, ilRbacLog\gatherFaPa(), ilObjectFactory\getInstanceByRefId(), getTarget(), ilRbacLog\isActive(), ilUtil\redirect(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

Referenced by copySingleObject(), and saveTarget().

{
global $ilAccess,$objDefinition,$rbacsystem,$ilUser,$ilCtrl,$rbacreview;
include_once('./Services/Link/classes/class.ilLink.php');
include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
// check permissions
foreach ($a_sources as $source_ref_id)
{
$source_type = ilObject::_lookupType($source_ref_id, true);
// Create permission
if(!$rbacsystem->checkAccess('create', $this->getTarget(), $source_type))
{
ilUtil::sendFailure($this->lng->txt('permission_denied'),true);
$ilCtrl->returnToParent($this);
}
// Copy permission
if(!$ilAccess->checkAccess('copy','',$source_ref_id))
{
ilUtil::sendFailure($this->lng->txt('permission_denied'),true);
$ilCtrl->returnToParent($this);
}
// check that these objects are really not containers
if($objDefinition->isContainer($source_type))
{
ilUtil::sendFailure($this->lng->txt('cntr_container_only_on_their_own'),true);
$ilCtrl->returnToParent($this);
}
}
reset($a_sources);
// clone
foreach ($a_sources as $source_ref_id)
{
// Save wizard options
$wizard_options = ilCopyWizardOptions::_getInstance($copy_id);
$wizard_options->saveOwner($ilUser->getId());
$wizard_options->saveRoot((int) $source_ref_id);
$wizard_options->read();
$orig = ilObjectFactory::getInstanceByRefId((int) $source_ref_id);
$new_obj = $orig->cloneObject($this->getTarget(),$copy_id);
// Delete wizard options
$wizard_options->deleteAll();
// rbac log
include_once "Services/AccessControl/classes/class.ilRbacLog.php";
{
$rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(), false);
$rbac_log = ilRbacLog::gatherFaPa($new_obj->getRefId(), array_keys($rbac_log_roles), true);
ilRbacLog::add(ilRbacLog::COPY_OBJECT, $new_obj->getRefId(), $rbac_log, (int)$source_ref_id);
}
}
unset($_SESSION["clipboard"]["ref_ids"]);
unset($_SESSION["clipboard"]["cmd"]);
if (count($a_sources) == 1)
{
ilUtil::sendSuccess($this->lng->txt("object_duplicated"),true);
ilUtil::redirect(ilLink::_getLink($new_obj->getRefId()));
}
else
{
ilUtil::sendSuccess($this->lng->txt("objects_duplicated"),true);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectCopyGUI::copySingleObject ( )
protected

Start cloning a single (not container) object.

Returns

Definition at line 689 of file class.ilObjectCopyGUI.php.

References $ilCtrl, $ilErr, $ilUser, ilCopyWizardOptions\_allocateCopyId(), ilCopyWizardOptions\_getInstance(), ilLink\_getLink(), ilRbacLog\add(), ilRbacLog\COPY_OBJECT, copyMultipleNonContainer(), ilRbacLog\gatherFaPa(), ilObjectFactory\getInstanceByRefId(), getSource(), getTarget(), getType(), ilRbacLog\isActive(), ilUtil\redirect(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

Referenced by saveSource(), and saveTarget().

{
include_once('./Services/Link/classes/class.ilLink.php');
include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
global $ilAccess,$ilErr,$rbacsystem,$ilUser,$ilCtrl,$rbacreview;
// Source defined
if(!$this->getSource())
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$ilCtrl->returnToParent($this);
}
$this->copyMultipleNonContainer(array($this->getSource()));
return;
// old implementation
// Create permission
if(!$rbacsystem->checkAccess('create', $this->getTarget(), $this->getType()))
{
ilUtil::sendFailure($this->lng->txt('permission_denied'),true);
$ilCtrl->returnToParent($this);
}
// Source defined
if(!$this->getSource())
{
ilUtil::sendFailure($this->lng->txt('select_one'),true);
$ilCtrl->returnToParent($this);
}
// Copy permission
if(!$ilAccess->checkAccess('copy','',$this->getSource()))
{
ilUtil::sendFailure($this->lng->txt('permission_denied'),true);
$ilCtrl->returnToParent($this);
}
// Save wizard options
$wizard_options = ilCopyWizardOptions::_getInstance($copy_id);
$wizard_options->saveOwner($ilUser->getId());
$wizard_options->saveRoot((int) $this->getSource());
/*
$options = $_POST['cp_options'] ? $_POST['cp_options'] : array();
foreach($options as $source_id => $option)
{
$wizard_options->addEntry($source_id,$option);
}
*/
$wizard_options->read();
$new_obj = $orig->cloneObject($this->getTarget(),$copy_id);
// Delete wizard options
$wizard_options->deleteAll();
// rbac log
include_once "Services/AccessControl/classes/class.ilRbacLog.php";
{
$rbac_log_roles = $rbacreview->getParentRoleIds($new_obj->getRefId(), false);
$rbac_log = ilRbacLog::gatherFaPa($new_obj->getRefId(), array_keys($rbac_log_roles), true);
ilRbacLog::add(ilRbacLog::COPY_OBJECT, $new_obj->getRefId(), $rbac_log, (int)$this->getSource());
}
ilUtil::sendSuccess($this->lng->txt("object_duplicated"),true);
ilUtil::redirect(ilLink::_getLink($new_obj->getRefId()));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectCopyGUI::executeCommand ( )

Control class handling.

Returns

Definition at line 53 of file class.ilObjectCopyGUI.php.

References $cmd, $ilCtrl, and init().

{
global $ilCtrl;
$this->init();
$next_class = $ilCtrl->getNextClass($this);
$cmd = $ilCtrl->getCmd();
switch($next_class)
{
default:
$this->$cmd();
break;
}
}

+ Here is the call graph for this function:

ilObjectCopyGUI::getMode ( )

get copy mode

Returns

Definition at line 447 of file class.ilObjectCopyGUI.php.

References $mode.

Referenced by showItemSelection().

{
return $this->mode;
}

+ Here is the caller graph for this function:

ilObjectCopyGUI::getParentObject ( )

Get parent gui object.

Returns
object parent gui

Definition at line 456 of file class.ilObjectCopyGUI.php.

References $parent_obj.

{
}
ilObjectCopyGUI::getSource ( )

Get source id.

Returns

Definition at line 496 of file class.ilObjectCopyGUI.php.

References $_GET, and $_SESSION.

Referenced by copyContainer(), copySingleObject(), init(), initTargetSelection(), keepObjectsInClipboard(), saveTarget(), searchSource(), showItemSelection(), showSourceSelectionTree(), and showTargetSelectionTree().

{
if ($_GET["source_ids"] != "")
{
return "";
}
return $_SESSION['copy_source'];
}

+ Here is the caller graph for this function:

ilObjectCopyGUI::getTarget ( )

Get copy target.

Returns

Definition at line 519 of file class.ilObjectCopyGUI.php.

References $_SESSION.

Referenced by copyContainer(), copyMultipleNonContainer(), copySingleObject(), initSourceSelection(), and saveTarget().

{
return $_SESSION['copy_target'];
}

+ Here is the caller graph for this function:

ilObjectCopyGUI::getType ( )

Returns $type.

See Also
ilObjectCopyGUI::$type

Definition at line 466 of file class.ilObjectCopyGUI.php.

References $type.

Referenced by copyContainer(), copySingleObject(), init(), initFormSearch(), showItemSelection(), showTargetSelectionTree(), and sourceExists().

{
return $this->type;
}

+ Here is the caller graph for this function:

ilObjectCopyGUI::init ( )
protected

Init return, mode.

Returns

Definition at line 75 of file class.ilObjectCopyGUI.php.

References $_GET, $_REQUEST, $ilCtrl, ilObject\_lookupObjId(), ilObject\_lookupType(), getSource(), getType(), setMode(), setTarget(), and setType().

Referenced by executeCommand().

{
global $ilCtrl;
if($_REQUEST['new_type'])
{
$this->setMode(self::SEARCH_SOURCE);
$ilCtrl->setParameter($this,'new_type',$this->getType());
$ilCtrl->setParameterByClass(get_class($this->parent_obj), 'new_type', $this->getType());
$ilCtrl->setParameterByClass(get_class($this->parent_obj), 'cpfl', 1);
$ilCtrl->setReturnByClass(get_class($this->parent_obj), 'create');
}
elseif($_REQUEST['selectMode'] == self::SOURCE_SELECTION)
{
$this->setMode(self::SOURCE_SELECTION);
$ilCtrl->setParameterByClass(get_class($this->parent_obj), 'selectMode', self::SOURCE_SELECTION);
$this->setTarget((int) $_GET['ref_id']);
$ilCtrl->setReturnByClass(get_class($this->parent_obj), '');
}
else
{
$this->setMode(self::TARGET_SELECTION);
$ilCtrl->setReturnByClass(get_class($this->parent_obj),'');
if ($_GET["source_ids"] == "")
{
$this->setType(
);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectCopyGUI::initFormSearch ( )
protected

Init search form.

Returns

Definition at line 957 of file class.ilObjectCopyGUI.php.

References $ilCtrl, $lng, getType(), and ilTextInputGUI\setSize().

Referenced by searchSource(), and showSourceSearch().

{
global $lng,$ilCtrl;
include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
$this->form = new ilPropertyFormGUI();
$this->form->setTableWidth('600px');
$ilCtrl->setParameter($this,'new_type',$this->getType());
#$ilCtrl->setParameter($this, 'cp_mode', self::SOURCE_SELECTION);
$this->form->setFormAction($ilCtrl->getFormAction($this));
$this->form->setTitle($lng->txt($this->getType().'_copy'));
$this->form->addCommandButton('searchSource', $lng->txt('btn_next'));
$tit = new ilTextInputGUI($lng->txt('title'),'tit');
$tit->setSize(40);
$tit->setMaxLength(70);
$tit->setRequired(true);
$tit->setInfo($lng->txt('wizard_title_info'));
$this->form->addItem($tit);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectCopyGUI::initSourceSelection ( )
protected

Init source selection.

Returns

Definition at line 155 of file class.ilObjectCopyGUI.php.

References $_GET, $_SESSION, $ilCtrl, $path, getTarget(), setMode(), setSource(), setTarget(), and showSourceSelectionTree().

{
global $ilCtrl,$tree;
// empty session on init
$_SESSION['paste_copy_repexpand'] = array();
// copy opened nodes from repository explorer
$_SESSION['paste_copy_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
$this->setMode(self::SOURCE_SELECTION);
$this->setSource(0);
$this->setTarget((int) $_GET['ref_id']);
// open current position
$path = $tree->getPathId($this->getTarget());
foreach((array) $path as $node_id)
{
if(!in_array($node_id, $_SESSION['paste_copy_repexpand']))
$_SESSION['paste_copy_repexpand'][] = $node_id;
}
$ilCtrl->setReturnByClass(get_class($this->parent_obj),'');
}

+ Here is the call graph for this function:

ilObjectCopyGUI::initTargetSelection ( )
protected

Init copy from repository/search list commands.

Returns

Definition at line 114 of file class.ilObjectCopyGUI.php.

References $_GET, $_SESSION, $ilCtrl, $path, ilObject\_lookupObjId(), ilObject\_lookupType(), getSource(), setMode(), setSource(), setTarget(), setType(), and showTargetSelectionTree().

{
global $ilCtrl, $tree;
// empty session on init
$_SESSION['paste_copy_repexpand'] = array();
// copy opened nodes from repository explorer
$_SESSION['paste_copy_repexpand'] = is_array($_SESSION['repexpand']) ? $_SESSION['repexpand'] : array();
$this->setMode(self::TARGET_SELECTION);
$this->setTarget(0);
// note that source_id is empty, if source_ids are given
if ($_GET['source_id'] > 0)
{
// open current position
$path = $tree->getPathId((int)$_GET['source_id']);
foreach((array)$path as $node_id)
{
if(!in_array($node_id, $_SESSION['paste_copy_repexpand']))
$_SESSION['paste_copy_repexpand'][] = $node_id;
}
$this->setSource((int) $_GET['source_id']);
$this->setType(
);
}
$ilCtrl->setReturnByClass(get_class($this->parent_obj),'');
}

+ Here is the call graph for this function:

ilObjectCopyGUI::keepObjectsInClipboard ( )

Keep objects in clipboard.

Definition at line 536 of file class.ilObjectCopyGUI.php.

References $_GET, $_SESSION, $ilCtrl, and getSource().

{
global $ilCtrl;
$_SESSION['clipboard']['cmd'] = "copy";
if ($_GET["source_ids"] == "")
{
$_SESSION['clipboard']['ref_ids'] = array((int) $this->getSource());
}
else
{
$_SESSION['clipboard']['ref_ids'] = explode("_", $_GET["source_ids"]);
}
$ilCtrl->returnToParent($this);
}

+ Here is the call graph for this function:

ilObjectCopyGUI::saveSource ( )
protected

select source object

Returns

Definition at line 616 of file class.ilObjectCopyGUI.php.

References $_POST, copySingleObject(), searchSource(), ilUtil\sendFailure(), setSource(), and showItemSelection().

{
global $objDefinition;
if(isset($_POST['source']))
{
$this->setSource($_POST['source']);
}
else
{
ilUtil::sendFailure($this->lng->txt('select_one'));
$this->searchSource();
return false;
}
if($objDefinition->isContainer($this->getType()))
{
}
else
{
$this->copySingleObject();
}
}

+ Here is the call graph for this function:

ilObjectCopyGUI::saveTarget ( )
protected

Save target selection.

Returns

Definition at line 382 of file class.ilObjectCopyGUI.php.

References $_GET, $_REQUEST, ilObject\_lookupObjId(), ilObject\_lookupTitle(), copyMultipleNonContainer(), copySingleObject(), getSource(), getTarget(), ilUtil\sendFailure(), setTarget(), showItemSelection(), and showTargetSelectionTree().

{
global $objDefinition, $tree;
if(isset($_REQUEST['target']))
{
$this->setTarget((int) $_REQUEST['target']);
}
else
{
ilUtil::sendFailure($this->lng->txt('select_one'));
return false;
}
if($_GET["source_ids"] == "" && $objDefinition->isContainer($this->getType()))
{
// check, if object should be copied into itself
$is_child = array();
if ($tree->isGrandChild($this->getSource(), $this->getTarget()))
{
}
if ($this->getSource() == $this->getTarget())
{
}
if (count($is_child) > 0)
{
ilUtil::sendFailure($this->lng->txt("msg_not_in_itself")." ".implode(',',$is_child));
return false;
}
}
else
{
if ($_GET["source_ids"] == "")
{
$this->copySingleObject();
}
else
{
$source_ids = explode("_", $_GET["source_ids"]);
$this->copyMultipleNonContainer($source_ids);
}
}
}

+ Here is the call graph for this function:

ilObjectCopyGUI::searchSource ( )
protected

Search source.

Returns

Definition at line 556 of file class.ilObjectCopyGUI.php.

References $_POST, $_REQUEST, $_SESSION, $ilCtrl, $lng, $res, $results, $tpl, getSource(), initFormSearch(), QP_COMBINATION_AND, ilUtil\sendFailure(), ilUtil\sendInfo(), and ilQueryParser\setMinWordLength().

Referenced by saveSource(), and showItemSelection().

{
global $tree,$ilObjDataCache,$lng,$ilCtrl,$tpl;
if(isset($_POST['tit']))
{
ilUtil::sendInfo($this->lng->txt('wizard_search_list'));
$_SESSION['source_query'] = $_POST['tit'];
}
else
{
$_POST['tit'] = $_SESSION['source_query'];
}
$this->initFormSearch();
$this->form->setValuesByPost();
if(!$this->form->checkInput())
{
ilUtil::sendFailure($lng->txt('msg_no_search_string'),true);
$ilCtrl->returnToParent($this);
return false;
}
include_once './Services/Search/classes/class.ilQueryParser.php';
$query_parser = new ilQueryParser($this->form->getInput('tit'));
$query_parser->setMinWordLength(1,true);
$query_parser->setCombination(QP_COMBINATION_AND);
$query_parser->parse();
if(!$query_parser->validate())
{
ilUtil::sendFailure($query_parser->getMessage(),true);
$ilCtrl->returnToParent($this);
}
// only like search since fulltext does not support search with less than 3 characters
include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php';
$object_search = new ilLikeObjectSearch($query_parser);
$object_search->setFilter(array($_REQUEST['new_type']));
$res = $object_search->performSearch();
$res->setRequiredPermission('copy');
$res->filter(ROOT_FOLDER_ID,true);
if(!count($results = $res->getResultsByObjId()))
{
ilUtil::sendFailure($this->lng->txt('search_no_match'),true);
$ilCtrl->returnToParent($this);
}
include_once './Services/Object/classes/class.ilObjectCopySearchResultTableGUI.php';
$table = new ilObjectCopySearchResultTableGUI($this,'searchSource',$_REQUEST['new_type']);
$table->setSelectedReference($this->getSource());
$table->parseSearchResults($results);
$tpl->setContent($table->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectCopyGUI::setMode (   $a_mode)

set copy mode

Parameters
int$a_mode
Returns

Definition at line 438 of file class.ilObjectCopyGUI.php.

Referenced by init(), initSourceSelection(), and initTargetSelection().

{
$this->mode = $a_mode;
}

+ Here is the caller graph for this function:

ilObjectCopyGUI::setSource (   $a_source_id)

Set source id.

Parameters
int$a_source_id
Returns

Definition at line 487 of file class.ilObjectCopyGUI.php.

References $_SESSION.

Referenced by initSourceSelection(), initTargetSelection(), saveSource(), and unsetSession().

{
$_SESSION['copy_source'] = $a_source_id;
}

+ Here is the caller graph for this function:

ilObjectCopyGUI::setTarget (   $a_target)

Set target id.

Parameters
int$a_target
Returns

Definition at line 510 of file class.ilObjectCopyGUI.php.

References $_SESSION.

Referenced by init(), initSourceSelection(), initTargetSelection(), and saveTarget().

{
$_SESSION['copy_target'] = $a_target;
}

+ Here is the caller graph for this function:

ilObjectCopyGUI::setType (   $type)

Sets $type.

Parameters
object$type
See Also
ilObjectCopyGUI::$type

Definition at line 477 of file class.ilObjectCopyGUI.php.

References $type.

Referenced by init(), and initTargetSelection().

{
$this->type = $type;
}

+ Here is the caller graph for this function:

ilObjectCopyGUI::showItemSelection ( )
protected
Returns

Definition at line 647 of file class.ilObjectCopyGUI.php.

References $tpl, getMode(), getSource(), getType(), searchSource(), ilUtil\sendFailure(), and ilUtil\sendInfo().

Referenced by saveSource(), and saveTarget().

{
global $tpl;
if(!$this->getSource())
{
ilUtil::sendFailure($this->lng->txt('select_one'));
$this->searchSource();
return false;
}
ilUtil::sendInfo($this->lng->txt($this->getType().'_copy_threads_info'));
include_once './Services/Object/classes/class.ilObjectCopySelectionTableGUI.php';
$tpl->addJavaScript('./Services/CopyWizard/js/ilContainer.js');
$tpl->setVariable('BODY_ATTRIBUTES','onload="ilDisableChilds(\'cmd\');"');
switch($this->getMode())
{
case self::SOURCE_SELECTION:
$back_cmd = 'showSourceSelectionTree';
break;
case self::TARGET_SELECTION:
$back_cmd = 'showTargetSelectionTree';
break;
case self::SEARCH_SOURCE:
$back_cmd = 'searchSource';
break;
}
$table = new ilObjectCopySelectionTableGUI($this,'showItemSelection',$this->getType(),$back_cmd);
$table->parseSource($this->getSource());
$tpl->setContent($table->getHTML());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectCopyGUI::showSourceSearch (   $a_tplvar)

Show init screen Normally shown below the create and import form when creating a new object.

Parameters
string$a_tplvarThe tpl variable to fill
Returns

Definition at line 918 of file class.ilObjectCopyGUI.php.

References $tpl, initFormSearch(), and unsetSession().

{
global $tpl;
// Disabled for performance
#if(!$this->sourceExists())
#{
# return false;
#}
$this->unsetSession();
$this->initFormSearch();
if($a_tplvar)
{
$tpl->setVariable($a_tplvar,$this->form->getHTML());
}
else
{
return $this->form;
}
}

+ Here is the call graph for this function:

ilObjectCopyGUI::showSourceSelectionTree ( )

Show target selection.

Definition at line 324 of file class.ilObjectCopyGUI.php.

References $_GET, $ilCtrl, $tpl, getSource(), ilPasteIntoMultipleItemsExplorer\SEL_TYPE_RADIO, and ilUtil\sendInfo().

Referenced by initSourceSelection().

{
global $ilTabs, $ilToolbar, $ilCtrl, $tree, $tpl, $objDefinition;
$this->tpl = $tpl;
$this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.paste_into_multiple_objects.html',
"Services/Object");
ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard_source'));
include_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
'ilias.php?baseClass=ilRepositoryGUI&cmd=goto', 'paste_copy_repexpand');
$exp->setRequiredFormItemPermission('visible,read,copy');
$ilCtrl->setParameter($this, 'selectMode', self::SOURCE_SELECTION);
$exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'showSourceSelectionTree'));
$exp->setTargetGet('ref_id');
$exp->setPostVar('source');
$exp->setCheckedItems(array($this->getSource()));
#$exp->setNotSelectableItems(array($this->getTarget()));
// Filter to container
foreach(array('cat','root','grp','fold') as $container)
{
$exp->removeFormItemForType($container);
}
if($_GET['paste_copy_repexpand'] == '')
{
$expanded = $tree->readRootId();
}
else
{
$expanded = $_GET['paste_copy_repexpand'];
}
$this->tpl->setVariable('FORM_TARGET', '_self');
$this->tpl->setVariable('FORM_ACTION', $ilCtrl->getFormAction($this, 'copySelection'));
$exp->setExpand($expanded);
// build html-output
$exp->setOutput(0);
$output = $exp->getOutput();
$this->tpl->setVariable('OBJECT_TREE', $output);
$this->tpl->setVariable('CMD_SUBMIT', 'saveSource');
$this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('btn_next'));
$ilToolbar->addButton($this->lng->txt('cancel'), $ilCtrl->getLinkTarget($this,'cancel'));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectCopyGUI::showTargetSelectionTree ( )

Show target selection.

Definition at line 184 of file class.ilObjectCopyGUI.php.

References $_GET, $_POST, $ilCtrl, $lng, $t, $tpl, ilUtil\getImagePath(), ilPlugin\getPluginObject(), getSource(), getType(), IL_COMP_SERVICE, ilPlugin\lookupNameForId(), ilPasteIntoMultipleItemsExplorer\SEL_TYPE_RADIO, and ilUtil\sendInfo().

Referenced by initTargetSelection(), and saveTarget().

{
global $ilTabs, $ilToolbar, $ilCtrl, $tree, $tpl, $objDefinition, $lng;
$this->tpl = $tpl;
if($objDefinition->isContainer($this->getType()))
{
ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard_container'));
}
else
{
ilUtil::sendInfo($this->lng->txt('msg_copy_clipboard'));
}
//
include_once("./Services/Repository/classes/class.ilRepositorySelectorExplorerGUI.php");
$exp = new ilRepositorySelectorExplorerGUI($this, "showTargetSelectionTree");
$exp->setTypeWhiteList(array("root", "cat", "grp", "crs", "fold"));
$exp->setSelectMode("target", false);
if ($exp->handleCommand())
{
return;
}
$output = $exp->getHTML();
// toolbars
$t = new ilToolbarGUI();
$t->setFormAction($ilCtrl->getFormAction($this, "saveTarget"));
if($objDefinition->isContainer($this->getType()))
{
$t->addFormButton($lng->txt("btn_next"), "saveTarget");
}
else
{
$t->addFormButton($lng->txt("paste"), "saveTarget");
}
$t->addSeparator();
$t->addFormButton($lng->txt("obj_insert_into_clipboard"), "keepObjectsInClipboard");
$t->addFormButton($lng->txt("cancel"), "cancel");
$t->setCloseFormTag(false);
$t->setLeadingImage(ilUtil::getImagePath("arrow_upright.svg"), " ");
$output = $t->getHTML().$output;
$t->setLeadingImage(ilUtil::getImagePath("arrow_downright.svg"), " ");
$t->setCloseFormTag(true);
$t->setOpenFormTag(false);
$output.= "<br />".$t->getHTML();
$this->tpl->setContent($output);
return;
// old implementation
$this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.paste_into_multiple_objects.html',
"Services/Object");
include_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
'ilias.php?baseClass=ilRepositoryGUI&amp;cmd=goto', 'paste_copy_repexpand');
// Target selection should check for create permission
$required_perm = 'visible';
$create_perm = 'create_'.ilObject::_lookupType($this->getSource(), true);
if($create_perm)
{
$required_perm .= (','.$create_perm);
}
$exp->setRequiredFormItemPermission($required_perm);
$exp->setExpandTarget($ilCtrl->getLinkTarget($this, 'showTargetSelectionTree'));
$exp->setTargetGet('ref_id');
$exp->setPostVar('target');
$exp->highlightNode($_GET['ref_id']);
$exp->setCheckedItems(array((int) $_POST['target']));
// Filter to container
foreach(array('cat','root','crs','grp','fold') as $container)
{
/*
if($this->getType() == 'crs' and $container == 'crs')
{
continue;
}
*/
$sub = $objDefinition->getSubObjects($container);
if(!isset($sub[$this->getType()]))
{
$exp->removeFormItemForType($container);
}
}
if($_GET['paste_copy_repexpand'] == '')
{
$expanded = $tree->readRootId();
}
else
{
$expanded = $_GET['paste_copy_repexpand'];
}
$this->tpl->setVariable('FORM_TARGET', '_self');
$this->tpl->setVariable('FORM_ACTION', $ilCtrl->getFormAction($this, 'copySelection'));
$exp->setExpand($expanded);
// build html-output
$exp->setOutput(0);
$output = $exp->getOutput();
$this->tpl->setVariable('OBJECT_TREE', $output);
$this->tpl->setVariable('CMD_SUBMIT', 'saveTarget');
if($objDefinition->isContainer($this->getType()))
{
$this->tpl->setVariable('TXT_SUBMIT',$this->lng->txt('btn_next'));
}
else
{
if(!$objDefinition->isPlugin($this->getType()))
{
$submit = $this->lng->txt('obj_'.$this->getType().'_duplicate');
}
else
{
// get plugin instance
include_once "Services/Component/classes/class.ilPlugin.php";
$plugin = ilPlugin::getPluginObject(IL_COMP_SERVICE, "Repository", "robj",
ilPlugin::lookupNameForId(IL_COMP_SERVICE, "Repository", "robj", $this->getType()));
$submit = $plugin->txt('obj_'.$this->getType().'_duplicate');
}
$this->tpl->setVariable('TXT_SUBMIT', $submit);
}
$ilToolbar->addButton($this->lng->txt('cancel'), $ilCtrl->getLinkTarget($this,'cancel'));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjectCopyGUI::sourceExists ( )
protected

Check if there is any source object.

Returns
bool

Definition at line 946 of file class.ilObjectCopyGUI.php.

References $ilUser, ilUtil\_getObjectsByOperations(), and getType().

{
global $ilUser;
return (bool) ilUtil::_getObjectsByOperations($this->getType(),'copy',$ilUser->getId(),1);
}

+ Here is the call graph for this function:

ilObjectCopyGUI::unsetSession ( )
protected

Unset session variables.

Returns

Definition at line 983 of file class.ilObjectCopyGUI.php.

References $_SESSION, and setSource().

Referenced by showSourceSearch().

{
unset($_SESSION['source_query']);
$this->setSource(0);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilObjectCopyGUI::$lng
private
ilObjectCopyGUI::$mode = 0
private

Definition at line 20 of file class.ilObjectCopyGUI.php.

Referenced by getMode().

ilObjectCopyGUI::$parent_obj = null
private

Definition at line 24 of file class.ilObjectCopyGUI.php.

Referenced by getParentObject().

ilObjectCopyGUI::$source = 0
private

Definition at line 27 of file class.ilObjectCopyGUI.php.

ilObjectCopyGUI::$target = 0
private

Definition at line 28 of file class.ilObjectCopyGUI.php.

ilObjectCopyGUI::$type = ''
private

Definition at line 26 of file class.ilObjectCopyGUI.php.

Referenced by getType(), and setType().

const ilObjectCopyGUI::SEARCH_SOURCE = 3

Definition at line 18 of file class.ilObjectCopyGUI.php.

const ilObjectCopyGUI::SOURCE_SELECTION = 1

Definition at line 16 of file class.ilObjectCopyGUI.php.

const ilObjectCopyGUI::TARGET_SELECTION = 2

Definition at line 17 of file class.ilObjectCopyGUI.php.


The documentation for this class was generated from the following file: