Inheritance: extends yii\base\Widget
    /**
     * Runs the widget.
     */
    public function run()
    {
        // Print elfinder widget in modal
        Modal::begin(['toggleButton' => false, 'id' => $this->options['id'] . '-dialog', 'size' => Modal::SIZE_LARGE]);
        echo ElFinder::widget(['language' => $this->language, 'controller' => $this->controller, 'path' => $this->path, 'filter' => 'image', 'callbackFunction' => new JsExpression('function(file, id){

                console.log( file.url, "' . $this->buttonOptions['id'] . '" );

                $("#' . $this->options['id'] . '").val( file.url );
                $("#' . $this->options['id'] . '-thumb").attr("src", file.url ).show();
                $("#' . $this->options['id'] . '-dialog").modal("hide");

            }'), 'path' => $this->path, 'frameOptions' => ['style' => 'width: 100%; height: 500px; border: 0px;']]);
        Modal::end();
        // Render input and upload button
        if ($this->hasModel()) {
            $attr = $this->attribute;
            $hidden = $this->model->{$attr} ? '' : 'display:none;';
            $replace['{image}'] = '<img id="' . $this->options['id'] . '-thumb" class="thumbnail" src="' . $this->model->{$attr} . '" style="max-width: 150px; max-height: 150px; ' . $hidden . '" />';
            $replace['{input}'] = Html::activeTextInput($this->model, $this->attribute, $this->options);
        } else {
            $hidden = $this->value ? '' : 'display:none;';
            $replace['{image}'] = '<img id="' . $this->options['id'] . '-thumb" src="' . $this->value . '"  style="max-width: 150px; max-height: 150px; ' . $hidden . '" />';
            $replace['{input}'] = Html::textInput($this->name, $this->value, $this->options);
        }
        $replace['{button}'] = Html::tag($this->buttonTag, $this->buttonName, $this->buttonOptions);
        echo strtr($this->template, $replace);
        // Publish assets
        AssetsCallBack::register($this->getView());
        if (!empty($this->multiple)) {
            $this->getView()->registerJs("\n\n            mihaildev.elFinder.register(" . Json::encode($this->options['id']) . ",\n                function(files, id){\n                    var _f = [];\n                    for (var i in files) { _f.push(files[i].url); }\n                    \$('#' + id).val(_f.join(', ')).trigger('change');\n                    return true;\n                });\n\n            \$(document).on('click','#" . $this->buttonOptions['id'] . "',\n                function(){\n                    mihaildev.elFinder.openManager(" . Json::encode($this->_managerOptions) . ");\n                }\n            );");
        } else {
            $this->getView()->registerJs("\n\n                mihaildev.elFinder.register(" . Json::encode($this->options['id']) . ", function(file, id){\n                    \$('#' + id).val(file.url).trigger('change');\n                    return true;\n                });\n\n                \$(document).on('click',\n                    '#" . $this->buttonOptions['id'] . "',\n                    function(){\n                        //mihaildev.elFinder.openManager(" . Json::encode($this->_managerOptions) . ");\n                        \$('#" . $this->options['id'] . "-dialog').modal('show');\n                    }\n                );");
        }
    }
Example #2
0
 public function init()
 {
     parent::init();
     if (empty($this->language)) {
         $this->language = ElFinder::getSupportedLanguage(\Yii::$app->language);
     }
     if (empty($this->options['id'])) {
         $this->options['id'] = $this->getId();
     } else {
         $this->setId($this->options['id']);
     }
     $managerOptions = [];
     if (!empty($this->filter)) {
         $managerOptions['filter'] = $this->filter;
     }
     $managerOptions['callback'] = $this->getId() . "_manager";
     if (!empty($this->language)) {
         $managerOptions['lang'] = $this->language;
     }
     if (!empty($this->path)) {
         $managerOptions['path'] = $this->path;
     }
     $this->_managerOptions['url'] = ElFinder::getManagerUrl($this->controller, $managerOptions);
     $this->_managerOptions['width'] = $this->width;
     $this->_managerOptions['height'] = $this->height;
     $this->_managerOptions['id'] = $managerOptions['callback'];
 }
Example #3
0
 public function init()
 {
     if ($this->controller === null) {
         $this->controller = Adm::getInstance()->id . '/elfinder';
     }
     parent::init();
 }
 public function getManagerOptions()
 {
     $options = ['url' => Url::toRoute('connect'), 'customData' => [Yii::$app->request->csrfParam => Yii::$app->request->csrfToken], 'resizable' => false];
     if (isset($_GET['CKEditor'])) {
         $options['getFileCallback'] = new JsExpression('function(file){ ' . 'window.opener.CKEDITOR.tools.callFunction(' . Json::encode($_GET['CKEditorFuncNum']) . ', file.url); ' . 'window.close(); }');
         $options['lang'] = $_GET['langCode'];
     }
     if (isset($_GET['filter'])) {
         if (is_array($_GET['filter'])) {
             $options['onlyMimes'] = $_GET['filter'];
         } else {
             $options['onlyMimes'] = [$_GET['filter']];
         }
     }
     if (isset($_GET['lang'])) {
         $options['lang'] = $_GET['lang'];
     }
     if (isset($_GET['callback'])) {
         if (isset($_GET['multiple'])) {
             $options['commandsOptions']['getfile']['multiple'] = true;
         }
         $options['getFileCallback'] = new JsExpression('function(file){ ' . 'if (window!=window.top) {var parent = window.parent;}else{var parent = window.opener;}' . 'if(parent.mihaildev.elFinder.callFunction(' . Json::encode($_GET['callback']) . ', file))' . 'window.close(); }');
     }
     if (!isset($options['lang'])) {
         $options['lang'] = ElFinder::getSupportedLanguage(Yii::$app->language);
     }
     if (!empty($this->disabledCommands)) {
         $options['commands'] = new JsExpression('ElFinderGetCommands(' . Json::encode($this->disabledCommands) . ')');
     }
     return ArrayHelper::merge($options, $this->managerOptions);
 }
Example #5
0
 public function init()
 {
     if (empty($this->language)) {
         $this->language = self::getSupportedLanguage(Yii::$app->language);
     }
     $managerOptions = [];
     if (!empty($this->filter)) {
         $managerOptions['filter'] = $this->filter;
     }
     if (!empty($this->callbackFunction)) {
         $managerOptions['callback'] = $this->id;
     }
     if (!empty($this->language)) {
         $managerOptions['lang'] = $this->language;
     }
     if (!empty($this->path)) {
         $managerOptions['path'] = $this->path;
     }
     if (!empty($this->startPath)) {
         $managerOptions['#'] = ElFinder::genPathHash($this->startPath);
     }
     $this->frameOptions['src'] = $this->getManagerUrl($this->controller, $managerOptions);
     if (!isset($this->frameOptions['style'])) {
         $this->frameOptions['style'] = "width: 100%; height: 100%; border: 0;";
     }
 }
Example #6
0
 public function init()
 {
     parent::init();
     if (empty($this->language)) {
         $this->language = ElFinder::getSupportedLanguage(Yii::$app->language);
     }
     if (empty($this->buttonOptions['id'])) {
         $this->buttonOptions['id'] = $this->options['id'] . '_button';
     }
     $this->buttonOptions['type'] = 'button';
     $managerOptions = [];
     if (!empty($this->filter)) {
         $managerOptions['filter'] = $this->filter;
     }
     $managerOptions['callback'] = $this->options['id'];
     if (!empty($this->language)) {
         $managerOptions['lang'] = $this->language;
     }
     if (!empty($this->multiple)) {
         $managerOptions['multiple'] = $this->multiple;
     }
     if (!empty($this->path)) {
         $managerOptions['path'] = $this->path;
     }
     $this->_managerOptions['url'] = ElFinder::getManagerUrl($this->controller, $managerOptions);
     $this->_managerOptions['width'] = $this->width;
     $this->_managerOptions['height'] = $this->height;
     $this->_managerOptions['id'] = $this->options['id'];
 }
Example #7
0
 /**
  * @param string $lang
  * @param \yii\web\View $view
  */
 public static function addLangFile($lang, $view)
 {
     $lang = ElFinder::getSupportedLanguage($lang);
     if ($lang !== false && $lang !== 'en') {
         $view->registerJsFile(self::getPathUrl() . '/js/i18n/elfinder.' . $lang . '.js', ['depends' => [Assets::className()]]);
     }
 }
Example #8
0
 /**
  * @param string $lang
  * @param \yii\web\View $view
  */
 public static function addLangFile($lang, $view)
 {
     $lang = ElFinder::getSupportedLanguage($lang);
     if ($lang !== false && $lang !== 'en') {
         list(, $path) = \Yii::$app->assetManager->publish(__DIR__ . "/assets");
         $view->registerJsFile($path . '/js/i18n/elfinder.' . $lang . '.js', ['depends' => [Assets::className()]]);
     }
 }
Example #9
0
 /**
  * Executes the widget.
  * @return string the result of widget execution to be outputted.
  */
 public function run()
 {
     $ckeditorOptions = [];
     if ($this->removeFirstTag) {
         $ckeditorOptions['enterMode'] = new JsExpression('CKEDITOR.ENTER_BR');
     }
     $ckeditorOptions = ArrayHelper::merge($ckeditorOptions, $this->clientOptions);
     $options = ArrayHelper::merge(['initOnEvent' => 'focus', 'options' => ['class' => 'form-control form-redactor']], $this->options);
     $options['editorOptions'] = ElFinder::ckeditorOptions(Adm::getInstance()->id . '/elfinder', $ckeditorOptions);
     return $this->form->field($this->model, $this->attribute)->widget(CKEditor::className(), $options);
 }
Example #10
0
 public function init()
 {
     parent::init();
     $bundle = \yii\bootstrap\BootstrapAsset::register(\Yii::$app->view);
     $this->editorOptions = \mihaildev\elfinder\ElFinder::ckeditorOptions('/admin/file-manager-elfinder', ['preset' => 'full', 'extraPlugins' => 'codemirror', 'entities' => false, 'allowedContent' => true, 'baseHref' => \Yii::$app->homeUrl, 'contentsCss' => [$bundle->baseUrl . '/css/bootstrap.css', '/main.css']]);
 }
Example #11
0
/* @var $this yii\web\View */
/* @var $model app\modules\appointment\models\Locality */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="locality-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'contact')->widget(\mihaildev\ckeditor\CKEditor::className(), ['editorOptions' => \mihaildev\elfinder\ElFinder::ckeditorOptions('elfinder')]);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton('Сохранить', ['class' => 'btn btn-success']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Example #12
0
<?php

/* @var $this yii\web\View */
$this->title = Yii::t('backend', 'File Manager');
?>

<div class="row">
    <div class="col-xs-12">
        <?php 
echo \mihaildev\elfinder\ElFinder::widget(['language' => 'zh_CN', 'controller' => 'file-manager-elfinder', 'frameOptions' => ['style' => 'min-height: 500px; width: 100%; border: 0']]);
?>
    </div>
</div>
Example #13
0
 protected function launch()
 {
     switch ($this->editor) {
         case self::EDITOR_CKEDITOR_BASIC:
             echo CKEditor::widget(['model' => $this->model, 'attribute' => $this->attribute, 'name' => $this->name, 'value' => $this->value, 'options' => ['class' => 'form-control', 'rows' => 10], 'editorOptions' => ElFinder::ckeditorOptions('media/manager', array_merge($this->ckEditorOptions, ['filebrowserBrowseUrl' => ['/menu/backend/item/ckeditor-select'], 'preset' => 'basic', 'tabSpaces' => 4, 'autoGrow_onStartup' => true, 'autoGrow_bottomSpace' => 50]))]);
             break;
         case self::EDITOR_CKEDITOR_STANDARD:
             echo CKEditor::widget(['model' => $this->model, 'attribute' => $this->attribute, 'name' => $this->name, 'value' => $this->value, 'options' => ['class' => 'form-control', 'rows' => 10], 'editorOptions' => ElFinder::ckeditorOptions('media/manager', array_merge($this->ckEditorOptions, ['filebrowserBrowseUrl' => ['/menu/backend/item/ckeditor-select'], 'preset' => 'standard', 'tabSpaces' => 4, 'autoGrow_onStartup' => true, 'autoGrow_bottomSpace' => 50]))]);
             break;
         case self::EDITOR_CKEDITOR_FULL:
             echo CKEditor::widget(['model' => $this->model, 'attribute' => $this->attribute, 'name' => $this->name, 'value' => $this->value, 'options' => ['class' => 'form-control', 'rows' => 10], 'editorOptions' => ElFinder::ckeditorOptions('media/manager', array_merge($this->ckEditorOptions, ['filebrowserBrowseUrl' => ['/menu/backend/item/ckeditor-select'], 'preset' => 'full', 'tabSpaces' => 4, 'autoGrow_onStartup' => true, 'autoGrow_bottomSpace' => 50]))]);
             break;
         case self::EDITOR_IMPERAVI:
             echo Imperavi::widget(['model' => $this->model, 'attribute' => $this->attribute, 'name' => $this->name, 'value' => $this->value, 'settings' => $this->imperaviOptions]);
             break;
         default:
             echo $this->hasModel() ? Html::activeTextarea($this->model, $this->attribute, $this->options) : Html::textarea($this->name, $this->value, $this->options);
     }
 }
Example #14
0
        <?php 
echo $form->field($model, 'state')->checkbox();
?>

        <hr>

        <?php 
echo $form->field($model, 'intro')->widget(\mihaildev\ckeditor\CKEditor::className(), ['editorOptions' => \mihaildev\elfinder\ElFinder::ckeditorOptions(['elfinder', 'path' => '/'], ['preset' => 'standart', 'allowedContent' => true, 'height' => '200px', 'toolbar' => Yii::$app->zoo->cke_editor_toolbar, 'contentsCss' => Yii::$app->zoo->cke_editor_css])]);
?>

        <?php 
echo $form->field($model, 'content')->widget(\mihaildev\ckeditor\CKEditor::className(), ['editorOptions' => \mihaildev\elfinder\ElFinder::ckeditorOptions(['elfinder', 'path' => '/'], ['preset' => 'standart', 'allowedContent' => true, 'height' => '200px', 'toolbar' => Yii::$app->zoo->cke_editor_toolbar, 'contentsCss' => Yii::$app->zoo->cke_editor_css])]);
?>

        <?php 
echo $form->field($model, 'quote')->widget(\mihaildev\ckeditor\CKEditor::className(), ['editorOptions' => \mihaildev\elfinder\ElFinder::ckeditorOptions(['elfinder', 'path' => '/'], ['preset' => 'standart', 'allowedContent' => true, 'height' => '200px', 'toolbar' => Yii::$app->zoo->cke_editor_toolbar, 'contentsCss' => Yii::$app->zoo->cke_editor_css])]);
?>

        <hr>

        <?php 
echo $form->field($model, 'metaTitle')->textInput(['maxlength' => true, 'class' => 'uk-width-1-1']);
?>

        <?php 
echo $form->field($model, 'metaDescription')->textarea(['rows' => 2, 'class' => 'uk-width-1-1']);
?>

        <?php 
echo $form->field($model, 'metaKeywords')->textInput(['maxlength' => true, 'class' => 'uk-width-1-1']);
?>
Example #15
0
// $form->field($model, 'informasi')->widget(TinyMce::className(), [
//     'options' => ['rows' => 15],
//     'clientOptions' => [
//      'content_style'=>'p {font-size:15px;}',
//         'plugins' => [
//             "advlist autolink lists link charmap print preview anchor",
//             "searchreplace visualblocks code fullscreen",
//             "insertdatetime media table contextmenu paste"
//         ],
//         'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
//     ]
// ]);
?>
 
<?php 
echo $form->field($model, 'informasi')->widget(CKEditor::className(), ['editorOptions' => ElFinder::ckeditorOptions(['elfinder', 'path' => 'some/sub/path'], ['preset' => Yii::$app->devicedetect->isMobile() ? 'basic' : 'full', 'skin' => 'office2013'])]);
?>



  <?php 
echo $form->field($model, 'status')->dropDownList(DataKerja::status(), ['maxlength' => true]);
?>

    <?php 
//= $form->field($model, 'created_at')->textInput()
?>

    <?php 
//= $form->field($model, 'modified_at')->textInput()
?>
Example #16
0
?>

            <?php 
echo $form->field($model, 'type')->dropDownList($pageTypesMap);
?>
        </div>

        <div id="editor-wrapper" class="col-md-9">

            <div class="row" data-type="<?php 
echo Page::TYPE_CONTENT;
?>
" style="display: none">
                <div class="col-md-12">
                    <?php 
echo $form->field($model, 'content')->widget(CKEditor::className(), ['editorOptions' => ElFinder::ckeditorOptions('elfinder-backend', ['height' => 300])]);
?>
                </div>
            </div>

            <div class="row" data-type="<?php 
echo Page::TYPE_BLOCKS;
?>
" style="display: none">
                <?php 
echo $this->render('_blocks', ['model' => $model]);
?>
            </div>

        </div>
Example #17
0
 public function init()
 {
     $this->editorOptions = \mihaildev\elfinder\ElFinder::ckeditorOptions('/admin/file-manager-elfinder', ['preset' => 'full', 'extraPlugins' => 'sourcedialog', 'allowedContent' => true, 'inline' => true, 'height' => 'auto']);
     parent::init();
 }
Example #18
0
<?php

use mihaildev\elfinder\InputFile;
use mihaildev\elfinder\ElFinder;
use yii\web\JsExpression;
//mihaildev\elfinder\Assets::noConflict($this);
$this->title = Yii::t('backend', 'File Manager');
?>

<div class="row">
    <div class="col-xs-12">
        <?php 
echo ElFinder::widget(['language' => 'ru', 'controller' => 'elfinder', 'filter' => ['image', 'application'], 'frameOptions' => ['style' => 'min-height: 500px; width: 100%; border: 0']]);
?>
    </div>
</div>


Example #19
0
</a></li>
            <li><a href="#meta-options" data-toggle="tab"><?php 
echo Yii::t('gromver.platform', 'Metadata');
?>
</a></li>
        </ul>
        <br/>
        <div class="tab-content">
            <div id="main-options" class="tab-pane active">
                <div class="form-group container">
                    <?php 
echo Html::activeLabel($model, 'detail_text');
?>
                    <div>
                        <?php 
echo \mihaildev\ckeditor\CKEditor::widget(['model' => $model, 'attribute' => 'detail_text', 'editorOptions' => \mihaildev\elfinder\ElFinder::ckeditorOptions('grom/media/manager', ['extraPlugins' => 'codesnippet'])]);
?>
                    </div>
                </div>
                <?php 
echo $form->field($model, 'language')->dropDownList(Yii::$app->getLanguagesList(), ['prompt' => Yii::t('gromver.platform', 'Select ...'), 'id' => 'language']);
?>

                <?php 
echo $form->field($model, 'category_id')->widget(\kartik\widgets\DepDrop::className(), ['pluginOptions' => ['depends' => ['language'], 'placeholder' => Yii::t('gromver.platform', 'Select ...'), 'url' => \yii\helpers\Url::to(['categories', 'selected' => $model->category_id])]]);
?>

                <?php 
echo $form->field($model, 'status')->dropDownList(['' => Yii::t('gromver.platform', 'Select ...')] + $model->statusLabels());
?>
Example #20
0
File: _form.php Project: apuc/admin
                <a data-toggle='modal' data-target='#myModal' href='#'>Обзор</a> |
                <a class = 'del_img_pages' href = '#'>Удалить</a>
            </div>
            <?php 
echo $form->field($model, 'images')->textInput(['maxlength' => true])->hiddenInput()->label(false);
?>
            <div class="cleared"></div>
            <br>
            <?/*= $form->field($model, 'count_product')->textInput() */?><!--
            --><?/*= $form->field($model, 'hint')->textInput(['maxlength' => true]) */?>
            <?php 
echo $form->field($model, 'fix_menu')->dropDownList(['0' => 'Не прикреплять', '1' => 'Меню 1-го уровня', '2' => 'Меню 2-го уровня']);
?>

            <?php 
echo $form->field($model, 'description')->widget(CKEditor::className(), ['editorOptions' => \mihaildev\elfinder\ElFinder::ckeditorOptions('elfinder', ['preset' => 'standard', 'inline' => false])]);
?>
        </div>
        <div id="panel2" class="tab-pane fade <?php 
echo $tabContent2;
?>
">
            <h3>Вид</h3>
            <?php 
echo $form->field($model, 'blokc_id')->dropDownList($block);
?>
            <?php 
echo Html::button('Добавить блок', ['class' => 'btn btn-success', 'id' => 'addCustBlock']);
?>
            <br>
            <hr>
Example #21
0
<?php

/* @var $this yii\web\View */
use mihaildev\elfinder\InputFile;
use mihaildev\elfinder\ElFinder;
use yii\web\JsExpression;
?>

<?php 
echo ElFinder::widget(['language' => 'ru', 'frameOptions' => ['style' => 'height:100%;width:100%;'], 'containerOptions' => ['style' => 'height:calc(100vh - 70px);width:100%;'], 'controller' => 'elfinder', 'filter' => ['image', 'application', 'text', 'video'], 'callbackFunction' => new JsExpression('function(file, id){}')]);
Example #22
0
?>

    <?php 
echo $form->errorSummary($model);
?>

    <?php 
echo $form->field($model, 'title')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'short_text')->widget(CKEditor::className(), ['editorOptions' => ElFinder::ckeditorOptions('elfinder-backend', ['preset' => 'basic'])]);
?>

    <?php 
echo $form->field($model, 'text')->widget(CKEditor::className(), ['editorOptions' => ElFinder::ckeditorOptions('elfinder-backend')]);
?>

    <?php 
echo $form->field($model, 'slug')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'status')->dropDownList(Post::getStatuses());
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('blog', 'Create') : Yii::t('blog', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>
Example #23
0
<?php

use mihaildev\elfinder\ElFinder;
?>

    
<div class="container-fluid" style="height:800px">

    <?php 
echo 'File Manager';
echo ElFinder::widget(['language' => 'en', 'controller' => 'blog/elfinder', 'filter' => 'image', 'containerOptions' => ['resizable' => 'true', 'style' => 'height:100%']]);
?>

</div>

Example #24
0
<?php

/**
 * @var $this \yii\web\View
 */
use mihaildev\elfinder\ElFinder;
use yii\helpers\Html;
$this->title = Yii::t('cms', 'Files');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="files-index">

    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">
                <?php 
echo Html::encode($this->title);
?>
            </h1>
        </div>
    </div>

    <?php 
echo ElFinder::widget(['controller' => 'elfinder-backend', 'frameOptions' => ['style' => 'min-height: 500px; width:100%']]);
?>

</div>
Example #25
0
<?php

/**
 * index
 *
 * @author Semenov Alexander <*****@*****.**>
 * @link http://skeeks.com/
 * @copyright 2010-2014 SkeekS (Sx)
 * @date 06.02.2015
 * @since 1.0.0
 */
?>

<?php 
echo \mihaildev\elfinder\ElFinder::widget(['language' => \Yii::$app->admin->languageCode, 'controller' => 'cms/elfinder-full', 'callbackFunction' => new \yii\web\JsExpression('function(file, id){}'), 'frameOptions' => ['style' => 'width: 100%; height: 800px;']]);
/*echo \mihaildev\elfinder\InputFile::widget([
    'language'   => 'ru',
    'controller' => 'cms/elfinder', // вставляем название контроллера, по умолчанию равен elfinder
    'filter'     => 'image',    // фильтр файлов, можно задать массив фильтров https://github.com/Studio-42/elFinder/wiki/Client-configuration-options#wiki-onlyMimes
    'name'       => 'myinput',
    'value'      => '',
]);*/
Example #26
0
<?php

/**
 * @package   yii2-cms
 * @author    Yuri Shekhovtsov <*****@*****.**>
 * @copyright Copyright &copy; Yuri Shekhovtsov, lowbase.ru, 2015 - 2016
 * @version   1.0.0
 */
use mihaildev\elfinder\ElFinder;
use yii\web\JsExpression;
$this->title = 'Файловый менеджер';
echo ElFinder::widget(['language' => 'ru', 'controller' => 'elfinder', 'filter' => 'image', 'callbackFunction' => new JsExpression('function(file, id){}'), 'frameOptions' => ['style' => "width: 100%; height: 500px; border: 0;"]]);
Example #27
0
<?php

use mihaildev\ckeditor\CKEditor;
use mihaildev\elfinder\ElFinder;
use yii\web\View;
/**
 * @var $form \yii\widgets\ActiveForm
 * @var $block \nullref\cms\blocks\html\Block
 * @var $this \yii\web\View
 */
list(, $footnotesUrl) = Yii::$app->assetManager->publish('@nullref/cms/assets/ckeditor-plugins/codemirror');
$this->registerJs("CKEDITOR.plugins.addExternal( 'codemirror', '" . $footnotesUrl . "/','plugin.js');\nObject.keys(CKEDITOR.dtd.\$removeEmpty).forEach(function(key){CKEDITOR.dtd.\$removeEmpty[key] = 0;});\n", View::POS_END);
$editorConfig = ['id' => 'editor', 'editorOptions' => ['preset' => 'full', 'inline' => false, 'extraPlugins' => 'codemirror', 'allowedContent' => true, 'basicEntities' => false, 'entities' => false, 'entities_greek' => false, 'entities_latin' => false, 'htmlEncodeOutput' => false, 'entities_processNumerical' => false, 'fillEmptyBlocks' => false, 'fullPage' => false, 'codemirror' => ['autoCloseBrackets' => true, 'autoCloseTags' => true, 'autoFormatOnStart' => true, 'autoFormatOnUncomment' => true, 'continueComments' => true, 'enableCodeFolding' => true, 'enableCodeFormatting' => true, 'enableSearchTools' => true, 'highlightMatches' => true, 'indentWithTabs' => false, 'lineNumbers' => true, 'lineWrapping' => true, 'mode' => 'htmlmixed', 'matchBrackets' => true, 'matchTags' => true, 'showAutoCompleteButton' => true, 'showCommentButton' => true, 'showFormatButton' => true, 'showSearchButton' => true, 'showTrailingSpace' => true, 'showUncommentButton' => true, 'styleActiveLine' => true, 'theme' => 'default', 'useBeautify' => true]]];
$editorConfig['editorOptions'] = ElFinder::ckeditorOptions('elfinder-backend', $editorConfig['editorOptions']);
echo $form->field($block, 'content')->widget(CKEditor::className(), $editorConfig);
echo $form->field($block, 'tag')->textInput();
echo $form->field($block, 'tagClass')->textInput();
 protected function launch()
 {
     switch ($this->editor) {
         case self::EDITOR_CKEDITOR_BASIC:
             echo CKEditor::widget(['model' => $this->model, 'attribute' => $this->attribute, 'name' => $this->name, 'value' => $this->value, 'options' => ['class' => 'form-control', 'rows' => 10], 'editorOptions' => ElFinder::ckeditorOptions('grom/media/manager', ['filebrowserBrowseUrl' => ['/grom/menu/backend/item/ckeditor-select'], 'extraPlugins' => 'codesnippet', 'preset' => 'basic', 'tabSpaces' => 4])]);
             break;
         case self::EDITOR_CKEDITOR_STANDARD:
             echo CKEditor::widget(['model' => $this->model, 'attribute' => $this->attribute, 'name' => $this->name, 'value' => $this->value, 'options' => ['class' => 'form-control', 'rows' => 10], 'editorOptions' => ElFinder::ckeditorOptions('grom/media/manager', ['filebrowserBrowseUrl' => ['/grom/menu/backend/item/ckeditor-select'], 'extraPlugins' => 'codesnippet', 'preset' => 'standard', 'tabSpaces' => 4])]);
             break;
         case self::EDITOR_CKEDITOR_FULL:
             echo CKEditor::widget(['model' => $this->model, 'attribute' => $this->attribute, 'name' => $this->name, 'value' => $this->value, 'options' => ['class' => 'form-control', 'rows' => 10], 'editorOptions' => ElFinder::ckeditorOptions('grom/media/manager', ['filebrowserBrowseUrl' => ['/grom/menu/backend/item/ckeditor-select'], 'extraPlugins' => 'codesnippet', 'preset' => 'full', 'tabSpaces' => 4])]);
             break;
         case self::EDITOR_IMPERAVI:
             echo Widget::widget(['model' => $this->model, 'attribute' => $this->attribute, 'name' => $this->name, 'value' => $this->value]);
             break;
         default:
             echo $this->hasModel() ? Html::activeTextarea($this->model, $this->attribute, $this->options) : Html::textarea($this->name, $this->value, $this->options);
     }
 }
Example #29
0
?>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-12">
            <?php 
echo $form->field($model, 'annotation')->textarea(['rows' => 2]);
?>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-12">
            <?php 
echo $form->field($model, 'content')->widget(CKEditor::className(), ['editorOptions' => ElFinder::ckeditorOptions('elfinder', [])]);
?>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-6">
            <?php 
echo $form->field($model, 'image')->widget(InputFile::className(), ['controller' => 'elfinder', 'filter' => 'image', 'template' => '<div class="input-group">
                                                {input}<span class="input-group-btn">{button}</span>
                                            </div>', 'options' => ['class' => 'form-control'], 'buttonName' => Yii::t('document', 'Выбрать файл'), 'buttonOptions' => ['class' => 'btn btn-default'], 'multiple' => false]);
?>
        </div>
        <div class="col-lg-6">
            <?php 
echo $form->field($model, 'position')->textInput(['maxlength' => true]);
Example #30
0
    	<div class="col-lg-4"><?php 
echo $form->field($model, 'published')->dropDownList($model->publishedList, [$model->published]);
?>
</div>
    	<div class="col-lg-4"><?php 
echo $form->field($model, 'created_by')->dropDownList($model->authorsList, [$model->created_by]);
?>
</div>
    </div>

    <?php 
echo $form->field($model, 'intro')->textarea(['rows' => 6]);
?>
    
	<?php 
echo $form->field($model, 'text')->widget(CKEditor::className(), ['editorOptions' => ElFinder::ckeditorOptions('elfinder', ['preset' => 'full', 'inline' => false])]);
?>

    
    <?php 
if ($model->image != '') {
    ?>
    <div class="row form-group">
    	<div class="col-lg-4">
    		<img src="<?php 
    echo $model->imageUrl;
    ?>
" alt="" class="img-responsive img-thumbnail" />
    		<br>
    		<?php 
    echo $form->field($model, 'image')->textInput()->label(false);