view.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <?php
  2. use common\models\Interview;
  3. use slavkovrn\lightbox\LightBoxWidget;
  4. use yii\grid\GridView;
  5. use yii\helpers\Html;
  6. use yii\helpers\Url;
  7. use yii\widgets\DetailView;
  8. /* @var $this yii\web\View */
  9. /* @var $model common\models\Interview */
  10. $this->title = $model->title;
  11. $this->params['breadcrumbs'][] = ['label' => Yii::t('common', 'Interviews'), 'url' => ['index']];
  12. $this->params['breadcrumbs'][] = $this->title;
  13. ?>
  14. <p>
  15. <?= Html::a(Yii::t('common', '更新访谈信息'), ['update', 'id' => $model->id], ['class' => 'btn btn-success']) ?>
  16. <?= Html::a(Yii::t('common', 'Create Interview Log'), ['/interview-log/create', 'interview_id' => $model->id, 'origin' => Yii::$app->request->url], ['class' => 'btn btn-success', 'title' => Yii::t('common', 'Create Interview Log'), 'target' => '_blank']) ?>
  17. <?= Html::a(Yii::t('common', 'Create Goods Index'), ['/goods-index/create', 'entity' => Interview::className(), 'entity_id' => $model->id, 'origin' => Yii::$app->request->url], ['class' => 'btn btn-success', 'title' => Yii::t('common', 'Create Goods Index'), 'target' => '_blank']) ?>
  18. <?= Html::a(Yii::t('common', '删除访谈'), ['delete', 'id' => $model->id], [
  19. 'class' => 'btn btn-danger',
  20. 'data' => [
  21. 'confirm' => Yii::t('common', 'Are you sure you want to delete this item?'),
  22. 'method' => 'post',
  23. ],
  24. ]) ?>
  25. </p>
  26. <div class="nav-tabs-custom">
  27. <ul class="nav nav-tabs">
  28. <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true">访谈信息</a></li>
  29. <li><a href="#tab_2" data-toggle="tab" aria-expanded="true">访谈记录</a></li>
  30. <li><a href="#tab_3" data-toggle="tab" aria-expanded="true">关联商品</a></li>
  31. </ul>
  32. <div class="tab-content">
  33. <div class="tab-pane active" id="tab_1">
  34. <?= DetailView::widget([
  35. 'model' => $model,
  36. 'attributes' => [
  37. 'id',
  38. [
  39. 'attribute' => 'cover',
  40. 'format' => 'raw',
  41. 'value' => function ($model) {
  42. $images = [ // images at popup window of prettyPhoto galary
  43. 1 => [
  44. 'src' => $model->cover,
  45. 'title' => '',
  46. ],
  47. ];
  48. return $model->cover ? LightBoxWidget::widget([
  49. 'id' => 'cover', // id of plugin should be unique at page
  50. 'class' => 'galary', // class of plugin to define style
  51. 'height' => '100px', // height of image visible in widget
  52. 'width' => '100px', // width of image visible in widget
  53. 'images' => $images,
  54. ]) : null;
  55. }
  56. ],
  57. [
  58. 'attribute' => 'banner',
  59. 'format' => 'raw',
  60. 'value' => function ($model) {
  61. $images = [];
  62. foreach ($model->banner as $index => $banner) {
  63. $images[$index] = ['src' => $banner, 'title' => ''];
  64. }
  65. return $model->banner ? LightBoxWidget::widget([
  66. 'id' => 'banner', // id of plugin should be unique at page
  67. 'class' => 'galary', // class of plugin to define style
  68. 'height' => '100px', // height of image visible in widget
  69. 'width' => '100px', // width of image visible in widget
  70. 'images' => $images,
  71. ]) : null;
  72. }
  73. ],
  74. [
  75. 'attribute' => 'picture',
  76. 'format' => 'raw',
  77. 'value' => function ($model) {
  78. $images = [];
  79. foreach ($model->picture as $index => $picture) {
  80. $images[$index] = ['src' => $picture, 'title' => ''];
  81. }
  82. return $model->picture ? LightBoxWidget::widget([
  83. 'id' => 'picture', // id of plugin should be unique at page
  84. 'class' => 'galary', // class of plugin to define style
  85. 'height' => '100px', // height of image visible in widget
  86. 'width' => '100px', // width of image visible in widget
  87. 'images' => $images,
  88. ]) : null;
  89. }
  90. ],
  91. [
  92. 'attribute' => 'vid',
  93. 'format' => 'raw',
  94. 'value' => function ($model){
  95. return '<iframe frameborder="0" src="https://v.qq.com/txp/iframe/player.html?vid='.$model->vid.'" allowFullScreen="true"></iframe>';
  96. }
  97. ],
  98. [
  99. 'attribute' => 'compere_id',
  100. 'format' => 'raw',
  101. 'value' => function ($model) {
  102. if (!empty($model->compere)) {
  103. return Html::a($model->compere->name, \yii\helpers\Url::to(['/compere/view', 'id' => $model->compere_id]), ['title' => '详情', 'target' => '_blank']);
  104. } else {
  105. return '无';
  106. }
  107. },
  108. ],
  109. [
  110. 'attribute' => 'master_id',
  111. 'format' => 'raw',
  112. 'value' => function ($model) {
  113. if (!empty($model->master)) {
  114. return Html::a($model->master->name, \yii\helpers\Url::to(['/master/view', 'id' => $model->master_id]), ['title' => '详情', 'target' => '_blank']);
  115. } else {
  116. return '无';
  117. }
  118. },
  119. ],
  120. 'title',
  121. 'desc',
  122. [
  123. 'attribute' => 'province',
  124. 'format' => 'raw',
  125. 'value' => function ($model) {
  126. return \common\models\Region::getNameById($model->province);
  127. },
  128. ],
  129. [
  130. 'attribute' => 'city',
  131. 'format' => 'raw',
  132. 'value' => function ($model) {
  133. return \common\models\Region::getNameById($model->city);
  134. },
  135. ],
  136. [
  137. 'attribute' => 'area',
  138. 'format' => 'raw',
  139. 'value' => function ($model) {
  140. return \common\models\Region::getNameById($model->area);
  141. },
  142. ],
  143. 'address',
  144. 'created_at:datetime',
  145. 'updated_at:datetime',
  146. [
  147. 'attribute' => 'status',
  148. 'value' => function ($model) {
  149. return Interview::getStatusList($model->status);
  150. },
  151. ],
  152. ],
  153. ]) ?>
  154. </div>
  155. <!-- 访谈记录-->
  156. <div class="tab-pane " id="tab_2">
  157. <?= GridView::widget([
  158. 'dataProvider' => $log['data'],
  159. 'columns' => [
  160. 'id',
  161. 'interview_id',
  162. 'type',
  163. 'content',
  164. 'created_at',
  165. 'updated_at',
  166. 'status',
  167. [
  168. 'class' => 'common\helpers\DiyActionColumn',
  169. 'template' => '{update} {delete}',
  170. 'buttons' => [
  171. 'update' => function ($url, $model, $key) {
  172. return Html::a(Yii::t('yii', 'Update'), Url::to(['/interview-log/update', 'id' => $model->id, 'origin' => Yii::$app->request->url]), [
  173. 'class' => 'btn btn-success btn-xs',
  174. 'title' => Yii::t('common', 'Update Interview Log'),
  175. 'target' => '_blank'
  176. ]);
  177. },
  178. 'delete' => function ($url, $model, $key) {
  179. return Html::a('删除', Url::to(['/interview-log/delete', 'id' => $model->id, 'origin' => Yii::$app->request->url]), [
  180. 'class' => 'btn btn-success btn-xs',
  181. 'title' => Yii::t('common', '删除访谈记录'),
  182. 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'),
  183. 'data-method' => 'post',
  184. ]);
  185. },
  186. ],
  187. ],
  188. ],
  189. ]); ?>
  190. </div>
  191. <!-- 管理商品列表管理-->
  192. <div class="tab-pane " id="tab_3">
  193. <?= GridView::widget([
  194. 'dataProvider' => $index['data'],
  195. //'filterModel' => $searchModel,
  196. 'columns' => [
  197. 'id',
  198. 'goods_id',
  199. 'entity',
  200. 'entity_id',
  201. 'attribute',
  202. [
  203. 'class' => 'common\helpers\DiyActionColumn',
  204. 'template' => '{update} {delete}',
  205. 'buttons' => [
  206. 'update' => function ($url, $model, $key) {
  207. return Html::a(Yii::t('yii', 'Update'), Url::to(['/goods-index/update', 'id' => $model->id, 'origin' => Yii::$app->request->url]), [
  208. 'class' => 'btn btn-success btn-xs',
  209. 'title' => Yii::t('common', 'Update Goods Index'),
  210. 'target' => '_blank'
  211. ]);
  212. },
  213. 'delete' => function ($url, $model, $key) {
  214. return Html::a('删除', Url::to(['/goods-index/delete', 'id' => $model->id, 'origin' => Yii::$app->request->url]), [
  215. 'class' => 'btn btn-success btn-xs',
  216. 'title' => Yii::t('common', '删除关联商品'),
  217. 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'),
  218. 'data-method' => 'post',
  219. ]);
  220. },
  221. ],
  222. ],
  223. ],
  224. ]); ?>
  225. </div>
  226. </div>
  227. </div>