<?php use yii\helpers\Html; use kartik\grid\GridView; ?> <div class="row"> <div class="col-xs-12"> <?php $thumbnailSize = \Yii::$app->controller->module->thumbnailSize; echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => false, 'export' => false, 'pjax' => true, 'columns' => [['class' => 'yii\\grid\\DataColumn', 'format' => 'html', 'contentOptions' => ['style' => "width: {$thumbnailSize[0]}px; height: {$thumbnailSize[1]}px"], 'value' => function ($model) { $fileType = $model->mime_type; if ($model->dimension) { $fileType = 'image'; } return dpodium\filemanager\components\Filemanager::getThumbnail($fileType, $model->object_url . $model->src_file_name); }], 'caption', 'alt_text', 'description', ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'mime_type', 'filter' => false], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}', 'buttons' => ['update' => function ($url, $model) use($view) { $url = \Yii::$app->urlManager->createUrl(['/filemanager/files/update', 'id' => $model['file_id'], 'view' => $view]); return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('filemanager', 'Edit')]); }, 'delete' => function ($url, $model) { $url = \Yii::$app->urlManager->createUrl(['/filemanager/files/delete', 'id' => $model['file_id']]); return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, ['title' => Yii::t('filemanager', 'Delete'), 'data-method' => 'post', 'data-confirm' => Yii::t('filemanager', 'Confirm delete {src_file_name} ?', ['src_file_name' => $model['src_file_name']])]); }]]]]); ?> </div> </div>
</div> <?php } ?> <div class="row"> <div class="col-lg-4 col-md-4 col-xs-12"> <?php if ($uploadType === 'full-page') { ?> <div style="text-align: center;"> <?php $fileType = $model->mime_type; if ($model->dimension) { $fileType = 'image'; } echo dpodium\filemanager\components\Filemanager::getThumbnail($fileType, $model->object_url . $model->src_file_name, "250px", "250px"); ?> </div> <?php } ?> </div> <div class="<?php echo $uploadType === 'full-page' ? 'col-lg-8 col-md-8 col-xs-12' : 'col-xs-12'; ?> "> <?php $tagDisplayValue = json_encode($model->tags); $objectUrl = $model->object_url . $model->src_file_name; $btnCopyToClipboard = Html::button('<i class="fa fa-copy"></i>', ['class' => 'btn-copy btn-xs', 'title' => Yii::t('filemanager', 'Copy')]); echo DetailView::widget(['model' => $model, 'attributes' => ['src_file_name', 'thumbnail_name', ['label' => $model->folder->getAttributeLabel('storage'), 'value' => $model->folder->storage], ['label' => $model->folder->getAttributeLabel('category'), 'value' => $model->folder->category], 'mime_type', 'dimension', ['label' => $model->getAttributeLabel('object_url'), 'format' => 'raw', 'value' => Html::tag('div', $objectUrl, ['class' => 'copy-object-url', 'style' => 'float: left']) . $btnCopyToClipboard], ['label' => $model->getAttributeLabel('caption'), 'format' => 'raw', 'value' => Editable::widget(['model' => $model, 'attribute' => 'caption', 'asPopover' => false])], ['label' => $model->getAttributeLabel('alt_text'), 'format' => 'raw', 'value' => Editable::widget(['model' => $model, 'attribute' => 'alt_text', 'asPopover' => false])], ['label' => $model->getAttributeLabel('description'), 'format' => 'raw', 'value' => Editable::widget(['model' => $model, 'attribute' => 'description', 'asPopover' => false, 'submitOnEnter' => false, 'inputType' => Editable::INPUT_TEXTAREA])], ['label' => $model->getAttributeLabel('tags'), 'format' => 'raw', 'value' => Editable::widget(['model' => $model, 'attribute' => 'tags', 'asPopover' => false, 'submitOnEnter' => false, 'inputType' => Editable::INPUT_SELECT2, 'displayValue' => implode(', ', $editableTagsLabel), 'options' => ['data' => $tags, 'options' => ['multiple' => true, 'placeholder' => Yii::t('filemanager', 'Enter or select tags...')], 'pluginOptions' => ['tags' => true, 'maximumInputLength' => 32]], 'pluginEvents' => ['editableReset' => "function(event) {\n jQuery('#' + event.currentTarget.id + ' .kv-editable-parent .input-group select').select2('val', {$tagDisplayValue});\n }"]])], 'created_at:dateTime', 'updated_at:dateTime']]);
<?php use yii\helpers\Html; use kartik\grid\GridView; ?> <div class="row"> <div class="col-xs-12"> <?php $thumbnailSize = \Yii::$app->controller->module->thumbnailSize; $gridWidth = $thumbnailSize[0] + 40; echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => false, 'export' => false, 'pjax' => true, 'columns' => [['class' => 'yii\\grid\\DataColumn', 'format' => 'html', 'contentOptions' => ['style' => "width: {$gridWidth}px; text-align: center;"], 'value' => function ($model) { $fileType = $model->mime_type; if ($model->dimension) { $fileType = 'image'; } return dpodium\filemanager\components\Filemanager::getThumbnail($fileType, $model->getFileUrl(true)); }], 'caption', 'alt_text', 'description', ['class' => 'yii\\grid\\DataColumn', 'attribute' => 'mime_type', 'filter' => false], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}', 'buttons' => ['update' => function ($url, $model) use($view) { $url = \Yii::$app->urlManager->createUrl(['/filemanager/files/update', 'id' => $model['file_id'], 'view' => $view]); return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, ['title' => Yii::t('filemanager', 'Edit')]); }, 'delete' => function ($url, $model) { $url = \Yii::$app->urlManager->createUrl(['/filemanager/files/delete', 'id' => $model['file_id']]); return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, ['title' => Yii::t('filemanager', 'Delete'), 'data-method' => 'post', 'data-confirm' => Yii::t('filemanager', 'Confirm delete {src_file_name} ?', ['src_file_name' => $model['src_file_name']])]); }]]]]); ?> </div> </div>