<?php
/**
 * Copyright (c) 2016 Serhii Borodai <clarifying@gmail.com>.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 *  all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 *
 */

/** @var $this \Zend\View\Renderer\PhpRenderer */
$this->headScript()
    ->appendFile('/js/script-set-prof.js')
;

$this->headLink()
    ->appendStylesheet('/css/styles-set-prof.css')
;


/** @var \App\Entity\User $user */
$user = $this->user;

/** @var \App\Entity\IdentityInterface $identity */
$identity = $this->identity();
$gravatar = $this->gravatar($identity->getEmail());
$gravatar->setDefaultImg(\Zend\View\Helper\Gravatar::DEFAULT_IDENTICON);
$sxml = new SimpleXMLElement(substr($gravatar, 0, -1) . '/>');
$src = $sxml['src'];
?>
<section class="b-content__title">
    <div class="wrapp">
        <picture>
            <img src="/img/bg-img-logo.svg" alt="No logo">
        </picture>
        <p class="lead"><?= $identity->getEmail() ?></p>
    </div>
</section>

<section class="b-content__form">
    <div class="wrapp">        
        <form action="" class="b-content__form-set" name="setting" data-url="<?= $this->url('user.cabinet.profile', ['lang' => $this->lang]) ?>" data-url-success="<?= $this->url('user.cabinet', ['lang' => $this->lang]) ?>">            
            <div>
                <label for="setting-password" class="b-content__form-set-item-label">
                    <p class="text"><?= _t("Старый пароль:") ?> </p>
                </label>
                <span class="input input--akira">
                    <input class="input__field input__field--akira" type="password" id="setting-password" name="password" value=""/>
                </span>
            </div>
            <div>
                <label for="setting-new-password" class="b-content__form-set-item-label">
                    <p class="text"><?= _t("Новый пароль:") ?> </p>
                </label>
                <span class="input input--akira">
                    <input class="input__field input__field--akira" type="password" id="setting-new-password" name="new-password"/>
                </span>
            </div>
            <div class='wrapp-button submit' data-action="<?= _t('Ваши данные обновлены') ?>">
                <input type="submit" name="submit" value="<?= _t('Сохранить') ?>">
            </div>
            <div class="wrapp-button reset" data-url="<?= $this->url('user.cabinet', ['lang' => $this->lang]) ?>">
                <input type="reset" name="reset" value="<?= _t('Отмена') ?>" class="text bold">
            </div>            
        </form>
        
        
    </div>
</section>

</main>

