<div id="ctrl_<?= $this->strId ?>" class="dcawizard">
    <div class="selector_container">
        <?php if ($this->hasListCallback): ?>
            <?= $this->listCallbackContent ?>
        <?php else: ?>
        <?php if ($this->hasRows): ?>
        <table class="tl_listing showColumns">
            <thead>
                <?php foreach ($this->headerFields as $field): ?>
                <td class="tl_folder_tlist"><?= \Haste\Util\Format::dcaLabel($this->foreignTable, $field) ?></td>
                <?php endforeach; ?>
                <?php if ($this->showOperations): ?>
                <td class="tl_folder_tlist"></td>
                <?php endif; ?>
            </thead>
            <tbody>
                <?php foreach ($this->rows as $row): ?>
                <tr>
                    <?php foreach ($this->fields as $field): ?>
                    <td class="tl_file_list"><?= \Haste\Util\Format::dcaValue($this->foreignTable, $field, $row[$field], $this->dataContainer) ?></td>
                    <?php endforeach; ?>

                    <?php if ($this->showOperations): ?>
                    <td class="tl_file_list tl_right_nowrap">
                        <?php foreach ($this->operations as $operation): ?>
                        <?= $this->generateOperation($operation, $row) ?>
                        <?php endforeach; ?>
                    </td>
                    <?php endif; ?>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
        <?php elseif ($this->emptyLabel): ?>
        <p><?= $this->emptyLabel ?></p>
        <?php endif; ?>
        <?php endif; ?>

        <?php if (!$this->hideButton): ?>
        <p style="margin-top:9px;">
            <a href="<?= $this->buttonHref ?>"
               class="tl_submit"
               data-options="<?= $this->dcaWizardOptions; ?>"
               onclick="Backend.getScrollOffset();DcaWizard.openModalWindow(JSON.parse(this.getAttribute('data-options')));return false"
             >
                <?= $this->buttonLabel ?>
            </a>
        </p>
        <?php endif; ?>
    </div>
</div>

<script>
    var script = document.createElement('script');
    script.setAttribute('type', 'text/javascript');
    script.setAttribute('src', '<?= sprintf('system/modules/dcawizard/assets/dcawizard%s.js', (($GLOBALS['TL_CONFIG']['debugMode']) ? '' : '.min')) ?>');
    document.getElementsByTagName('head').item(0).appendChild(script);
</script>
