<form name="add_object" action="<?php echo Horde::applicationUrl('addobjectaction.php') ?>" method="post">

<table border="0" cellpadding="0" cellspacing="5" align="center">
<tr class="header">
    <td colspan="2">

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
    <td class="header">
        <b>&nbsp;<?php echo _("Add a new contact") ?>&nbsp;</b>
    </td>
    <td class="header" align="right">
        <input type="submit" class="button" name="actionID" value="<?php echo _("Save") ?>" />
        <input type="reset" class="button" name="reset" value="<?php echo _("Reset") ?>" />
    </td>
</tr>
</table>

    </td>
</tr>

<?php
foreach ($attributes as $key => $field):
    if (!isset($fields[$key]) || $field['type'] == 'multiline') {
        continue;
    }
    if ($field['type'] == 'date'):
        if ($this->object->getValue($key)) {
            $value = explode('/', date('d/m/Y', $this->object->getValue($key)));
        } else {
            $value = array('', '', '');
        }
?>
<tr>
    <td class="light" align="right"><b><?php echo $field['desc'] ?>&nbsp;</b></td>
    <td>
        <input type="text" name="object[<?php echo $key ?>][day]" size="2" value="<?php echo $value[0] ?>" />
        <input type="text" name="object[<?php echo $key ?>][month]" size="2" value="<?php echo $value[1] ?>" />
        <input type="text" name="object[<?php echo $key ?>][year]" size="4" value="<?php echo $value[2] ?>" />
    </td>
</tr>
<?php
    else:
        $value = htmlspecialchars($this->object->getValue($key));
?>
<tr>
    <td class="light" align="right"><b><?php echo $field['desc'] ?>&nbsp;</b></td>
    <td><input type="text" name="object[<?php echo $key ?>]" size="30" value="<?php echo $value ?>" /></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>

<?php
foreach ($attributes as $key => $field):
    if (!isset($fields[$key]) || $field['type'] != 'multiline') {
        continue;
    }
    $value = htmlspecialchars($this->object->getValue($key));
?>
<tr>
    <td class="light" valign="top" align="right"><br /><b><?php echo $field['desc'] ?>&nbsp;</b></td>
    <td><textarea name="object[<?php echo $key ?>]" rows="4" wrap="hard" cols="40"><?php echo $value ?></textarea></td>
</tr>
<?php endforeach; ?>

<tr class="header">
    <td colspan="2" class="header" align="right">
        <input type="submit" class="button" name="actionID" value="<?php echo _("Save") ?>" />
        <input type="reset" class="button" name="reset" value="<?php echo _("Reset") ?>" />
    </td>
</tr>

</table>

<input type="hidden" name="source" value="<?php echo $this->object->source->name ?>" />
<input type="hidden" name="object[__owner]" value="<?php echo Auth::getAuth() ?>" />

</form>
