<?php
final class KanriView extends View {
    /**
     * (non-PHPdoc)
     * @see View::preRender()
     */
    protected function preRender() {
        $contents = file_get_contents(WEB . 'pc' . DIRECTORY_SEPARATOR . 'tpl' . DIRECTORY_SEPARATOR . 'kanri.tpl');
        $tpl = '';
        $res = $this->response->get('tournaments');
        for ($i = 0, $j = count($res); $i < $j; $i++) {
            $row = $res[$i];
            $row['no'] = $i + 1;
            if (empty($row['main_image'])) {
                $row['gazo'] = '画像なし';
            } else {
                $row['gazo'] = '<a href="/resource/' . $row['main_image'] . '" target="_blank">画像確認</a>';
            }
            if ($row['apply_flag'] == 1) {
                $row['button'] = '';
                $row['status'] = '<a href="/entry_list?uno=' . $row['user_no'] . '&tno=' . $row['tournament_no']
                        . '" target="_blank">参加者一覧</a>';
            } else {
                $row['button'] = '<input type="submit" name="submit" value="許可">';
                $row['status'] = '許可待ち';
            }
            $tpl .= GenerateUtil::staticCreate($contents, $row);
        }
        $this->response->set('kanri_tpl', $tpl);
    }
}
// EOF.
