本文整理汇总了PHP中yii\helpers\Html::submitButton方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::submitButton方法的具体用法?PHP Html::submitButton怎么用?PHP Html::submitButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\helpers\Html
的用法示例。
在下文中一共展示了Html::submitButton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: launch
protected function launch()
{
echo Html::beginForm($this->url, 'get');
echo Html::input('text', $this->queryParam, $this->query);
echo Html::submitButton(\Yii::t('gromver.platform', 'Find'));
echo Html::endForm();
}
示例2: submitDropdown
/**
* Button with multiple submit options.
* @param ActiveForm $form
* @param $model
* @param $attribute
* @param $items
* @param string $content
* @param array $options
* @return string
*/
public static function submitDropdown(ActiveForm $form, $model, $attribute, $items, $content = "Save", $options = [])
{
if (count($items) == 1) {
return $form->field($model, $attribute, ['options' => ['class' => 'pull-left']])->label(false)->hiddenInput(['value' => key($items)]) . Html::submitButton(reset($items), $options);
}
$lis = '';
foreach ($items as $key => $name) {
$lis .= Html::tag('li', "<a href='#'>{$name}</a>", ['onclick' => "\$(this).closest('div').find('input').val('{$key}');\n \$(this).parents('form').submit();", 'class' => $model->{$attribute} == $key ? 'active' : '']);
}
return Html::beginTag('div', ['class' => 'btn-group']) . $form->field($model, $attribute, ['options' => ['class' => 'pull-left']])->label(false)->hiddenInput() . Html::button($content . '<span class="caret"></span>', ['class' => 'btn dropdown-toggle btn-primary', "data-toggle" => "dropdown"]) . Html::beginTag('ul', ['class' => 'dropdown-menu']) . $lis . Html::endTag('ul') . Html::endTag('div');
}
示例3: api_form
public function api_form()
{
$model = new GuestbookModel();
$settings = Yii::$app->getModule('admin')->activeModules['guestbook']->settings;
ob_start();
$form = ActiveForm::begin(['enableClientValidation' => true, 'action' => Url::to(['/admin/guestbook/send'])]);
switch (Yii::$app->session->getFlash(GuestbookModel::FLASH_KEY)) {
case 'success':
$message = Yii::$app->getModule('admin')->activeModules['guestbook']->settings['preModerate'] ? Yii::t('easyii/guestbook/api', 'Message successfully sent and will be published after moderation') : Yii::t('easyii/guestbook/api', 'Message successfully added');
echo Alert::widget(['options' => ['class' => 'alert-success'], 'body' => $message]);
break;
case 'error':
echo Alert::widget(['options' => ['class' => 'alert-danger'], 'body' => Yii::t('easyii/guestbook/api', 'An error has occurred')]);
break;
}
echo $form->field($model, 'name');
if ($settings['enableTitle']) {
echo $form->field($model, 'title');
}
echo $form->field($model, 'text')->textarea();
if ($settings['enableCaptcha']) {
echo $form->field($model, 'reCaptcha')->widget(ReCaptcha::className());
}
echo Html::submitButton(Yii::t('easyii', 'Send'), ['class' => 'btn btn-primary']);
ActiveForm::end();
return ob_get_clean();
}
示例4: saveButtons
/**
* @param ActiveRecord $model Model instance
* @param string $indexAction Route path to index action
* @return string Rendered save buttons with redurectUrl!
*/
public static function saveButtons(ActiveRecord $model, $indexAction = 'index', $buttonClass = 'btn-sm', $onlySaveAndBack = false)
{
$result = '<div class="form-group no-margin btn-group">';
if ($onlySaveAndBack === false) {
$result .= Html::a(Icon::show('arrow-circle-left') . Yii::t('app', 'Back'), Yii::$app->request->get('returnUrl', [$indexAction, 'id' => $model->id]), ['class' => 'btn btn-default ' . $buttonClass]);
}
if ($model->isNewRecord && $onlySaveAndBack === false) {
$result .= Html::submitButton(Icon::show('save') . Yii::t('app', 'Save & Go next'), ['class' => 'btn btn-success ' . $buttonClass, 'name' => 'action', 'value' => 'next']);
}
$result .= Html::submitButton(Icon::show('save') . Yii::t('app', 'Save & Go back'), ['class' => 'btn btn-warning ' . $buttonClass, 'name' => 'action', 'value' => 'back']);
if ($onlySaveAndBack === false) {
$result .= Html::submitButton(Icon::show('save') . Yii::t('app', 'Save'), ['class' => 'btn btn-primary ' . $buttonClass, 'name' => 'action', 'value' => 'save']);
}
$result .= '</div>';
return $result;
}
示例5: api_form
public function api_form($options = [])
{
$model = new FeedbackModel();
$settings = Yii::$app->getModule('admin')->activeModules['feedback']->settings;
$options = array_merge($this->_defaultFormOptions, $options);
ob_start();
$form = ActiveForm::begin(['enableClientValidation' => true, 'action' => Url::to(['/admin/feedback/send'])]);
echo Html::hiddenInput('errorUrl', $options['errorUrl'] ? $options['errorUrl'] : Url::current([self::SENT_VAR => 0]));
echo Html::hiddenInput('successUrl', $options['successUrl'] ? $options['successUrl'] : Url::current([self::SENT_VAR => 1]));
echo $form->field($model, 'name');
echo $form->field($model, 'email')->input('email');
if ($settings['enablePhone']) {
echo $form->field($model, 'phone');
}
if ($settings['enableTitle']) {
echo $form->field($model, 'title');
}
echo $form->field($model, 'text')->textarea();
if ($settings['enableCaptcha']) {
echo $form->field($model, 'reCaptcha')->widget(ReCaptcha::className());
}
echo Html::submitButton(Yii::t('easyii', 'Send'), ['class' => 'btn btn-primary']);
ActiveForm::end();
return ob_get_clean();
}
示例6: actionForm
public function actionForm()
{
echo Html::beginForm();
echo Html::checkboxList('test', ['value 1' => 'item 1', 'value 2' => 'item 2', 'value 3' => 'item 3'], isset($_POST['test']) ? $_POST['test'] : null, function ($index, $label, $name, $value, $checked) {
return Html::label($label . ' ' . Html::checkbox($name, $value, $checked), null, ['class' => 'inline checkbox']);
});
echo Html::submitButton();
echo Html::endForm();
print_r($_POST);
}
示例7: run
public function run()
{
$id = $this->getId();
echo Html::beginForm(Url::canonical(), 'get', ['data-pjax' => '1', 'id' => $this->name]);
echo Html::beginTag('div');
echo Html::beginTag("select", ['id' => $id, 'multiple' => 'multiple', 'class' => 'invisible', 'style' => 'width: ' . $this->width . 'px;', 'name' => $this->name . '[]']);
echo Html::renderSelectOptions($this->selectedValues, $this->_allValues);
echo Html::endTag("select");
echo Html::submitButton('OK', ['style' => 'margin: 0 5px;']);
echo Html::endTag('div');
echo Html::endForm();
echo "<script type='text/javascript'>";
echo "\$('#{$id}').removeClass('invisible');";
echo "\$('#{$id}').multipleSelect()";
echo "</script>";
}
示例8: actionButton
/**
* Generates crud action button
* @param string $action
* @param bool|null $isNewRecord
* @param array $options
* @return string
*/
public static function actionButton($action = self::ACTION_SAVE_AND_LEAVE, $isNewRecord = null, $options = [])
{
$content = ArrayHelper::getValue(static::getActionButtonContent($isNewRecord), $action, ArrayHelper::getValue($options, 'content', 'Submit'));
ArrayHelper::remove($options, 'content');
$options = array_merge(ArrayHelper::getValue(static::getActionButtonOptions(), $action, ['class' => 'btn btn-primary']), ['name' => self::ACTION_BUTTON_NAME, 'value' => $action], $options);
return Html::submitButton($content, $options);
}
示例9: run
public function run()
{
if ($this->footerWrapper) {
echo Html::beginTag('div', ['class' => 'form-group panel-footer']);
}
$submit_options = [];
if ($this->form) {
$submit_options['form'] = $this->form;
}
$extra = '';
if ($this->extraBtns) {
$extra = ' ' . implode(' ', (array) $this->extraBtns);
}
if (isset($this->model->isNewRecord) && $this->model->isNewRecord) {
if ($this->saveLink) {
$submit_options['class'] = 'btn btn-success';
echo Html::submitButton(__('Create'), $submit_options);
}
echo $extra;
} else {
if ($this->saveLink) {
$submit_options['class'] = 'btn btn-primary';
echo Html::submitButton(__('Update'), $submit_options);
}
echo $extra;
if ($this->removeLink) {
echo ' ';
echo Html::a(__('Delete'), ['delete', 'id' => $this->model->id], ['class' => 'btn btn-danger', 'data-confirm' => __('Are you sure you want to delete this item?'), 'data-method' => 'post']);
}
}
if ($this->footerWrapper) {
echo Html::endTag('div');
}
}
示例10: renderVerificationButton
protected function renderVerificationButton()
{
$form = ActiveForm::begin(['action' => ['@contact/request-' . $this->type . '-confirmation'], 'class' => 'form-inline']);
echo $form->field($this->model->contact, 'id')->hiddenInput()->label(false);
echo Html::submitButton(Yii::t('hipanel:client', '{icon} Verify', ['icon' => Html::tag('i', '', ['class' => 'fa fa-check'])]), ['class' => 'btn btn-sm btn-info']);
$form->end();
}
示例11: submitButton
public static function submitButton($model)
{
$html = '<div class="form-group">';
$html .= Html::submitButton($model->isNewRecord ? 'Thêm mới' : 'Cập nhật', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
$html .= '</div>';
return $html;
}
示例12: init
/**
* Initializes the widget.
*/
public function init()
{
parent::init();
echo Html::beginTag('div', ['class' => 'main-sidebar']);
echo Html::beginTag('div', ['class' => 'sidebar']);
if (isset($this->user) and count($this->user) > 0) {
$image = isset($this->user['image']) ? $this->user['image'] : '';
$username = isset($this->user['username']) ? $this->user['username'] : '';
echo Html::beginTag('div', ['class' => 'user-panel']);
echo Html::beginTag('div', ['class' => 'pull-left image']);
echo '<img src="' . $image . '" class="img-circle" alt="user" />';
echo Html::endTag('div');
echo Html::beginTag('div', ['class' => 'pull-left info']);
echo Html::tag('p', $username);
echo Html::tag('a', '<i class="fa fa-circle text-success"></i> Online');
echo Html::endTag('div');
echo Html::endTag('div');
}
if (isset($this->search) and count($this->search) > 0) {
$method = isset($this->search['method']) ? $this->search['method'] : 'get';
$action = isset($this->search['action']) ? $this->search['action'] : '';
echo Html::beginTag('form', ['method' => $method, 'action' => $action, 'class' => 'sidebar-form']);
echo Html::beginTag('div', ['class' => 'input-group']);
echo Html::input('text', 'q', '', ['class' => 'form-control', 'placeholder' => 'Search...']);
echo Html::beginTag('span', ['class' => 'input-group-btn']);
echo Html::submitButton(Html::tag('i', '', ['class' => 'fa fa-search']), ['id' => 'search-btn', 'class' => "btn btn-flat"]);
echo Html::endTag('span');
echo Html::endTag('div');
echo Html::endTag('form');
}
}
示例13: run
public function run()
{
echo '<form id="form1" data-pjax-exclude method="GET">';
parent::run();
echo '<div class="form-group"><div class="col-lg-11">';
echo Html::submitButton('Select users', ['class' => 'btn btn-primary']);
echo '</div></div></form>';
}
示例14: run
public function run()
{
echo Html::endTag('div');
$buttons = Html::tag('div', Html::submitButton(__('Search'), ['class' => 'btn btn-primary']));
echo Html::tag('div', $buttons, ['class' => 'panel-footer ' . $this->extraClass . $this->targetClass]);
echo Html::endTag('div');
parent::run();
}
示例15: run
/**
* @inheritdoc
*/
public function run()
{
$form = ActiveForm::begin();
echo $form->errorSummary($this->commentModel);
echo $form->field($this->commentModel, 'title')->textInput(['maxlength' => true]);
echo $form->field($this->commentModel, 'content')->textarea($this->textAreaOptions);
echo Html::submitButton(empty($this->buttonLabel) ? Yii::t('app', 'Save') : $this->buttonLabel, $this->buttonOptions);
ActiveForm::end();
}