本文整理汇总了PHP中yii\bootstrap\Button类的典型用法代码示例。如果您正苦于以下问题:PHP Button类的具体用法?PHP Button怎么用?PHP Button使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Button类的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:
?>
<div id="form-contents">
<p id='form-error'><?php
echo \Yii::t('app', '{h}Enter Valid Email or username you registered with{ch}', ['h' => '<b>', 'ch' => '</b>']);
?>
</p>
<p> <input type="text" id="email" class="form-control" /></p>
<div id="pbar" class="progress progress-striped active">
<div class="progress-bar" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%">
</div>
</div>
<p><?php
echo Button::widget(['label' => Yii::t('app', 'Reset Password'), 'options' => ['class' => 'btn-sm btn-danger', 'id' => 'submitReset']]);
?>
</p>
<p><?php
echo Html::checkbox('activation', false, ['id' => 'resendActivation']) . ' ' . \Yii::t('app', 'Only Resend Activation Code');
?>
</p>
</div>
<?php
Dialog::end();
?>
<!-- Login part -->
<div class="site-login">
<h1><?php
示例7: foreach
<?php
use yii\bootstrap\Button;
use yii\bootstrap\Modal;
use yii\helpers\Html;
Modal::begin(['id' => 'modal-fav', 'header' => '添加收藏', 'clientOptions' => ['show' => false], 'footer' => Button::widget(['label' => '保存', 'id' => 'btn-fav-save', 'options' => ['class' => 'btn btn-primary']])]);
?>
<div class="row">
<?php
if (empty($this->context->collections)) {
?>
no fav co
<?php
} else {
?>
<?php
foreach ($this->context->collections as $model) {
?>
<div class="col-md-4 col-xs-6">
<span>
<?php
echo Html::radio("collections", false, ['value' => $model->id, 'class' => 'collection']);
?>
</span>
<span>
<?php
echo Html::label($model->name);
?>
</span>
示例8:
<?php
echo Html::passwordInput('password', '', ['class' => 'form-control', 'required' => 'required', 'placeholder' => 'กรุณากรอกรหัสผ่านใหม่']);
?>
</div>
</div>
</div>
</div>
<div class="row rowbb">
<div class="col-md-12">
<div class="form-actions fluid">
<div class="text-center">
<?php
echo Button::widget(['label' => 'บันทึก', 'options' => ['class' => 'btn green', 'type' => 'submit']]);
?>
<a href="<?php
echo Url::toRoute('user/list');
?>
" class="btn default" >ยกเลิก </a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
示例9: renderDropdown
/**
* Generates the dropdown menu.
*
* @return string the rendering result.
*/
protected function renderDropdown()
{
$buttons = [];
foreach ($this->buttons as $key => $button) {
$options = $this->options;
unset($options['id']);
$url = $this->createUrl($this->key, $key);
$label = $this->encodeLabels ? Html::encode($button['label']) : $button['label'];
$buttons[] = ['label' => isset($button['icon']) ? Html::icon($button['icon'], ['class' => 'text-' . $button['type']]) . ' ' . $label : $label, 'url' => $url, 'linkOptions' => $options];
}
if (count($buttons) <= 1) {
return '';
}
$splitButton = Button::widget(['label' => '<span class="caret"></span>', 'encodeLabel' => false, 'options' => ['data-toggle' => 'dropdown', 'aria-haspopup' => 'true', 'class' => 'btn-default dropdown-toggle btn-xs']]);
return $splitButton . "\n" . Dropdown::widget(['items' => $buttons, 'encodeLabels' => false, 'options' => ['class' => 'pull-right']]);
}
示例10:
<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
示例11: 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");
示例12:
<?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>
示例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: 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();
示例15:
<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);