ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilCopyWizardOptions Class Reference
+ Collaboration diagram for ilCopyWizardOptions:

Public Member Functions

 getRequiredSteps ()
 Get required steps. More...
 
 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 123 of file class.ilCopyWizardOptions.php.

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

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

124  {
125  global $ilDB;
126 
127  $query = "SELECT MAX(copy_id) latest FROM copy_wizard_options ";
128  $res = $ilDB->query($query);
129  $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
130 
131  $ilDB->insert("copy_wizard_options", array(
132  "copy_id" => array("integer", ((int) $row->latest) + 1),
133  "source_id" => array("integer", 0)
134  ));
135  return ((int) $row->latest) + 1;
136  }
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(), ilCourseStart\cloneDependencies(), ilCourseObjectiveQuestion\cloneDependencies(), ilObjCategory\cloneDependencies(), ilContainerStartObjects\cloneDependencies(), ilObjectActivation\cloneDependencies(), ilConditionHandler\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(), ilLOTestAssignment\cloneSettings(), ilLOSettings\cloneSettings(), ilContainerSorting\cloneSorting(), ilLORandomTestQuestionPools\copy(), ilObjContentObject\copyAllPagesAndChapters(), ilObjectCopyGUI\copyMultipleNonContainer(), ilSoapObjectAdministration\copyObject(), ilObjCloud\doClone(), ilObjPortfolioTemplate\doCloneObject(), ilObjDataCollection\doCloneObject(), ilObjPoll\doCloneObject(), ilObjBibliographic\doCloneObject(), ilObjItemGroup\fixContainerItemGroupRefsAfterCloning(), ilObjForum\getDiskUsage(), ilSoapUtils\ilClone(), ilSoapUtils\ilCloneDependencies(), ilObjectCopyProgressTableGUI\parse(), ilObjWorkspaceFolderGUI\performPasteIntoMultipleObjects(), ilTestRandomQuestionSetConfig\registerClonedSourcePoolDefinitionIdMapping(), and ilObjectCopyGUI\updateProgress().

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 106 of file class.ilCopyWizardOptions.php.

References $ilDB, $query, and $res.

Referenced by ilContainerGUI\cloneAllObject(), and ilObjectCopyGUI\copyContainerToTargets().

107  {
108  global $ilDB;
109 
110  $query = "SELECT * FROM copy_wizard_options ".
111  "WHERE copy_id = ".$ilDB->quote($a_copy_id ,'integer')." ";
112  $res = $ilDB->query($query);
113  return $res->numRows() ? false : true;
114  }
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 424 of file class.ilCopyWizardOptions.php.

References $ilDB, $query, and $res.

Referenced by initContainer().

425  {
426  global $ilDB;
427 
428  if(!is_array($a_options))
429  {
430  return false;
431  }
432 
433  $query = "DELETE FROM copy_wizard_options ".
434  "WHERE copy_id = ".$this->db->quote($this->copy_id ,'integer')." ".
435  "AND source_id = ".$this->db->quote($a_source_id ,'integer');
436  $res = $ilDB->manipulate($query);
437 
438  $ilDB->insert('copy_wizard_options',array(
439  'copy_id' => array('integer',$this->copy_id),
440  'source_id' => array('integer',$a_source_id),
441  'options' => array('clob',serialize($a_options))
442  ));
443  return true;
444  }
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
int | string$a_source_idarray key of mapping entry
mixed$a_target_idarray value of mapping entry

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

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

Referenced by initContainer().

455  {
456  global $ilDB;
457 
458  $query = "SELECT * FROM copy_wizard_options ".
459  "WHERE copy_id = ".$this->db->quote($this->copy_id ,'integer')." ".
460  "AND source_id = -2 ";
461  $res = $this->db->query($query);
462  $mappings = array();
463  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
464  {
465  $mappings = unserialize($row->options);
466  }
467  $mappings[$a_source_id] = $a_target_id;
468 
469  $query = "DELETE FROM copy_wizard_options ".
470  "WHERE copy_id = ".$ilDB->quote($this->getCopyId(),'integer')." ".
471  "AND source_id = -2 ";
472  $res = $ilDB->manipulate($query);
473 
474 
475  $ilDB->insert('copy_wizard_options', array(
476  'copy_id' => array('integer',$this->getCopyId()),
477  'source_id' => array('integer',-2),
478  'options' => array('clob',serialize($mappings))
479  ));
480 
481  return true;
482  }
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 235 of file class.ilCopyWizardOptions.php.

References getOptions().

236  {
237  return in_array($a_user_id,$this->getOptions(self::OWNER_KEY));
238  }
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 505 of file class.ilCopyWizardOptions.php.

References $ilDB, $query, and $res.

506  {
507  global $ilDB;
508 
509  $query = "DELETE FROM copy_wizard_options ".
510  "WHERE copy_id = ".$this->db->quote($this->copy_id ,'integer');
511  $res = $ilDB->manipulate($query);
512  }
global $ilDB

◆ disableSOAP()

ilCopyWizardOptions::disableSOAP ( )

Disable soap calls.

Recursive call of ilClone and ilCloneDependencies

public

Parameters

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

References $ilDB, and getCopyId().

199  {
200  global $ilDB;
201 
202  $this->options[self::DISABLE_SOAP] = 1;
203 
204  $ilDB->insert("copy_wizard_options", array(
205  "copy_id" => array("integer", $this->getCopyId()),
206  "source_id" => array("integer", self::DISABLE_SOAP),
207  "options" => array('clob',serialize(array(1)))
208  ));
209  }
global $ilDB
+ Here is the call graph for this function:

◆ dropFirstDependenciesNode()

ilCopyWizardOptions::dropFirstDependenciesNode ( )

Drop first node (for cloneDependencies())

public

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

References dropFirstNodeById().

396  {
397  return $this->dropFirstNodeById(-1);
398  }
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 384 of file class.ilCopyWizardOptions.php.

References dropFirstNodeById().

385  {
386  return $this->dropFirstNodeById(0);
387  }
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 348 of file class.ilCopyWizardOptions.php.

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

Referenced by dropFirstDependenciesNode(), and dropFirstNode().

349  {
350  global $ilDB;
351 
352  if(!isset($this->options[$a_id]) or !is_array($this->options[$a_id]))
353  {
354  return false;
355  }
356 
357  $this->options[$a_id] = array_slice($this->options[$a_id],1);
358 
359  $ilDB->update('copy_wizard_options',array(
360  'options' => array('clob',serialize($this->options[$a_id]))
361  ),array(
362  'copy_id' => array('integer',$this->getCopyId()),
363  'source_id' => array('integer',$a_id)));
364 
365  $this->read();
366  // check for role_folder
367  if(($node = $this->fetchFirstNodeById($a_id)) === false)
368  {
369  return true;
370  }
371  if($node['type'] == 'rolf')
372  {
373  $this->dropFirstNodeById($a_id);
374  }
375  return true;
376  }
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 337 of file class.ilCopyWizardOptions.php.

References fetchFirstNodeById().

338  {
339  return $this->fetchFirstNodeById(-1);
340  }
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 326 of file class.ilCopyWizardOptions.php.

References fetchFirstNodeById().

327  {
328  return $this->fetchFirstNodeById(0);
329  }
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 309 of file class.ilCopyWizardOptions.php.

References getOptions().

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

310  {
311  $tree = $this->getOptions($a_id);
312  if(isset($tree[0]) and is_array($tree[0]))
313  {
314  return $tree[0];
315  }
316  return false;
317  }
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 246 of file class.ilCopyWizardOptions.php.

References $copy_id.

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

247  {
248  return $this->copy_id;
249  }
+ Here is the caller graph for this function:

◆ getMappings()

ilCopyWizardOptions::getMappings ( )

Get Mappings.

public

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

491  {
492  if(isset($this->options[-2]) and is_array($this->options[-2]))
493  {
494  return $this->options[-2];
495  }
496  return array();
497  }

◆ getOptions()

ilCopyWizardOptions::getOptions (   $a_source_id)

Get entry by source.

public

Parameters
intsource ref_id

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

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

408  {
409  if(isset($this->options[$a_source_id]) and is_array($this->options[$a_source_id]))
410  {
411  return $this->options[$a_source_id];
412  }
413  return array();
414  }
+ Here is the caller graph for this function:

◆ getRequiredSteps()

ilCopyWizardOptions::getRequiredSteps ( )

Get required steps.

Returns
type

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

93  {
94  return count($this->options[0]) + count($this->options[-1]);
95  }

◆ initContainer()

ilCopyWizardOptions::initContainer (   $a_source_id,
  $a_target_id 
)

Init container Add copy entry.

public

Parameters

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

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

261  {
262  global $tree;
263 
264  $mapping_source = $tree->getParentId($a_source_id);
265  $this->addEntry($a_source_id,array('type' => ilCopyWizardOptions::COPY_WIZARD_COPY));
266  $this->appendMapping($mapping_source,$a_target_id);
267  }
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 186 of file class.ilCopyWizardOptions.php.

References getOptions().

187  {
188  return in_array($a_root,$this->getOptions(self::ROOT_NODE));
189  }
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 217 of file class.ilCopyWizardOptions.php.

218  {
219  if(isset($this->options[self::DISABLE_SOAP]) and $this->options[self::DISABLE_SOAP])
220  {
221  return false;
222  }
223  return true;
224  }

◆ read()

ilCopyWizardOptions::read ( )

public

Parameters

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

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

Referenced by __construct(), and dropFirstNodeById().

522  {
523  global $ilDB;
524 
525  $query = "SELECT * FROM copy_wizard_options ".
526  "WHERE copy_id = ".$this->db->quote($this->copy_id ,'integer');
527  $res = $this->db->query($query);
528 
529  $this->options = array();
530  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
531  {
532  $this->options[$row->source_id] = unserialize($row->options);
533  }
534 
535  return true;
536  }
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 545 of file class.ilCopyWizardOptions.php.

References $options.

Referenced by storeTree().

546  {
547  global $tree;
548 
549  $this->tmp_tree[] = $tree->getNodeData($a_source_id);
550 
551 
552  foreach($tree->getChilds($a_source_id) as $sub_nodes)
553  {
554  $sub_node_ref_id = $sub_nodes['child'];
555  // check ommited, linked ...
556  $options = $this->options[$sub_node_ref_id];
557  if($options['type'] == self::COPY_WIZARD_COPY or
558  $options['type'] == self::COPY_WIZARD_LINK)
559  {
560  $this->readTree($sub_node_ref_id);
561  }
562  }
563  }
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 145 of file class.ilCopyWizardOptions.php.

References $ilDB, and getCopyId().

146  {
147  global $ilDB;
148 
149  $ilDB->insert("copy_wizard_options", array(
150  "copy_id" => array("integer", $this->getCopyId()),
151  "source_id" => array("integer", self::OWNER_KEY),
152  "options" => array('clob',serialize(array($a_user_id)))
153  ));
154 
155  return true;
156  }
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 165 of file class.ilCopyWizardOptions.php.

References $ilDB, and getCopyId().

166  {
167  global $ilDB;
168 
169  $ilDB->insert("copy_wizard_options", array(
170  "copy_id" => array("integer", $this->getCopyId()),
171  "source_id" => array("integer", self::ROOT_NODE),
172  "options" => array('clob',serialize(array($a_root)))
173  ));
174 
175  return true;
176 
177  }
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 279 of file class.ilCopyWizardOptions.php.

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

280  {
281  global $ilDB;
282 
283  $this->tmp_tree = array();
284  $this->readTree($a_source_id);
285  $a_tree_structure = $this->tmp_tree;
286 
287  $ilDB->update("copy_wizard_options", array(
288  "options" => array('clob',serialize($a_tree_structure))
289  ), array(
290  "copy_id" => array('integer',$this->getCopyId()),
291  "source_id" => array('integer',0
292  )));
293 
294  $ilDB->insert('copy_wizard_options',array(
295  'copy_id' => array('integer',$this->getCopyId()),
296  'source_id' => array('integer',-1),
297  'options' => array('clob',serialize($a_tree_structure))
298  ));
299 
300  return true;
301  }
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: