<?php
/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf
 */

namespace webtools\drucklisten;


class LehrplanlisteSettings extends \webtools\drucklisten\DruckSheetSettings
{
  public function __construct()
  {
    parent::__construct();
    $this->einstellDarstellung = new \EinstellDarstellung();
  }

  
  public function loadFromPOST($pTnlist = '')
  {
    parent::loadFromPOST($pTnlist);
    for ($i = 1; $i <= 7; $i++) {
      $this->einstellDarstellung->{'option' . $i} = \PostOperations::isDefined('option' . $i);
    }
  }

  
  public function loadFromReqObj($pPostSettings, $pGrafikZeitSettObj = null)
  {
    
    parent::loadFromReqObj($pPostSettings);
    
    $this->einstellDarstellung = $pPostSettings->einstellDarstellung;
  }

  

  
  public function fromDruckListSettings($settings)
  {
    parent::fromDruckListSettings($settings);
    
    $vars = get_object_vars($this->einstellDarstellung);
    $i = 0;
    foreach ($vars as $name => $value) {
      $this->einstellDarstellung->{$name} = $settings->isEinstellSet($i);
      $i++;
    }
  }

  
  public function toDruckListSettings($pTyp)
  {
    $settings = parent::toDruckListSettings($pTyp);

    
    $vars = get_object_vars($this->einstellDarstellung);
    $i = 0;
    foreach ($vars as $value) {
      $settings->setEinstell($i, $value);
      $i++;
    }

    return $settings;
  }
}