<?php

/**
 *
 * @copyright  2011-2014 izend.org
 * @version    20
 * @link       http://www.izend.org
 */
?>
<?php extract($errors); ?>
<form action="" method="post">
<input type="hidden" name="useredit_token" value="<?php echo $token; ?>" />
<?php if ($user_accessed): ?>
<input type="hidden" name="useredit_accessed" value="<?php echo $user_accessed; ?>" />
<?php endif; ?>
<?php if ($with_info): ?>
<p class="inlabel<?php if ($missing_firstname): ?> inerror<?php endif; ?>">Prénom&nbsp;:</p>
<p><input type="text" name="useredit_firstname" id="useredit_firstname" size="30" maxlength="100" title="Prénom" onkeypress="return focusonenter(event, 'useredit_lastname')" value="<?php echo htmlspecialchars($user_firstname, ENT_COMPAT, 'UTF-8'); ?>" /></p>
<p class="inlabel<?php if ($missing_lastname): ?> inerror<?php endif; ?>">Nom&nbsp;:</p>
<p><input type="text" name="useredit_lastname" id="useredit_lastname" size="30" maxlength="100" title="Nom" onkeypress="return focusonenter(event, '<?php echo $with_name ? 'useredit_name' : 'useredit_mail'; ?>')" value="<?php echo htmlspecialchars($user_lastname, ENT_COMPAT, 'UTF-8'); ?>" /></p>
<?php endif; ?>
<?php if ($with_name): ?>
<p class="inlabel<?php if ($missing_name or $bad_name or $duplicated_name): ?> inerror<?php endif; ?>">Identifiant&nbsp;:</p>
<p><input id="useredit_name" type="text" name="useredit_name" size="20" maxlength="20" title="2 à 20 lettres" onkeypress="return submitonenter(event, 'useredit_modify')" value="<?php echo htmlspecialchars($user_name, ENT_COMPAT, 'UTF-8'); ?>" /><?php if ($user_name and !$bad_name): ?>&nbsp;<img class="avatar" src="<?php echo $base_path; ?>/avatars/<?php echo $user_name; ?>.png" alt="" width="24" height="24" /><?php endif; ?></p>
<?php else: ?>
<input type="hidden" name="useredit_name" value="<?php echo htmlspecialchars($user_name, ENT_COMPAT, 'UTF-8'); ?>" />
<?php endif; ?>
<p class="inlabel<?php if ($missing_mail or $bad_mail or $duplicated_mail): ?> inerror<?php endif; ?>">Adresse d'email&nbsp;:</p>
<p><input id="useredit_mail" type="text" name="useredit_mail" size="40" maxlength="100" title="nom@domaine.fr" onkeypress="return submitonenter(event, 'useredit_modify')" value="<?php echo htmlspecialchars($user_mail, ENT_COMPAT, 'UTF-8'); ?>" /></p>
<?php if ($with_role): ?>
<?php $rolename=array('administrator' => 'administrateur', 'writer' => 'rédacteur', 'reader' => 'lecteur', 'moderator' => 'modérateur', 'client' => 'client'); ?>
<p><?php foreach ($supported_roles as $role): ?><?php echo PHP_EOL; ?><input name="useredit_role[]" type="checkbox" value="<?php echo $role; ?>"<?php if ($user_role and in_array($role, $user_role)) echo ' checked="checked"'; ?> />&nbsp;<?php echo $rolename[$role]; ?><?php endforeach; ?><?php echo PHP_EOL; ?></p>
<?php endif; ?>
<?php if ($with_website): ?>
<p class="inlabel<?php if ($bad_website): ?> inerror<?php endif; ?>">Site web&nbsp;:</p>
<p><input id="useredit_website" type="text" name="useredit_website" size="40" maxlength="100" title="www.domaine.fr" onkeypress="return submitonenter(event, 'useredit_modify')" value="<?php echo htmlspecialchars($user_website, ENT_COMPAT, 'UTF-8'); ?>" /></p>
<?php else: ?>
<input type="hidden" name="useredit_website" value="<?php echo htmlspecialchars($user_website, ENT_COMPAT, 'UTF-8'); ?>" />
<?php endif; ?>
<?php if ($with_timezone): ?>
<p class="inlabel<?php if ($bad_timezone): ?> inerror<?php endif; ?>">Fuseau horaire&nbsp;:</p>
<p><input id="useredit_timezone" type="text" name="useredit_timezone" size="40" maxlength="100" title="Europe/Paris" onkeypress="return submitonenter(event, 'useredit_modify')" value="<?php echo htmlspecialchars($user_timezone, ENT_COMPAT, 'UTF-8'); ?>" /></p>
<?php else: ?>
<input type="hidden" name="useredit_timezone" value="<?php echo htmlspecialchars($user_timezone, ENT_COMPAT, 'UTF-8'); ?>" />
<?php endif; ?>
<?php if ($with_locale): ?>
<p><?php foreach ($system_languages as $lang): ?><?php echo PHP_EOL; ?><input name="useredit_locale" type="radio" value="<?php echo $lang; ?>" title="<?php echo $lang; ?>"<?php if ($lang == $user_locale) echo ' checked="checked"'; ?> />&nbsp;<span class="lang <?php echo $lang; ?>" title="<?php echo $lang; ?>"><?php echo $lang; ?></span><?php endforeach; ?><?php echo PHP_EOL; ?></p>
<?php else: ?>
<input type="hidden" name="useredit_locale" value="<?php echo htmlspecialchars($user_locale, ENT_COMPAT, 'UTF-8'); ?>" />
<?php endif; ?>
<?php if ($with_status): ?>
<fieldset id="useredit_status">
<legend>Statut</legend>
<input name="useredit_active" type="checkbox" <?php if ($user_active) echo 'checked="checked"'; ?> />&nbsp;actif
<input name="useredit_banned" type="checkbox" <?php if ($user_banned) echo 'checked="checked"'; ?> />&nbsp;banni
</fieldset>
<?php if ($user_accessed): ?>
<?php require_once 'datefr.php'; ?>
<p><span id="useredit_accessed">Dernier accès le <?php echo longdate_fr($user_accessed); ?> à <?php echo date('H:i', $user_accessed); ?></span></p>
<?php endif; ?>
<?php endif; ?>
<p class="noprint">
<?php if ($with_delete): ?>
<?php if ($confirm_delete): ?>
<input type="submit" class="submit submit_confirm" name="useredit_confirmdelete" id="useredit_confirmdelete" value="Confirmer" />
la suppression ou
<input type="submit" class="submit submit_cancel" name="useredit_cancel" id="useredit_cancel" value="Annuler" />
<?php else: ?>
<input type="submit" class="submit submit_modify" name="useredit_modify" id="useredit_modify" value="Modifier" />
le profil ou
<input type="submit" class="submit submit_delete" name="useredit_delete" id="useredit_delete" value="Supprimer" />
le compte
<?php endif; ?>
<?php else: ?>
<input type="submit" class="submit submit_modify" name="useredit_modify" id="useredit_modify" value="Modifier" />
<?php endif; ?>
</p>
<?php if ($with_newpassword): ?>
<p class="noprint inlabel<?php if ($missing_newpassword or $bad_newpassword): ?> inerror<?php endif; ?>">Mot de passe&nbsp;:</p>
<p class="noprint"><input type="password" name="useredit_newpassword" id="useredit_newpassword" size="20" maxlength="20" title="au moins 6 lettres et chiffres" onkeypress="return submitonenter(event, 'useredit_change')" value="<?php echo htmlspecialchars($user_newpassword, ENT_COMPAT, 'UTF-8'); ?>" /></p>
<p class="noprint"><input type="submit" class="submit submit_change" name="useredit_change" id="useredit_change" value="Changer" /></p>
<?php endif; ?>
</form>
<div class="errors">
<?php if ($missing_lastname and $missing_firstname): ?>
<p>Un nom et un prénom sont obligatoires.</p>
<?php else: ?>
<?php if ($missing_lastname): ?>
<p>Un nom est obligatoire.</p>
<?php endif; ?>
<?php if ($missing_firstname): ?>
<p>Un prénom est obligatoire.</p>
<?php endif; ?>
<?php endif; ?>
<?php if ($missing_name): ?>
<p>Un identifiant est obligatoire.</p>
<?php elseif ($bad_name): ?>
<p>Un identifiant doit comporter de 2 à 20 lettres.</p>
<?php elseif ($duplicated_name): ?>
<p>Cet identifiant est déjà pris.</p>
<?php endif; ?>
<?php if ($missing_mail): ?>
<p>Une adresse d'email est obligatoire.</p>
<?php elseif ($bad_mail): ?>
<p>L'adresse d'email est invalide.</p>
<?php elseif ($duplicated_mail): ?>
<p>Cette adresse d'email est déjà utilisée.</p>
<?php endif; ?>
<?php if ($bad_timezone): ?>
<p>Le fuseau horaire est incorrect.</p>
<?php endif; ?>
<?php if ($bad_website): ?>
<p>L'URL du site web est invalide.</p>
<?php endif; ?>
<?php if ($missing_newpassword or $bad_newpassword): ?>
<p>Entrez une combinaison de lettres et de chiffres d'au moins 6 caractères.</p>
<?php endif; ?>
</div>
<?php extract($infos); ?>
<div class="infos">
<?php if ($internal_error): ?>
<p>Une erreur interne s'est produite.
<?php if ($contact_page): ?>Si vous pouvez décrire le problème, merci de <a href="<?php echo $contact_page; ?>" rel="nofollow">nous contacter</a>.<?php endif; ?></p>
<?php endif; ?>
<?php if ($account_modified): ?>
<p>Les données du compte ont été modifiées.</p>
<?php endif; ?>
<?php if ($password_changed): ?>
<p>Le mot de passe a été changé.</p>
<?php endif; ?>
</div>
<?php
$focus=false;
if ($missing_firstname) {
	$focus='#useredit_firstname';
}
else if ($missing_lastname) {
	$focus='#useredit_lastname';
}
else if ($missing_name or $bad_name or $duplicated_name) {
	$focus='#useredit_name';
}
else if ($missing_mail or $bad_mail or $duplicated_mail) {
	$focus='#useredit_mail';
}
else if ($bad_timezone) {
	$focus='#useredit_timezone';
}
else if ($bad_website) {
	$focus='#useredit_website';
}
else if ($missing_newpassword or $bad_newpassword) {
	$focus='#useredit_newpassword';
}
?>
<?php if ($focus): ?>
<script type="text/javascript">
$(function() {$('<?php echo $focus; ?>').focus();});
</script>
<?php endif; ?>
