本文整理汇总了PHP中yii\bootstrap\Html::endForm方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::endForm方法的具体用法?PHP Html::endForm怎么用?PHP Html::endForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\bootstrap\Html
的用法示例。
在下文中一共展示了Html::endForm方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:
<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
echo Html::endForm();
?>
</div>
</div>
示例3: getItems
/**
* @param null $code
*
* @return array
*/
public static function getItems($code = null)
{
/**@var $parentSettings self[] */
$items = [];
if ($code == null) {
$parentSettings = Setting::find()->where(['parent_id' => 0, 'type' => self::TYPE_GROUP])->orderBy(['sort_order' => SORT_ASC])->all();
} else {
$currentSetting = self::findOne(['code' => $code]);
if ($currentSetting !== null) {
$parentSettings = Setting::find()->where(['parent_id' => $currentSetting->id, 'type' => self::TYPE_GROUP])->orderBy(['sort_order' => SORT_ASC])->all();
} else {
$parentSettings = Setting::find()->where(['parent_id' => 0, 'type' => self::TYPE_GROUP])->orderBy(['sort_order' => SORT_ASC])->all();
}
}
foreach ($parentSettings as $parentSetting) {
$content = Html::beginForm('', 'POST', ['class' => 'form-horizontal', 'id' => 'nava-setting-form', 'enctype' => 'multipart/form-data']);
$content .= $parentSetting->getContent();
$content .= Html::beginTag('div', ['class' => 'form-group']);
$content .= Html::beginTag('div', ['class' => 'col-sm-9 col-sm-offset-3']);
$content .= Html::submitButton(Yii::t('setting', 'Save'), ['class' => 'btn btn-success']);
$content .= Html::endTag('div');
$content .= Html::endTag('div');
$content .= Html::endForm();
$items[] = ['label' => ($parentSetting->icon != '' ? '<span class="glyphicon ' . $parentSetting->icon . '"></span> ' : '') . $parentSetting->getName(), 'content' => $content];
}
return $items;
}
示例4: 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;
}
示例5: function
}
$item = ['label' => Inflector::camel2words($group), 'content' => $itemBody, 'contentOptions' => $options];
$items[] = $item;
}
echo Collapse::widget(['items' => $items]);
?>
<div class="form-group">
<div class="col-lg-offset-2 col-lg-10">
<?php
echo Html::submitButton(Yii::t('app', 'Save settings'), ['class' => 'btn btn-primary']);
?>
</div>
</div>
<?php
Html::endForm();
?>
<?php
$js = <<<EOF
\$(":checkbox").on("click", function(event) {
\$(this).attr('value', this.checked ? 1 : 0)
if (\$(this).attr('value')!=1) {
\$(this).removeAttr('checked');
} else {
\$(this).attr('checked', 'checked');
}
});
EOF;
$this->registerJs($js);
示例6: 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;
}
示例7:
<?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();
?>
示例8:
<?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();