本文整理汇总了PHP中yii\bootstrap\Button::widget方法的典型用法代码示例。如果您正苦于以下问题:PHP Button::widget方法的具体用法?PHP Button::widget怎么用?PHP Button::widget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\bootstrap\Button
的用法示例。
在下文中一共展示了Button::widget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
if (!empty($this->clientEvents)) {
$events = $this->registerCKFInderEvents();
$this->clientOptions['onInit'] = new JsExpression("function(finder){ {$events}}");
}
$options = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions);
$this->getView()->registerJs("\$('#{$this->options['id']}-popup').on('click', function(){ CKFinder.{$this->type}({$options}); });");
CKFinderAsset::register($this->getView());
Html::addCssClass($this->options, 'form-control');
$input = $this->hasModel() ? Html::activeTextInput($this->model, $this->attribute, $this->options) : Html::textInput($this->name, $this->value, $this->options);
return implode("\n", [Html::beginTag('div', ['class' => 'input-group']), $input, Html::beginTag('span', ['class' => 'input-group-btn']), Button::widget(['id' => $this->options['id'] . '-popup', 'label' => $this->buttonLabel, 'options' => $this->buttonOptions]), Html::endTag('span'), Html::endTag('div')]);
}
示例2: renderButton
/**
* Generates the button dropdown.
* @return string the rendering result.
*/
protected function renderButton()
{
Html::addCssClass($this->options, 'btn');
$label = $this->label;
if ($this->encodeLabel) {
$label = Html::encode($label);
}
$options = $this->options;
$splitButton = '';
$caretHtml = $this->caretHtml ? $this->caretHtml : '<span class="caret"></span>';
if ($this->split) {
$options = $this->options;
$this->options['data-toggle'] = 'dropdown';
Html::addCssClass($this->options, 'dropdown-toggle');
$splitButton = Button::widget(['label' => $this->caretHtml ? $this->caretHtml : '<span class="caret"></span>', 'encodeLabel' => false, 'options' => $this->options, 'view' => $this->getView()]);
} else {
$label .= ' ' . $this->caretHtml ? $this->caretHtml : '<span class="caret"></span>';
$options = $this->options;
if (!isset($options['href'])) {
$options['href'] = '#';
}
Html::addCssClass($options, 'dropdown-toggle');
$options['data-toggle'] = 'dropdown';
}
return Button::widget(['tagName' => $this->tagName, 'label' => $label, 'options' => $options, 'encodeLabel' => false, 'view' => $this->getView()]) . "\n" . $splitButton;
}
示例3: getButtons
protected function getButtons()
{
$content = '';
foreach ($this->buttons as $button) {
$content .= Button::widget($button) . "\n";
}
return $content;
}
示例4: renderButtons
/**
* Generates the buttons that compound the group as specified on [[buttons]].
* @return string the rendering result.
*/
protected function renderButtons()
{
$buttons = [];
foreach ($this->buttons as $button) {
if (is_array($button)) {
$label = ArrayHelper::getValue($button, 'label');
$options = ArrayHelper::getValue($button, 'options');
$buttons[] = Button::widget(['label' => $label, 'options' => $options, 'encodeLabel' => $this->encodeLabels, 'view' => $this->getView()]);
} else {
$buttons[] = $button;
}
}
return implode("\n", $buttons);
}
示例5: renderButtons
/**
* Generates the buttons that compound the group as specified on [[buttons]].
* @return string the rendering result.
*/
protected function renderButtons()
{
$buttons = [];
foreach ($this->buttons as $button) {
if (is_array($button)) {
$button['view'] = $this->getView();
if (!isset($button['encodeLabel'])) {
$button['encodeLabel'] = $this->encodeLabels;
}
$buttons[] = Button::widget($button);
} else {
$buttons[] = $button;
}
}
return implode("\n", $buttons);
}
示例6:
<strong class="pull-right primary-font">Bhaumik Patel</strong>
</div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur bibendum ornare dolor, quis ullamcorper ligula sodales.
</p>
</div>
</li>
</ul>
</div>
<!-- /.panel-body -->
<div class="panel-footer">
<div class="input-group">
<input id="btn-input" type="text" class="form-control input-sm" placeholder="Type your message here..." />
<span class="input-group-btn">
<?php
echo Button::widget(['label' => 'Send', 'options' => ['class' => 'btn btn-warning btn-sm', 'id' => 'btn-chat']]);
?>
</span>
</div>
</div>
<!-- /.panel-footer -->
</div><!-- /.panel .chat-panel -->
</div>
</div>
<!-- this goes on every site file in p2made demos -->
<br><div class="alert alert-success" role="alert">
<ul class="fa-ul">
<li>
<?php
echo FA::fw(FA::_CODE)->li()->size(FA::SIZE_LARGE);
示例7:
$this->title = 'Edit chipset';
$this->params['breadcrumbs'][] = ['label' => 'Chipsets', 'url' => '/chipset'];
$this->params['breadcrumbs'][] = 'Edit';
?>
<div class="box">
<?php
$form = ActiveForm::begin(['id' => 'edit-chipset-form', 'action' => 'save']);
?>
<?php
echo Html::activeHiddenInput($model, 'id');
?>
<div class="box-body">
<div class="form-group">
<?php
echo $form->field($model, 'value');
?>
</div>
<div class="box-footer">
<?php
echo Button::widget(['label' => 'Save', 'options' => ['class' => 'btn btn-primary']]);
?>
<?php
echo Html::a('Cancel', Yii::$app->request->referrer, ['class' => 'btn btn-default']);
?>
</div>
</div>
<?php
ActiveForm::end();
?>
</div>
示例8:
<img id="user-avatar" class="img-responsive" alt="<?php
echo $model->fullname;
?>
" src="<?php
echo $model->image;
?>
"/>
</div>
<!-- Allow user to update only their profiles -->
<?php
if (!\Yii::$app->user->isGuest && \Yii::$app->user->identity->id == $model->id) {
?>
<div style="padding-bottom:5px;">
<?php
echo Button::widget(['label' => Yii::t('app', 'Change Avatar'), 'options' => ['class' => 'btn-sm btn-warning', 'id' => 'updateAvatar']]);
?>
<?php
echo Html::a(Yii::t('app', 'Update Profile'), ['update', 'id' => $model->id], ['class' => 'btn btn-sm btn-primary']);
?>
</div>
<?php
}
?>
<?php
echo DetailView::widget(['model' => $model, 'attributes' => ['email:email', 'fname', 'lname', 'username', 'mobile', 'regtime:date', ['label' => $model->getAttributeLabel('gender'), 'value' => $model->gender == 1 ? Yii::t('app', 'Male') : Yii::t('app', 'Female')]]]);
?>
<?php
示例9: function
<?php
use yii\bootstrap\Button;
?>
<ul id="filelist"></ul>
<?php
echo Button::widget(['label' => 'Browse', 'options' => ['id' => 'browse', 'class' => 'btn-default']]);
?>
<?php
echo Button::widget(['label' => 'Start Upload', 'options' => ['id' => 'start-upload', 'class' => 'btn-default']]);
?>
<?php
echo \indica\yii2plupload\widgets\CoreWidget::widget(['varName' => 'uploader', 'settings' => ['browse_button' => 'browse', 'url' => ['default/upload']]]);
?>
<h3>Console</h3>
<pre id="console"></pre>
<?php
$this->registerJs("\n\tuploader.bind('FilesAdded', function(up, files) {\n\t\tvar html = '';\n\t\tplupload.each(files, function(file) {\n\t\t\thtml += '<li id=\"' + file.id + '\">' + file.name + ' (' + plupload.formatSize(file.size) + ') <b></b></li>';\n\t\t});\n\t\tdocument.getElementById('filelist').innerHTML += html;\n\t});\n\tuploader.bind('UploadProgress', function(up, file) {\n\t\tdocument.getElementById(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + \"%</span>\";\n\t});\n\tuploader.bind('Error', function(up, err) {\n\t\tdocument.getElementById('console').innerHTML += \"\\nError #\" + err.code + \": \" + err.message;\n\t});\n\tdocument.getElementById('start-upload').onclick = function() {\n\t\tuploader.start();\n\t};\n");
示例10:
<?php
use kartik\form\ActiveForm;
use kartik\icons\Icon;
use kartik\widgets\Select2;
use yii\helpers\Html;
?>
<div class="well">
<?php
echo $this->render('alert');
?>
<?php
$form = ActiveForm::begin(['id' => 'Administrator', 'action' => \yii\helpers\Url::to(['']), 'type' => ActiveForm::TYPE_HORIZONTAL, 'enableClientScript' => false, 'enableClientValidation' => true, 'encodeErrorSummary' => false, 'formConfig' => ['labelSpan' => 3], 'options' => ['onkeypress' => "return event.keyCode != 13;"]]);
echo $form->errorSummary($admin, ['class' => 'alert alert-danger']);
?>
<?php
echo $form->field($admin, 'name')->textInput(['autocomplete' => 'off', 'placeholder' => $admin->getAttributeLabel('name')]);
?>
<?php
echo $form->field($admin, 'password')->passwordInput(['autocomplete' => 'off', 'placeholder' => $admin->getAttributeLabel('password')]);
?>
<?php
echo $form->field($admin, 'email')->textInput(['autocomplete' => 'off', 'placeholder' => $admin->getAttributeLabel('email')]);
?>
<?php
echo \yii\bootstrap\Button::widget(['id' => 'backButton', 'label' => Icon::show('arrow-circle-left') . Yii::t('install', 'Back'), 'encodeLabel' => false, 'options' => ['class' => 'btn btn-info', 'onClick' => new \yii\web\JsExpression("\n \$('#stepsMenu a:eq({$previousStep})').click();\n return false;")]]);
echo Html::a(Icon::show('arrow-circle-right') . Yii::t('install', 'Continue'), '', ['class' => 'btn btn-info', 'style' => 'margin-left: 10px;', 'onClick' => new \yii\web\JsExpression("\n \$('#Administrator').submit();\n return false;")]);
?>
</div>
示例11: JsExpression
use app\helpers\Icon;
use app\widgets\ActiveForm;
use app\widgets\InputGroup;
use yii\bootstrap\Button;
use yii\helpers\Html;
use yii\web\JsExpression;
/** @var $this yii\web\View */
/** @var $form app\widgets\ActiveForm */
/** @var $model app\forms\user\Profile */
/** @var $emailId string */
$emailId = Html::getInputId($model, 'email');
$form = ActiveForm::begin(['id' => 'user-profile-form', 'pjax' => true, 'layout' => 'horizontal', 'enableClientValidation' => true, 'fieldConfig' => ['horizontalCssClasses' => ['label' => 'col-sm-2', 'wrapper' => 'col-sm-10']]]);
?>
<?php
echo $form->field($model, 'email')->widget(InputGroup::className(), ['inputOptions' => ['class' => 'form-control', 'disabled' => 'disabled'], 'button' => true, 'addon' => Button::widget(['label' => Icon::icon('glyphicon glyphicon-copy'), 'encodeLabel' => false, 'options' => ['class' => 'btn btn-default btn-flat'], 'clientEvents' => ['click' => new JsExpression("function (ev) {\n ev.preventDefault();\n \$('#{$emailId}').removeAttr('disabled').select();\n document.execCommand('copy');\n \$('#{$emailId}').attr('disabled', 'disabled');\n }")]])]);
?>
<?php
echo $form->field($model, 'name');
?>
<?php
echo $form->field($model, 'password')->passwordInput();
?>
<?php
echo $form->field($model, 'password_repeat')->passwordInput();
?>
<?php
ActiveForm::endWithActions(['cancel' => false]);
?>
示例12: switch
use yii\bootstrap\Button;
/**
* @var $elements []
* @var $model SettingsModel
*/
$form = ActiveForm::begin();
$message = \Yii::$app->session->getFlash('settings');
if ($message) {
echo Alert::widget(['options' => ['class' => 'alert-success'], 'body' => $message]);
}
foreach ($elements as $key => $element) {
if (is_callable($element['input'])) {
echo $element['input']($model, $key);
} else {
switch ($element['input']) {
case 'dropdown':
echo $form->field($model, $key)->dropDownList($element['options']);
break;
case 'checkboxList':
echo $form->field($model, $key)->checkboxList($element['options']);
break;
default:
case 'text':
echo $form->field($model, $key);
}
}
}
echo '<div class="form-group">';
echo Button::widget(['label' => Yii::t('yii2settings', 'Save'), 'options' => ['class' => 'btn-primary']]);
echo '</div>';
$form->end();
示例13:
<div class="panel panel-default own-panel">
<div class="panel-body">
<div class="row">
<div class="col-xs-12 col-sm-10">
<?php
echo \yii\bootstrap\Button::widget(['label' => '<span id="own-date-start">2016-01-01</span> - <span id="own-date-end">2016-01-05</span> <i class="fa fa-calendar"></i>', 'options' => ['id' => 'own-date-filter', 'class' => 'btn btn-success'], 'encodeLabel' => false]);
?>
<div class="btn-group" role="group" id="own-filter-date-quick">
<button type="button" class="btn btn-default" data-date="0">今天</button>
<button type="button" class="btn btn-default" data-date="-1">昨天</button>
<button type="button" class="btn btn-default" data-date="-7">近7天</button>
<button type="button" class="btn btn-default" data-date="-15">近15天</button>
<button type="button" class="btn btn-default" data-date="-30">近30天</button>
</div>
<?php
echo \yii\helpers\Html::button('<i class="fa fa-refresh"></i> 刷新一下', ['class' => 'btn btn-success btn-sm', 'id' => 'own-refresh-chart']);
?>
</div>
<div class="col-xs-12 col-sm-2">
<?php
\yii\bootstrap\Modal::begin(['options' => ['class' => 'own-filter'], 'header' => '<h5><label>筛选</label></h5>', 'footer' => '<button type="button" class="btn btn-primary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="own-sure-filter">确认</button>', 'toggleButton' => ['label' => '<i class="fa fa-filter"></i> 过滤', 'class' => 'btn btn-success btn-sm pull-right']]);
?>
<div class="btn-group" role="group" id="own-filter-tab">
<button type="button" class="btn btn-success" id="own-filter-tag-platform">平台</button>
<button type="button" class="btn btn-default" id="own-filter-tag-server">区服</button>
<button type="button" class="btn btn-default" id="own-filter-tag-channel">渠道</button>
</div>
<hr>
<div class="btn-group pull-right btn-group-xs" role="group">
<button type="button" class="btn btn-success" id="own-filter-check-all">全选</button>
示例14:
<div class="col-sm-6">
<?php
echo Html::hiddenInput('response_formatting', '');
?>
<div class="radio">
<?php
echo Html::radio('response_formatting', true, ['label' => 'User friendly', 'value' => 'pretty']);
?>
</div>
<div class="radio">
<?php
echo Html::radio('response_formatting', false, ['label' => 'Raw (JSON)', 'value' => 'raw']);
?>
</div>
</div>
</div>
<div class="col-sm-offset-2">
<?php
foreach ($model->coreAttributeNames() as $attributeName) {
echo Html::activeHiddenInput($model, $attributeName);
}
?>
<?php
echo Button::widget(['label' => 'Send request!', 'options' => ['class' => 'btn-primary']]);
?>
</div>
<?php
ActiveForm::end();
示例15:
<?php
use karpoff\icrop\CropImageUpload;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use yii\grid\GridView;
echo \yii\bootstrap\Button::widget(['options' => ['id' => 'button-add', 'href' => Url::to('crop/edit'), 'class' => 'btn btn-primary'], 'tagName' => 'a', 'label' => 'Add']);
echo GridView::widget(array_merge(['id' => 'list-grid'], $grid_config));