<table cellspacing="0" width="100%">
<tr>
  <td class="header" align="center" colspan="<?php echo $this->totalspan + 3 + count($this->days) ?>">
    <?php echo (!$print_view) ? Horde::link($this->link(-1), _("Last week")) . Horde::img('nav/left.png', '<', array('title' => _("Last week"), 'hspace' => '2', 'align' => 'middle'), $GLOBALS['registry']->getImageDir('horde')) . '</a>' : '' ?>
    <b><?php echo $this->days[$this->startDay]->getTime($prefs->getValue('date_format')) . ' - ' . $this->days[$this->endDay]->getTime($prefs->getValue('date_format')) ?></b>
    <?php echo (!$print_view) ? Horde::link($this->link(1), _("Next week")) . Horde::img('nav/right.png', '>', array('title' => _("Next week"), 'hspace' => '2', 'align' => 'middle'), $GLOBALS['registry']->getImageDir('horde')) . '</a>' : '' ?>
  </td>
</tr>
<tr>
  <td class="control" width="1%" align="center" colspan="3">&nbsp;</td>

<?php foreach ($this->days as $day): ?>
  <td class="control" width="1%">&nbsp;</td>
  <td class="<?php echo ($day->isToday() ? 'selected-control' : 'control') ?>" width="<?php echo round(90 / count($this->days)) ?>%" colspan="<?php echo $day->_totalspan ?>" align="center" nowrap="nowrap">
    <?php if (Kronolith::getDefaultCalendar(PERMS_EDIT) && !$print_view) {
        $addurl = Util::addParameter('addevent.php', array('month' => $day->month,
                                                           'year' => $day->year,
                                                           'mday' => $day->mday,
                                                           'url' => Horde::selfURL(true)));
        echo Horde::link(Horde::applicationUrl($addurl), _("Create a New Event"))
            . Horde::img('new_small.png', '+', array('title' => _("Create a New Event")))
            . '</a>';
    } ?>
    <b><?php echo Horde::link($day->link(), $day->getTime('%A'), 'widget') . $day->getTime('%A, %d.') ?></a></b>
  </td>
<?php endforeach; ?>
</tr>
<tr>
  <td class="control" width="1%" align="center" colspan="3">&nbsp;</td>
<?php foreach ($this->days as $day): ?>
    <td class="control" width="1%">&nbsp;</td>
    <?php foreach ($this->_currentCalendars as $cid => $cal): ?>
    <td class="<?php echo ($day->isToday() ? 'selected-control' : 'control') ?>" width="<?php echo floor((90/count($this->days)) / count($this->_currentCalendars)) ?>%" align="center" colspan="<?php echo $day->_span[$cid] ?>">
      <b><?php echo $cal->get('name') ?></b>
    </td>
    <?php endforeach; ?>
<?php endforeach; ?>
</tr>
