ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilCopyWizardOptions Class Reference
+ Collaboration diagram for ilCopyWizardOptions:

Public Member Functions

 saveOwner ($a_user_id)
 Save owner for copy. More...
 
 saveRoot ($a_root)
 Save root node id. More...
 
 isRootNode ($a_root)
 Is root node. More...
 
 disableSOAP ()
 Disable soap calls. More...
 
 isSOAPEnabled ()
 Check if SOAP calls are disabled. More...
 
 checkOwner ($a_user_id)
 check owner More...
 
 getCopyId ()
 Get copy id. More...
 
 initContainer ($a_source_id, $a_target_id)
 Init container Add copy entry. More...
 
 storeTree ($a_source_id)
 Save tree Stores two copies of the tree structure: id 0 is used for recursive call of cloneObject() id -1 is used for recursive call of cloneDependencies() More...
 
 fetchFirstNode ()
 Fetch first node for cloneObject. More...
 
 fetchFirstDependenciesNode ()
 Fetch first dependencies node. More...
 
 dropFirstNodeById ($a_id)
 Drop first node by id. More...
 
 dropFirstNode ()
 Drop first node (for cloneObject()) More...
 
 dropFirstDependenciesNode ()
 Drop first node (for cloneDependencies()) More...
 
 getOptions ($a_source_id)
 Get entry by source. More...
 
 addEntry ($a_source_id, $a_options)
 Add new entry. More...
 
 appendMapping ($a_source_id, $a_target_id)
 Add mapping of source -> target. More...
 
 getMappings ()
 Get Mappings. More...
 
 deleteAll ()
 Delete all entries. More...
 
 read ()
 public More...
 

Static Public Member Functions

static _getInstance ($a_copy_id)
 Get instance of copy wizard options. More...
 
static _isFinished ($a_copy_id)
 check if copy is finished More...
 
static _allocateCopyId ()
 Allocate a copy for further entries. More...
 

Data Fields

const COPY_WIZARD_OMIT = 1
 
const COPY_WIZARD_COPY = 2
 
const COPY_WIZARD_LINK = 3
 
const OWNER_KEY = -3
 
const DISABLE_SOAP = -4
 
const ROOT_NODE = -5
 

Private Member Functions

 __construct ($a_copy_id=0)
 Private Constructor (Singleton class) More...
 
 fetchFirstNodeById ($a_id)
 Get first node of stored tree. More...
 
 readTree ($a_source_id)
 Purge ommitted node recursively. More...
 

Private Attributes

 $db
 
 $copy_id
 
 $source_id
 
 $options = array()
 

Static Private Attributes

static $instances = null
 

Detailed Description

Definition at line 32 of file class.ilCopyWizardOptions.php.

Constructor & Destructor Documentation

◆ __construct()

ilCopyWizardOptions::__construct (   $a_copy_id = 0)
private

Private Constructor (Singleton class)

private

Parameters
intcopy_id

Definition at line 57 of file class.ilCopyWizardOptions.php.

References $ilDB, and read().

58  {
59  global $ilDB;
60 
61  $this->db = $ilDB;
62  $this->copy_id = $a_copy_id;
63 
64  if($this->copy_id)
65  {
66  $this->read();
67  }
68  }
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ _allocateCopyId()

static ilCopyWizardOptions::_allocateCopyId ( )
static

Allocate a copy for further entries.

public

Definition at line 112 of file class.ilCopyWizardOptions.php.

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilContainer\cloneAllObject(), ilObjectGUI\cloneAllObject(), ilObjectCopyGUI\copyMultipleNonContainer(), ilSoapObjectAdministration\copyObject(), ilObjectCopyGUI\copySingleObject(), and ilObjWorkspaceFolderGUI\performPasteIntoMultipleObjects().

113  {
114  global $ilDB;
115 
116  $query = "SELECT MAX(copy_id) latest FROM copy_wizard_options ";
117  $res = $ilDB->query($query);
118  $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
119 
120  $ilDB->insert("copy_wizard_options", array(
121  "copy_id" => array("integer", $row->latest + 1),
122  "source_id" => array("integer", 0)
123  ));
124  return $row->latest + 1;
125  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
+ Here is the caller graph for this function:

◆ _getInstance()

static ilCopyWizardOptions::_getInstance (   $a_copy_id)
static

Get instance of copy wizard options.

public

Parameters
intcopy id

Definition at line 78 of file class.ilCopyWizardOptions.php.

Referenced by ilObjTest\_getAvailableTests(), ilObject\appendCopyInfo(), ilContainer\cloneAllObject(), ilObjectGUI\cloneAllObject(), ilLPCollection\cloneCollection(), ilLPCollectionOfRepositoryObjects\cloneCollection(), ilCourseObjectiveMaterials\cloneDependencies(), ilCourseObjectiveQuestion\cloneDependencies(), ilCourseStart\cloneDependencies(), ilObjCategory\cloneDependencies(), ilContainerStartObjects\cloneDependencies(), ilObjectActivation\cloneDependencies(), ilObject\cloneDependencies(), ilEventItems\cloneItems(), ilItemGroupItems\cloneItems(), ilObjSurveyQuestionPool\cloneObject(), ilObjBookingPool\cloneObject(), ilObjFileBasedLM\cloneObject(), ilObjMediaCast\cloneObject(), ilObjCourse\cloneObject(), ilObjWiki\cloneObject(), ilObjGlossary\cloneObject(), ilObjSAHSLearningModule\cloneObject(), ilObjQuestionPool\cloneObject(), ilObjContentObject\cloneObject(), ilObjSurvey\cloneObject(), ilTestFixedQuestionSetConfig\cloneQuestionSetRelatedData(), ilLOSettings\cloneSettings(), ilContainerSorting\cloneSorting(), ilObjContentObject\copyAllPagesAndChapters(), ilObjectCopyGUI\copyMultipleNonContainer(), ilSoapObjectAdministration\copyObject(), ilObjectCopyGUI\copySingleObject(), ilObjCloud\doClone(), ilObjPortfolioTemplate\doCloneObject(), ilObjDataCollection\doCloneObject(), ilObjPoll\doCloneObject(), ilObjBibliographic\doCloneObject(), ilObjItemGroup\fixContainerItemGroupRefsAfterCloning(), ilObjForum\getDiskUsage(), ilSoapUtils\ilClone(), ilSoapUtils\ilCloneDependencies(), and ilObjWorkspaceFolderGUI\performPasteIntoMultipleObjects().

79  {
80  if(is_array(self::$instances) and isset(self::$instances[$a_copy_id]))
81  {
82  return self::$instances[$a_copy_id];
83  }
84  return self::$instances[$a_copy_id] = new ilCopyWizardOptions($a_copy_id);
85  }
+ Here is the caller graph for this function:

◆ _isFinished()

static ilCopyWizardOptions::_isFinished (   $a_copy_id)
static

check if copy is finished

public

Parameters
intcopy id

Definition at line 95 of file class.ilCopyWizardOptions.php.

References $ilDB, $query, and $res.

Referenced by ilContainer\cloneAllObject().

96  {
97  global $ilDB;
98 
99  $query = "SELECT * FROM copy_wizard_options ".
100  "WHERE copy_id = ".$ilDB->quote($a_copy_id ,'integer')." ";
101  $res = $ilDB->query($query);
102  return $res->numRows() ? false : true;
103  }
global $ilDB
+ Here is the caller graph for this function:

◆ addEntry()

ilCopyWizardOptions::addEntry (   $a_source_id,
  $a_options 
)

Add new entry.

public

Parameters
intref_id of source
arrayarray of options

Definition at line 412 of file class.ilCopyWizardOptions.php.

References $ilDB, $query, and $res.

Referenced by initContainer().

413  {
414  global $ilDB;
415 
416  if(!is_array($a_options))
417  {
418  return false;
419  }
420 
421  $query = "DELETE FROM copy_wizard_options ".
422  "WHERE copy_id = ".$this->db->quote($this->copy_id ,'integer')." ".
423  "AND source_id = ".$this->db->quote($a_source_id ,'integer');
424  $res = $ilDB->manipulate($query);
425 
426  $ilDB->insert('copy_wizard_options',array(
427  'copy_id' => array('integer',$this->copy_id),
428  'source_id' => array('integer',$a_source_id),
429  'options' => array('clob',serialize($a_options))
430  ));
431  return true;
432  }
global $ilDB
+ Here is the caller graph for this function:

◆ appendMapping()

ilCopyWizardOptions::appendMapping (   $a_source_id,
  $a_target_id 
)

Add mapping of source -> target.

public

Parameters
intsource ref_id
inttarget ref_id

Definition at line 442 of file class.ilCopyWizardOptions.php.

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, and getCopyId().

Referenced by initContainer().

443  {
444  global $ilDB;
445 
446  $query = "SELECT * FROM copy_wizard_options ".
447  "WHERE copy_id = ".$this->db->quote($this->copy_id ,'integer')." ".
448  "AND source_id = -2 ";
449  $res = $this->db->query($query);
450  $mappings = array();
451  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
452  {
453  $mappings = unserialize($row->options);
454  }
455  $mappings[$a_source_id] = $a_target_id;
456 
457  $query = "DELETE FROM copy_wizard_options ".
458  "WHERE copy_id = ".$ilDB->quote($this->getCopyId(),'integer')." ".
459  "AND source_id = -2 ";
460  $res = $ilDB->manipulate($query);
461 
462 
463  $ilDB->insert('copy_wizard_options', array(
464  'copy_id' => array('integer',$this->getCopyId()),
465  'source_id' => array('integer',-2),
466  'options' => array('clob',serialize($mappings))
467  ));
468 
469  return true;
470  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkOwner()

ilCopyWizardOptions::checkOwner (   $a_user_id)

check owner

public

Parameters
intuser_id

Definition at line 224 of file class.ilCopyWizardOptions.php.

References getOptions().

225  {
226  return in_array($a_user_id,$this->getOptions(self::OWNER_KEY));
227  }
getOptions($a_source_id)
Get entry by source.
+ Here is the call graph for this function:

◆ deleteAll()

ilCopyWizardOptions::deleteAll ( )

Delete all entries.

public

Definition at line 493 of file class.ilCopyWizardOptions.php.

References $ilDB, $query, and $res.

494  {
495  global $ilDB;
496 
497  $query = "DELETE FROM copy_wizard_options ".
498  "WHERE copy_id = ".$this->db->quote($this->copy_id ,'integer');
499  $res = $ilDB->manipulate($query);
500  }
global $ilDB

◆ disableSOAP()

ilCopyWizardOptions::disableSOAP ( )

Disable soap calls.

Recursive call of ilClone and ilCloneDependencies

public

Parameters

Definition at line 187 of file class.ilCopyWizardOptions.php.

References $ilDB, and getCopyId().

188  {
189  global $ilDB;
190 
191  $this->options[self::DISABLE_SOAP] = 1;
192 
193  $ilDB->insert("copy_wizard_options", array(
194  "copy_id" => array("integer", $this->getCopyId()),
195  "source_id" => array("integer", self::DISABLE_SOAP),
196  "options" => array('clob',serialize(array(1)))
197  ));
198  }
global $ilDB
+ Here is the call graph for this function:

◆ dropFirstDependenciesNode()

ilCopyWizardOptions::dropFirstDependenciesNode ( )

Drop first node (for cloneDependencies())

public

Definition at line 383 of file class.ilCopyWizardOptions.php.

References dropFirstNodeById().

384  {
385  return $this->dropFirstNodeById(-1);
386  }
dropFirstNodeById($a_id)
Drop first node by id.
+ Here is the call graph for this function:

◆ dropFirstNode()

ilCopyWizardOptions::dropFirstNode ( )

Drop first node (for cloneObject())

public

Definition at line 372 of file class.ilCopyWizardOptions.php.

References dropFirstNodeById().

373  {
374  return $this->dropFirstNodeById(0);
375  }
dropFirstNodeById($a_id)
Drop first node by id.
+ Here is the call graph for this function:

◆ dropFirstNodeById()

ilCopyWizardOptions::dropFirstNodeById (   $a_id)

Drop first node by id.

private

Definition at line 336 of file class.ilCopyWizardOptions.php.

References $ilDB, fetchFirstNodeById(), getCopyId(), and read().

Referenced by dropFirstDependenciesNode(), and dropFirstNode().

337  {
338  global $ilDB;
339 
340  if(!isset($this->options[$a_id]) or !is_array($this->options[$a_id]))
341  {
342  return false;
343  }
344 
345  $this->options[$a_id] = array_slice($this->options[$a_id],1);
346 
347  $ilDB->update('copy_wizard_options',array(
348  'options' => array('clob',serialize($this->options[$a_id]))
349  ),array(
350  'copy_id' => array('integer',$this->getCopyId()),
351  'source_id' => array('integer',$a_id)));
352 
353  $this->read();
354  // check for role_folder
355  if(($node = $this->fetchFirstNodeById($a_id)) === false)
356  {
357  return true;
358  }
359  if($node['type'] == 'rolf')
360  {
361  $this->dropFirstNodeById($a_id);
362  }
363  return true;
364  }
fetchFirstNodeById($a_id)
Get first node of stored tree.
dropFirstNodeById($a_id)
Drop first node by id.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fetchFirstDependenciesNode()

ilCopyWizardOptions::fetchFirstDependenciesNode ( )

Fetch first dependencies node.

public

Definition at line 325 of file class.ilCopyWizardOptions.php.

References fetchFirstNodeById().

326  {
327  return $this->fetchFirstNodeById(-1);
328  }
fetchFirstNodeById($a_id)
Get first node of stored tree.
+ Here is the call graph for this function:

◆ fetchFirstNode()

ilCopyWizardOptions::fetchFirstNode ( )

Fetch first node for cloneObject.

public

Parameters

Definition at line 314 of file class.ilCopyWizardOptions.php.

References fetchFirstNodeById().

315  {
316  return $this->fetchFirstNodeById(0);
317  }
fetchFirstNodeById($a_id)
Get first node of stored tree.
+ Here is the call graph for this function:

◆ fetchFirstNodeById()

ilCopyWizardOptions::fetchFirstNodeById (   $a_id)
private

Get first node of stored tree.

private

Definition at line 297 of file class.ilCopyWizardOptions.php.

References getOptions().

Referenced by dropFirstNodeById(), fetchFirstDependenciesNode(), and fetchFirstNode().

298  {
299  $tree = $this->getOptions($a_id);
300  if(isset($tree[0]) and is_array($tree[0]))
301  {
302  return $tree[0];
303  }
304  return false;
305  }
getOptions($a_source_id)
Get entry by source.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCopyId()

ilCopyWizardOptions::getCopyId ( )

Get copy id.

public

Definition at line 235 of file class.ilCopyWizardOptions.php.

References $copy_id.

Referenced by appendMapping(), disableSOAP(), dropFirstNodeById(), saveOwner(), saveRoot(), and storeTree().

236  {
237  return $this->copy_id;
238  }
+ Here is the caller graph for this function:

◆ getMappings()

ilCopyWizardOptions::getMappings ( )

Get Mappings.

public

Definition at line 478 of file class.ilCopyWizardOptions.php.

479  {
480  if(isset($this->options[-2]) and is_array($this->options[-2]))
481  {
482  return $this->options[-2];
483  }
484  return array();
485  }

◆ getOptions()

ilCopyWizardOptions::getOptions (   $a_source_id)

Get entry by source.

public

Parameters
intsource ref_id

Definition at line 395 of file class.ilCopyWizardOptions.php.

Referenced by checkOwner(), fetchFirstNodeById(), and isRootNode().

396  {
397  if(isset($this->options[$a_source_id]) and is_array($this->options[$a_source_id]))
398  {
399  return $this->options[$a_source_id];
400  }
401  return array();
402  }
+ Here is the caller graph for this function:

◆ initContainer()

ilCopyWizardOptions::initContainer (   $a_source_id,
  $a_target_id 
)

Init container Add copy entry.

public

Parameters

Definition at line 249 of file class.ilCopyWizardOptions.php.

References addEntry(), appendMapping(), and COPY_WIZARD_COPY.

250  {
251  global $tree;
252 
253  $mapping_source = $tree->getParentId($a_source_id);
254  $this->addEntry($a_source_id,array('type' => ilCopyWizardOptions::COPY_WIZARD_COPY));
255  $this->appendMapping($mapping_source,$a_target_id);
256  }
addEntry($a_source_id, $a_options)
Add new entry.
appendMapping($a_source_id, $a_target_id)
Add mapping of source -> target.
+ Here is the call graph for this function:

◆ isRootNode()

ilCopyWizardOptions::isRootNode (   $a_root)

Is root node.

public

Parameters
intref_id of copy

Definition at line 175 of file class.ilCopyWizardOptions.php.

References getOptions().

176  {
177  return in_array($a_root,$this->getOptions(self::ROOT_NODE));
178  }
getOptions($a_source_id)
Get entry by source.
+ Here is the call graph for this function:

◆ isSOAPEnabled()

ilCopyWizardOptions::isSOAPEnabled ( )

Check if SOAP calls are disabled.

public

Definition at line 206 of file class.ilCopyWizardOptions.php.

207  {
208  if(isset($this->options[self::DISABLE_SOAP]) and $this->options[self::DISABLE_SOAP])
209  {
210  return false;
211  }
212  return true;
213  }

◆ read()

ilCopyWizardOptions::read ( )

public

Parameters

Definition at line 509 of file class.ilCopyWizardOptions.php.

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by __construct(), and dropFirstNodeById().

510  {
511  global $ilDB;
512 
513  $query = "SELECT * FROM copy_wizard_options ".
514  "WHERE copy_id = ".$this->db->quote($this->copy_id ,'integer');
515  $res = $this->db->query($query);
516 
517  $this->options = array();
518  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
519  {
520  $this->options[$row->source_id] = unserialize($row->options);
521  }
522 
523  return true;
524  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
+ Here is the caller graph for this function:

◆ readTree()

ilCopyWizardOptions::readTree (   $a_source_id)
private

Purge ommitted node recursively.

private

Parameters
arraycurrent node

Definition at line 533 of file class.ilCopyWizardOptions.php.

References $options.

Referenced by storeTree().

534  {
535  global $tree;
536 
537  $this->tmp_tree[] = $tree->getNodeData($a_source_id);
538 
539 
540  foreach($tree->getChilds($a_source_id) as $sub_nodes)
541  {
542  $sub_node_ref_id = $sub_nodes['child'];
543  // check ommited, linked ...
544  $options = $this->options[$sub_node_ref_id];
545  if($options['type'] == self::COPY_WIZARD_COPY or
546  $options['type'] == self::COPY_WIZARD_LINK)
547  {
548  $this->readTree($sub_node_ref_id);
549  }
550  }
551  }
readTree($a_source_id)
Purge ommitted node recursively.
+ Here is the caller graph for this function:

◆ saveOwner()

ilCopyWizardOptions::saveOwner (   $a_user_id)

Save owner for copy.

It will be checked against this user id in all soap calls

public

Parameters

Definition at line 134 of file class.ilCopyWizardOptions.php.

References $ilDB, and getCopyId().

135  {
136  global $ilDB;
137 
138  $ilDB->insert("copy_wizard_options", array(
139  "copy_id" => array("integer", $this->getCopyId()),
140  "source_id" => array("integer", self::OWNER_KEY),
141  "options" => array('clob',serialize(array($a_user_id)))
142  ));
143 
144  return true;
145  }
global $ilDB
+ Here is the call graph for this function:

◆ saveRoot()

ilCopyWizardOptions::saveRoot (   $a_root)

Save root node id.

public

Parameters
intref_id of copy source

Definition at line 154 of file class.ilCopyWizardOptions.php.

References $ilDB, and getCopyId().

155  {
156  global $ilDB;
157 
158  $ilDB->insert("copy_wizard_options", array(
159  "copy_id" => array("integer", $this->getCopyId()),
160  "source_id" => array("integer", self::ROOT_NODE),
161  "options" => array('clob',serialize(array($a_root)))
162  ));
163 
164  return true;
165 
166  }
global $ilDB
+ Here is the call graph for this function:

◆ storeTree()

ilCopyWizardOptions::storeTree (   $a_source_id)

Save tree Stores two copies of the tree structure: id 0 is used for recursive call of cloneObject() id -1 is used for recursive call of cloneDependencies()

public

Parameters
intsource id

Definition at line 268 of file class.ilCopyWizardOptions.php.

References $ilDB, getCopyId(), and readTree().

269  {
270  global $ilDB;
271 
272  $this->readTree($a_source_id);
273  $a_tree_structure = $this->tmp_tree;
274 
275  $ilDB->update("copy_wizard_options", array(
276  "options" => array('clob',serialize($a_tree_structure))
277  ), array(
278  "copy_id" => array('integer',$this->getCopyId()),
279  "source_id" => array('integer',0
280  )));
281 
282  $ilDB->insert('copy_wizard_options',array(
283  'copy_id' => array('integer',$this->getCopyId()),
284  'source_id' => array('integer',-1),
285  'options' => array('clob',serialize($a_tree_structure))
286  ));
287 
288  return true;
289  }
readTree($a_source_id)
Purge ommitted node recursively.
global $ilDB
+ Here is the call graph for this function:

Field Documentation

◆ $copy_id

ilCopyWizardOptions::$copy_id
private

Definition at line 46 of file class.ilCopyWizardOptions.php.

Referenced by getCopyId().

◆ $db

ilCopyWizardOptions::$db
private

Definition at line 44 of file class.ilCopyWizardOptions.php.

◆ $instances

ilCopyWizardOptions::$instances = null
staticprivate

Definition at line 34 of file class.ilCopyWizardOptions.php.

◆ $options

ilCopyWizardOptions::$options = array()
private

Definition at line 48 of file class.ilCopyWizardOptions.php.

Referenced by readTree().

◆ $source_id

ilCopyWizardOptions::$source_id
private

Definition at line 47 of file class.ilCopyWizardOptions.php.

◆ COPY_WIZARD_COPY

◆ COPY_WIZARD_LINK

◆ COPY_WIZARD_OMIT

◆ DISABLE_SOAP

const ilCopyWizardOptions::DISABLE_SOAP = -4

Definition at line 41 of file class.ilCopyWizardOptions.php.

◆ OWNER_KEY

const ilCopyWizardOptions::OWNER_KEY = -3

Definition at line 40 of file class.ilCopyWizardOptions.php.

◆ ROOT_NODE

const ilCopyWizardOptions::ROOT_NODE = -5

Definition at line 42 of file class.ilCopyWizardOptions.php.


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