| Current Path : /var/www/html/ebook/backend/modules/contentPoll/views/content-poll/ |
| Current File : /var/www/html/ebook/backend/modules/contentPoll/views/content-poll/view.php |
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model backend\modules\contentAnnouncement\models\ContentAnnouncement */
$this->title = Yii::t('app', 'View Details Poll');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Poll'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$this->registerCss('.detail-view th{width:20%;text-align:right;white-space: nowrap;}');
\yii\web\YiiAsset::register($this);
?>
<div class="wrapper wrapper-content animated fadeInRight">
<?= Html::a(Yii::t('app', 'Back to list'), ['index'], ['class' => 'btn btn-primary']) ?><br><br>
<div class="ibox float-e-margins">
<div class="ibox-content">
<?php
echo DetailView::widget([
'model' => $model,
'attributes' => [
[
'attribute' => 'poll_status',
'value' => \backend\modules\refdynawebv2\models\Ref::getDesc('CONTENT_STATUS', $model->poll_status),
],
[
'attribute' => 'poll_language',
'value' => \backend\modules\refdynawebv2\models\Ref::getDesc('CONTENT_LANGUAGE', $model->poll_language),
],
'poll_question',
[
'attribute' => 'poll_answer',
'format' => 'raw',
'value' => function ($model) {
$output = '';
$poll_answer_arr = json_decode($model->poll_answer, true);
if (!empty($poll_answer_arr)) {
$output = '<ol>';
foreach ($poll_answer_arr as $poll_answer) {
$output .= '<li>' . $poll_answer . '</li>';
}
$output .= '</ol>';
}
return $output;
}
],
'created_at',
[
'attribute' => 'created_by',
'value' => \backend\modules\mimin\models\User::getname($model->created_by),
],
'updated_at',
[
'attribute' => 'updated_by',
'value' => \backend\modules\mimin\models\User::getname($model->updated_by),
],
],
]);
$modelTranslation = \backend\modules\contentPoll\models\ContentPoll::find()
->where(['=', 'poll_parent_id', $model->poll_id])
->orderBy(['poll_id' => SORT_ASC])
->all();
if (!empty($modelTranslation)) {
foreach ($modelTranslation as $rowTranslation) {
$poll_answer_list = '';
$poll_answer_arr = json_decode($rowTranslation->poll_answer, true);
if (!empty($poll_answer_arr)) {
$poll_answer_list = '<ol>';
foreach ($poll_answer_arr as $poll_answer) {
$poll_answer_list .= '<li>' . $poll_answer . '</li>';
}
$poll_answer_list .= '</ol>';
}
echo '<table class="table table-striped table-bordered detail-view">
<tbody>
<tr>
<th>Language</th>
<td>' . \backend\modules\refdynawebv2\models\Ref::getDesc('CONTENT_LANGUAGE', $rowTranslation->poll_language) . '</td>
</tr>
<tr>
<th>Question</th>
<td>' . $rowTranslation->poll_question . '</td>
</tr>
<tr>
<th>Answer</th>
<td>' . $poll_answer_list . '</td>
</tr>
</tbody>
</table>';
}
}
?>
</div>
</div>
</div>