ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
HeaderFooter.php
Go to the documentation of this file.
1 <?php
2 
4 
67 {
68  // Header/footer image location
69  const IMAGE_HEADER_LEFT = 'LH';
70  const IMAGE_HEADER_CENTER = 'CH';
71  const IMAGE_HEADER_RIGHT = 'RH';
72  const IMAGE_FOOTER_LEFT = 'LF';
73  const IMAGE_FOOTER_CENTER = 'CF';
74  const IMAGE_FOOTER_RIGHT = 'RF';
75 
81  private $oddHeader = '';
82 
88  private $oddFooter = '';
89 
95  private $evenHeader = '';
96 
102  private $evenFooter = '';
103 
109  private $firstHeader = '';
110 
116  private $firstFooter = '';
117 
123  private $differentOddEven = false;
124 
130  private $differentFirst = false;
131 
137  private $scaleWithDocument = true;
138 
144  private $alignWithMargins = true;
145 
151  private $headerFooterImages = [];
152 
156  public function __construct()
157  {
158  }
159 
165  public function getOddHeader()
166  {
167  return $this->oddHeader;
168  }
169 
177  public function setOddHeader($pValue)
178  {
179  $this->oddHeader = $pValue;
180 
181  return $this;
182  }
183 
189  public function getOddFooter()
190  {
191  return $this->oddFooter;
192  }
193 
201  public function setOddFooter($pValue)
202  {
203  $this->oddFooter = $pValue;
204 
205  return $this;
206  }
207 
213  public function getEvenHeader()
214  {
215  return $this->evenHeader;
216  }
217 
225  public function setEvenHeader($pValue)
226  {
227  $this->evenHeader = $pValue;
228 
229  return $this;
230  }
231 
237  public function getEvenFooter()
238  {
239  return $this->evenFooter;
240  }
241 
249  public function setEvenFooter($pValue)
250  {
251  $this->evenFooter = $pValue;
252 
253  return $this;
254  }
255 
261  public function getFirstHeader()
262  {
263  return $this->firstHeader;
264  }
265 
273  public function setFirstHeader($pValue)
274  {
275  $this->firstHeader = $pValue;
276 
277  return $this;
278  }
279 
285  public function getFirstFooter()
286  {
287  return $this->firstFooter;
288  }
289 
297  public function setFirstFooter($pValue)
298  {
299  $this->firstFooter = $pValue;
300 
301  return $this;
302  }
303 
309  public function getDifferentOddEven()
310  {
312  }
313 
321  public function setDifferentOddEven($pValue)
322  {
323  $this->differentOddEven = $pValue;
324 
325  return $this;
326  }
327 
333  public function getDifferentFirst()
334  {
335  return $this->differentFirst;
336  }
337 
345  public function setDifferentFirst($pValue)
346  {
347  $this->differentFirst = $pValue;
348 
349  return $this;
350  }
351 
357  public function getScaleWithDocument()
358  {
360  }
361 
369  public function setScaleWithDocument($pValue)
370  {
371  $this->scaleWithDocument = $pValue;
372 
373  return $this;
374  }
375 
381  public function getAlignWithMargins()
382  {
384  }
385 
393  public function setAlignWithMargins($pValue)
394  {
395  $this->alignWithMargins = $pValue;
396 
397  return $this;
398  }
399 
407  public function addImage(HeaderFooterDrawing $image, $location = self::IMAGE_HEADER_LEFT)
408  {
409  $this->headerFooterImages[$location] = $image;
410 
411  return $this;
412  }
413 
421  public function removeImage($location = self::IMAGE_HEADER_LEFT)
422  {
423  if (isset($this->headerFooterImages[$location])) {
424  unset($this->headerFooterImages[$location]);
425  }
426 
427  return $this;
428  }
429 
437  public function setImages(array $images)
438  {
439  $this->headerFooterImages = $images;
440 
441  return $this;
442  }
443 
449  public function getImages()
450  {
451  // Sort array
452  $images = [];
453  if (isset($this->headerFooterImages[self::IMAGE_HEADER_LEFT])) {
454  $images[self::IMAGE_HEADER_LEFT] = $this->headerFooterImages[self::IMAGE_HEADER_LEFT];
455  }
456  if (isset($this->headerFooterImages[self::IMAGE_HEADER_CENTER])) {
457  $images[self::IMAGE_HEADER_CENTER] = $this->headerFooterImages[self::IMAGE_HEADER_CENTER];
458  }
459  if (isset($this->headerFooterImages[self::IMAGE_HEADER_RIGHT])) {
460  $images[self::IMAGE_HEADER_RIGHT] = $this->headerFooterImages[self::IMAGE_HEADER_RIGHT];
461  }
462  if (isset($this->headerFooterImages[self::IMAGE_FOOTER_LEFT])) {
463  $images[self::IMAGE_FOOTER_LEFT] = $this->headerFooterImages[self::IMAGE_FOOTER_LEFT];
464  }
465  if (isset($this->headerFooterImages[self::IMAGE_FOOTER_CENTER])) {
466  $images[self::IMAGE_FOOTER_CENTER] = $this->headerFooterImages[self::IMAGE_FOOTER_CENTER];
467  }
468  if (isset($this->headerFooterImages[self::IMAGE_FOOTER_RIGHT])) {
469  $images[self::IMAGE_FOOTER_RIGHT] = $this->headerFooterImages[self::IMAGE_FOOTER_RIGHT];
470  }
471  $this->headerFooterImages = $images;
472 
474  }
475 
479  public function __clone()
480  {
481  $vars = get_object_vars($this);
482  foreach ($vars as $key => $value) {
483  if (is_object($value)) {
484  $this->$key = clone $value;
485  } else {
486  $this->$key = $value;
487  }
488  }
489  }
490 }
__clone()
Implement PHP __clone to create a deep clone, not just a shallow copy.
$location
Definition: buildRTE.php:44
setImages(array $images)
Set header/footer images.
setAlignWithMargins($pValue)
Set AlignWithMargins.
setDifferentOddEven($pValue)
Set DifferentOddEven.
removeImage($location=self::IMAGE_HEADER_LEFT)
Remove header/footer image.
setScaleWithDocument($pValue)
Set ScaleWithDocument.
addImage(HeaderFooterDrawing $image, $location=self::IMAGE_HEADER_LEFT)
Add header/footer image.
Header/Footer Formatting Syntax taken from Office Open XML Part 4 - Markup Language Reference...
$key
Definition: croninfo.php:18
setDifferentFirst($pValue)
Set DifferentFirst.