ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
HeaderFooter.php
Go to the documentation of this file.
1 <?php
30 if (!defined('PHPEXCEL_ROOT')) {
34  define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
35 }
36 
38 require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet/HeaderFooterDrawing.php';
39 
40 
109 {
110  /* Header/footer image location */
111  const IMAGE_HEADER_LEFT = 'LH';
112  const IMAGE_HEADER_CENTER = 'CH';
113  const IMAGE_HEADER_RIGHT = 'RH';
114  const IMAGE_FOOTER_LEFT = 'LF';
115  const IMAGE_FOOTER_CENTER = 'CF';
116  const IMAGE_FOOTER_RIGHT = 'RF';
117 
123  private $_oddHeader;
124 
130  private $_oddFooter;
131 
137  private $_evenHeader;
138 
144  private $_evenFooter;
145 
151  private $_firstHeader;
152 
158  private $_firstFooter;
159 
166 
173 
180 
187 
193  private $_headerFooterImages = array();
194 
198  public function __construct()
199  {
200  // Initialise values
201  $this->_oddHeader = '';
202  $this->_oddFooter = '';
203  $this->_evenHeader = '';
204  $this->_evenFooter = '';
205  $this->_firstHeader = '';
206  $this->_firstFooter = '';
207  $this->_differentOddEven = false;
208  $this->_differentFirst = false;
209  $this->_scaleWithDocument = true;
210  $this->_alignWithMargins = true;
211  $this->_headerFooterImages = array();
212  }
213 
219  public function getOddHeader() {
220  return $this->_oddHeader;
221  }
222 
229  public function setOddHeader($pValue) {
230  $this->_oddHeader = $pValue;
231  return $this;
232  }
233 
239  public function getOddFooter() {
240  return $this->_oddFooter;
241  }
242 
249  public function setOddFooter($pValue) {
250  $this->_oddFooter = $pValue;
251  return $this;
252  }
253 
259  public function getEvenHeader() {
260  return $this->_evenHeader;
261  }
262 
269  public function setEvenHeader($pValue) {
270  $this->_evenHeader = $pValue;
271  return $this;
272  }
273 
279  public function getEvenFooter() {
280  return $this->_evenFooter;
281  }
282 
289  public function setEvenFooter($pValue) {
290  $this->_evenFooter = $pValue;
291  return $this;
292  }
293 
299  public function getFirstHeader() {
300  return $this->_firstHeader;
301  }
302 
309  public function setFirstHeader($pValue) {
310  $this->_firstHeader = $pValue;
311  return $this;
312  }
313 
319  public function getFirstFooter() {
320  return $this->_firstFooter;
321  }
322 
329  public function setFirstFooter($pValue) {
330  $this->_firstFooter = $pValue;
331  return $this;
332  }
333 
339  public function getDifferentOddEven() {
341  }
342 
349  public function setDifferentOddEven($pValue = false) {
350  $this->_differentOddEven = $pValue;
351  return $this;
352  }
353 
359  public function getDifferentFirst() {
360  return $this->_differentFirst;
361  }
362 
369  public function setDifferentFirst($pValue = false) {
370  $this->_differentFirst = $pValue;
371  return $this;
372  }
373 
379  public function getScaleWithDocument() {
381  }
382 
389  public function setScaleWithDocument($pValue = true) {
390  $this->_scaleWithDocument = $pValue;
391  return $this;
392  }
393 
399  public function getAlignWithMargins() {
401  }
402 
409  public function setAlignWithMargins($pValue = true) {
410  $this->_alignWithMargins = $pValue;
411  return $this;
412  }
413 
422  public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT) {
423  $this->_headerFooterImages[$location] = $image;
424  return $this;
425  }
426 
434  public function removeImage($location = self::IMAGE_HEADER_LEFT) {
435  if (isset($this->_headerFooterImages[$location])) {
436  unset($this->_headerFooterImages[$location]);
437  }
438  return $this;
439  }
440 
448  public function setImages($images) {
449  if (!is_array($images)) {
450  throw new Exception('Invalid parameter!');
451  }
452 
453  $this->_headerFooterImages = $images;
454  return $this;
455  }
456 
462  public function getImages() {
463  // Sort array
464  $images = array();
465  if (isset($this->_headerFooterImages[self::IMAGE_HEADER_LEFT])) $images[self::IMAGE_HEADER_LEFT] = $this->_headerFooterImages[self::IMAGE_HEADER_LEFT];
466  if (isset($this->_headerFooterImages[self::IMAGE_HEADER_CENTER])) $images[self::IMAGE_HEADER_CENTER] = $this->_headerFooterImages[self::IMAGE_HEADER_CENTER];
467  if (isset($this->_headerFooterImages[self::IMAGE_HEADER_RIGHT])) $images[self::IMAGE_HEADER_RIGHT] = $this->_headerFooterImages[self::IMAGE_HEADER_RIGHT];
468  if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_LEFT])) $images[self::IMAGE_FOOTER_LEFT] = $this->_headerFooterImages[self::IMAGE_FOOTER_LEFT];
469  if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_CENTER])) $images[self::IMAGE_FOOTER_CENTER] = $this->_headerFooterImages[self::IMAGE_FOOTER_CENTER];
470  if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT])) $images[self::IMAGE_FOOTER_RIGHT] = $this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT];
471  $this->_headerFooterImages = $images;
472 
474  }
475 
479  public function __clone() {
480  $vars = get_object_vars($this);
481  foreach ($vars as $key => $value) {
482  if (is_object($value)) {
483  $this->$key = clone $value;
484  } else {
485  $this->$key = $value;
486  }
487  }
488  }
489 }