<?php
function admin_user_form($user) {
global $accessLevels;
echo '
<form action="'.$_SERVER['PHP_SELF'].'" method="POST" name="userform">
<input type="hidden" name="content" value="admin">
<input type="hidden" name="page" value="accounts">
<input type="hidden" name="action" value="newuser">
<input type="hidden" name="password" value="'.$user['password'].'">
<input type="hidden" name="id" value="'.$user['id'].'">
<table cellpadding="5" cellspacing="0" align="center" class="user">
<tr class="usertitle"><td colspan="4" align="center">
';
if ($user) echo localize_string("Edit the User Account");
else echo localize_string("Create a New Account");
echo '
</td></tr>
<tr>
<td align="right">'.localize_string("Username").':</td>
<td><input type="text" name="username" size="15" maxlength="19" value="'.$user['username'].'"></td>
<td align="right">'.localize_string("Access Level").':</td>
<td>
<select name="access">
';
foreach ($accessLevels as $key => $value)
if ($key == $user['access'])
echo '<option value="'.$key.'" selected>'.$value.'</option>';
else
echo '<option value="'.$key.'">'.$value.'</option>';
echo '
</select>
</td>
</tr>
<tr>
<td align="right">'.localize_string("First Name").':</td>
<td><input type="text" name="firstname" size="15" maxlength="49" value="'.$user['firstname'].'"></td>
<td align="right">'.localize_string("Last Name").':</td><td><input type="text" name="lastname" size="15" maxlength="49" value="'.$user['lastname'].'"></td>
</tr>
<tr>
<td align="right">'.localize_string("Email Address").':</td>
<td colspan="3"><input type="text" name="email" size="50" maxlength="244" value="'.$user['email'].'"></td>
</tr>
<tr>
<td align="right">'.localize_string("Password").':</td>
<td><input type="password" name="passwd1" size="15" maxlength="20"></td>
<td align="right">'.localize_string("Confirm Password").':</td>
<td><input type="password" name="passwd2" size="15" maxlength="20"></td>
</tr>
<tr>
<td colspan="4" align="right">
<input type="reset" value="'.localize_string("Reset").'"><input type="submit" value="'.localize_string("Submit").'" onclick="javascript:return check_user_form(this.form);">
</td>
</tr>
</table>
</form>
';
}
?>