kokjan/frontend/views/forum/view.php

85 lines
2.7 KiB
PHP

<?php
/* @var $this yii\web\View */
use yii\widgets\DetailView;
use himiklab\yii2\recaptcha\ReCaptcha;
use yii\captcha\Captcha;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\widgets\ListView;
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => $model->forumCategory->name, 'url' => ['/forum/index', 'id' => $model->forum_category_id]];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="card shadow">
<div class="card-body">
<h3><strong> <span class="fa fa-comments"></span> <?= $this->title ?></strong></h3>
<div><small><strong>โพสโดย <span class="fa fa-user-circle"></span> <?= $model->thread_by ?>
เมื่อ <span
class="fa fa-calendar"></span> <?= Yii::$app->formatter->asDatetime($model->created_at) ?>
</small></div>
</strong>
<br />
<h5> <?= \yii\helpers\HtmlPurifier::process($model->description) ?></h5>
<? /*= DetailView::widget([
'model' => $model,
'attributes' => [
'thread_by',
'tel'
]
])*/ ?>
</div>
</div>
</div>
</div>
<div class="my-4">
<h4>รายการความคิดเห็น</h4>
<?= ListView::widget([
'dataProvider' => $dataProviderComment,
'pager' => ['class' => 'yii\bootstrap4\LinkPager'],
'summary' => false,
'itemView' => '_forum_comment',
'options' => [
'class' => 'list-view row'
],
'itemOptions' => [
'tag' => false,
]
]) ?>
</div>
<div class="row my-4">
<div class="col-12">
<div class="card shadow">
<div class="card-body">
<?php $form = ActiveForm::begin(['id' => 'forum-thread-id']); ?>
<?= $form->field($comment, 'forum_comment')->textarea(['rows' => 5]) ?>
<?= $form->field($comment, 'comment_by') ?>
<!-- hCaptcha widget -->
<div class="h-captcha" data-sitekey="<?= Yii::$app->params['hcaptcha_site_key'] ?>"></div>
<?= Html::submitButton('ตอบกระทู้', ['class' => 'btn btn-success']) ?>
<?php ActiveForm::end() ?>
</div>
</div>
</div>
</div>
</div>
<!-- โหลด hCaptcha JS -->
<script src="https://hcaptcha.com/1/api.js" async defer></script>