<form method="post" name="event" action="search.php">
<?php Util::pformInput() ?>
<input type="hidden" name="actionID" value="search_calendar" />
<table cellspacing="0" width="100%">
 <tr>
  <td align="left" class="header">
      <b><?php echo _("Advanced Search") ?></b>
  </td>
  <td align="right" class="header">
    <?php echo Horde::widget(Util::addParameter(Horde::applicationUrl('search.php'), 'search_mode', 'basic'), _("Basic Search"), 'smallheader', '', '', _("_Basic Search")) ?></a>
  </td>
 </tr>
</table>

<br/>

<table cellspacing="0">

<!-- general header -->
<tr>
 <td align="left" colspan="5" class="header">
  <span class="smallheader"><b><?php echo _("General") ?></b></span>
 </td>
</tr>

<?
$calendars = Kronolith::listCalendars(false, PERMS_EDIT);
$issearch = true;
// initialize row alternating var
$_i = 0;
require KRONOLITH_TEMPLATES . '/edit/javascript.inc';
?>
<!-- title -->
<tr>
 <td align="right" class="light"><b><?php echo Horde::label('title', _("Tit_le")) ?>&nbsp;&nbsp;</b></td>
 <td align="left" class="item<?php echo($_i++ % 2)?>" colspan="4">
  <input type="text" name="title" id="title" value="<?php echo htmlspecialchars($event->title) ?>" size="40" maxlength="255" />
 </td>
</tr>

<!-- calendar -->
<tr>
 <td align="right" class="light"><b><?php echo Horde::label('targetcalendar', _("C_alendar")) ?>&nbsp;&nbsp;</b></td>
 <td align="left" class="item<?php echo($_i++ % 2)?>" colspan="4">
    <select id="calendar" name="calendar">
    <?php
    echo '<option value="__any"' .
         (!isset($event->calendar)) ? ' selected="selected"' : '' . '>' . _("Any") .
         '</option>';
    foreach ($calendars as $id => $cal) {
        $sel = ($id == $event->calendar) ? ' selected="selected"' : '';
        echo sprintf('<option value="%s"%s>%s</option>',
                     $id, $sel, $cal->get('name')) . "\n";
    } ?>
    </select>

 </td>
</tr>

<!-- category -->
<tr>
 <td align="right" class="light">
    <b><?php echo Horde::label('category', _("Categor_y")) ?>&nbsp;&nbsp;</b>
 </td>
 <td align="left" class="item<?php echo($_i++ % 2)?>" colspan="4">
   <select id="category" name="category">
   <?php
    echo '<option value="__any"';
    echo (!isset($event->category)) ? ' selected="selected"' : '';
    echo '>' . _("Any") . '</option>';
    $categories = $cManager->get();

    foreach ($categories as $name) {
        echo '<option value="' . htmlspecialchars($name) . '"';
        echo ($event->category == $name) ? ' selected="selected">' : '>';
        echo htmlspecialchars($name) . '</option>';
     }
    ?>
    </select>
 </td>
</tr>

<!-- location -->
<tr>
 <td align="right" class="light"><b><?php echo Horde::label('location', _("Lo_cation")) ?>&nbsp;&nbsp;</b></td>
 <td align="left" class="item<?php echo($_i++ % 2)?>" colspan="4">
  <input type="text" name="location" id="location" value="<?php echo htmlspecialchars($event->location) ?>" size="40" maxlength="255" />
 </td>
</tr>

<!-- status -->
<tr>
 <td align="right" class="light">
    <b><?php echo Horde::label('status', _("Stat_us")) ?>&nbsp;&nbsp;</b>
 </td>
 <td align="left" class="item<?php echo($_i++ % 2)?>" colspan="4">
  <?php echo Kronolith::buildStatusWidget('status', $event->status, true) ?>
 </td>
</tr>

<!-- description -->
<tr>
 <td align="right" class="light"><b><?php echo Horde::label('description', _("Descri_ption")) ?>&nbsp;&nbsp;</b></td>
 <td align="left" class="item<?php echo($_i++ % 2)?>" colspan="4">
  <input type="text" name="description" id="description" value="<?php echo htmlspecialchars($event->description) ?>" size="40" maxlength="255" />
 </td>
</tr>

<?php require KRONOLITH_TEMPLATES . '/edit/edit_timespan.inc'; ?>

</table>

<br />
<div>
 <input type="submit" class="button" value="<?php echo _("Search") ?>" />&nbsp;
 <input type="reset" class="button" value="<?php echo _("Clear Form") ?>" />
</div>
</form>
