Your IP : 216.73.216.79


Current Path : /var/www/html/persada/backend/modules/contentStatistics/views/content-statistics/
Upload File :
Current File : /var/www/html/persada/backend/modules/contentStatistics/views/content-statistics/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 Statistic');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Statistics'), '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' => 'stats_status',
                        'value' => \backend\modules\refdynawebv2\models\Ref::getDesc('CONTENT_STATUS', $model->stats_status),
                    ],
//                    [
//                        'attribute' => 'stats_type',
//                        'value' => \backend\modules\refdynawebv2\models\Ref::getDesc('STATS_TYPE', $model->stats_type),
//                    ],
                    [
                        'attribute' => 'stats_language',
                        'value' => \backend\modules\refdynawebv2\models\Ref::getDesc('CONTENT_LANGUAGE', $model->stats_language),
                    ],
                    'stats_title',
                    [
                        'attribute' => 'stats_content',
                        'format' => 'raw',
                    ],
                    'stats_code',
                    [
                        'attribute' => 'stats_img',
                        'format' => 'raw',
                        'value' => function ($model) {
                            $output = '';
                            if (!empty($model->stats_img))
                                $output = '<img src="' . Yii::getAlias('@web') . '/' . $model->stats_img . '" height="100">';
                            return $output;
                        }
                    ],
//                    [
//                        'attribute' => 'stats_item',
//                        'format' => 'raw',
//                        'value' => function ($model) {
//                            $output = '';
//                            $stats_item_arr = json_decode($model->stats_item, true);
//                            if (!empty($stats_item_arr)) {
//                                $output = '<div class="row">
//                                    <div class="col-sm-4"><b>Category</b></div>
//                                    <div class="col-sm-4"><b>Subcategory</b></div>
//                                    <div class="col-sm-4"><b>Figure</b></div>
//                                </div>';
//                                foreach ($stats_item_arr as $stats_item) {
//                                    $output .= '<div class="row">
//                                        <div class="col-sm-4">' . $stats_item['category'] . '</div>
//                                        <div class="col-sm-4">' . $stats_item['subcategory'] . '</div>
//                                        <div class="col-sm-4">' . $stats_item['figure'] . '</div>
//                                    </div>';
//                                }
//                            }
//                            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\contentStatistics\models\ContentStatistics::find()
                    ->where(['=', 'stats_parent_id', $model->stats_id])
                    ->orderBy(['stats_id' => SORT_ASC])
                    ->all();
            if (!empty($modelTranslation)) {
                foreach ($modelTranslation as $rowTranslation) {
                    $output_trans = '';
                    $stats_item_arr = json_decode($rowTranslation->stats_item, true);
                    if (!empty($stats_item_arr)) {
                        $output_trans = '<div class="row">
                                    <div class="col-sm-4"><b>Category</b></div>
                                    <div class="col-sm-4"><b>Subcategory</b></div>
                                    <div class="col-sm-4"><b>Figure</b></div>
                                </div>';
                        foreach ($stats_item_arr as $stats_item) {
                            $output_trans .= '<div class="row">
                                        <div class="col-sm-4">' . $stats_item['category'] . '</div>
                                        <div class="col-sm-4">' . $stats_item['subcategory'] . '</div>
                                        <div class="col-sm-4">' . $stats_item['figure'] . '</div>
                                    </div>';
                        }
                    }

                    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->stats_language) . '</td>
                            </tr>
                            <tr>
                                <th>Title</th>
                                <td>' . $rowTranslation->stats_title . '</td>
                            </tr>
                            <tr>
                                <th>Description</th>
                                <td>' . $rowTranslation->stats_content . '</td>
                            </tr>
                            <!--tr>
                                <th>Item</th>
                                <td>' . $output_trans . '</td>
                            </tr-->
                        </tbody>
                    </table>';
                }
            }
            ?>
        </div>
    </div>
</div>