Skip to content
Snippets Groups Projects
home-address-fieldset.phtml 3.76 KiB
Newer Older
<!-- fid_adlr: fid - user - home-address-fieldset -->
<?php
/**
 * Copyright (C) 2019 Leipzig University Library
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * @author   Sebastian Kehr <kehr@ub.uni-leipzig.de>
 * @license  http://opensource.org/licenses/gpl-2.0.php GNU GPLv2
 */

use Zend\Form\Element;
use Zend\Form\Fieldset;

/** @var Fieldset $address */
$address = $this->address;
?>

<h3><?= $this->translate('fid::' . $address->getLabel()) ?></h3>

<?php /* id */ ?>
<?php
$elemId = $address->get('id');
if ($elemId->getValue()) {
    echo $this->formElement($elemId);
}
?>

<?php /* phone */ ?>
<?php
/** @var Element\Text $elemDeliveryAddress */
$elemDeliveryAddress = $this->form->get('data')->get('delivery_address');
$elemDeliveryAddress->setAttribute('id', 'delivery_address');
?>
<div class="form-group eula">
    <div>
        <?= $this->formElement($elemDeliveryAddress) ?>
        <?= $this->formLabel($elemDeliveryAddress) ?>
    </div>
    <?= $this->formElementErrors($elemDeliveryAddress) ?>
</div>

<?php /* first line */ ?>
<?php
/** @var Element\Text $elemLine1 */
$elemLine1 = $address->get('line1');
$elemLine1->setLabelAttributes(['class' => 'col-md-4']);
$elemLine1->setAttributes(['class' => 'form-control']);
?>
<div id="home-address-container">
  <div class="form-group">
      <?= $this->formLabel($elemLine1) ?>
      <?= $this->formElement($elemLine1) ?>
      <?= $this->formElementErrors($elemLine1) ?>
  </div>
  <?php /* second line */ ?>
  <?php
  /** @var Element\Text $elemLine2 */
  $elemLine2 = $address->get('line2');
  $elemLine2->setLabelAttributes(['class' => 'col-md-4']);
  $elemLine2->setAttributes(['class' => 'form-control']);
  ?>
  <div class="form-group">
      <?= $this->formLabel($elemLine2) ?>
      <?= $this->formElement($elemLine2) ?>
      <?= $this->formElementErrors($elemLine2) ?>
  </div>
  <?php /* address zip */ ?>
  <?php
  /** @var Element\Text $elemZip */
  $elemZip = $address->get('zip');
  $elemZip->setLabelAttributes(['class' => 'col-md-4']);
  $elemZip->setAttributes(['class' => 'form-control']);
  ?>
  <div class="form-group">
      <?= $this->formLabel($elemZip) ?>
      <?= $this->formElement($elemZip) ?>
      <?= $this->formElementErrors($elemZip) ?>
  </div>
  <?php /* city */ ?>
  <?php
  /** @var Element\Text $elemCity */
  $elemCity = $address->get('city');
  $elemCity->setLabelAttributes(['class' => 'col-md-4']);
  $elemCity->setAttributes(['class' => 'form-control']);
  ?>
  <div class="form-group">
      <?= $this->formLabel($elemCity) ?>
      <?= $this->formElement($elemCity) ?>
      <?= $this->formElementErrors($elemCity) ?>
  </div>
  <?php /* country */ ?>
  <?php
  /** @var Element\Text $elemCountry */
  $elemCountry = $address->get('country');
  $elemCountry->setLabelAttributes(['class' => 'col-md-4']);
  $elemCountry->setAttributes(['class' => 'form-control']);
  ?>
  <div class="form-group">
      <?= $this->formLabel($elemCountry) ?>
      <?= $this->formElement($elemCountry) ?>
      <?= $this->formElementErrors($elemCountry) ?>
  </div>
<hr/>
<?=$this->inlineScript(\Zend\View\Helper\HeadScript::FILE, 'user_delivery_address.js', 'SET');?>
<!-- fid_adlr: fid - user - home-address-fieldset - END -->