<?php include('users_menu.tpl.php'); ?>

<form action="<?php echo $tpl['sendmail']['form_action']; ?>" method="post" class="page">
	<fieldset>
		<legend><?php echo __('Nouveau message'); ?></legend>
		<div id="users_sendmail_fields">
			<div>
				<p class="field<?php if ($tpl['field_error'] == 'name') : ?> field_error<?php endif; ?>">
					<label for="users_sendmail_name"><?php echo __('Nom d\'utilisateur :'); ?></label>
					<input required value="<?php echo $tpl['sendmail']['name']; ?>" id="users_sendmail_name" name="name" type="text" maxlength="<?php echo $tpl['sendmail']['maxlength']['name']; ?>" size="50" class="large">
				</p>
				<p class="field<?php if ($tpl['field_error'] == 'email') : ?> field_error<?php endif; ?>">
					<label for="users_sendmail_email"><?php echo __('Adresse de l\'expéditeur :'); ?></label>
					<input required value="<?php echo $tpl['sendmail']['email']; ?>" id="users_sendmail_email" name="email" type="text" maxlength="<?php echo $tpl['sendmail']['maxlength']['email']; ?>" size="50" class="large">
				</p>
				<p class="field<?php if ($tpl['field_error'] == 'subject') : ?> field_error<?php endif; ?>">
					<label for="users_sendmail_subject"><?php echo __('Sujet :'); ?></label>
					<input required value="<?php echo $tpl['sendmail']['subject']; ?>" id="users_sendmail_subject" name="subject" type="text" maxlength="<?php echo $tpl['sendmail']['maxlength']['subject']; ?>" size="50" class="large">
				</p>
				<p class="field<?php if ($tpl['field_error'] == 'message') : ?> field_error<?php endif; ?>">
					<label for="users_sendmail_message"><?php echo __('Message :'); ?></label>
					<textarea required rows="14" cols="30" id="users_sendmail_message" name="message" maxlength="<?php echo $tpl['sendmail']['maxlength']['message']; ?>"><?php echo $tpl['sendmail']['message']; ?></textarea>
				</p>
			</div>
			<div>
				<p class="field">
					<?php echo __('Destinataires :'); ?>
				</p>
				<p class="field">
					<input name="config[_checkboxes][]" type="hidden" value="users_all">
					<input<?php if ($tpl['sendmail']['users_all']) : ?> checked<?php endif; ?> id="users_sendmail_users_all" name="users_all" type="checkbox">
					<label for="users_sendmail_users_all"><?php echo __('Tous les utilisateurs'); ?></label>
				</p>
				<p class="field">
					<input name="config[_checkboxes][]" type="hidden" value="users_activated">
					<input<?php if ($tpl['sendmail']['users_activated']) : ?> checked<?php endif; ?> id="users_sendmail_users_activated" name="users_activated" type="checkbox">
					<label for="users_sendmail_users_activated"><?php echo __('Tous les utilisateurs activés'); ?></label>
				</p>
				<p class="field">
					<input name="config[_checkboxes][]" type="hidden" value="users_deactivated">
					<input<?php if ($tpl['sendmail']['users_deactivated']) : ?> checked<?php endif; ?> id="users_sendmail_users_deactivated" name="users_deactivated" type="checkbox">
					<label for="users_sendmail_users_deactivated"><?php echo __('Tous les utilisateurs désactivés'); ?></label>
				</p>
				<p class="field">
					<input name="config[_checkboxes][]" type="hidden" value="users_pending">
					<input<?php if ($tpl['sendmail']['users_pending']) : ?> checked<?php endif; ?> id="users_sendmail_users_pending" name="users_pending" type="checkbox">
					<label for="users_sendmail_users_pending"><?php echo __('Tous les utilisateurs en attente de validation'); ?></label>
				</p>
			</div>
			<div>
				<p class="field">&nbsp;</p>
				<p class="field">
					<input name="config[_checkboxes][]" type="hidden" value="users_select">
					<input<?php if ($tpl['sendmail']['users_select']) : ?> checked<?php endif; ?> id="users_sendmail_users_select" name="users_select" type="checkbox">
					<label for="users_sendmail_users_select"><?php echo __('Les utilisateurs suivants :'); ?></label>
				</p>
				<p class="field">
					<select name="users_list[]" class="multiple" multiple size="9">
<?php foreach ($tpl['sendmail']['users_list'] as &$i) : ?>
						<option<?php if ($i['selected']) : ?> selected<?php endif; ?> value="<?php echo $i['id']; ?>"><?php echo $i['name']; ?> (<?php echo $i['email']; ?>)</option>
<?php endforeach; ?>
					</select>
				</p>
				<p class="field">
					<input name="config[_checkboxes][]" type="hidden" value="groups_select">
					<input<?php if ($tpl['sendmail']['groups_select']) : ?> checked<?php endif; ?> id="users_sendmail_groups_select" name="groups_select" type="checkbox">
					<label for="users_sendmail_groups_select"><?php echo __('Les utilisateurs des groupes suivants :'); ?></label>
				</p>
				<p class="field">
					<select name="groups_list[]" class="multiple" multiple size="9">
<?php foreach ($tpl['sendmail']['groups_list'] as &$i) : ?>
						<option<?php if ($i['selected']) : ?> selected<?php endif; ?> value="<?php echo $i['id']; ?>"><?php echo $i['name']; ?></option>
<?php endforeach; ?>
					</select>
				</p>
			</div>
		</div>
	</fieldset>
	<div id="submit">
		<div>
			<input name="anticsrf" type="hidden" value="<?php echo $tpl['anticsrf'](); ?>">
			<input type="submit" value="<?php echo __('Envoyer'); ?>">
		</div>
	</div>
</form>