Your IP : 216.73.216.79


Current Path : /var/www/html/drsa/backend/modules/contentArticle/views/content-article/
Upload File :
Current File : /var/www/html/drsa/backend/modules/contentArticle/views/content-article/view.php

<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model backend\modules\contentArticle\models\ContentArticle */

$this->title = Yii::t('app', 'View Details Article');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Articles'), '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' => [
                    [
                        'format' => 'raw',
                        'attribute' => 'article_portal_category',
                        'value' => function ($model) {
                            $output = '';
                            if (!empty($model->article_portal_category)) {
                                $portal_arr = json_decode($model->article_portal_category);
                                if (!empty($portal_arr)) {
                                    foreach ($portal_arr as $portal_code) {

                                        $ref = (new \yii\db\Query())->select(['descr'])
                                                ->from('ref')
                                                ->where(['=', 'cat', 'PORTAL'])
                                                ->andwhere(['=', 'code', $portal_code])
                                                ->one();
                                        if (!empty($ref))
                                            $output .= '<span class="label label-warning" style="display:inline-block;">' . $ref['descr'] . '</span><br>';
                                    }
                                }
                            }
                            return $output;
                        }
                    ],
                    [
                        'attribute' => 'article_status',
                        'value' => \backend\modules\refdynawebv2\models\Ref::getDesc('CONTENT_STATUS', $model->article_status),
                    ],
                    [
                        'attribute' => 'article_category',
                        'value' => \backend\modules\refdynawebv2\models\Ref::getDesc('ARTICLECATEGORY', $model->article_category),
                    ],
                    'article_code',
                    'article_start_date',
                    'article_start_time',
                    'article_end_date',
                    'article_end_time',
                    [
                        'attribute' => 'article_source',
                        'value' => \backend\modules\refdynawebv2\models\Ref::getDesc('ARTICLESOURCE', $model->article_source, 'descr_en'),
                    ],
//                    [
//                        'attribute' => 'article_subcategory',
//                        'value' => \backend\modules\refdynawebv2\models\Ref::getDesc('ARTICLESUBCATEGORY', $model->article_subcategory, 'descr_en'),
//                    ],
                    '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\contentArticle\models\ContentArticleTranslation::find()
                    ->where(['=', 'article_translation_parent_id', $model->article_id])
                    ->orderBy(['article_translation_id' => SORT_ASC])
                    ->all();
            if (!empty($modelTranslation)) {
                foreach ($modelTranslation as $rowTranslation) {
                    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->article_translation_language) . '</td>
                            </tr>
                            <tr>
                                <th>Title</th>
                                <td>' . $rowTranslation->article_translation_title . '</td>
                            </tr>
                            <tr>
                                <th>Content</th>
                                <td>' . $rowTranslation->article_translation_content . '</td>
                            </tr>
                        </tbody>
                    </table>';
                }
            }
            ?>
        </div>
    </div>
</div>