本文整理汇总了PHP中yii\bootstrap\Html::beginForm方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::beginForm方法的具体用法?PHP Html::beginForm怎么用?PHP Html::beginForm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\bootstrap\Html
的用法示例。
在下文中一共展示了Html::beginForm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initBuy
/**
* Инициализация кнопки
* @param \frontend\models\Market $market
* @return string|void
*/
public function initBuy(\frontend\models\Market $market = null)
{
if ($market && isset($market->settings)) {
$settings = json_decode($market->settings, true);
} else {
$settings = array();
}
$xml_structure = $this->getStructure();
$html = \yii\bootstrap\Html::beginForm('?r=payqr/button/create' . (isset($market->id) ? "&market_id=" . $market->id : ""), 'post', []);
$html .= \yii\bootstrap\Html::csrfMetaTags();
//инициализируем общие настройки кнопки
foreach ($xml_structure as $row) {
if (isset($row['field'][0]['@attributes']['value']) && !$this->buttonStructure($row)) {
$html .= $this->generateHtml($row, $settings);
}
}
//инициализиурем параметры кнопки в соответствии с местом отображения
foreach ($this->ShowInPlace as $place => $placeTranslate) {
foreach ($this->buttonXmlStructure as $xmlrow) {
$html .= $this->generateHtml($xmlrow, $settings, array(0 => $place, 1 => $placeTranslate));
}
}
$html .= \yii\bootstrap\Html::submitButton('Сохранить');
$html .= \yii\bootstrap\Html::endForm();
return $html;
}
示例2: generateTemplateSetting
/**
* Ham generate template widget khi move vao postion.
* @param string $containerId id cua container
* @param string $positionId id cua position
* @param string $widgetId id cua widget trong mang data cua diy
* @param string $id id cua widget
* @param array $settings Mang gia tri cua cac option
* @return string
*/
public static function generateTemplateSetting($containerId, $positionId, $widgetId, $id, $settings)
{
// Get widget info by id
$model = self::find()->where(['_id' => $id])->one();
$templateSetting = null;
if ($model) {
// Template widget
$templateSetting .= Html::beginTag('div', ['class' => 'let_widget row', 'data-id' => $id, 'id' => $widgetId]);
$templateSetting .= Html::beginTag('div', ['class' => 'btn btn-info']);
$templateSetting .= $model->title;
$templateSetting .= Html::endTag('div');
// Begin button widget
$templateSetting .= Html::beginTag('div', ['class' => 'pull-right']);
$templateSetting .= Html::beginTag('div', ['class' => 'btn-group buttonDeleteWidget']);
$templateSetting .= Html::button('<i class="glyphicon glyphicon-trash"></i>', ['type' => 'button', 'class' => 'btn btn-danger btn-xs', 'onclick' => 'deleteItems(this, "w", ".let_widget");']);
$templateSetting .= Html::button('<i class="glyphicon glyphicon-plus"></i>', ['type' => 'button', 'class' => 'btn btn-success btn-xs', 'onclick' => 'accordionWidget("' . $widgetId . '");']);
$templateSetting .= Html::endTag('div');
$templateSetting .= Html::endTag('div');
// End button widget
$templateSetting .= Html::beginTag('div', ['class' => 'row setting_widget', 'id' => 'setting_widget_' . $widgetId, 'style' => 'margin-top: 20px; display: none;', 'data-show' => 0, 'data-container' => $containerId, 'data-position' => $positionId, 'data-id' => $widgetId]);
// Begin template setting.
$templateSetting .= Html::beginForm(NULL, 'POST', ['role' => 'form', 'id' => 'settingForm']);
if (!empty($model->setting)) {
foreach ($model->setting as $keySetting => $config) {
// Kieu hien thi cua setting
$type = ArrayHelper::getValue($config, 'type');
// Gia tri cua setting
$value = ArrayHelper::getValue($settings, $keySetting);
// Danh sach cac gia tri cua setting neu la dropdown, checkbox, radio
$items = ArrayHelper::getValue($config, 'items');
$templateSetting .= Html::beginTag('div', ['class' => 'form-group field-setting-key']);
$templateSetting .= Html::beginTag('label', ['class' => 'control-label col-sm-2', 'for' => 'DiyWidget-' . $keySetting . '']);
$templateSetting .= $keySetting;
$templateSetting .= Html::endTag('label');
$templateSetting .= Html::beginTag('div', ['class' => 'col-sm-10']);
$templateSetting .= self::getInputByType($type, $templateSetting, $keySetting, $value, $items);
$templateSetting .= Html::beginTag('div', ['class' => 'help-block help-block-error help-block m-b-none']) . Html::endTag('div');
$templateSetting .= Html::endTag('div');
// End .col-sm-10
$templateSetting .= Html::endTag('div');
// End .field-setting-key
}
}
// Begin button save
$templateSetting .= Html::beginTag('div', ['class' => 'col-sm-12']);
$templateSetting .= Html::beginTag('div', ['class' => 'pull-right']);
$templateSetting .= Html::button(Yii::t('diy', 'Save'), ['type' => 'button', 'class' => 'btn btn-success', 'onclick' => 'saveSettingsWidget(this);']);
$templateSetting .= Html::endTag('div');
$templateSetting .= Html::endTag('div');
// End button save
$templateSetting .= Html::endForm();
// End template setting
$templateSetting .= Html::endTag('div');
// End .row
$templateSetting .= Html::endTag('div');
// End .let_widget
}
return $templateSetting;
}
示例3:
<div class="panel-heading">
<?php
echo Yii::t('InstallerModule.views_config_modules', 'Recommended <strong>Modules</strong>');
?>
</div>
<div class="panel-body">
<p><?php
echo Yii::t('InstallerModule.views_config_modules', 'HumHub is very flexible and can be adjusted and/or expanded for various different applications thanks to its’ different modules. The following modules are just a few examples and the ones we thought are most important for your chosen application.<br><br>You can always install or remove modules later. You can find more available modules after installation in the admin area.');
?>
</p>
<br>
<?php
echo Html::beginForm();
?>
<?php
foreach ($modules as $module) {
?>
<label>
<?php
echo Html::checkbox('enableModules[' . $module['id'] . ']', true);
echo $module['name'];
?>
</label>
<p class="help-block" style="margin: 0 0 10px 23px;"><?php
echo $module['description'];
?>
</p>
示例4:
<?php
/**
* Created by PhpStorm.
* User: brunosalzano
* Date: 25/01/16
* Time: 07:41
*/
/** @var $this \yii\web\View */
use yii\bootstrap\Html;
use d4rkstar\dbconfig\components\ConfigurationUtils;
use yii\helpers\Inflector;
use yii\bootstrap\Collapse;
$params = Yii::$app->controller->module->config->params;
print Html::beginForm('', 'post', ['class' => 'form-horizontal']);
$this->title = Yii::t('app', 'Configuration');
$this->params['breadcrumbs'][] = $this->title;
$items = [];
$isFirst = true;
print Html::tag('h1', Html::encode($this->title));
if (!Yii::$app->user->isGuest) {
print ' ' . Html::tag('small', Html::icon('pencil', ['class' => 'xs']) . Html::a('Manage', \yii\helpers\Url::to('manage')));
}
?>
<?php
if (count($params) == 0) {
print Html::tag('h2', Yii::t('app', 'No configuration items.'));
} else {
print Html::tag('p', Yii::t('app', 'Click on the titles to expand.'));
示例5:
echo Html::hiddenInput('getAll', $widget->getAll);
echo Html::hiddenInput('title', $widget->title);
echo Html::submitButton($widget->htmlButtonName, ['class' => $widget->buttonClass]);
echo Html::endForm();
}
?>
</div>
<div class="<?php
echo $widget->blockClass;
?>
" style="<?php
echo $widget->blockStyle;
?>
">
<?php
//if ($widget->html) {
if ($widget->pdf) {
echo Html::beginForm(['/export/pdf'], 'post');
echo Html::hiddenInput('model', $widget->model);
echo Html::hiddenInput('searchAttributes', $widget->searchAttributes);
echo Html::hiddenInput('sort', $widget->sort);
echo Html::hiddenInput('page', $widget->page);
echo Html::hiddenInput('getAll', $widget->getAll);
echo Html::hiddenInput('title', $widget->title);
echo Html::submitButton($widget->pdfButtonName, ['class' => $widget->buttonClass]);
echo Html::endForm();
}
?>
</div>
示例6: isset
use kartik\daterange\DateRangePicker;
use kartik\widgets\Select2;
use yii\bootstrap\Html;
use yii\helpers\ArrayHelper;
use yii\widgets\LinkPager;
$this->title = 'Reports By Products';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="reports_user">
<div class="box box-default" >
<div class="box-header">
<h3 class="box-title">Filter Reports</h3>
</div>
<div class="box-body">
<?php
echo Html::beginForm(['reports/products'], 'post', ['class' => '']);
?>
<div class="col-sm-6">
<div class="form-group">
<label for="date_range" class="control-label">Date Range</label>
<div class="">
<div class="input-group drp-container">
<?php
echo DateRangePicker::widget(['name' => 'date_range', 'value' => isset($posted_data['date_range']) ? $posted_data['date_range'] : Yii::$app->formatter->asDate('now', 'php:d-M-y') . ' to ' . Yii::$app->formatter->asDate('now', 'php:d-M-y'), 'convertFormat' => true, 'options' => ['id' => 'date_range'], 'pluginOptions' => ['format' => 'd-M-y', 'separator' => ' to ']]);
?>
</div>
</div>
</div>
</div>
<div class="col-sm-6">
示例7: generatePreviewImage
/**
* Function generate preview infomation image
* @param $image Infomation image
* @return string
*/
public static function generatePreviewImage($image)
{
$image = Json::decode($image);
$url = ArrayHelper::getValue($image, 'url');
$title = ArrayHelper::getValue($image, 'title');
$caption = ArrayHelper::getValue($image, 'caption');
$alt_text = ArrayHelper::getValue($image, 'alt_text');
$imageUrl = Yii::getAlias('@web') . DIRECTORY_SEPARATOR . Yii::$app->getModule('gallery')->syaDirUpload . DIRECTORY_SEPARATOR . $url;
$imagePath = Yii::getAlias(Yii::$app->getModule('gallery')->syaDirPath) . Yii::$app->getModule('gallery')->syaDirUpload . DIRECTORY_SEPARATOR . $url;
$info = FileHelper::getInfomation($imagePath);
$basename = ArrayHelper::getValue($info, 'basename');
$filesize = ArrayHelper::getValue($info, 'filesize');
$fileatime = ArrayHelper::getValue($info, 'fileatime');
$width = ArrayHelper::getValue($info, 'width');
$height = ArrayHelper::getValue($info, 'height');
$template = Html::tag('h3', Yii::t('gallery', 'ATTACHMENT DETAILS'), []);
// Info img
$template .= Html::beginTag('div', ['class' => 'sya_info_galllery row']);
$template .= Html::beginTag('div', ['class' => 'col-md-6', 'style' => 'padding: 0;']);
$template .= Html::img($imageUrl, []);
$template .= Html::endTag('div');
$template .= Html::beginTag('div', ['class' => 'col-md-6', 'style' => 'padding: 0; word-break: break-word;']);
// File Name
$template .= Html::beginTag('div', ['style' => 'font-weight: bold;']);
$template .= $basename;
$template .= Html::endTag('div');
$template .= Html::beginTag('div', []);
$template .= date('d/m/Y', $fileatime);
$template .= Html::endTag('div');
// File size
$template .= Html::beginTag('div', []);
$template .= $filesize;
$template .= Html::endTag('div');
$template .= Html::beginTag('div', []);
$template .= $width . ' x ' . $height;
$template .= Html::endTag('div');
$template .= Html::endTag('div');
$template .= Html::endTag('div');
// Attribute img
$template .= Html::beginTag('div', ['class' => 'col-md-12 form-horizontal', 'style' => 'margin-top: 20px;']);
$template .= Html::beginForm(' ', ' ', ['id' => 'sya_gallery_form_preview']);
// Url
$template .= Html::beginTag('div', ['class' => 'form-group field-gallery-url']);
$template .= Html::tag('label', 'Url', ['class' => 'control-label col-sm-3']);
$template .= Html::beginTag('div', ['class' => 'col-sm-9']);
$template .= Html::input('text', 'sya_url', $url, ['class' => 'col-sm-10 form-control', 'readonly' => true]);
$template .= Html::endTag('div');
$template .= Html::endTag('div');
// Title
$template .= Html::beginTag('div', ['class' => 'form-group field-gallery-title']);
$template .= Html::tag('label', 'Title', ['class' => 'control-label col-sm-3']);
$template .= Html::beginTag('div', ['class' => 'col-sm-9']);
$template .= Html::input('text', 'sya_title', $title, ['class' => 'col-sm-10 form-control', 'id' => 'sya_preview_title']);
$template .= Html::endTag('div');
$template .= Html::endTag('div');
// Caption
$template .= Html::beginTag('div', ['class' => 'form-group field-gallery-caption']);
$template .= Html::tag('label', 'Caption', ['class' => 'control-label col-sm-3']);
$template .= Html::beginTag('div', ['class' => 'col-sm-9']);
$template .= Html::textarea('sya_caption', $caption, ['class' => 'col-sm-10 form-control', 'id' => 'sya_preview_caption']);
$template .= Html::endTag('div');
$template .= Html::endTag('div');
// Alt text
$template .= Html::beginTag('div', ['class' => 'form-group field-gallery-alt-text']);
$template .= Html::tag('label', 'Alt text', ['class' => 'control-label col-sm-3']);
$template .= Html::beginTag('div', ['class' => 'col-sm-9']);
$template .= Html::input('text', 'sya_alt_text', $alt_text, ['class' => 'col-sm-10 form-control', 'id' => 'sya_preview_alt_text']);
$template .= Html::endTag('div');
$template .= Html::endTag('div');
$template .= Html::endForm();
$template .= Html::endTag('div');
return $template;
}
示例8:
<li class="list-group-item"><?php
echo Yii::t('update', 'Update app');
?>
</li>
<li class="list-group-item"><?php
echo Yii::t('update', 'Finished');
?>
</li>
</ul>
</div>
<div class="col-sm-8 form-wrapper">
<?php
echo Html::tag('h4', Yii::t('update', 'Choose language'), ['class' => 'step-title']);
?>
<?php
echo Html::beginForm('', 'post', ['class' => 'form-vertical']);
?>
<div class="form-group">
<?php
// Html::label(Yii::t('update', 'Choose language'), 'language', ['class' => 'form-label'])
?>
<?php
echo Html::dropDownList('language', Yii::$app->language, $languages, ['class' => 'form-control']);
?>
</div>
<div class="form-action">
<?php
echo Html::submitButton(Yii::t('update', 'Save and continue'), ['class' => 'btn btn-primary']);
?>
</div>
<?php
示例9:
<?php
/**
* @author Evgeniy Bobrov <yujin1st@gmail.com>
* @link http://yujin1st.ru
*/
/* @var $this \yii\web\View */
use yii\bootstrap\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
?>
<?php
NavBar::begin(['brandLabel' => 'App', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['tag' => 'div', 'id' => 'navbar', 'class' => 'navbar'], 'innerContainerOptions' => ['class' => 'navbar-container']]);
$menuItems = [['label' => 'Home', 'url' => ['/site/index']]];
if (Yii::$app->user->isGuest) {
$menuItems[] = ['label' => 'Login', 'url' => ['/site/login']];
} else {
$menuItems[] = '<li>' . Html::beginForm(['/site/logout'], 'post') . Html::submitButton('Logout (' . Yii::$app->user->identity->username . ')', ['class' => 'btn btn-link']) . Html::endForm() . '</li>';
}
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => $menuItems]);
NavBar::end();
?>
示例10:
<?php
use yii\bootstrap\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
/* @var $this \yii\web\View */
$webUser = Yii::$app->user;
NavBar::begin(['id' => 'header', 'brandLabel' => Yii::$app->name, 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
$menuItems = [['label' => Yii::t('menu', 'About'), 'url' => ['/site/about']], ['label' => Yii::t('menu', 'F.A.Q.'), 'url' => ['/help/faq']], ['label' => Yii::t('menu', 'Contact'), 'url' => ['/help/contact']]];
if ($webUser->isGuest) {
$menuItems[] = ['label' => Yii::t('menu', 'Signup'), 'url' => ['/signup/index']];
$menuItems[] = ['label' => Yii::t('menu', 'Login'), 'url' => ['/auth/login']];
} else {
$menuItems[] = ['label' => Yii::t('menu', 'Account'), 'url' => ['/account/index']];
$menuItems[] = '<li>' . Html::beginForm(['/auth/logout'], 'post', ['class' => 'navbar-form']) . Html::submitButton('Logout (' . $webUser->identity->username . ')', ['class' => 'btn btn-link']) . Html::endForm() . '</li>';
}
echo Nav::widget(['id' => 'header-menu', 'options' => ['class' => 'navbar-nav navbar-right'], 'items' => $menuItems]);
NavBar::end();
示例11: sprintf
</div>
</div
<p> </p>
<div class="row">
<div class="col-sm-6-offset col-sm-offset-2 col-md-7 col-md-offset-2 main">
<?php
echo DetailView::widget(['model' => $subject_model, 'attributes' => [['group' => true, 'label' => 'Participant information', 'rowOptions' => ['class' => 'info']], ['columns' => [['attribute' => 'cubric_id', 'valueColOptions' => ['style' => 'width:20%']], ['attribute' => 'first_name', 'label' => 'name', 'value' => sprintf('%s %s', $subject_model->first_name, $subject_model->last_name), 'valueColOptions' => ['style' => 'width:60%']], ['attribute' => 'dob', 'label' => 'DOB', 'valueColOptions' => ['style' => 'width:20%']]]]]]);
?>
<?php
echo Html::beginForm(Url::to(['default/update']), 'post');
?>
<?php
foreach ($screening_questions as $ques) {
?>
<fieldset>
<?php
if (strlen($ques['caption']) > 0) {
?>
<legend><?php
echo $ques['caption'];
示例12:
<div class="container warning-message">
<div class='row'>
<div class="col-lg-12 text-center">
</div>
</div>
</div>
<div class="container main-content">
<div class="row">
<div class="col-lg-3 sidenav-widget">
<?php
//include_once ('inc/menu.php');
?>
</div>
<div class="col-lg-9">
<?php
echo Html::beginForm(['/site/addsensor'], 'post');
?>
<div class='row main-header'>
<div class="col-lg-12">
<h2><?php
echo \Yii::t('app', 'Add Sensor');
?>
</h2>
</div>
<div class="col-lg-4">
<?php
echo \Yii::t('app', 'NAME SENSOR');
?>
<br /><?php
echo \Yii::t('app', 'e.g. River [name] Sensor');
?>
示例13:
<h4>Membership managment</h4>
<?php
use yii\bootstrap\Html;
?>
<?php
echo Html::beginForm('members');
?>
Please type the names of the users you would like to add into this group into the box below.
<p> </p>
<?php
echo Html::dropDownList('members', array_keys(\yii::$app->CollectionComponent->memberList($collectionModel->id)), \yii::$app->CollectionComponent->memberList($collectionModel->id), ['multiple' => 'multiple', 'id' => 'member-select', 'style' => 'width:80%']);
?>
<?php
echo \yii\helpers\Html::endForm();
?>
示例14:
<?php
use yii\bootstrap\Html;
use app\widgets\HotWidget;
use yii\helpers\Url;
use yii\widgets\LinkPager;
use frontend\components\Common;
?>
<div class="properties-listing spacer">
<div class="row">
<div class="col-lg-3 col-sm-4 ">
<?php
echo Html::beginForm(Url::to('main/main/find'), 'get');
?>
<div class="search-form"><h4><span class="glyphicon glyphicon-search"></span> Search for</h4>
<!--<input type="text" class="form-control" placeholder="Search of Properties">-->
<?php
echo Html::textInput('search', '', ['class' => 'form-control', 'placeholder' => 'Search of Properties']);
?>
<div class="row">
<div class="col-lg-5">
<select class="form-control">
<option>Buy</option>
<option>Rent</option>
<option>Sale</option>
</select>
</div>
<div class="col-lg-7">
<?php
示例15: function
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
ActiveForm::end();
} else {
?>
<?php
echo Html::beginForm(['add-to-cart-transfer']);
?>
<div class="box">
<div class="box-header with-border">
<h3 class="box-title"><?php
echo Yii::t('hipanel:domain', 'Starting the transfer procedure for the following domains');
?>
</h3>
</div>
<div class="box-body">
<?php
echo GridView::widget(['dataProvider' => $transferDataProvider, 'tableOptions' => ['class' => 'table table-hover'], 'layout' => "{items}\n{pager}", 'rowOptions' => function ($model) {
return ['class' => $model->hasErrors('password') ? 'danger' : ''];
}, 'columns' => [['attribute' => 'domain', 'format' => 'raw', 'value' => function ($model, $key, $i) {
$html = Html::tag('span', $model->domain, ['class' => 'text-bold']);
/** @var Domain $model */