| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?php
- /**
- * Author: lf
- * Blog: https://blog.feehi.com
- * Email: job@feehi.com
- * Created at: 2016-04-14 12:09
- */
- use common\libs\Constants;
- use yii\widgets\DetailView;
- /**
- * @var $model common\models\Article
- */
- ?>
- <?= DetailView::widget([
- 'model' => $model,
- 'attributes' => [
- 'id',
- [
- 'attribute' => 'category',
- 'value' => function($model){
- return $model->category === null ? "-" : $model->category->name;
- }
- ],
- 'title',
- 'sub_title',
- 'summary',
- [
- 'attribute' => 'thumb',
- 'format' => 'raw',
- 'value' => function($model){
- return "<img style='max-width:200px;max-height:200px' src='" . $model->thumb . "' >";
- }
- ],
- 'seo_title',
- 'seo_keywords',
- 'seo_description',
- [
- 'attribute' => 'status',
- 'value' => function($model){
- return Constants::getStatusItems($model->status);
- }
- ],
- 'sort',
- 'template',
- 'author_id',
- 'author_name',
- 'scan_count',
- 'comment_count',
- [
- 'attribute' => 'can_comment',
- 'value' => function($model){
- return Constants::getYesNoItems($model->can_comment);
- }
- ],
- [
- 'attribute' => 'visibility',
- 'value' => function($model){
- return Constants::getArticleVisibility($model->visibility);
- }
- ],
- 'password',
- [
- 'attribute' => 'flag_headline',
- 'value' => function($model){
- return Constants::getYesNoItems($model->flag_headline);
- }
- ],
- [
- 'attribute' => 'flag_recommend',
- 'value' => function($model){
- return Constants::getYesNoItems($model->flag_recommend);
- }
- ],
- [
- 'attribute' => 'flag_slide_show',
- 'value' => function($model){
- return Constants::getYesNoItems($model->flag_slide_show);
- }
- ],
- [
- 'attribute' => 'flag_special_recommend',
- 'value' => function($model){
- return Constants::getYesNoItems($model->flag_special_recommend);
- }
- ],
- [
- 'attribute' => 'flag_roll',
- 'value' => function($model){
- return Constants::getYesNoItems($model->flag_roll);
- }
- ],
- [
- 'attribute' => 'flag_bold',
- 'value' => function($model){
- return Constants::getYesNoItems($model->flag_bold);
- }
- ],
- [
- 'attribute' => 'flag_picture',
- 'value' => function($model){
- return Constants::getYesNoItems($model->flag_picture);
- }
- ],
- [
- 'format' => 'raw',
- 'attribute' => 'content',
- 'value' => function($model){
- /** @var \common\models\Article $model */
- return $model->articleContent->content;
- }
- ],
- 'created_at:datetime',
- 'updated_at:datetime',
- ],
- ]) ?>
|