Inheritance: extends yii\base\Widget
コード例 #1
0
ファイル: select-file.php プロジェクト: skeeks-cms/cms
            $search = new \skeeks\cms\models\Search(\skeeks\cms\models\StorageFile::className());
            $dataProvider = $search->getDataProvider();

            $dataProvider->sort->defaultOrder = [
                'created_at' => SORT_DESC
            ];

        ?>
        <?php 
echo \skeeks\cms\widgets\StorageFileManager::widget(['clientOptions' => ['completeUploadFile' => new \yii\web\JsExpression(<<<JS
                function(data)
                {
                    _.delay(function()
                    {
                        \$.pjax.reload('#sx-storage-files', {});
                    }, 500)

                }
JS
)]]);
?>
        <p></p>
        <? $dataProvider->pagination->defaultPageSize = 10; ?>
        <?php 
echo \skeeks\cms\modules\admin\widgets\GridViewHasSettings::widget(['dataProvider' => $dataProvider, 'filterModel' => $search->getLoadedModel(), 'pjaxOptions' => ['id' => 'sx-storage-files'], 'columns' => [['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\StorageFile $model) {
    return \yii\helpers\Html::a('<i class="glyphicon glyphicon-circle-arrow-left"></i> ' . \Yii::t('skeeks/cms', 'Choose file'), $model->src, ['class' => 'btn btn-primary', 'onclick' => 'sx.SelectFile.submit("' . $model->src . '"); return false;', 'data-pjax' => 0]);
}, 'format' => 'raw'], ['class' => \skeeks\cms\modules\admin\grid\ActionColumn::className(), 'controller' => \Yii::$app->createController('cms/admin-storage-files')[0], 'isOpenNewWindow' => true], ['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\StorageFile $model) {
    if ($model->isImage()) {
        $smallImage = \Yii::$app->imaging->getImagingUrl($model->src, new \skeeks\cms\components\imaging\filters\Thumbnail());
        return "<a href='" . $model->src . "' data-pjax='0' class='sx-fancybox' title='" . \Yii::t('skeeks/cms', 'Increase') . "'>\n                                    <img src='" . $smallImage . "' />\n                                </a>";
コード例 #2
0
ファイル: model-storage-files.php プロジェクト: Liv1020/cms
    </div>

    <?php 
\skeeks\cms\modules\admin\widgets\Pjax::end();
?>

    <div class="sx-controlls">
        <?php 
echo \skeeks\cms\widgets\StorageFileManager::widget(['clientOptions' => ['simpleUpload' => ['options' => ['multiple' => true]], 'completeUploadFile' => new \yii\web\JsExpression(<<<JS
                function(data)
                {
                    var result = data.response;
                    if (result.success === true)
                    {

                        var SingleUpload = new sx.classes.MultiUpload( _.extend({$widget->getJsonString()}, {
                            'file_id' : result.file.id,
                        }) );

                        SingleUpload.execute();
                    }

                    \$.pjax.reload('#pjax-storage-images-widget-{$widget->id}', {});
                }
JS
)]]);
?>
    </div>
</div>

コード例 #3
0
ファイル: index.php プロジェクト: skeeks-cms/cms
 * @since 1.0.0
 */
/* @var $this yii\web\View */
/* @var $searchModel common\models\searchs\Game */
/* @var $dataProvider yii\data\ActiveDataProvider */
?>


<? $pjax = \skeeks\cms\modules\admin\widgets\Pjax::begin(); ?>

<? $pjaxId = $pjax->id; ?>
<?php 
echo \skeeks\cms\widgets\StorageFileManager::widget(['clientOptions' => ['completeUploadFile' => new \yii\web\JsExpression(<<<JS
        function(data)
        {
            \$.pjax.reload('#{$pjaxId}', {});
        }
JS
)]]);
?>
<p></p>

    <?php 
echo $this->render('_search', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
?>

<?php 
echo \skeeks\cms\modules\admin\widgets\GridViewStandart::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'adminController' => $controller, 'pjax' => $pjax, 'pjaxOptions' => ['id' => 'sx-storage-files'], 'columns' => [['class' => \yii\grid\DataColumn::className(), 'value' => function (\skeeks\cms\models\StorageFile $model) {
    if ($model->isImage()) {
        $smallImage = \Yii::$app->imaging->getImagingUrl($model->src, new \skeeks\cms\components\imaging\filters\Thumbnail());
        return "<a href='" . $model->src . "' class='sx-fancybox' data-pjax='0' title='" . \Yii::t('skeeks/cms', 'Increase') . "'>\n                            <img src='" . $smallImage . "' style='max-width: 50px;'/>\n                        </a>";