ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
HeaderFooter.php
Go to the documentation of this file.
1 <?php
97 {
98  /* Header/footer image location */
99  const IMAGE_HEADER_LEFT = 'LH';
100  const IMAGE_HEADER_CENTER = 'CH';
101  const IMAGE_HEADER_RIGHT = 'RH';
102  const IMAGE_FOOTER_LEFT = 'LF';
103  const IMAGE_FOOTER_CENTER = 'CF';
104  const IMAGE_FOOTER_RIGHT = 'RF';
105 
111  private $_oddHeader = '';
112 
118  private $_oddFooter = '';
119 
125  private $_evenHeader = '';
126 
132  private $_evenFooter = '';
133 
139  private $_firstHeader = '';
140 
146  private $_firstFooter = '';
147 
153  private $_differentOddEven = false;
154 
160  private $_differentFirst = false;
161 
167  private $_scaleWithDocument = true;
168 
174  private $_alignWithMargins = true;
175 
181  private $_headerFooterImages = array();
182 
186  public function __construct()
187  {
188  }
189 
195  public function getOddHeader() {
196  return $this->_oddHeader;
197  }
198 
205  public function setOddHeader($pValue) {
206  $this->_oddHeader = $pValue;
207  return $this;
208  }
209 
215  public function getOddFooter() {
216  return $this->_oddFooter;
217  }
218 
225  public function setOddFooter($pValue) {
226  $this->_oddFooter = $pValue;
227  return $this;
228  }
229 
235  public function getEvenHeader() {
236  return $this->_evenHeader;
237  }
238 
245  public function setEvenHeader($pValue) {
246  $this->_evenHeader = $pValue;
247  return $this;
248  }
249 
255  public function getEvenFooter() {
256  return $this->_evenFooter;
257  }
258 
265  public function setEvenFooter($pValue) {
266  $this->_evenFooter = $pValue;
267  return $this;
268  }
269 
275  public function getFirstHeader() {
276  return $this->_firstHeader;
277  }
278 
285  public function setFirstHeader($pValue) {
286  $this->_firstHeader = $pValue;
287  return $this;
288  }
289 
295  public function getFirstFooter() {
296  return $this->_firstFooter;
297  }
298 
305  public function setFirstFooter($pValue) {
306  $this->_firstFooter = $pValue;
307  return $this;
308  }
309 
315  public function getDifferentOddEven() {
317  }
318 
325  public function setDifferentOddEven($pValue = false) {
326  $this->_differentOddEven = $pValue;
327  return $this;
328  }
329 
335  public function getDifferentFirst() {
336  return $this->_differentFirst;
337  }
338 
345  public function setDifferentFirst($pValue = false) {
346  $this->_differentFirst = $pValue;
347  return $this;
348  }
349 
355  public function getScaleWithDocument() {
357  }
358 
365  public function setScaleWithDocument($pValue = true) {
366  $this->_scaleWithDocument = $pValue;
367  return $this;
368  }
369 
375  public function getAlignWithMargins() {
377  }
378 
385  public function setAlignWithMargins($pValue = true) {
386  $this->_alignWithMargins = $pValue;
387  return $this;
388  }
389 
398  public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT) {
399  $this->_headerFooterImages[$location] = $image;
400  return $this;
401  }
402 
410  public function removeImage($location = self::IMAGE_HEADER_LEFT) {
411  if (isset($this->_headerFooterImages[$location])) {
412  unset($this->_headerFooterImages[$location]);
413  }
414  return $this;
415  }
416 
424  public function setImages($images) {
425  if (!is_array($images)) {
426  throw new Exception('Invalid parameter!');
427  }
428 
429  $this->_headerFooterImages = $images;
430  return $this;
431  }
432 
438  public function getImages() {
439  // Sort array
440  $images = array();
441  if (isset($this->_headerFooterImages[self::IMAGE_HEADER_LEFT])) $images[self::IMAGE_HEADER_LEFT] = $this->_headerFooterImages[self::IMAGE_HEADER_LEFT];
442  if (isset($this->_headerFooterImages[self::IMAGE_HEADER_CENTER])) $images[self::IMAGE_HEADER_CENTER] = $this->_headerFooterImages[self::IMAGE_HEADER_CENTER];
443  if (isset($this->_headerFooterImages[self::IMAGE_HEADER_RIGHT])) $images[self::IMAGE_HEADER_RIGHT] = $this->_headerFooterImages[self::IMAGE_HEADER_RIGHT];
444  if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_LEFT])) $images[self::IMAGE_FOOTER_LEFT] = $this->_headerFooterImages[self::IMAGE_FOOTER_LEFT];
445  if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_CENTER])) $images[self::IMAGE_FOOTER_CENTER] = $this->_headerFooterImages[self::IMAGE_FOOTER_CENTER];
446  if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT])) $images[self::IMAGE_FOOTER_RIGHT] = $this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT];
447  $this->_headerFooterImages = $images;
448 
450  }
451 
455  public function __clone() {
456  $vars = get_object_vars($this);
457  foreach ($vars as $key => $value) {
458  if (is_object($value)) {
459  $this->$key = clone $value;
460  } else {
461  $this->$key = $value;
462  }
463  }
464  }
465 }