Example #1
0
    public function init()
    {
        if (!$this->simpleUploadBtnTitle) {
            $this->simpleUploadBtnTitle = \Yii::t('app', "Add files");
        }
        parent::init();
        $clientOptions = ArrayHelper::merge($this->defaultClientOptions(), $this->clientOptions);
        $clientOptionsString = \yii\helpers\Json::encode($clientOptions);
        \skeeks\cms\modules\admin\assets\ActionFilesAsset::register($this->getView());
        $this->view->registerJs(<<<JS
        (function(sx, \$, _)
        {
            sx.FileManager = new sx.classes.DefaultFileManager('#sx-file-manager', {$clientOptionsString});
        })(sx, sx.\$, sx._);
JS
);
    }
Example #2
0
    public function init()
    {
        parent::init();
        $clientOptions = ArrayHelper::merge($this->defaultClientOptions(), $this->clientOptions);
        $options = ['commonData' => ['group' => $this->fileGroup], 'simpleUploadButtons' => ['source-simpleUpload-' . $this->id, 'source-simpleUpload-2-' . $this->id], 'remoteUploadButtonSelector' => '.source-remoteUpload-' . $this->id, 'allUploadProgressSelector' => '.sx-progress-bar-' . $this->id, 'oneFileUploadProgressSelector' => '.sx-progress-bar-file-' . $this->id];
        $clientOptions = ArrayHelper::merge($clientOptions, $options);
        $clientOptionsString = \yii\helpers\Json::encode($clientOptions);
        \skeeks\cms\modules\admin\assets\ActionFilesAsset::register($this->getView());
        $fileManagerId = "sx-file-manager-{$this->id}";
        $this->view->registerJs(<<<JS
        (function(sx, \$, _)
        {
            new sx.classes.CustomFileManager('#{$fileManagerId}', {$clientOptionsString});

        })(sx, sx.\$, sx._);
JS
);
    }