/** * 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 );"); } }
public function run() { if (is_null($this->imageOptions)) { $this->imageOptions = ['class' => 'img-responsive']; } $this->imageOptions['id'] = Yii::$app->getSecurity()->generateRandomString(10); $inputField = Html::getInputId($this->model, $this->attribute); $class = \yii\helpers\StringHelper::basename(get_class($this->model)) . 'Cutter'; echo Html::beginTag('div', ['class' => 'image-cutter', 'id' => $inputField . '-cutter']); echo Html::activeFileInput($this->model, $this->attribute); echo Html::hiddenInput($class . '[' . $this->attribute . ']', $this->model->{$this->attribute}); $previewImage = Html::beginTag('div', ['class' => 'img-container']); $previewImage .= Html::tag('span', '', ['class' => 'helper']); $previewImage .= Html::tag('span', Yii::t('sadovojav/cutter/cutter', 'Click to upload image'), ['class' => 'message']); $previewImage .= Html::img($this->model->{$this->attribute} ? $this->model->{$this->attribute} : null, ['class' => 'preview-image']); $previewImage .= Html::endTag('div'); echo Html::label($previewImage, Html::getInputId($this->model, $this->attribute), ['class' => 'dropzone']); echo Html::checkbox($class . '[' . $this->attribute . '-remove]', false, ['label' => Yii::t('sadovojav/cutter/cutter', 'Remove')]); Modal::begin(['header' => Html::tag('h4', Yii::t('sadovojav/cutter/cutter', 'Cutter'), ['class' => 'modal-title']), 'closeButton' => false, 'footer' => $this->getModalFooter($inputField), 'size' => Modal::SIZE_LARGE]); echo Html::beginTag('div', ['class' => 'image-container']); echo Html::img(null, $this->imageOptions); echo Html::endTag('div'); echo Html::tag('br'); echo Html::beginTag('div', ['class' => 'row']); echo Html::beginTag('div', ['class' => 'col-md-2']); echo Html::label(Yii::t('sadovojav/cutter/cutter', 'Aspect ratio'), $inputField . '-aspectRatio'); echo Html::textInput($class . '[' . $this->attribute . '-aspectRatio]', isset($this->cropperOptions['aspectRatio']) ? $this->cropperOptions['aspectRatio'] : 0, ['id' => $inputField . '-aspectRatio', 'class' => 'form-control']); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'col-md-2']); echo Html::label(Yii::t('sadovojav/cutter/cutter', 'Angle'), $inputField . '-dataRotate'); echo Html::textInput($class . '[' . $this->attribute . '-cropping][dataRotate]', '', ['id' => $inputField . '-dataRotate', 'class' => 'form-control']); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'col-md-2']); echo Html::label(Yii::t('sadovojav/cutter/cutter', 'Position') . ' (x)', $inputField . '-dataX'); echo Html::textInput($class . '[' . $this->attribute . '-cropping][dataX]', '', ['id' => $inputField . '-dataX', 'class' => 'form-control']); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'col-md-2']); echo Html::label(Yii::t('sadovojav/cutter/cutter', 'Position') . ' (y)', $inputField . '-dataY'); echo Html::textInput($class . '[' . $this->attribute . '-cropping][dataY]', '', ['id' => $inputField . '-dataY', 'class' => 'form-control']); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'col-md-2']); echo Html::label(Yii::t('sadovojav/cutter/cutter', 'Width'), $inputField . '-dataWidth'); echo Html::textInput($class . '[' . $this->attribute . '-cropping][dataWidth]', '', ['id' => $inputField . '-dataWidth', 'class' => 'form-control']); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'col-md-2']); echo Html::label(Yii::t('sadovojav/cutter/cutter', 'Height'), $inputField . '-dataHeight'); echo Html::textInput($class . '[' . $this->attribute . '-cropping][dataHeight]', '', ['id' => $inputField . '-dataHeight', 'class' => 'form-control']); echo Html::endTag('div'); echo Html::endTag('div'); Modal::end(); echo Html::endTag('div'); $options = ['inputField' => $inputField, 'useWindowHeight' => $this->useWindowHeight, 'cropperOptions' => $this->cropperOptions]; $options = Json::encode($options); $this->view->registerJs('jQuery("#' . $inputField . '").cutter(' . $options . ');'); }
private function initializeModal(){ Modal::begin([ 'id' => 'activity-modal', 'size' => $this->size, 'header' => '<h2>'. $this->modelTitle .'</h2>', 'footer' => Html::button('Close', ['class' => 'btn btn-info', 'data-dismiss' => 'modal']), ]); Modal::end(); // Modal::begin([ // 'id' => 'activity-delete-modal', // 'header' => '<h2>'. $this->deleteModelTitle .'</h2>', // 'footer' => Html::button('Close', ['class' => 'btn btn-default', 'data-dismiss' => 'modal']) // . PHP_EOL . Html::button('Delete', [ // 'class' => 'btn btn-primary btn-modal-save', // 'id' => 'delete-role-model', // 'data-id' => '', // 'onClick' => new JsExpression('var id=$("#delete-role-model").attr("data-id");$.ajax({type:"'. $this->deleteVerb .'",url:"'.$this->deleteUrl.'",data:{id:id},success:function(){$.pjax.reload({container:"#'. $this->pjaxContainerId .'",timeout:2e3}),$("#activity-delete-modal").modal("hide")}});') // ]), // ]); // echo 'Are You Sure To Delete This Item'; // Modal::end(); }
/** * iframe modal 框架模态弹出窗 */ private function run_iframe() { \Yii::$app->view->on(View::EVENT_END_BODY, function () { Modal::begin(['id' => 'iframeModal', 'header' => '<h4 class="modal-title"> Header </h4>', 'footer' => '<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>', 'size' => Modal::SIZE_LARGE]); echo '<iframe ></iframe>'; Modal::end(); }); $this->ifram_jscode(); }
public function run() { if (is_null($this->imageOptions)) { $this->imageOptions = ['class' => 'img-responsive']; } $this->imageOptions['id'] = Yii::$app->getSecurity()->generateRandomString(10); $inputField = Html::getInputId($this->model, $this->attribute); echo Html::beginTag('div', ['id' => $inputField . '-cutter']); echo Html::activeFileInput($this->model, $this->attribute); echo Html::beginTag('div', ['class' => 'preview-pane', 'style' => $this->model->{$this->attribute} ? 'display:block' : 'display:none']); echo Html::beginTag('div', ['class' => 'preview-container']); echo Html::img($this->model->{$this->attribute} ? $this->model->{$this->attribute} : null, ['class' => 'preview-image img-responsive']); echo Html::endTag('div'); echo Html::endTag('div'); echo Html::checkbox($this->attribute . '-remove', false, ['label' => Yii::t('sadovojav/cutter/default', 'REMOVE')]); Modal::begin(['header' => Html::tag('h4', Yii::t('sadovojav/cutter/default', 'CUTTER')), 'closeButton' => [], 'footer' => $this->getModalFooter($inputField), 'size' => Modal::SIZE_LARGE]); echo Html::beginTag('div', ['class' => 'image-container']); echo Html::img(null, $this->imageOptions); echo Html::endTag('div'); echo Html::tag('br'); echo Html::beginTag('div', ['class' => 'row']); echo Html::beginTag('div', ['class' => 'col-md-2']); echo Html::label(Yii::t('sadovojav/cutter/default', 'ASPECT_RATIO'), $inputField . '-aspectRatio'); echo Html::textInput($this->attribute . '-aspectRatio', isset($this->jcropOptions['aspectRatio']) ? $this->jcropOptions['aspectRatio'] : 0, ['id' => $inputField . '-aspectRatio', 'class' => 'form-control']); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'col-md-2']); echo Html::label(Yii::t('sadovojav/cutter/default', 'ANGLE'), $inputField . '-dataRotate'); echo Html::textInput($this->attribute . '-cropping[dataRotate]', '', ['id' => $inputField . '-dataRotate', 'class' => 'form-control']); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'col-md-2']); echo Html::label(Yii::t('sadovojav/cutter/default', 'POSITION') . ' (X)', $inputField . '-dataX'); echo Html::textInput($this->attribute . '-cropping[dataX]', '', ['id' => $inputField . '-dataX', 'class' => 'form-control']); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'col-md-2']); echo Html::label(Yii::t('sadovojav/cutter/default', 'POSITION') . ' (Y)', $inputField . '-dataY'); echo Html::textInput($this->attribute . '-cropping[dataY]', '', ['id' => $inputField . '-dataY', 'class' => 'form-control']); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'col-md-2']); echo Html::label(Yii::t('sadovojav/cutter/default', 'WIDTH'), $inputField . '-dataWidth'); echo Html::textInput($this->attribute . '-cropping[dataWidth]', '', ['id' => $inputField . '-dataWidth', 'class' => 'form-control']); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'col-md-2']); echo Html::label(Yii::t('sadovojav/cutter/default', 'HEIGHT'), $inputField . '-dataHeight'); echo Html::textInput($this->attribute . '-cropping[dataHeight]', '', ['id' => $inputField . '-dataHeight', 'class' => 'form-control']); echo Html::endTag('div'); echo Html::endTag('div'); Modal::end(); echo Html::endTag('div'); $view = $this->getView(); CutterAsset::register($view); $options = ['inputField' => $inputField, 'useWindowHeight' => $this->useWindowHeight, 'jcropOptions' => $this->jcropOptions]; $options = Json::encode($options); $view->registerJs('jQuery("#' . $inputField . '").cutter(' . $options . ');'); }
private function genModal() { $forceOptions = ['size' => Modal::SIZE_LARGE]; $modal = Modal::begin(array_merge($this->modalOptions, $forceOptions)); if ($this->fieldID !== null && $this->returnType === null) { $this->returnType = self::RETURN_TYPE_URL; } $url = Url::to([$this->browserUrl, 'fieldID' => $this->fieldID, 'returnType' => $this->returnType, 'modalID' => $modal->id, 'subDir' => $this->options['subDir'], 'createDir' => $this->options['createDir'], 'changeDir' => $this->options['changeDir'], 'upload' => $this->options['upload']]); echo '<iframe src="' . $url . '" frameborder="0" style="height:80vh;width:100%"></iframe>'; Modal::end(); }
public function run() { parent::run(); Modal::end(); echo Html::endTag('div'); $view = $this->getView(); ModalViewAsset::register($view); $settings = ['containerSelector' => $this->containerSelector]; $context = $this->containerSelector === null ? 'teleport.$commonContainer' : "\$('{$this->containerSelector}')"; $view->registerJs("jQuery('#{$this->id}',{$context}).modalView(" . Json::encode($settings) . ");"); }
public function run() { $params = []; $footer = $this->getButtons(); if ($footer) { $params['footer'] = $footer; } if ($this->title) { $params['header'] = '<h4>' . Html::encode($this->title) . '</h4>'; } //~ if($this->updateModal) { //~ $params['options']['data-update-modal'] = Url::to($this->updateModal); //~ } BaseModal::begin($params); echo $this->content; BaseModal::end(); }
public function run() { $object = Object::getForClass(\app\models\Form::className()); $groups = PropertyGroup::getForModel($object->id, $this->formId); $view = !empty($this->model->form_view) ? $this->model->form_view : 'form'; $successView = !empty($this->model->form_success_view) ? $this->model->form_success_view : 'success'; if (!$this->isModal) { echo Html::beginTag('div', ['id' => 'form-info-' . $this->id, 'style' => 'display: none;']); echo $this->render($successView); echo '</div>'; } echo $this->render($view, ['id' => $this->id, 'model' => $this->model, 'groups' => $groups, 'options' => $this->options]); if ($this->isModal) { Modal::end(); Modal::begin(['id' => 'modal-form-info-' . $this->id, 'size' => Modal::SIZE_SMALL, 'header' => $this->statusHeaderName ? $this->statusHeaderName : $this->model->name . ' ' . \Yii::t('app', 'status')]); echo $this->render($successView); Modal::end(); } }
public function run() { echo Html::activeHiddenInput($this->model, $this->attribute, $this->options); $input_id = $this->attribute; if ($this->model[$this->attribute]) { $label = (new Category())->getAnchorPath($this->model[$this->attribute]); } else { $label = 'Выберете категорию'; } Modal::begin(['header' => null, 'toggleButton' => ['label' => $label, 'class' => 'btn-link category-link-select', 'id' => 'btn-categories-modal'], 'options' => ['id' => 'categories-modal', 'data-input-id' => strtolower($this->model->formName()) . '-' . $input_id, 'data-categories-id' => $this->pluginOptions['categories_id']]]); echo Html::beginTag('div', ['class' => 'category-list', 'id' => 'category-list']); // echo Html::beginTag('ul', ['class' => 'list-inline', 'id' => 'categories-lists']); // echo '<li id="category-list-1"></li>'; // echo Html::endTag('ul'); echo Html::endTag('div'); Modal::end(); //echo Html::a('Выберете категорию', null, ['id' => 'category-link-select']); $view = $this->view; CategoryAsset::register($view); }
/** * @inheritdoc */ public function init() { parent::init(); //assert view file is set if ($this->view === null) { $msg = Yii::t('app', 'Please set a view file'); throw new InvalidConfigException($msg); } //default config if (empty($this->sections)) { $this->sections = ['Server' => 'server', 'Yii' => 'yii', 'Database' => 'db', 'Localization' => 'localization', 'Caching' => 'caching', 'RBAC' => 'rbac', 'Current User' => 'currentuser']; } //get php info $this->loadPhpInfo(); //get modal code ob_start(); Modal::begin(['id' => '{id}', 'header' => '<h4>{title}</h4>', 'size' => Modal::SIZE_LARGE]); echo '{content}'; Modal::end(); $this->modalCode = ob_get_clean(); }
/** * Renders the field. */ public function run() { if (is_null($this->imageOptions)) { $this->imageOptions = ['alt' => 'Crop this image']; } $this->imageOptions['id'] = Yii::$app->getSecurity()->generateRandomString(10); $inputField = Html::getInputId($this->model, $this->attribute, ['data-image_id' => $this->imageOptions['id']]); $default_jcropOptions = ['dashed' => FALSE, 'zoomable' => FALSE, 'rotatable' => FALSE]; $this->jcropOptions = array_merge($default_jcropOptions, $this->jcropOptions); if (is_null($this->form)) { $this->form = new ActiveForm(); if (!is_null($this->enableClientValidation)) { $this->form->enableClientValidation = $this->enableClientValidation; } } echo Html::beginTag('div', ['class' => 'uploadcrop']); echo $this->form->field($this->model, $this->attribute)->fileInput(); echo Html::beginTag('div', ['id' => 'preview-pane']); echo Html::beginTag('div', ['class' => 'preview-container']); echo Html::img('', ['class' => 'preview_image']); echo Html::endTag('div'); echo Html::endTag('div'); Modal::begin(['header' => '<h2>Crop image</h2>', 'closeButton' => [], 'footer' => Html::button('Cancel', ['id' => $this->imageOptions['id'] . '_button_cancel', 'class' => 'btn btn-default']) . Html::button('Accept', ['id' => $this->imageOptions['id'] . '_button_accept', 'class' => 'btn btn-success']), 'size' => Modal::SIZE_LARGE]); echo Html::beginTag('div', ['id' => 'image-source', 'class' => 'col-centered']); echo Html::img('', $this->imageOptions); echo Html::endTag('div'); echo html::hiddenInput($this->attribute . '-cropping[x]', '', ['id' => $inputField . '-x']); echo html::hiddenInput($this->attribute . '-cropping[width]', '', ['id' => $inputField . '-width']); echo html::hiddenInput($this->attribute . '-cropping[y]', '', ['id' => $inputField . '-y']); echo html::hiddenInput($this->attribute . '-cropping[height]', '', ['id' => $inputField . '-height']); Modal::end(); echo Html::endTag('div'); $view = $this->getView(); UploadCropAsset::register($view); $jcropOptions = ['inputField' => $inputField, 'jcropOptions' => $this->jcropOptions]; $jcropOptions['maxSize'] = $this->maxSize; $jcropOptions = Json::encode($jcropOptions); $view->registerJs('jQuery("#' . $inputField . '").uploadCrop(' . $jcropOptions . ');'); }
/** * @param $view View * @return string * @throws \Exception */ public static function widgetSendMessageModal(&$view) { $view->registerJs("messageurl = '" . Url::to(['/users/send-message'], true) . "';"); ob_start(); Modal::begin(['header' => '<h3>' . Yii::t('app', 'Send Message') . '</h3>', 'id' => 'messagemodal', 'size' => 'modal-md', 'closeButton' => ['label' => '', 'class' => 'close glyphicon glyphicon-remove'], 'options' => ['tabindex' => false], 'footer' => '<button type="button" class="btn btn-default pull-right" data-dismiss="modal">' . Yii::t('app', 'Cancel') . '</button>' . '<button type="button" class="btn btn-primary pull-left" id="sendBtn">' . Yii::t('app', 'Send') . '</button>']); $url = \yii\helpers\Url::to(['/users/search']); echo Select2::widget(['options' => ['placeholder' => 'To:'], 'model' => new \app\models\User(), 'theme' => Select2::THEME_KRAJEE, 'name' => 'receiver_id', 'pluginOptions' => ['allowClear' => true, 'minimumInputLength' => 3, 'ajax' => ['url' => $url, 'dataType' => 'json', 'data' => new JsExpression('function(params) { return {q:params.term}; }')], 'escapeMarkup' => new JsExpression('function (markup) { return markup; }'), 'templateResult' => new JsExpression('function(city) { return city.text; }'), 'templateSelection' => new JsExpression('function (city) { return city.text; }')]]); $Message = Yii::t('app', 'Message'); $placeholder = Yii::t('app', 'Enter you message..'); echo <<<HTML <div style="margin:20px 0 25px 0;"> <div class="form-group"> <label for="comment">{$Message} :</label> <textarea placeholder="{$placeholder}" class="form-control" rows="5" id="message" style="max-width:100%;"></textarea> </div> </div> HTML; Modal::end(); return ob_get_clean(); }
protected function initDefaultButtons() { if (!isset($this->buttons['view'])) { $this->buttons['view'] = function ($url, $model, $key) { Modal::begin(['id' => 'gridview_view_modal_' . $key, 'header' => '<h2>Detail</h2>']); echo DetailView::widget(['model' => $model, 'attributes' => $this->getDataCellDetailAttributes($model, $key)]); Modal::end(); $options = array_merge(['class' => 'btn btn-light btn-icon', 'data-toggle' => 'modal', 'data-target' => '#gridview_view_modal_' . $key, 'title' => Yii::t('yii', 'View'), 'aria-label' => Yii::t('yii', 'View'), 'data-pjax' => '0'], $this->buttonOptions); return Html::a('<span class="glyphicon"></span>', $url, $options); }; } if (!isset($this->buttons['update'])) { $this->buttons['update'] = function ($url, $model, $key) { $options = array_merge(['class' => 'btn btn-light btn-icon', 'title' => Yii::t('yii', 'Update'), 'aria-label' => Yii::t('yii', 'Update'), 'data-pjax' => '0'], $this->buttonOptions); return Html::a('<span class="glyphicon"></span>', $url, $options); }; } if (!isset($this->buttons['delete'])) { $this->buttons['delete'] = function ($url, $model, $key) { $options = array_merge(['class' => 'btn btn-light btn-icon', 'title' => Yii::t('yii', 'Delete'), 'aria-label' => Yii::t('yii', 'Delete'), 'data-confirm' => Yii::t('yii', 'Are you sure you want to delete this item?'), 'data-method' => 'post', 'data-pjax' => '0'], $this->buttonOptions); return Html::a('<span class="glyphicon"></span>', $url, $options); }; } }
/** * Ends modal widget. */ public function endModal() { Modal::end(); }
/** * Render Bootstrap Modal * @return ExplorerInput $this */ protected function renderModal() { $modalFooter = Html::button(Yii::t('main', 'Close'), ['class' => 'btn btn-default btn-close']) . Html::button(Yii::t('main', 'Select'), ['class' => 'btn btn-primary btn-select']); Modal::begin(['header' => "<h4>{$this->modalTitle}</h4>", 'id' => $this->options['id'] . $this->postfix, 'options' => ['class' => 'explorer-modal'], 'footer' => $modalFooter]); Pjax::begin(['enablePushState' => false]); echo $this->getBreadcrumbs(); echo $this->getGrid(); Pjax::end(); Modal::end(); return $this; }
/** * @param $view */ public function register($view) { $view->on($view::EVENT_END_BODY, function ($event) { $this->registerAssets($event->sender); if ($this->htmlScope) { echo Html::beginTag('span', ['class' => $this->htmlScopeClass]); } if ($this->dialog == I18N::DIALOG_BS) { \yii\bootstrap\Modal::begin(['header' => '<div id="dots-modal-header"><div id="dots-modal-cat-header"></div><div id="dots-modal-key-header"></div></div>', 'closeButton' => ['class' => 'close dot-close'], 'options' => ['id' => 'dots-btn-modal'], 'toggleButton' => ['id' => 'dots-btns', 'style' => 'display: none;']]); $this->bodyDialog(); \yii\bootstrap\Modal::end(); } else { if ($this->dialog == I18N::DIALOG_JQ) { \yii\jui\Dialog::begin(['options' => ['id' => 'dots-btn-modal', 'style' => 'display: none;'], 'clientOptions' => ['autoOpen' => false, 'width' => '50%']]); $this->bodyDialog(); \yii\jui\Dialog::end(); } else { if ($this->dialog == I18N::DIALOG_MAGNIFIC) { \pavlinter\translation\widgets\MagnificPopup::begin(['toggleButton' => ['id' => 'dots-btns', 'style' => 'display: none;', 'href' => '#dots-btn-modal'], 'popupClass' => 'dot-white-popup', 'effect' => 'zoom-in', 'popupOptions' => ['class' => 'dots-modal-magnific', 'id' => 'dots-btn-modal']]); echo Html::beginTag('div', ['id' => 'dots-modal-header']); echo Html::tag('div', null, ['id' => 'dots-modal-cat-header']); echo Html::tag('div', null, ['id' => 'dots-modal-key-header']); echo Html::endTag('div'); $this->bodyDialog(); \pavlinter\translation\widgets\MagnificPopup::end(); } } } if ($this->htmlScope) { echo Html::endTag('span'); } }); $this->showDot = true; }
/** * 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; } }
?> <!-- Модальное окно для больших мониторов --> <? Modal::begin ( [ 'size' => 'modal-lg', 'header' => '<h2>Оформление заявки</h2>', 'footer' => 'Переданные вами контактные данные будут использованы исключительно для связи наших менеджеров с Вами', 'options' => [ 'id' => 'order', //'class' => 'menu_category23' ], ] ); ?> <?php echo $this->render('block/contact/_form', ['name' => true, 'phone' => true, 'text' => '', 'class' => 'form-inline text-center']); ?> <? Modal::end ();?> <!-- /Модальное окно для больших мониторов --> <style type="text/css"> #_header { /*background: url(/image/shadow_000000_percent_50.png);*/ } </style>
/** * @param $template String template gallery * @throws \Exception */ protected function renderLayout($template) { // Display button add image and modal add image Modal::begin(['header' => Yii::t('gallery', 'Add Image'), 'footer' => '<button class="btn btn-success" id="insert_image" data-type="' . self::TYPE_UPLOAD . '">' . Yii::t('yii', 'Insert Image'), 'toggleButton' => ['label' => Yii::t('gallery', 'Add Image'), 'class' => 'btn btn-success'], 'size' => 'modal-lg custom_modal_gallery', 'options' => ['id' => 'sya_gallery_modal']]); echo Html::beginTag('div', ['class' => 'tabs-container']); echo Html::beginTag('div', ['class' => 'tabs-left']); echo Tabs::widget(['navType' => 'nav-tabs', 'encodeLabels' => false, 'items' => [['label' => Yii::t('gallery', 'Insert Media'), 'content' => '<div class="panel-body"><div id="my-awesome-dropzone" class="dropzone sya_custom_dropzone"> <div class="dropzone-previews"></div> </div></div>', 'linkOptions' => ['data-type' => self::TYPE_UPLOAD]], ['label' => Yii::t('gallery', 'Media Library'), 'content' => '<div class="panel-body" style="padding: 0;"> <input type="hidden" class="form-control sya_image_input"/> <div class="row"> <div class="col-md-12" style="margin-top: -125px;"> <div class="col-md-8" id="sya_gallery_path"> <div class="row sya_media_library"></div> </div> <div class="col-md-4" id="sya_gallery_viewpath"></div> </div> </div> </div>', 'linkOptions' => ['data-type' => self::TYPE_PATH]], ['label' => Yii::t('gallery', 'Insert from URL'), 'content' => '<div class="panel-body" id="sya_gallery_form_preview"> <input type="hidden" class="form-control sya_image_input"/> <input type="url" class="form-control sya_input_info_image" name="sya_url"/> <div id="embed_url_settings" class="row"></div> </div>', 'linkOptions' => ['data-type' => self::TYPE_URL]]]]); echo Html::endTag('div'); echo Html::endTag('div'); Modal::end(); // End Display button add image and modal add image echo $template; }
/** * @inheritdoc */ public function run() { $this->saveDetail(); $title = Yii::t('kvdynagrid', "Save / Edit Grid {title}", ['title' => ucfirst($this->model->category)]); $icon = "<i class='glyphicon glyphicon-{$this->model->category}'></i> "; Modal::begin(['header' => '<h3 class="modal-title">' . $icon . $title . '</h3>', 'toggleButton' => $this->toggleButton, 'options' => ['id' => $this->id]]); echo $this->render($this->_module->settingsView, ['model' => $this->model, 'requestSubmit' => $this->_requestSubmit]); Modal::end(); parent::run(); }
/** * Renders the field. */ public function run() { if (is_null($this->imageOptions)) { $this->imageOptions = ['alt' => 'Crop this image']; } $this->imageOptions['id'] = Yii::$app->getSecurity()->generateRandomString(10); $inputField = Html::getInputId($this->model, $this->attribute, ['data-image_id' => $this->imageOptions['id']]); $default_jcropOptions = ['dashed' => FALSE, 'rotatable' => FALSE]; $this->jcropOptions = array_merge($default_jcropOptions, $this->jcropOptions); if (is_null($this->form)) { $this->form = new ActiveForm(); if (!is_null($this->enableClientValidation)) { $this->form->enableClientValidation = $this->enableClientValidation; } } $view = $this->getView(); $assets = UploadCropAsset::register($view); echo Html::beginTag('div', ['class' => 'uploadcrop']); if ($this->imageSrc == '') { $img = $assets->baseUrl . '/img/nophoto.png'; } else { $img = $this->imageSrc; } echo $this->form->field($this->model, $this->attribute)->fileInput(['style' => 'cursor:pointer;'])->label(Html::img($img, ['width' => 200, 'height' => 200])); echo Html::beginTag('span', ['class' => 'upload-title']); echo $this->changePhotoTitle; echo Html::endTag('span'); // echo Html::beginTag('div', ['id' => 'preview-pane']); // echo Html::beginTag('div', ['class' => 'preview-container']); // echo Html::img('', ['class' => 'preview_image']); // echo Html::endTag('div'); // echo Html::endTag('div'); Modal::begin(['header' => '<h3>' . $this->title . '</h3>', 'closeButton' => [], 'footer' => Html::button('Cancel', ['id' => $this->imageOptions['id'] . '_button_cancel', 'class' => 'btn btn-default']) . Html::button('Crop & Save', ['id' => $this->imageOptions['id'] . '_button_accept', 'class' => 'btn btn-success']), 'size' => Modal::SIZE_LARGE]); echo Html::beginTag('div', ['class' => 'spinner']); echo Html::beginTag('div', ['class' => 'bounce1']); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'bounce2']); echo Html::endTag('div'); echo Html::beginTag('div', ['class' => 'bounce3']); echo Html::endTag('div'); echo Html::endTag('div'); echo Html::beginTag('div', ['id' => 'image-source', 'class' => 'col-centered']); echo Html::img('', $this->imageOptions); echo Html::endTag('div'); echo Html::beginTag('div', ['style' => 'display: block;margin: 0 auto;text-align: center;']); echo Html::beginTag('button', ['title' => 'Zoom In', 'class' => 'btn btn-primary', 'type' => 'button', 'id' => 'zoom-in']); echo Html::beginTag('span', ['class' => 'fa fa-search-plus']); echo Html::endTag('span'); echo Html::endTag('button'); echo Html::beginTag('button', ['title' => 'Zoom Out', 'class' => 'btn btn-primary', 'type' => 'button', 'id' => 'zoom-out']); echo Html::beginTag('span', ['class' => 'fa fa-search-minus']); echo Html::endTag('span'); echo Html::endTag('button'); echo Html::endTag('div'); echo html::hiddenInput('cropping[x]', '', ['id' => $inputField . '-x']); echo html::hiddenInput('cropping[width]', '', ['id' => $inputField . '-width']); echo html::hiddenInput('cropping[y]', '', ['id' => $inputField . '-y']); echo html::hiddenInput('cropping[height]', '', ['id' => $inputField . '-height']); Modal::end(); echo Html::endTag('div'); $jcropOptions = ['inputField' => $inputField, 'jcropOptions' => $this->jcropOptions]; $jcropOptions['maxSize'] = $this->maxSize; $jcropOptions['formId'] = $this->form->id; $jcropOptions = Json::encode($jcropOptions); $view->registerJs('jQuery("#' . $inputField . '").uploadCrop(' . $jcropOptions . ');'); }
public function modal($id, $pic) { Modal::begin(['header' => 'Picture', 'toggleButton' => ['label' => '<span class="glyphicon glyphicon-eye-open"></span>']]); echo Html::img('http://app.dev/img/page_' . $id . '/' . $pic, ['style' => 'width:120px;', 'class' => 'img-thumbnail']); Modal::end(); }
/** * Renders the import menu * * @return string the import menu markup */ public function renderImportUpload() { $modal = Modal::begin(['options' => ['id' => "import-modal"], 'header' => '<h2>' . Yii::t('ltimport', 'Import data') . '</h2>', 'footer' => '<button type="button" class="btn btn-default pull-right" data-dismiss="modal">Close</button>']); $form = ActiveForm::begin(['action' => ['import/import'], 'layout' => 'horizontal', 'options' => ['enctype' => 'multipart/form-data']]); echo Html::hiddenInput('tableName', $this->tableName); if ($this->uploadFolderZip) { echo Html::label(Yii::t('ltimport', 'Import Zip File')) . '<br>'; echo \kartik\widgets\FileInput::widget(['name' => 'importFolderZip', 'options' => ['multiple' => false], 'pluginOptions' => ['previewFileType' => 'any']]) . '<br><br>'; } echo Html::label(Yii::t('ltimport', 'Import data in selected format')) . '<br>'; echo \kartik\widgets\FileInput::widget(['name' => 'importFile', 'options' => ['multiple' => false], 'pluginOptions' => ['previewFileType' => 'any']]) . '<br><br>'; $form::end(); Modal::end(); }
/* @var $searchModel app\models\FrequenciaSearch */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Minhas Frequências'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="frequencia-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php // echo $this->render('_search', ['model' => $searchModel]); ?> <p><?php echo Html::a('Ver todas', ['minhasfrequencias'], ['class' => 'btn btn-success']); ?> </p> <?php Modal::begin(['header' => '<h3>Frequência Individual</h3>', 'id' => 'modal', 'size' => '']); echo "<div id='modalContent'></div>"; Modal::end(); ?> <?php echo \yii2fullcalendar\yii2fullcalendar::widget(array('events' => $events)); ?> </div>
<?php use yii\widgets\Pjax; /** @var \app\models\Budget $budgetModel */ /** @var \app\models\BudgetHistory $modelHistory */ \yii\bootstrap\Modal::begin(['header' => '<h3>Доход</h3>', 'toggleButton' => ['tag' => 'button', 'class' => 'btn btn-success btn-block', 'label' => '<i class="fa fa-plus-circle"></i> ' . Yii::t('app', 'New income')]]); echo $this->render('_income_form', ['model' => $modelHistory, 'budgetModel' => $budgetModel]); \yii\bootstrap\Modal::end();
Pjax::begin(['id' => 'pjax-otp-submit' , 'enablePushState' => false , 'timeout' =>false]); $form = ActiveForm::begin([ 'id' => 'otp-form', 'options'=> ['role' => 'form' , 'data-pjax' => '1']]); ?> <fieldset> <?= Html::textInput('otp','',['class' => 'form-control']); ?> <br> <?= Html::submitButton('Enter Otp',['class' => 'btn btn-primary'])?> </fieldset> <?php ActiveForm::end(); ?> <?php Pjax::end(); ?> <?php Modal::end(); ?> <?php $this->registerJs(' jQuery(document).on("pjax:success" ,"#pjax-reset-form" , function(event){ $("#reset-form").yiiActiveForm("validate"); var len = $("#reset-form").find(".has-error").length; if(len === 0){ $("#otp-modal").modal("show"); } }); '); ?>
/** * Display modal window with form for selecting visible columns. */ public function run() { $visibleColumns = $this->gridManager->getVisibleColumns($this->gridId); if ($visibleColumns === false) { $visibleColumns = array_keys($this->columnsList); } $columnsList = []; for ($i = 0; $i != count($visibleColumns); $i++) { $key = $visibleColumns[$i]; if (isset($this->columnsList[$key])) { $columnsList[$key] = $this->columnsList[$key]; unset($this->columnsList[$key]); } } $columnsList = array_merge($columnsList, $this->columnsList); $modal = Modal::begin($this->modalOptions); echo Html::beginForm($this->actionForm, $this->methodForm, $this->formOptions); echo Html::checkboxList('columns', $visibleColumns, $columnsList, ['class' => 'checkbox columns-list']); echo Html::beginTag('div', ['class' => 'form-group']); echo Html::submitButton($this->submitBtnLabel, $this->submitBtnOptions); echo Html::endTag('div'); echo Html::endForm(); Modal::end(); $pluginSortableOptions = Json::encode($this->pluginSortableOptions); $this->view->registerJs("jQuery('#{$modal->id} .columns-list').sortable({$pluginSortableOptions});"); }