ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Supervisor.php
Go to the documentation of this file.
1 <?php
2 
4 
8 
9 abstract class Supervisor implements IComparable
10 {
16  protected $isSupervisor;
17 
23  protected $parent;
24 
31 
39  public function __construct($isSupervisor = false)
40  {
41  // Supervisor?
42  $this->isSupervisor = $isSupervisor;
43  }
44 
53  public function bindParent($parent, $parentPropertyName = null)
54  {
55  $this->parent = $parent;
56  $this->parentPropertyName = $parentPropertyName;
57 
58  return $this;
59  }
60 
66  public function getIsSupervisor()
67  {
68  return $this->isSupervisor;
69  }
70 
76  public function getActiveSheet()
77  {
78  return $this->parent->getActiveSheet();
79  }
80 
87  public function getSelectedCells()
88  {
89  return $this->getActiveSheet()->getSelectedCells();
90  }
91 
98  public function getActiveCell()
99  {
100  return $this->getActiveSheet()->getActiveCell();
101  }
102 
106  public function __clone()
107  {
108  $vars = get_object_vars($this);
109  foreach ($vars as $key => $value) {
110  if ((is_object($value)) && ($key != 'parent')) {
111  $this->$key = clone $value;
112  } else {
113  $this->$key = $value;
114  }
115  }
116  }
117 
125  final public function exportArray(): array
126  {
127  return $this->exportArray1();
128  }
129 
138  abstract protected function exportArray1(): array;
139 
150  final protected function exportArray2(array &$exportedArray, string $index, $objOrValue): void
151  {
152  if ($objOrValue instanceof self) {
153  $exportedArray[$index] = $objOrValue->exportArray();
154  } else {
155  $exportedArray[$index] = $objOrValue;
156  }
157  }
158 }
getActiveCell()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:98
__clone()
Implement PHP __clone to create a deep clone, not just a shallow copy.
Definition: Supervisor.php:106
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
exportArray1()
Abstract method to be implemented in anything which extends this class.
getIsSupervisor()
Is this a supervisor or a cell style component?
Definition: Supervisor.php:66
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:76
bindParent($parent, $parentPropertyName=null)
Bind parent.
Definition: Supervisor.php:53
__construct($isSupervisor=false)
Create a new Supervisor.
Definition: Supervisor.php:39
$key
Definition: croninfo.php:18
exportArray2(array &$exportedArray, string $index, $objOrValue)
Populate array from exportArray1.
Definition: Supervisor.php:150
exportArray()
Export style as array.
Definition: Supervisor.php:125