<h1><?php echo $this->translate('event.title.setup'); ?></h1>

<h2><?php echo $this->service['name']; ?>&nbsp;&nbsp;<?php echo $this->translate('event.caption.setup'); ?></h2>

<?php
if(!empty($this->errorMessages)) {
    echo '<ul>';
    foreach($this->errorMessages as $element_name => $element_mess) {
        foreach($element_mess as $mess_key => $mess_value) {
            echo '<li>' . $this->translate("event.label.$element_name") . $mess_value . '</li>';
        }
    }
    echo '</ul>';
}
?>

<form action="<?php echo $this->appPath('controller'); ?>/commit" method="post">
<input type="hidden" name="service_id" value="<?php echo $this->escape($this->service['id']); ?>">

<table border="0" cellpadding="0" cellspacing="0" class="def" style="width:80%;">
<tbody>

<tr>
<th><?php echo $this->translate('event.label.name'); ?></th>
<th><?php echo $this->translate('event.label.enable'); ?></th>
<th><?php echo $this->translate('event.label.target'); ?></th>
<th><?php echo $this->translate('event.label.mailtemplate'); ?></th>
</tr>

<?php $count = 0; ?>
<?php foreach ($this->events as $event) : ?>
<?php $class = ($count++ % 2 ==0) ? "color":""; $id = $event['id']; ?>
<tr class="<?php echo $class; ?>">

<td style="text-align:left;">
<?php echo $this->escape($event['name']); ?>
<input type="hidden" name="event[<?php echo $id; ?>][id]" value="<?php echo $id; ?>" />
</td>

<td>
<input type="hidden" name="event[<?php echo $id; ?>][enable]" value="0" />
<?php $checked = null; if(!empty($this->form_input[$id]['enable'])) $checked = array('checked'=>true);?>
<?php echo $this->formCheckbox("event[{$event['id']}][enable]", '1', $checked); ?>
</td>

<td>
<?php if ($event['event_to'] == 0) { ?>
<input type="hidden" name="event[<?php echo $event['id']; ?>][authority_id]" value="" />
<?php $authority_id = empty($this->form_input[$id]['authority_id']) ? "" : $this->form_input[$id]['authority_id']; ?>
<?php echo $this->formSelect("event[{$event['id']}][authority_id]", $authority_id, array("multiple" => "multiple", "size" => 3), $this->authority_options); ?>
<?php } else { ?>
----<input type="hidden" name="event[<?php echo $event['id']; ?>][authority_id]" value="0<?php //echo $event['event_to']; ?>" />
<?php } ?>
</td>

<td>
<?php $mailtemplate_id = empty($this->form_input[$id]['mailtemplate_id']) ? "" : $this->form_input[$id]['mailtemplate_id']; ?>
<?php echo $this->formSelect("event[{$event['id']}][mailtemplate_id]", $mailtemplate_id, null, $this->mailtemplate_options); ?>
</td>

</tr>
<?php endforeach; ?>
</tbody>
<tfoot>
<tr>
<td colspan="4" style="text-align:left;">
<input type="hidden" name="action_user_createconfirm" value="true">
<input type='submit' style="width:80px;" value="<?php echo $this->translate('common.operation.register'); ?>">
&nbsp;&nbsp;
<input type="reset" style="width:80px;" value="<?php echo $this->translate('common.operation.reset'); ?>">
</td>
</tr>
</tfoot>
</table>


</form>


&gt;&gt;&gt;&nbsp;&nbsp;<a href="<?php echo $this->appPath(''); ?>"><?php echo $this->translate('common.operation.back_toppage'); ?></a>

