<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>

<form
	action="<?php echo url_for(($form->getObject()->isNew() ? '@create' : '@update')) ?>"
	method="post"
	<?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
	<?php if (!$form->getObject()->isNew()): ?> <input type="hidden"
	name="sf_method" value="put" /> <?php endif; ?>
<table class="registration">
	<thead>

	<?php if($form->hasErrors()): ?>
		<tr>
			<td colspan="2"><span class="error">Znaleziono błędy - ich opis
			uzyskasz po najechaniu na wykrzyknik.</span></td>
		</tr>
		<?php endif;?>

	</thead>
	<tfoot>
		<tr>
			<td colspan="2"><?php echo $form->renderHiddenFields(false) ?> &nbsp;
	<input type="submit" value="Zapisz" name='edit' />
			</td>
		</tr>
	</tfoot>
	<tbody>
	<?php echo $form->renderGlobalErrors() ?>
	<?php $fields=array(
      'gender_id'=>		array('label' => 'Płeć:'),
      'name'=>			array('label' => 'Imię:'),
      'surname'=>		array('label' => 'Nazwisko:'),
      'university'=>	array('label' => 'Uczelnia:'),
      'index_nr'=>		array('label' => 'Numer indeksu:'),
      'surname'=>		array('label' => 'Nazwisko:'),
      'telephone'=>		array('label' => 'Numer telefonu:'),
      'email'=>			array('label' => 'Adres e-mail:'),
	);?>

	<?php foreach ($fields as $name => $field):?>
	<?php $has_error=$form[$name]->hasError();?>
		<tr>
			<th><?php echo $form[$name]->renderLabel($field['label'],$has_error ? array('class'=>'error'): array()) ?></th>
			<td><?php echo $form[$name] ?> <?php  if($has_error): ?> <a
				title="<?php echo $form[$name]->getError();?>"> <?php echo image_tag('icons/warning.png',array('class' => 'warn')); ?>
			</a> <?php endif; ?></td>
		</tr>
		<?php endforeach;?>
	</tbody>
</table>
</form>
