/** * 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() { Icon::map($this->view, Icon::FA); echo "<div id='cjModalContent'>" . Icon::show('refresh fa-spin', [], Icon::FA) . "</div>"; // echo "".Icon::show('refresh fa-spin', [], Icon::FA).""; parent::run(); }
/** * Renders the widget. */ public function run() { $this->registerClientScript(); $button = Html::button(FontAwesome::icon('picture-o') . ' ' . $this->buttonLabel, $this->buttonOptions); if ($this->iframe) { $button .= Modal::widget(['id' => $this->getIFrameModalId(), 'header' => Html::tag('h4', $this->modalTitle, ['class' => 'modal-title']), 'size' => Modal::SIZE_LARGE, 'options' => ['class' => 'kcfinder-modal']]); } $thumbs = ''; if ($this->hasModel() && is_array($this->model->{$this->attribute})) { $images = $this->model->{$this->attribute}; foreach ($images as $path) { $thumbs .= strtr($this->thumbTemplate, ['{thumbSrc}' => $this->getThumbSrc($path), '{inputName}' => $this->getInputName(), '{inputValue}' => $path]); } } $thumbs = Html::tag('ul', $thumbs, ['id' => $this->getThumbsId(), 'class' => 'kcf-thumbs']); echo Html::tag('div', strtr($this->template, ['{button}' => $button, '{thumbs}' => $thumbs]), ['class' => 'kcf-input-group']); }
echo $form->field($model, 'description')->widget(LangInputWidget::classname(), ['options' => ['type' => 'activeTextarea']]); ?> <?php echo $form->field($model, 'content')->widget(LangInputWidget::classname(), ['options' => ['type' => 'activeTextarea', 'redactor' => true, 'urlPreffix' => 'news/', 'form' => $form]]); ?> </div> <div class="tab-pane" id="tags-tab"> <? $modalNewTag = Modal::widget([ 'id' => 'new-tag-modal', 'toggleButton' => [ 'label' => Yii::t('b/news/tag', 'Add new tag'), 'tag' => 'a', 'data-target' => '#new-tag-modal', 'href' => Url::toRoute(['tag/add-new-tag']), ], 'closeButton' => [ 'tag' => 'button', 'label' => '<span aria-hidden="true">×</span>' ], 'clientOptions' => false, ]); ?> <?php echo $form->field($model, 'tagIds')->widget(SelectizeTextInput::className(), ['loadUrl' => ['tag/tags-list'], 'options' => ['class' => 'form-control'], 'clientOptions' => ['plugins' => ['remove_button', 'restore_on_backspace', 'drag_drop'], 'valueField' => 'id', 'labelField' => 'name', 'searchField' => ['name'], 'options' => new JsExpression($model->getTagItems()), 'items' => $model->getTagIds(true), 'hideSelected' => true, 'closeAfterSelect' => true]])->hint($modalNewTag); ?> </div> <div class="tab-pane" id="image-tab"> <?php echo $form->field($model, 'image')->widget(FileInputWidget::classname(), ['options' => ['accept' => 'image/*'], 'pluginOptions' => ['initialPreview' => $model->getThumbFileUrl('image', 'small') ? [Html::img($model->getThumbFileUrl('image', 'small'), ['class' => 'file-preview-image'])] : []]]); ?>
public function getModal() { if (self::$_modal === null) { ob_start(); ob_implicit_flush(false); $this->optionsModal['class'] = Modal::className(); self::$_modal = Yii::createObject($this->optionsModal); $out = self::$_modal->run(); $out = ob_get_clean() . $out; $view = $this->getView(); $view->on($view::EVENT_END_BODY, function () use($out) { echo $out; }); } return self::$_modal; }
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(); }
/** * Disable * @return null */ public function renderHeader() { if ($this->showHeader) { parent::renderHeader(); } return null; }
/** * Initializes the widget. */ public function init() { $this->options = array_merge(['class' => 'modal-fs fade'], $this->options); $padding = $this->modalBodyPadding === false ? '0' : $this->modalBodyPadding; $this->getView()->registerCss("\n .modal-fs .modal-body{\n padding:{$padding};\n }\n "); parent::init(); FullscreenModalAsset::register($this->getView()); }
/** * 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(); }
/** * @inheritdoc */ public function run() { parent::run(); if ($this->remote) { $id = $this->options['id']; $url = Url::to($this->remote); $this->getView()->registerJs("Admin.Modal.remote('#{$id}', '{$url}');"); } }
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() { 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 . ');'); }
public function init() { if ($this->id) { $this->options['id'] = $this->id; } if ($this->header) { $this->header = Html::tag('h4', $this->header, ['class' => 'modal-title']); } if ($this->btn_close) { $close_btn = Html::tag('button', __('Close'), ['type' => 'button', 'class' => 'btn btn-default', 'data-dismiss' => 'modal']); $this->footer .= PHP_EOL . $close_btn; } parent::init(); }
/** * @inheritdocs */ public function run() { $view = $this->getView(); parent::run(); ModalAsset::register($view); $id = $this->options['id']; $ajaxSubmit = $this->ajaxSubmit ? 'true' : 'false'; $js = <<<JS jQuery('#{$id}').kbModalAjax({ url: '{$this->url}', ajaxSubmit: {$ajaxSubmit}, }); JS; $view->registerJs($js); }
/** * Renders the HTML markup for the footer of the modal. * This will also render buttons. * @return string the rendering result */ public function renderFooter() { $footer = parent::renderFooter(); if (empty($footer) && (isset($this->cancelButton) || isset($this->submitButton))) { if ($this->cancelButton) { $footer .= Button::widget($this->cancelButton); } if ($this->submitButton) { $footer .= Button::widget($this->submitButton); } Html::addCssClass($this->footerOptions, 'modal-footer'); $footer = Html::tag('div', "\n" . $footer . "\n", $this->footerOptions); } return $footer; }
/** * Initializes the widget. * This method will register the bootstrap asset bundle. If you override this method, * make sure you call the parent implementation first. */ public function init() { parent::init(); if (!isset($this->options['id'])) { $this->options['id'] = $this->getId(); } if (!isset($this->element) || $this->element === false) { $this->element = 'document.body'; } //Prepare modal dialog ob_start(); ob_implicit_flush(false); $this->_modal = \Yii::createObject(['class' => Modal::className(), 'header' => '<h4 class="modal-title">Карта</h4>', 'size' => Modal::SIZE_DEFAULT, 'toggleButton' => false, 'footer' => '<button type="button" class="btn btn-default" data-dismiss="modal">Закрыть</button>']); $this->_modal->run(); $this->_modalHtml = ob_get_clean(); }
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() { parent::run(); $js = <<<JS \$(function(){ \$(".modal-button").click(function(){ console.log(\$(this)); var target = \$(this).attr('modal-target'); \$(target) .modal("show") .find(".modal-body") .load( \$(this).closest("[modal-href]").attr("modal-href") ); }); }); JS; $view = $this->getView(); $view->registerJs($js, View::POS_READY, 'yii2popup'); }
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); }; } }
/* @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();
/** * @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(); }
/** * Registers JS code for handling relations. * @param \yii\web\View $view * @return string modal widget to be embedded in a view */ public static function registerRelations($view) { \netis\crud\assets\RelationsAsset::register($view); $options = \yii\helpers\Json::htmlEncode(['i18n' => ['loadingText' => Yii::t('app', 'Loading, please wait.')], 'keysSeparator' => \netis\crud\crud\Action::KEYS_SEPARATOR, 'compositeKeySeparator' => \netis\crud\crud\Action::COMPOSITE_KEY_SEPARATOR]); $view->registerJs("netis.init({$options})", \yii\web\View::POS_READY, 'netis.init'); // init relation tools used in _relations subview // relations modal may contain a form and must be rendered outside ActiveForm return \yii\bootstrap\Modal::widget(['id' => 'relationModal', 'size' => \yii\bootstrap\Modal::SIZE_LARGE, 'header' => '<span class="modal-title"></span>', 'footer' => implode('', [Html::button(Yii::t('app', 'Save'), ['id' => 'relationSave', 'class' => 'btn btn-primary']), Html::button(Yii::t('app', 'Cancel'), ['class' => 'btn btn-default', 'data-dismiss' => 'modal', 'aria-hidden' => 'true'])])]); }
/** * 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});"); }