public function run() { $settings = ArrayHelper::merge($this->getDefaultSettings(), $this->settings); $content = ''; foreach (Yii::$app->lang->getLanguages() as $langKey => $langTitle) { $htmlOptions = ['class' => '']; $htmlOptions['data-ml-language'] = $langTitle; if ($langKey != Yii::$app->lang->get()) { $htmlOptions['class'] .= ' hidden'; $attributeName = $this->attribute . '_' . $langKey; } else { $attributeName = $this->attribute; } $content .= Html::tag('div', Widget::widget(['model' => $this->model, 'attribute' => $attributeName, 'settings' => $settings, 'plugins' => $this->plugins]), $htmlOptions); } $groupName = str_replace('\\', '', get_class($this->model) . '_' . $this->attribute . '_' . 'multilang'); $content = Html::tag('div', $content, ['data-ml-group' => $groupName, 'class' => 'ml-group-wrapper']); Yii::$app->view->registerJs('$.fn.m22Multilang.register(\'[data-ml-group="' . $groupName . '"]\')', View::POS_READY); foreach ($this->css as $style => $options) { Yii::$app->view->registerCssFile($style, $options); } return $content; }
<?php use yii\helpers\Html; use vova07\imperavi\Widget as Redactor; use porcelanosa\yii2options\models\OptionsList; use yii\helpers\Url; /** * @var $optionList OptionsList * @var $option_name string * @var $richTextValue string * @var $behavior \porcelanosa\yii2options\OptionsBehavior */ ?> <div id="rich-text-<?php echo $optionList->name; ?> "> <label> <?php echo $optionList->name; ?> </label> <?php echo Html::textarea($option_name, $richTextValue, ['id' => $option_name]); ?> <?php echo Redactor::widget(['selector' => '#' . $option_name, 'settings' => ['lang' => 'ru', 'minHeight' => 200, 'maxHeight' => 600, 'structure' => true, 'imageManagerJson' => Url::to(['/options/images/images-get']), 'fileManagerJson' => Url::to(['/options/images/files-get']), 'imageUpload' => Url::to(['/options/images/image-upload']), 'fileUpload' => Url::to(['/options/images/file-upload']), 'plugins' => ['clips', 'fullscreen']]]); ?> </div>
<?php use vova07\imperavi\Widget; use yii\bootstrap\Tabs; use yii\helpers\Html; use yii\helpers\Url; use yii\web\JsExpression; /** * @var yii\web\View $this * @var string $attribute * @var array $options * @var array $languages */ $tabs = []; foreach ($languages as $language) { if ($options['redactor']) { $content = Widget::widget(['model' => $model->translate($language->locale), 'attribute' => "[{$language->locale}]" . $attribute, 'name' => $model->translate($language->locale)->formName() . "[{$language->locale}][" . $attribute . "]", 'options' => ['class' => 'wysiwygTextArea'], 'settings' => ['lang' => Yii::$app->getModule('radiata')->activeLanguage['code'], 'minHeight' => 300, 'pastePlainText' => true, 'buttonSource' => true, 'replaceDivs' => false, 'plugins' => ['fullscreen', 'imagemanager', 'filemanager'], 'imageUpload' => Url::to([$options['urlPreffix'] . 'image-upload']), 'imageManagerJson' => Url::to([$options['urlPreffix'] . 'images-get']), 'fileManagerJson' => Url::to([$options['urlPreffix'] . 'files-get']), 'fileUpload' => Url::to([$options['urlPreffix'] . 'file-upload']), 'callbacks' => ['change' => new JsExpression('function() { }')]]]); } else { $content = Html::$options['type']($model->translate($language->locale), "[{$language->locale}]" . $attribute, ['class' => 'form-control' . $options['additionalCssClasses']]); } $tabs[] = ['label' => '<i class="iconflags iconflags-' . $language->code . '"></i> ' . $language->code, 'encode' => false, 'content' => $content, 'active' => $language->locale == Yii::$app->language, 'linkOptions' => ['lang' => $language->locale, 'class' => 'lang-tab-a', 'title' => $language->locale]]; } if (count($languages) > 1) { echo Tabs::widget(['items' => $tabs, 'id' => $options['id']]); } else { echo $tabs[0]['content']; }
/* @var $model common\models\Post */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="post-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => 255]); ?> <?php echo \vova07\imperavi\Widget::widget(['model' => $model, 'attribute' => 'content', 'settings' => ['lang' => 'ru', 'minHeight' => 200, 'imageUpload' => Url::to(['/post/image-upload']), 'imageManagerJson' => Url::to(['/post/images-get']), 'fileUpload' => Url::to(['/post/file-upload']), 'fileManagerJson' => Url::to(['/post/files-get']), 'plugins' => ['fullscreen', 'filemanager', 'imagemanager', 'video']]]); ?> <?php echo $form->field($model, 'category_id')->dropDownList($model->categoryList()); ?> <?php echo $form->field($model, 'active')->checkbox(); ?> <?php echo $form->field($model, 'featured')->checkbox(); ?> <?php
<?php use yii\bootstrap\Modal; use app\models\R; use yii\helpers\Html; Modal::begin(['tag' => 'span', 'size' => 'modal-lg', 'header' => '<h4><b>Отправка на рассмотрение менеджеру</b><h4>', 'toggleButton' => ['label' => ''], 'footer' => '<button class="btn btn-primary" onclick="send(this, ' . $assignment->id . ')"><span></span> Отправить</button>', 'id' => 'viewDo_' . $assignment->id]); echo \vova07\imperavi\Widget::widget(['name' => 'report_text', 'id' => 'text_' . $assignment->id, 'settings' => ['lang' => 'ru', 'minHeight' => 200, 'plugins' => ['clips', 'fullscreen', 'fontsize', 'fontcolor']]]); echo \kato\DropZone::widget(['options' => ['maxFilesize' => '10', 'url' => 'upload/'], 'dropzoneContainer' => 'dropzone' . $assignment->id, 'previewsContainer' => 'dropzone' . $assignment->id]); Modal::end();
<?php use vova07\imperavi\Widget; ?> <div class="col-md-12"> <div class="row"> <?php echo $form->field($modelHotelData, 'lang_id[]')->hiddenInput(['value' => $language->local])->label(false); ?> <div class="control-label">Description</div> <?php echo Widget::widget(['name' => 'HotelData[description][]', 'value' => $modelHotelData->description, 'settings' => ['minHeight' => 200, 'plugins' => ['clips']]]); ?> <div class="control-label">Location</div> <?php echo Widget::widget(['name' => 'HotelData[location][]', 'value' => $modelHotelData->location, 'settings' => ['minHeight' => 200, 'plugins' => ['clips']]]); ?> <div class="control-label">Price information</div> <?php echo Widget::widget(['name' => 'HotelData[price_information][]', 'value' => $modelHotelData->price_information, 'settings' => ['minHeight' => 200, 'plugins' => ['clips']]]); ?> <div class="control-label">Other</div> <?php echo Widget::widget(['name' => 'HotelData[other][]', 'value' => $modelHotelData->other, 'settings' => ['minHeight' => 200, 'plugins' => ['clips']]]); ?> </div> </div>
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); } }
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); } }
<div class="col-md-6"> <?php Box::begin(['header' => 'Imperavi']); ?> <?php echo Widget::widget(['name' => 'redactor', 'settings' => ['lang' => 'en', 'minHeight' => 200, 'plugins' => ['clips', 'fullscreen']]]); ?> <?php highlight_string("\n<?php\nuse vova07\\imperavi\\Widget;\n\necho Widget::widget([\n 'name' => 'redactor',\n 'settings' => [\n 'lang' => 'en',\n 'minHeight' => 200,\n 'plugins' => [\n 'clips',\n 'fullscreen'\n ]\n ]\n]);\n?>\t\n\t\t\t"); ?> <?php Box::end(); ?> </div><!-- /.col (LEFT) --> <div class="col-md-6"> <?php Box::begin(['header' => 'Imperavi']); ?> <?php echo Widget::widget(['name' => 'redactor2', 'settings' => ['lang' => 'en', 'minHeight' => 200, 'fileUpload' => Url::to(['/default/file-upload']), 'imageManagerJson' => Url::to(['/default/images-get']), 'fileManagerJson' => Url::to(['/default/files-get']), 'plugins' => ['imagemanager', 'filemanager']]]); ?> <?php highlight_string("\n<?php\nuse vova07\\imperavi\\Widget;\n\necho Widget::widget([\n 'name' => 'redactor',\n 'settings' => [\n 'lang' => 'en',\n 'minHeight' => 200,\n 'plugins' => [\n 'clips',\n 'fullscreen'\n ]\n ]\n]);\n?>\t\n\t\t\t"); ?> <?php Box::end(); ?> </div><!-- /.col (LEFT) --> </div> <?php Box::end();
<div class="col-md-12"> <?php echo $form->field($invoice, 'newAmount')->textInput(); ?> <?php echo Html::label('Subject', 'Invoice[subject]'); ?> <?php echo Widget::widget(['name' => 'Invoice[subject]', 'value' => $invoice->subject, 'settings' => ['minHeight' => 200, 'plugins' => ['clips']]]); ?> <?php echo Html::label('Final Text', 'Invoice[finalText]'); ?> <?php echo Widget::widget(['name' => 'Invoice[finalText]', 'value' => $invoice->finalText, 'settings' => ['minHeight' => 200, 'plugins' => ['clips']]]); ?> <div class="col-md-offset-6 text-right"> <?php echo Html::submitButton('Show Template', ['class' => 'btn btn-primary', 'id' => 'show-credit-note']); ?> <?php echo Html::submitButton('Create credit note', ['class' => 'btn btn-success', 'id' => 'create-credit-note']); ?> </div> </div> </div> <?php $form->end();
</div> <p> <span><b>Файлы:</b></span> <div class="clear"></div> <?php foreach ($bid->attachments as $file) { ?> <a href="<?php echo $file->path; ?> " target="_blank"><?php echo $file->name; ?> </a> <div class="clear"></div> <?php } ?> </p> </div> <div class="col-xs-6 border-red"> <center><b>Комментарий к отчету</b></center> <?php echo \vova07\imperavi\Widget::widget(['name' => 'report_text', 'id' => 'text_' . $bid->id, 'settings' => ['lang' => 'ru', 'minHeight' => 200, 'plugins' => ['clips', 'fullscreen']]]); echo \kato\DropZone::widget(['options' => ['maxFilesize' => '10', 'url' => 'upload/'], 'dropzoneContainer' => 'dropzone' . $bid->id, 'previewsContainer' => 'dropzone' . $bid->id]); ?> </div> <?php Modal::end();
?> <?php echo $form->field($model, 'description')->textarea(['rows' => 6]); ?> <?php \vova07\imperavi\Widget::widget(['model' => $model, 'attribute' => 'description', 'settings' => ['lang' => 'ru', 'minHeight' => 200, 'plugins' => ['fontsize', 'fontcolor', 'fontfamily']]]); ?> <?php echo $form->field($model, 'properties')->textarea(['rows' => 6]); ?> <?php \vova07\imperavi\Widget::widget(['model' => $model, 'attribute' => 'properties', 'settings' => ['lang' => 'ru', 'minHeight' => 200, 'plugins' => ['fontsize', 'fontcolor', 'fontfamily']]]); ?> <?php echo $form->field($model, 'parent_id')->dropDownList(Categories::getDropDown(), ['prompt' => 'Выберите родительскую категорию']); ?> <?php echo $form->field($model, 'active')->dropDownList(Categories::$activeText); ?> <?php echo $form->field($model, 'meta_title')->textInput(['maxlength' => true]); ?> <?php
<div class="form-group"> <?php if ($label) { ?> <label class="control-label"><?php echo $label; ?> </label><?php } ?> <?php echo \vova07\imperavi\Widget::widget(['name' => $name, 'value' => $value, 'id' => uniqid('wysiwyg_'), 'settings' => ['lang' => 'ru', 'minHeight' => $item['height'] ? $item['height'] : "200", 'plugins' => ['fullscreen', 'table', 'fontcolor', 'fontfamily'], 'buttons' => ['formatting', 'bold', 'italic', 'deleted', 'underline', 'lists', 'image', 'link', 'horizontalrule', 'unorderedlist', 'orderedlist', 'alignment'], 'media_library_url' => \yii\helpers\Url::to(['/media/default/wysiwyg-window']), "allowedAttr" => [['input', '*'], ['td', '*'], ['a', '*'], ['img', '*'], ['span', '*'], ['iframe', '*'], ['video', '*'], ['audio', '*'], ['embed', '*'], ['object', '*'], ['param', '*'], ['source', '*']]], 'options' => ['data-name' => $name], 'plugins' => ['media_library' => 'lenarx\\media\\ImperaviAssets']]); ?> </div>