<?php
$this->addJs('fileupload.jquery-ui.widget.js');
$this->addJs('fileupload.iframe-transport.js');
$this->addJs('fileupload.plugin.js');
$this->addJs('fileupload.js');
$this->SetLayout('account');
?>

<!--[if IE 9 ]> <meta name="ie9" content="true" /> <![endif]-->

<h1><?=Language::getText('profile_header')?></h1>

<div class="message <?=$message_type?>"><?=$message?></div>

<div class="form wide">
    <p class="large"><?=Language::getText('personal_header')?></p>
    <p><?=Language::getText('asterisk')?></p>
    <form action="<?php echo BASE_URL; ?>/account/profile/" method="post">
        <label class="<?=(isset ($Errors['first_name'])) ? ' error' : ''?>"><?=Language::getText('first_name')?>:</label>
        <input class="text" type="text" name="first_name" value="<?=htmlspecialchars($loggedInUser->firstName)?>" />

        <label class="row<?=(isset ($Errors['last_name'])) ? ' error' : ''?>"><?=Language::getText('last_name')?>:</label>
        <input class="text" type="text" name="last_name" value="<?=htmlspecialchars($loggedInUser->lastName)?>" />

        <label class="row<?=(isset ($Errors['email'])) ? ' error' : ''?>">*<?=Language::getText('email')?>:</label>
        <input class="text" type="text" name="email" value="<?=htmlspecialchars($loggedInUser->email)?>" />

        <label class="row<?=(isset ($Errors['website'])) ? ' error' : ''?>"><?=Language::getText('website')?>:</label>
        <input class="text" type="text" name="website" value="<?=htmlspecialchars($loggedInUser->website)?>" />

        <label class="row<?=(isset ($Errors['about_me'])) ? ' error' : ''?>"><?=Language::getText('about_me')?>:</label>
        <textarea class="text" name="about_me" rows="10" cols="45"><?=htmlspecialchars($loggedInUser->aboutMe)?></textarea>

        <input type="hidden" value="yes" name="submitted" />
        <input type="hidden" name="nonce" value="<?php echo $formNonce; ?>" />
        <input class="button" type="submit" name="button" value="<?=Language::getText('profile_button')?>" />
    </form>
</div>

<h1><?php echo Language::getText('update_avatar_header'); ?></h1>
<div id="update_avatar" class="form">

    <div class="left">
        <?php $avatar = $this->getService('User')->getAvatarUrl($loggedInUser); ?>
        <p class="avatar"><span><img alt="<?php echo Language::getText('current_avatar'); ?>" src="<?php echo ($avatar) ? $avatar : $this->options->themeUrl . '/images/avatar.gif'; ?>"></span></p>
        <?php echo Language::getText('current_avatar'); ?><br />
        <a class="confirm" data-node="confirm_reset_avatar" href="<?php BASE_URL; ?>/account/profile/reset/"><?php echo Language::getText('reset_avatar'); ?></a>
    </div>

    <div class="right">
        <?php echo Language::getText('update_avatar_text'); ?>
        <form action="<?php echo BASE_URL; ?>/account/profile/" method="post">

            <input
                type="file"
                name="upload"
                class="uploader"
                data-text="<?php echo Language::getText('browse_files_button'); ?>"
                data-url="<?php echo BASE_URL; ?>/ajax/upload/"
                data-type="image"
                data-limit="<?php echo $config->fileSizeLimit; ?>"
                data-extensions="<?php echo urlencode(json_encode($config->acceptedImageFormats)); ?>"
                data-auto-submit="true"
            />

            <input type="hidden" name="submitted_avatar" value="true" />
            <input type="hidden" name="nonce" value="<?php echo $formNonce; ?>" />
        </form>
    </div>
</div>