<?php
if (file_exists('./config/development.config.php')) {
    ?>
    <h1>An error occurred</h1>
    <h2><?php echo $this->message ?></h2>

    <?php if (! empty($this->display_exceptions)) : ?>
        <?php if (isset($this->exception)
            && ($this->exception instanceof \Exception || $this->exception instanceof \Error)) : ?>
            <hr/>

            <h2>Additional information:</h2>
            <h3><?php echo get_class($this->exception) ?></h3>
            <dl>
                <dt>File:</dt>
                <dd>
                    <pre><?php echo $this->exception->getFile() ?>:<?php echo $this->exception->getLine() ?></pre>
                </dd>
                <dt>Message:</dt>
                <dd>
                    <pre><?php echo $this->escapeHtml($this->exception->getMessage()) ?></pre>
                </dd>
                <dt>Stack trace:</dt>
                <dd>
                    <pre><?php echo $this->escapeHtml($this->exception->getTraceAsString()) ?></pre>
                </dd>
            </dl>

            <?php if ($ex = $this->exception->getPrevious()) : ?>
                <hr/>

                <h2>Previous exceptions:</h2>
                <ul class="list-unstyled">
                    <?php $icount = 0 ?>
                    <?php while ($ex) : ?>
                        <li>
                            <h3><?php echo get_class($ex) ?></h3>
                            <dl>
                                <dt>File:</dt>
                                <dd>
                                    <pre><?php echo $ex->getFile() ?>:<?php echo $ex->getLine() ?></pre>
                                </dd>
                                <dt>Message:</dt>
                                <dd>
                                    <pre><?php echo $this->escapeHtml($ex->getMessage()) ?></pre>
                                </dd>
                                <dt>Stack trace:</dt>
                                <dd>
                                    <pre><?php echo $this->escapeHtml($ex->getTraceAsString()) ?></pre>
                                </dd>
                            </dl>
                        </li>
                        <?php
                        $ex = $ex->getPrevious();
                        if (++$icount >= 50) {
                            echo '<li>There may be more exceptions, but we do not have enough memory to process it.</li>';
                            break;
                        }
                        ?>
                    <?php endwhile ?>
                </ul>
            <?php endif ?>
        <?php else : ?>
            <h3>No Exception available</h3>
        <?php endif ?>
    <?php endif ?>
<?php } else {
    //当在生产环境时，取消下面的注释
    $this->layout()->setTemplate('error/404');
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title><?php echo $this->translate('哎呀…您访问的页面不存在'); ?></title>
        <style>
            *{margin:0;padding:0}
            body{font-family:"微软雅黑";background:#DAD9D7}
            img{border:none}
            a *{cursor:pointer}
            ul,li{list-style:none}
            table{table-layout:fixed;}
            table tr td{word-break:break-all; word-wrap:break-word;}

            a{text-decoration:none;outline:none}
            a:hover{text-decoration:underline}
            .cf:after{content: ".";display: block;height: 0;font-size: 0;clear:both;visibility: hidden;}
            .cf{zoom: 1;clear:both}

            .bg{width:100%;background:url("<?php echo $this->basePath('upload/common/404/01.jpg'); ?>") no-repeat center top #DAD9D7;position:absolute;top:0;left:0;height:600px;overflow:hidden}
            .cont{margin:0 auto;width:500px;line-height:20px;}
            .c1{height:360px;text-align:center}
            .c1 .img1{margin-top:180px}
            .c1 .img2{margin-top:165px}
            .cont h2{text-align:center;color:#555;font-size:18px;font-weight:normal;height:35px}
            .c2{height:35px;text-align:center}
            .c2 a{display:inline-block;margin:0 4px;font-size:14px;height:23px;color:#626262;padding-top:1px;text-decoration:none;text-align:left}
            .c2 a:hover{color:#626262;text-decoration:none;}
            .c2 a.home{width:66px;background:url("<?php echo $this->basePath('upload/common/404/02.png'); ?>");padding-left:30px}
            .c2 a.home:hover{background:url("<?php echo $this->basePath('upload/common/404/02.png'); ?>") 0 -24px}
            .c2 a.home:active{background:url("<?php echo $this->basePath('upload/common/404/02.png'); ?>") 0 -48px}
            .c2 a.re{width:66px;background:url("<?php echo $this->basePath('upload/common/404/03.png'); ?>");padding-left:30px}
            .c2 a.re:hover{background:url("<?php echo $this->basePath('upload/common/404/03.png'); ?>") 0 -24px}
            .c2 a.re:active{background:url("<?php echo $this->basePath('upload/common/404/03.png'); ?>") 0 -48px}
            .c2 a.sr{width:153px;background:url("<?php echo $this->basePath('upload/common/404/04.png'); ?>");padding-left:28px}
            .c2 a.sr:hover{background:url("<?php echo $this->basePath('upload/common/404/04.png'); ?>") 0 -24px}
            .c2 a.sr:active{background:url("<?php echo $this->basePath('upload/common/404/04.png'); ?>") 0 -48px}
            .c3{height:180px;text-align:center;color:#999;font-size:12px}
        </style>

    </head>
    <body>
    <div class="bg">
        <div class="cont">
            <div class="c1"><img src="<?php echo $this->basePath('upload/common/404/01.png'); ?>" class="img1" /></div>
            <h2><?php echo $this->translate('哎呀…出现了一个小问题'); ?></h2>
            <div class="c2">
                <a href="<?php echo $this->url('home'); ?>" class="home"><?php echo $this->translate('返回首页'); ?></a>
                <a href="https://bbs.dbshop.net" target="_blank" class="sr"><?php echo $this->translate('去官方论坛反馈一下'); ?></a>
            </div>
            <div class="c3"><a href="https://www.dberp.net/" class="c3">DBERP 进销存系统</a></div>
        </div>
    </div>
    </body>
    </html>
<?php } ?>