table.php 938 Bytes
Newer Older
Qiang Xue committed
1
<?php
2 3
/* @var $caption string */
/* @var $values array */
4 5 6

use yii\helpers\Html;
use yii\helpers\VarDumper;
Qiang Xue committed
7 8 9 10 11
?>
<h3><?= $caption ?></h3>

<?php if (empty($values)): ?>

12
    <p>Empty.</p>
Qiang Xue committed
13 14 15

<?php else:	?>

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    <div class="table-responsive">
        <table class="table table-condensed table-bordered table-striped table-hover request-table" style="table-layout: fixed;">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Value</th>
                </tr>
            </thead>
            <tbody>
            <?php foreach ($values as $name => $value): ?>
                <tr>
                    <th><?= Html::encode($name) ?></th>
                    <td><?= htmlspecialchars(VarDumper::dumpAsString($value), ENT_QUOTES|ENT_SUBSTITUTE, \Yii::$app->charset, true) ?></td>
                </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>
Qiang Xue committed
34 35

<?php endif; ?>