<?
/**
 * Copyright © 2012 Alcatel-Lucent.
 *
 * See the NOTICE file distributed with this work for additional information regarding copyright ownership. Licensed to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the specific language governing permissions and limitations under the License.
 */

$user = $this->user;
$validationErrors = $this->validationErrors;
?>
<div class="container">
    <h1><?=empty($user['id'])?$this->translate("Create New User"):$this->translate("User Settings")?></h1>
    <? if(!empty($this->messages)): ?>
    <div class="control-group success">
        <span class="help-block" id="messages">
            <?=implode(". ",$this->messages)?>
        </span>
    </div>
    <? endif ?>
    <? if(!empty($validationErrors['default'])): ?>
    <div class="control-group error"><span class="help-block"><?=$validationErrors['default']?></span></div>
    <? endif ?>
    <form method="POST" class="well form-horizontal">
        <fieldset>
            <div class="control-group <?=empty($validationErrors['username'])?"":"error"?>" id="controlGroup-username">
                <label class="control-label" for="username"><? echo $this->translate("Username")?></label>
                <div class="controls">
                    <input type="text" name="user[username]" id="username" value="<?=@$user['username']?>"/>
                    <span class="help-inline"><?=@$validationErrors['username']?></span>
                </div>
            </div>
            <div class="control-group <?=empty($validationErrors['password'])?"":"error"?>" id="controlGroup-password">
                <label class="control-label" for="password"><? echo $this->translate("Password")?></label>
                <div class="controls">
                    <input type="password" name="user[password]" id="password" value="<?=@$user['password']?>"/>
                    <span class="help-inline"><?=@$validationErrors['password']?></span>
                </div>
            </div>
            <div class="control-group <?=empty($validationErrors['passwordConfirm'])?"":"error"?>" id="controlGroup-passwordConfirm">
                <label class="control-label" for="passwordConfirm"><? echo $this->translate("Confirm Password")?></label>
                <div class="controls">
                    <input type="password" name="user[passwordConfirm]" id="passwordConfirm" value="<?=@$user['passwordConfirm']?>"/>
                    <span class="help-inline"><?=@$validationErrors['passwordConfirm']?></span>
                </div>
            </div>
            <div class="control-group <?=empty($validationErrors['real_name'])?"":"error"?>" id="controlGroup-real_name">
                <label class="control-label" for="real_name"><? echo $this->translate("Real Name")?></label>
                <div class="controls">
                    <input type="text" name="user[real_name]" id="real_name" value="<?=@$user['real_name']?>"/>
                    <span class="help-inline"><?=@$validationErrors['real_name']?></span>
                </div>
            </div>
            <input type="submit" class="btn btn-primary" value="<? echo $this->translate("Save")?>"/>
        </fieldset>
    </form>
</div>