本文整理汇总了PHP中yii\bootstrap\Modal::end方法的典型用法代码示例。如果您正苦于以下问题:PHP Modal::end方法的具体用法?PHP Modal::end怎么用?PHP Modal::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\bootstrap\Modal
的用法示例。
在下文中一共展示了Modal::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* 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 );");
}
}
示例2: run
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 . ');');
}
示例3: initializeModal
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();
}
示例4: run_iframe
/**
* 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();
}
示例5: run
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 . ');');
}
示例6: genModal
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();
}
示例7: run
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) . ");");
}
示例8: run
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();
}
示例9: run
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();
}
}
示例10: run
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);
}
示例11: init
/**
* @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();
}
示例12: 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, '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 . ');');
}
示例13: widgetSendMessageModal
/**
* @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();
}
示例14: initDefaultButtons
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);
};
}
}
示例15: endModal
/**
* Ends modal widget.
*/
public function endModal()
{
Modal::end();
}