/** * @inheritdoc */ public function init() { parent::init(); $customSettings = ['minHeight' => 150]; $settings = array_merge($this->getDefaultSettings(), $customSettings); $this->settings = $settings; }
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; }
* @var yii\web\View $this * @var bariew\templateAbstractModule\models\Config $model * @var yii\widgets\ActiveForm $form */ ?> <div class="config-form"> <?php $form = ActiveForm::begin(); ?> <?php $tabs = [['label' => Yii::t('app', 'Main'), 'content' => $this->render('_formMain', compact('form', 'model'))]]; foreach ($model->languageList() as $language) { $tabs[] = ['label' => $language, 'active' => empty($active) && ($active = $model->hasErrors('content') || ($active = $model->hasErrors('subject'))), 'content' => $form->field($model, "subject[{$language}]", ['options' => ['class' => 'subjectInput']])->textInput() . $form->field($model, "content[{$language}]", ['options' => ['class' => 'messageInput']])->widget(\vova07\imperavi\Widget::className(), ['options' => ['style' => ['min-height' => '200px']], 'settings' => ['deniedTags' => [], 'convertDivs' => false, 'paragraphy' => false, 'formattingTags' => [], 'convertLinks' => false, 'cleanup' => false, 'removeEmptyTags' => false, 'cleanSpaces' => false, 'cleanFontTag' => false, 'tidyHtml' => false, 'paragraphize' => false, 'replaceDivs' => false, 'replaceTags' => false, 'replaceStyles' => false, 'removeEmpty' => false, 'minHeight' => 200]])]; } ?> <?php echo \yii\bootstrap\Tabs::widget(['items' => $tabs]); ?> <label><?php echo Yii::t('modules/template', 'Variables'); ?> </label> <div class="configVariables"> <?php echo DetailView::widget(['model' => false, 'attributes' => $model->variables()]); ?> </div>
<?php /** * @var $attribute_name string * @var $form \yii\widgets\ActiveForm * @var $label string * @var $model \app\properties\AbstractModel * @var $multiple boolean * @var $property_id integer * @var $property_key string * @var $this \app\properties\handlers\Handler * @var $values array */ use vova07\imperavi\Widget as ImperaviWidget; use yii\helpers\Url; echo $form->field($model, $property_key . '[0]')->widget(ImperaviWidget::className(), ['settings' => ['replaceDivs' => false, 'minHeight' => 200, 'paragraphize' => true, 'pastePlainText' => true, 'buttonSource' => true, 'imageManagerJson' => Url::to(['/backend/dashboard/imperavi-images-get']), 'plugins' => ['table', 'fontsize', 'fontfamily', 'fontcolor', 'video', 'imagemanager'], 'replaceStyles' => [], 'replaceTags' => [], 'deniedTags' => [], 'removeEmpty' => [], 'imageUpload' => Url::to(['/backend/dashboard/imperavi-image-upload'])]]);
<?php echo $form->field($model, 'introtext')->textarea(['rows' => 12]); ?> <?php } ?> </div> <!-- end col-lg-6 --> <div class="col-lg-6"> <?php if ($editor == "imperavi") { ?> <?php echo $form->field($model, 'fulltext')->widget(\vova07\imperavi\Widget::className(), ['settings' => ['minHeight' => 250, 'paragraphize' => false, 'cleanOnPaste' => false, 'replaceDivs' => false, 'linebreaks' => false, 'plugins' => ['fullscreen', 'imagemanager'], 'imageUpload' => Url::to(['/articles/items/image-upload']), 'imageManagerJson' => Url::to(['/articles/items/images-get'])]]); ?> <?php } else { ?> <?php echo $form->field($model, 'fulltext')->textarea(['rows' => 12]); ?> <?php } ?> </div> <!-- end col-lg-6 --> </div> <!-- end #item -->
<?php echo $form->field($model, 'source_title')->widget(\yii\jui\AutoComplete::className(), ['clientOptions' => ['source' => $data, 'minLength' => '3', 'autoFill' => true], 'options' => ['class' => 'form-control']]); ?> <?php if (!$redactor) { ?> <?php echo $form->field($model, 'body')->textarea(['rows' => 5, 'cols' => 5, 'id' => 'my-textarea-id']); ?> <?php } else { ?> <?php echo $form->field($model, 'body')->widget(Widget::classname(), ['settings' => ['lang' => 'ru', 'minHeight' => 300, 'pastePlainText' => true, 'buttonSource' => true, 'plugins' => ['clips', 'fullscreen'], 'imageUpload' => Url::to(['/articles/image-upload'])]]); ?> <?php } ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Создать' : 'Обновить', ['class' => 'btn btn-primary', 'name' => 'create-button']); ?> </div> <?php ActiveForm::end();
case Content::ATTR_TYPE_TITLE: echo $form->field($model, $attr)->textInput(isset($value['config']) ? $value['config'] : []); $titleAttribute = $attr; break; case Content::ATTR_TYPE_STRING: echo $form->field($model, $attr)->textInput(isset($value['config']) ? $value['config'] : []); break; case Content::ATTR_TYPE_INTEGER: echo $form->field($model, $attr)->input('number', isset($value['config']) ? $value['config'] : []); break; case Content::ATTR_TYPE_URL: echo $form->field($model, $attr, ['template' => '{label}<div class="input-group"><span class="input-group-addon attached-button-chain"><i class="icon fa fa-chain"></i></span>{input}</div> {hint}{error}'])->textInput(isset($value['config']) ? $value['config'] : []); $urlAttribute = $attr; break; case Content::ATTR_TYPE_ADVANCED_TEXT: echo $form->field($model, $attr, ['options' => ['class' => 'form-group col-sm-12']])->widget(Widget::className(), isset($value['config']) ? $value['config'] : []); break; case Content::ATTR_TYPE_IMAGE: echo $form->field($model, $attr)->widget(FileAPI::className(), isset($value['config']) ? $value['config'] : []); break; case Content::ATTR_TYPE_TEXT: echo $form->field($model, $attr)->textarea(isset($value['config']) ? $value['config'] : []); break; case Content::ATTR_TYPE_DATE: echo $form->field($model, $attr)->widget(DateTimePicker::classname(), isset($value['config']) ? $value['config'] : []); break; case Content::ATTR_TYPE_BOOLEAN: echo $form->field($model, $attr)->checkbox(); break; case Content::ATTR_TYPE_DROPDOWN: echo $form->field($model, $attr)->dropDownList(isset($value['items']) ? $value['items'] : [], isset($value['config']) ? $value['config'] : []);
/** * @inheritdoc */ public function init() { if ($this->url === null) { throw new InvalidConfigException('The "url" attribute must be set.'); } else { $this->url = rtrim($this->url, '/') . '/'; } if ($this->path === null) { throw new InvalidConfigException('The "path" attribute must be set.'); } else { $this->path = rtrim(Yii::getAlias($this->path), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; if (!FileHelper::createDirectory($this->path)) { throw new InvalidCallException("Directory specified in 'path' attribute doesn't exist or cannot be created."); } } if ($this->uploadOnlyImage !== true) { $this->_validator = 'file'; } Widget::registerTranslations(); }
JS; $this->registerJs($js); ?> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'slug')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'announcement')->textarea(['rows' => 6]); echo $form->field($model, 'content')->widget(Widget::className(), ['settings' => ['lang' => 'ru', 'minHeight' => 200, 'imageUpload' => Url::to(['page/image-upload']), 'plugins' => ['fullscreen', 'fontcolor', 'table', 'clips']]]); ?> <?php echo $form->field($model, 'is_available')->checkbox(); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end();
<?php /** @var \yii\web\View $this */ /** @var integer $language_id */ /** @var \DevGroup\Multilingual\models\Language $language */ /** @var \app\models\PageTranslation $model */ /** @var string $attributePrefix */ /** @var \yii\widgets\ActiveForm $form */ use yii\helpers\Url; echo $form->field($model, $attributePrefix . 'title'); echo $form->field($model, $attributePrefix . 'is_published')->widget(kartik\widgets\SwitchInput::className()); echo $form->field($model, $attributePrefix . 'content')->widget(\vova07\imperavi\Widget::className(), ['settings' => ['minHeight' => 200, 'plugins' => ['table', 'fontsize', 'fontfamily', 'fontcolor', 'video', 'imagemanager', 'clips', 'fullscreen', 'filemanager'], 'pastePlainText' => true, 'buttonSource' => true, 'replaceStyles' => [], 'replaceTags' => [], 'deniedTags' => [], 'removeEmpty' => [], 'imageUpload' => Url::to(['/admin/image-upload']), 'imageManagerJson' => Url::to(['/admin/images-get']), 'fileUpload' => Url::to(['/admin/file-upload']), 'fileManagerJson' => Url::to(['/admin/files-get'])]]); ?> <!-- ok -->
$settings = ['lang' => $lang, 'minHeight' => 200, 'plugins' => ['fullscreen']]; if ($module->addImage || $module->uploadImage) { $settings['plugins'][] = 'imagemanager'; } if ($module->addImage) { $settings['imageManagerJson'] = Url::to(['images-get']); } if ($module->uploadImage) { $settings['imageUpload'] = Url::to(['image-upload']); } if ($module->addFile || $module->uploadFile) { $settings['plugins'][] = 'filemanager'; } if ($module->addFile) { $settings['fileManagerJson'] = Url::to(['files-get']); } if ($module->uploadFile) { $settings['fileUpload'] = Url::to(['file-upload']); } echo $form->field($model, 'content')->widget(Imperavi::className(), ['settings' => $settings]); echo $form->field($model, 'title_browser')->textInput(['maxlength' => 255]); echo $form->field($model, 'meta_keywords')->textInput(['maxlength' => 200]); echo $form->field($model, 'meta_description')->textInput(['maxlength' => 160]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Module::t('CREATE') : Module::t('UPDATE'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end();
<?php echo $form->field($model, 'title')->textInput(['maxlength' => 65, 'placeholder' => Yii::t('app', 'Title contain a seo keyword if possible')]); ?> </div> </div> <?php echo $form->field($model, 'description')->textArea(['maxlength' => 155, 'placeholder' => Yii::t('app', 'This description also used as meta description')]); ?> <?php $isettings = ['lang' => substr(Yii::$app->language, 0, 2), 'minHeight' => 400, 'toolbarFixedTopOffset' => 50, 'buttonSource' => true, 'plugins' => ['imagemanager', 'filemanager', 'video', 'table', 'clips', 'fullscreen'], 'buttons' => ['html', 'formatting', 'bold', 'italic', 'underline', 'deleted', 'unorderedlist', 'orderedlist', 'outdent', 'indent', 'image', 'file', 'link', 'alignment', 'horizontalrule'], 'replaceDivs' => false, 'deniedTags' => ['script']]; if ($module->enableUpload) { $isettings = array_merge($isettings, ['imageUpload' => Url::to(['//blog/default/image-upload']), 'fileUpload' => Url::to(['//blog/default/file-upload']), 'imageManagerJson' => Url::to(['//blog/default/images-get']), 'fileManagerJson' => Url::to(['//blog/default/files-get'])]); } use vova07\imperavi\Widget; echo $form->field($model, 'content')->widget(Widget::className(), ['settings' => $isettings, 'options' => ["style" => "width:100%"]]); ?> <?php if ($module->enableScriptsPage) { ?> <?php echo $form->field($model, 'scripts')->textArea(['rows' => 6, 'placeholder' => Yii::t('app', 'JavaScripts')]); ?> <?php } ?> </div> <div class="col-md-3"> <div class="well">
// 'url' => $url, // 'dataType' => 'json', // 'data' => new JsExpression('function(term,page) { return {search:term}; }'), // 'results' => new JsExpression('function(data,page) { return {results:data.results}; }'), // ], // 'initSelection' => new JsExpression($initScript), // ], // ]); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'content')->widget(\vova07\imperavi\Widget::className(), ['plugins' => ['quote' => 'backend\\assets\\EditorAssetBundle', 'skip' => 'backend\\assets\\EditorAssetBundle'], 'settings' => ['lang' => 'ru', 'minHeight' => 200, 'imageUpload' => \yii\helpers\Url::to(['/site/image-upload']), 'buttons' => ['html', 'formatting', 'bold', 'italic', 'underline', 'deleted', 'unorderedlist', 'orderedlist', 'outdent', 'indent', 'image', 'link', 'alignment', 'quote', 'skip'], 'plugins' => ['fullscreen', 'table', 'video', 'fontcolor'], 'deniedTags' => ['style'], 'replaceDivs' => false]]); ?> <div class="row"> <div class="col-sm-6"> <?php $source = []; if (!$model->isNewRecord) { if (isset($model->source_title) && trim($model->source_title) != '') { $source = [0 => $model->source_title]; } } echo $form->field($model, 'source_id')->widget(SelectizeDropDownList::classname(), ['loadUrl' => Url::to(['source/source-list']), 'items' => $source, 'options' => ['multiple' => false], 'clientOptions' => ['valueField' => 'value', 'labelField' => 'text', 'persist' => false]]); ?> </div>
/* @var $model common\models\TextPages */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="text-pages-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'text')->widget(Widget::className(), ['settings' => ['lang' => 'ru', 'minHeight' => 200, 'replaceDivs' => false, 'imageUpload' => Url::to(['/text-pages/image-upload']), 'plugins' => ['clips', 'fullscreen', 'table', 'filemanager', 'fontcolor', 'fontfamily', 'fontsize', 'limiter', 'video', 'textdirection', 'textexpander', 'imagemanager']]]); ?> <?php echo $form->field($model, 'url')->textInput(['maxlength' => true]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Создать' : 'Сохранить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
?> <?php echo $form->field($model, 'project_id')->dropdownList(\common\models\Project::find()->select(['domain', 'id'])->indexBy('id')->column(), ['prompt' => 'Domain:'])->label('Domain'); ?> <?php echo $form->field($model, 'alias')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'content')->widget(\vova07\imperavi\Widget::className(), ['settings' => ['replaceDivs' => false, 'lang' => 'ru', 'minHeight' => 200, 'plugins' => ['clips', 'fullscreen'], 'pastePlainText' => false, 'paragraphize' => false]]); ?> <?php echo $form->field($model, 'as_theme')->dropdownList([1 => 'yes', 0 => 'no']); ?> <?php echo $form->field($model, 'META_TITLE')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'META_DESC')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'META_KEYS')->textInput(['maxlength' => true]);
<?php use yii\helpers\Html; use yii\helpers\ArrayHelper; use yii\helpers\Url; use kartik\widgets\ActiveForm; use kartik\builder\Form; use kartik\datecontrol\DateControl; use kartik\widgets\FileInput; use kartik\builder\TabularForm; /** * @var yii\web\View $this * @var common\models\SliderImage $model * @var yii\widgets\ActiveForm $form */ ?> <div class="slider-image-form"> <?php $form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]); echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['publish_flag' => ['type' => Form::INPUT_CHECKBOX, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Опубликовано...']], 'slider' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Слайдер...']], 'href' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Ссылка...', 'maxlength' => 255]], 'body' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => \vova07\imperavi\Widget::className(), 'options' => ['settings' => ['toolbarFixed' => false, 'minHeight' => 100]]], 'menu_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\FileInput::className(), 'options' => ['pluginOptions' => ['accept' => 'image/*', 'allowedFileExtensions' => ['jpg', 'gif', 'png'], 'showRemove' => false, 'showUpload' => false, 'initialPreview' => $model->getUploadUrl('menu_image') ? Html::img($model->getUploadUrl('menu_image'), ['class' => 'file-preview-image']) : false, 'maxFileCount' => 1]]], 'href_enabled_flag' => ['type' => Form::INPUT_CHECKBOX, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Показывать кнопку перейти...']], 'created_date' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => DateControl::classname(), 'options' => ['type' => DateControl::FORMAT_DATE]], 'iframe_href' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Ссылка на iframе(если указан изображения игнорируются)...', 'maxlength' => 255]], 'banner_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\FileInput::className(), 'options' => ['pluginOptions' => ['accept' => 'image/*', 'allowedFileExtensions' => ['jpg', 'gif', 'png'], 'showRemove' => false, 'showUpload' => false, 'initialPreview' => $model->getUploadUrl('banner_image') ? Html::img($model->getUploadUrl('banner_image'), ['class' => 'file-preview-image']) : false, 'maxFileCount' => 1]]], 'banner_phone_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\FileInput::className(), 'options' => ['pluginOptions' => ['accept' => 'image/*', 'allowedFileExtensions' => ['jpg', 'gif', 'png'], 'showRemove' => false, 'showUpload' => false, 'initialPreview' => $model->getUploadUrl('banner_phone_image') ? Html::img($model->getUploadUrl('banner_phone_image'), ['class' => 'file-preview-image']) : false, 'maxFileCount' => 1]]], 'banner_tablet_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\FileInput::className(), 'options' => ['pluginOptions' => ['accept' => 'image/*', 'allowedFileExtensions' => ['jpg', 'gif', 'png'], 'showRemove' => false, 'showUpload' => false, 'initialPreview' => $model->getUploadUrl('banner_tablet_image') ? Html::img($model->getUploadUrl('banner_tablet_image'), ['class' => 'file-preview-image']) : false, 'maxFileCount' => 1]]]]]); echo Html::button(Yii::t('app', 'Cancel'), ['class' => 'btn btn-default', 'style' => 'margin-right: 20px', 'onclick' => 'window.location = "' . Url::to(['index']) . '"']); echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Save'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 10px', 'name' => 'goto', 'value' => 'list']); echo Html::submitButton(Yii::t('app', 'Apply'), ['class' => 'btn btn-primary', 'style' => 'margin-right: 0px']); ActiveForm::end(); ?> </div>
/* @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
<div class="blog-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'short_text')->widget(Imperavi::className(), ['settings' => ['minHeight' => 300, 'imageGetJson' => Url::to(['/blogs/default/imperavi-get']), 'imageUpload' => Url::to(['/blogs/default/imperavi-image-upload']), 'fileUpload' => Url::to(['/blogs/default/imperavi-file-upload'])]]); ?> <?php echo $form->field($model, 'text')->widget(Imperavi::className(), ['settings' => ['minHeight' => 300, 'imageGetJson' => Url::to(['/blogs/default/imperavi-get']), 'imageUpload' => Url::to(['/blogs/default/imperavi-image-upload']), 'fileUpload' => Url::to(['/blogs/default/imperavi-file-upload'])]]); ?> <?php echo $form->field($model, 'status')->dropDownList(Blog::statusNames()); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
use common\widgets\elfinder\InputFile; use yii\bootstrap\Modal; use mihaildev\elfinder\ElFinder; use yii\web\JsExpression; /** * @var yii\web\View $this * @var common\models\Post $model * @var yii\widgets\ActiveForm $form */ ?> <div class="post-form"> <?php $form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]); echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['title' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Заголовок...', 'maxlength' => 255]], 'intro' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => \vova07\imperavi\Widget::className(), 'options' => ['settings' => ['toolbarFixed' => false, 'minHeight' => 100, 'plugins' => ['elfinder', 'fontcolor']]]], 'body' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => \vova07\imperavi\Widget::className(), 'options' => ['settings' => ['toolbarFixed' => false, 'minHeight' => 100]]], 'user_id' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => ArrayHelper::map(common\models\User::find()->all(), 'id', 'username'), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'category_id' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => ArrayHelper::map(common\models\PostCategory::find()->all(), 'id', 'title'), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'state_index' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => kartik\widgets\Select2::className(), 'options' => ['data' => (new common\models\Post())->getStateIndexList(), 'options' => ['placeholder' => 'Выбрать...'], 'pluginOptions' => ['allowClear' => true]]], 'main_flag' => ['type' => Form::INPUT_CHECKBOX, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Главная...']], 'noforeign_id' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => yii::t('app', 'Enter') . ' Noforeign ID...', 'maxlength' => 11]], 'created_datetime' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => DateControl::classname(), 'options' => ['type' => DateControl::FORMAT_DATETIME]], 'start_date' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => DateControl::classname(), 'options' => ['type' => DateControl::FORMAT_DATE]], 'start_time' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => DateControl::classname(), 'options' => ['type' => DateControl::FORMAT_TIME]], 'preview_image' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => InputFile::className(), 'options' => ['language' => 'ru', 'controller' => 'elfinder', 'filter' => 'image', 'options' => ['class' => 'form-control'], 'buttonOptions' => ['class' => 'btn btn-default'], 'multiple' => false, 'path' => 'news']], 'doc_file' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => InputFile::className(), 'options' => ['language' => 'ru', 'controller' => 'elfinder', 'filter' => 'image', 'options' => ['class' => 'form-control'], 'buttonOptions' => ['class' => 'btn btn-default'], 'multiple' => false, 'path' => 'news']]]]); /* ?> <script> if (!RedactorPlugins) var RedactorPlugins = {}; RedactorPlugins.elfinder = function() { return { init: function() { var elfinder = this.button.add('elfinder', 'Elfinder'); this.button.setAwesome('elfinder', 'fa-elfinder'); this.button.addCallback(elfinder, this.elfinder.openElfinder); }, openElfinder: function() {
<?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>
<div class="mhelpdoc-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'title')->textInput(['maxlength' => 128])->hint("为了在手机上显示美观,建议不超过20个字"); ?> <!-- <//?= $form->field($model, 'content')->textarea(['rows' => 6]) ?> --> <?php echo $form->field($model, 'content')->widget(Widget::className(), ['settings' => ['lang' => 'zh_cn', 'minHeight' => 200, 'maxHeight' => 400, 'buttonSource' => true, 'convertDivs' => false, 'removeEmptyTags' => false, 'plugins' => ['clips', 'fullscreen', 'fontcolor', 'fontfamily', 'fontsize', 'limiter', 'table', 'textexpander', 'textdirection', 'video', 'definedlinks', 'filemanager', 'imagemanager'], 'imageManagerJson' => Url::to(['/helpdoc/imagesget']), 'imageUpload' => Url::to(['/helpdoc/imageupload'])]])->hint("为了在手机上显示美观,建议使用字体18px"); ?> <!-- <//?= $form->field($model, 'sort')->textInput() ?> --> <!-- <//?= $form->field($model, 'visual')->textInput() ?> --> <?php echo $form->field($model, 'visual')->dropDownList(MHelpdoc::getVisualOption()); ?>
<?php $form = ActiveForm::begin(['layout' => 'horizontal', 'options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo $form->field($model, 'app_name')->textInput(); ?> <?php echo $form->field($model, 'app_logo')->fileInput(); if ($model->app_logo) { echo "<div class='form-group'><div class='col-sm-offset-3 col-sm-9'>"; echo Html::img('/uploads/settings/app_logo/' . $model->app_logo, ['class' => 'img-thumbnail', 'width' => 150]); echo "</div></div>"; } ?> <?php echo $form->field($model, 'app_description')->widget(Widget::classname(), ['settings' => ['lang' => 'ru', 'minHeight' => 300, 'pastePlainText' => true, 'buttonSource' => true, 'plugins' => ['clips', 'fullscreen']]]); ?> <div class="form-group"> <div class="col-sm-offset-3 col-sm-9"> <?php echo Html::submitButton(\Yii::t('app', 'Save'), ['class' => 'btn btn-primary']); ?> </div> </div> <?php ActiveForm::end(); ?> </div>
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model common\models\Comment */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="comment-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'content')->widget(\vova07\imperavi\Widget::className(), ['settings' => ['lang' => 'ru', 'minHeight' => 200, 'imageUpload' => \yii\helpers\Url::to(['/site/image-upload']), 'buttons' => ['html', 'bold', 'italic', 'underline', 'deleted']]]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Создать' : 'Изменить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
<div class="box box-primary"> <div class="box-body"> <?php $form = ActiveForm::begin(); ?> <div class="row"> <div class="col-md-8"> <?php echo $form->field($model, 'title')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'summary')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'text')->widget(Imperavi::className(), ['settings' => ['lang' => 'ru', 'replaceDivs' => false, 'minHeight' => 400, 'imageUpload' => Url::to(['/news/default/image-upload']), 'fileUpload' => Url::to(['/news/default/file-upload']), 'plugins' => ['table']]]); ?> </div> <div class="col-md-4"> <?php echo $form->field($model, 'meta_title')->textInput(); ?> <?php echo $form->field($model, 'meta_description')->textarea(['rows' => 4]); ?> <?php echo $form->field($model, 'alias')->textInput(['maxlength' => true]); ?> <div class="form-group"> <?php
<?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>
/** * Create ActiveForm widget. * * @param \yii\widgets\ActiveForm $form * @param \yii\db\ActiveRecord $model Model * @param string $attribute Model attribute */ public function createWidget($form, $model, $attribute) { $widget = $this->getAttributeWidget($model, $attribute); $tableSchema = $model->getTableSchema(); switch ($widget) { case 'widget': echo $this->createField($form, $model, $attribute, [], 'widget'); break; case 'wysiwyg': $options = ['widgetClass' => RedactorWidget::className(), 'settings' => ['minHeight' => 200, 'plugins' => ['video', 'fullscreen']]]; if ($this->redactorImageUpload === true) { $imageOptions = ['settings' => ['imageManagerJson' => Url::to(['model/redactor-list', 'name' => $this->getModelName($model), 'attr' => $attribute]), 'imageUpload' => Url::to(['model/redactor-upload', 'name' => $this->getModelName($model), 'attr' => $attribute]), 'imageUploadErrorCallback' => new JsExpression('function(json) { alert(json.error); }'), 'plugins' => ['imagemanager']]]; $options = ArrayHelper::merge($options, $imageOptions); } if ($this->redactorFileUpload === true) { $fileOptions = ['settings' => ['fileManagerJson' => Url::to(['model/redactor-list', 'name' => $this->getModelName($model), 'attr' => $attribute, 'type' => 'file']), 'fileUpload' => Url::to(['model/redactor-upload', 'name' => $this->getModelName($model), 'attr' => $attribute, 'type' => 'file']), 'fileUploadErrorCallback' => new JsExpression('function(json) { alert(json.error); }'), 'plugins' => ['filemanager']]]; $options = ArrayHelper::merge($options, $fileOptions); } echo $this->createField($form, $model, $attribute, $options, 'widget'); break; case 'date': $options = ['widgetClass' => TimePicker::className(), 'mode' => 'date', 'clientOptions' => ['dateFormat' => 'yy-mm-dd']]; echo $this->createField($form, $model, $attribute, $options, 'widget'); break; case 'time': $options = ['widgetClass' => TimePicker::className(), 'mode' => 'time', 'clientOptions' => ['timeFormat' => 'HH:mm:ss', 'showSecond' => true]]; echo $this->createField($form, $model, $attribute, $options, 'widget'); break; case 'datetime': $options = ['widgetClass' => TimePicker::className(), 'mode' => 'datetime', 'clientOptions' => ['dateFormat' => 'yy-mm-dd', 'timeFormat' => 'HH:mm:ss', 'showSecond' => true]]; echo $this->createField($form, $model, $attribute, $options, 'widget'); break; case 'select': $options = ['options' => ['placeholder' => Yii::t('ycm', 'Choose {name}', ['name' => $model->getAttributeLabel($attribute)])], 'settings' => ['allowClear' => true, 'width' => '100%'], 'items' => ['' => '']]; echo $this->createField($form, $model, $attribute, $options, 'select'); break; case 'selectMultiple': $options = ['options' => ['multiple' => true, 'placeholder' => Yii::t('ycm', 'Choose {name}', ['name' => $model->getAttributeLabel($attribute)])], 'settings' => ['width' => '100%']]; echo $this->createField($form, $model, $attribute, $options, 'select'); break; case 'image': $options = []; if (!$model->isNewRecord && !empty($model->{$attribute})) { $className = StringHelper::basename($model->className()); $inputName = $className . '[' . $attribute . '_delete]'; $inputId = strtolower($className . '-' . $attribute . '_delete'); $url = $this->getAttributeUrl($this->getModelName($model), $attribute, $model->{$attribute}); ob_start(); echo '<div class="checkbox"><label for="' . $inputId . '"> <input type="checkbox" name="' . $inputName . '" id="' . $inputId . '" value="delete"> ' . Yii::t('ycm', 'Delete image') . ' </label></div>'; Modal::begin(['size' => Modal::SIZE_LARGE, 'header' => '<h4>' . Yii::t('ycm', 'Preview image') . '</h4>', 'toggleButton' => ['label' => Yii::t('ycm', 'Preview image'), 'class' => 'btn btn-info btn-sm']]); echo Html::img($url, ['class' => 'modal-image']); Modal::end(); $html = ob_get_clean(); $options['hint'] = $html; } echo $this->createField($form, $model, $attribute, $options, 'fileInput'); break; case 'file': $options = []; if (!$model->isNewRecord && !empty($model->{$attribute})) { $className = StringHelper::basename($model->className()); $inputName = $className . '[' . $attribute . '_delete]'; $inputId = strtolower($className . '-' . $attribute . '_delete'); $url = $this->getAttributeUrl($this->getModelName($model), $attribute, $model->{$attribute}); $html = '<div class="checkbox"><label for="' . $inputId . '"> <input type="checkbox" name="' . $inputName . '" id="' . $inputId . '" value="delete"> ' . Yii::t('ycm', 'Delete file') . ' </label></div>'; $html .= Html::a(Yii::t('ycm', 'Download file'), $url, ['class' => 'btn btn-info btn-sm']); $options['hint'] = $html; } echo $this->createField($form, $model, $attribute, $options, 'fileInput'); break; case 'text': $options = ['maxlength' => $tableSchema->columns[$attribute]->size]; echo $this->createField($form, $model, $attribute, $options, 'textInput'); break; case 'hidden': $options = ['maxlength' => $tableSchema->columns[$attribute]->size]; $options = $this->getAttributeOptions($attribute, $options); echo Html::activeHiddenInput($model, $attribute, $options); break; case 'password': $options = ['maxlength' => $tableSchema->columns[$attribute]->size]; echo $this->createField($form, $model, $attribute, $options, 'passwordInput'); break; case 'textarea': $options = ['rows' => 6]; echo $this->createField($form, $model, $attribute, $options, 'textarea'); break; case 'radio': echo $this->createField($form, $model, $attribute, [], 'radio'); break; case 'boolean': case 'checkbox': echo $this->createField($form, $model, $attribute, [], 'checkbox'); break; case 'dropdown': $options = ['prompt' => Yii::t('ycm', 'Choose {name}', ['name' => $model->getAttributeLabel($attribute)])]; echo $this->createField($form, $model, $attribute, $options, 'dropDownList'); break; case 'listbox': $options = ['prompt' => '']; echo $this->createField($form, $model, $attribute, $options, 'listBox'); break; case 'checkboxList': echo $this->createField($form, $model, $attribute, [], 'checkboxList'); break; case 'radioList': echo $this->createField($form, $model, $attribute, [], 'radioList'); break; case 'disabled': $options = ['maxlength' => $tableSchema->columns[$attribute]->size, 'readonly' => true]; echo $this->createField($form, $model, $attribute, $options, 'textInput'); break; case 'hide': break; default: $options = $this->getAttributeOptions($attribute); echo $form->field($model, $attribute)->{$widget}($options); break; } }
?> <?php echo $form->field($model, 'google')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'site_motto')->textInput(['maxlength' => 1000]); ?> <?php echo $form->field($model, 'partnership')->widget(Wisiwig::className(), ['settings' => ['lang' => 'ru', 'minHeight' => 200, 'plugins' => ['clips', 'fullscreen']]]); ?> <?php echo $form->field($model, 'about')->widget(Wisiwig::className(), ['settings' => ['lang' => 'ru', 'minHeight' => 200, 'plugins' => ['clips', 'fullscreen']]]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div> <div id="YMapsID" style="width:0px;height:0px"></div> <script type="text/javascript">
?> <?php echo $form->field($model, 'slug')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'description')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'keywords')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'body')->widget(Widget::className(), ['settings' => ['minHeight' => 200, 'plugins' => ['filemanager', 'fullscreen', 'fontcolor', 'imagemanager', 'table', 'video'], 'imageManagerJson' => Url::to(['/site/images-get']), 'fileManagerJson' => Url::to(['/site/files-get']), 'imageUpload' => Url::to(['/site/image-upload']), 'fileUpload' => Url::to(['/site/file-upload'])]]); ?> <?php echo $form->field($model, 'status')->checkbox(['label' => Yii::t('backend', 'Activate')]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('backend', 'Create') : Yii::t('backend', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
<?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']; }
?> " /> <?php } ?> <?php echo $form->field($model, 'product_type')->dropDownlist(Product::getTypeArray()); ?> <?php echo $form->field($model, 'product_name')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'product_summary')->textarea(['rows' => 6]); ?> <?php echo $form->field($model, 'product_description')->widget(Widget::className(), ['settings' => ['lang' => 'ru', 'replaceDivs' => false, 'minHeight' => 400, 'imageUpload' => Url::to(['/product/default/image-upload']), 'fileUpload' => Url::to(['/product/default/file-upload'])]]); ?> </div> <div class="col-md-4"> <?php echo $form->field($model, 'meta_title')->textInput(); ?> <?php echo $form->field($model, 'meta_description')->textarea(['rows' => 4]); ?> <?php echo $form->field($model, 'alias')->textInput(['maxlength' => true]); ?> </div> </div>