Created
June 24, 2020 12:14
-
-
Save MasterHans/9515a0c2e6a811b26fcee94c2873d612 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$script = <<<JS | |
$(function () { | |
$('#showModalMessage').click(function () { | |
$('#modalMessage').modal('show') | |
.find('.modalContent') | |
.load($(this).data('value')); | |
}); | |
$('#showModalBan').click(function () { | |
$('#modalBan').modal('show') | |
.find('.modalContent') | |
.load($(this).data('value')); | |
}); | |
$('#showModalBansHistory').click(function () { | |
$('#modalBanHistory').modal('show') | |
.find('.modalContent1') | |
.load($(this).data('value')); | |
}); | |
}); | |
// Функция для кнопки вывода второго модального окна | |
function onClickButtonCause(e) | |
{ | |
var url = e.value, | |
container2 = $('.modalContent2'); | |
$('#modalCauseBanHistory').modal('show') | |
.find(container2) | |
.load(url); | |
// .load($(this).data('value')); | |
} | |
JS; | |
$this->registerJs($script, $this::POS_END); | |
Modal::begin([ | |
'header' => '<h4>'.\Yii::t('yii', 'To send a message to the user.').'</h4>', | |
'id' => 'modalMessage', | |
'size' => '', | |
]); | |
echo "<div class='modalContent'></div>"; | |
Modal::end(); | |
Modal::begin([ | |
'header' => '<h4>Блокировка пользователя</h4>', | |
'id' => 'modalBan', | |
'size' => '', | |
]); | |
echo "<div class='modalContent'></div>"; | |
Modal::end(); | |
Modal::begin([ | |
// 'header' => '<h4>История банов пользователя</h4>', | |
'header' => '', | |
'id' => 'modalBanHistory', | |
'size' => 'modal-lg', | |
]); | |
echo "<div class='modalContent1'></div>"; | |
Modal::end(); | |
Modal::begin([ | |
// 'header' => '<h4>История банов пользователя</h4>', | |
'header' => '', | |
'id' => 'modalCauseBanHistory', | |
'size' => 'modal-xl', | |
]); | |
echo "<div class='modalContent2'></div>"; | |
Modal::end(); | |
?> | |
Кнопка №1 | |
<a href="javascript:void(0);" id="showModalBansHistory" class="btn btn-info btn-block" data-value="<?= Url::to(['/ban/view-for-user', 'user_id' => $model->id]) ?>">История Банов</a> | |
Кнопка №2 | |
'buttons' => [ | |
'view' => function ($url, $model, $key) { | |
$url = ['/reviews-cause-ban'/*, 'user_id' => $model->id*/]; | |
// return Html::a('<i class="far fa-eye"></i> Причина', $url, ['class' => 'btn btn-default', 'id'=>'showModalReviewsCauseBanHistory', 'onclick' => 'onClickButtonCause(this); false;']); | |
return Html::button( | |
'<i class="far fa-eye"></i> Причина', | |
[ | |
'value'=> Url::to(['/reviews-cause-ban'/*,'id' => $model->id*/]), | |
'class' => 'btn-update', | |
'title'=>'Корректировать', | |
'id'=>'showModalReviewsCauseBanHistory', | |
'data-pjax' => '0', | |
'onclick' => 'onClickButtonCause(this); false;', | |
]); | |
} | |
], |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment