
<div class="<?= $this->class ?> ce_table listing block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>>

  <?php if ($this->headline): ?>
    <<?= $this->hl ?>><?= $this->headline ?></<?= $this->hl ?>>
  <?php endif; ?>

  <?php if ($this->searchable): ?>
    <div class="list_search">
      <form action="<?= $this->action ?>" method="get">
        <div class="formbody">
          <input type="hidden" name="order_by" value="<?= $this->order_by ?>" />
          <input type="hidden" name="sort" value="<?= $this->sort ?>" />
          <input type="hidden" name="per_page" value="<?= $this->per_page ?>" />
          <label for="ctrl_search" class="invisible"><?= $this->fields_label ?></label>
          <select name="search" id="ctrl_search" class="select">
            <?= $this->search_fields ?>
          </select>
          <label for="ctrl_for" class="invisible"><?= $this->keywords_label ?></label>
          <input type="text" name="for" id="ctrl_for" class="text" value="<?= $this->for ?>" />
          <input type="submit" class="submit" value="<?= $this->search_label ?>" />
        </div>
      </form>
    </div>
  <?php endif; ?>

  <?php if ($this->per_page): ?>
    <div class="list_per_page">
      <form action="<?= $this->action ?>" method="get">
        <div class="formbody">
          <input type="hidden" name="order_by" value="<?= $this->order_by ?>" />
          <input type="hidden" name="sort" value="<?= $this->sort ?>" />
          <input type="hidden" name="search" value="<?= $this->search ?>" />
          <input type="hidden" name="for" value="<?= $this->for ?>" />
          <label for="ctrl_per_page" class="invisible"><?= $this->per_page_label ?></label>
          <select name="per_page" id="ctrl_per_page" class="select">
            <option value="10"<?php if ($this->per_page == 10): ?> selected="selected"<?php endif; ?>>10</option>
            <option value="20"<?php if ($this->per_page == 20): ?> selected="selected"<?php endif; ?>>20</option>
            <option value="30"<?php if ($this->per_page == 30): ?> selected="selected"<?php endif; ?>>30</option>
            <option value="50"<?php if ($this->per_page == 50): ?> selected="selected"<?php endif; ?>>50</option>
            <option value="100"<?php if ($this->per_page == 100): ?> selected="selected"<?php endif; ?>>100</option>
            <option value="250"<?php if ($this->per_page == 250): ?> selected="selected"<?php endif; ?>>250</option>
            <option value="500"<?php if ($this->per_page == 500): ?> selected="selected"<?php endif; ?>>500</option>
          </select>
          <input type="submit" class="submit" value="<?= $this->per_page_label ?>" />
        </div>
      </form>
    </div>
  <?php endif; ?>

  <table class="all_records">
  <thead>
    <tr>
      <?php foreach ($this->thead as $col): ?>
        <th class="head<?= $col['class'] ?>"><a href="<?= $col['href'] ?>" title="<?= $col['title'] ?>"><?= $col['link'] ?></a></th>
      <?php endforeach; ?>
      <?php if ($this->details): ?>
        <th class="head col_last">&nbsp;</th>
      <?php endif; ?>
    </tr>
  </thead>
  <tbody>
    <?php foreach ($this->tbody as $class=>$row): ?>
      <tr class="<?= $class ?>">
        <?php foreach ($row as $col): ?>
          <td class="body <?= $col['class'] ?>"><?= $col['content'] ?></td>
        <?php endforeach; ?>
        <?php if ($this->details && isset($col)): ?>
          <?php if ($col['details']): ?>
            <td class="body <?= $this->col_last ?> col_last"><a href="<?= $col['url'] ?>"><?= Image::getHtml('assets/contao/images/info.gif') ?></a></td>
          <?php else: ?>
            <td class="body <?= $this->col_last ?> col_last">&nbsp;</td>
          <?php endif; ?>
        <?php endif; ?>
      </tr>
    <?php endforeach; ?>
  </tbody>
  </table>

  <?= $this->pagination ?>

</div>
