本文整理汇总了PHP中yii\helpers\Html::endForm方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::endForm方法的具体用法?PHP Html::endForm怎么用?PHP Html::endForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\helpers\Html
的用法示例。
在下文中一共展示了Html::endForm方法的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: run
public function run()
{
SelectAsset::register($this->view);
FilterAsset::register($this->view);
$values = [];
foreach ($this->data as $value) {
$value = strval($value);
$values[$value] = $value;
}
if (!$this->default) {
$this->default = $this->multiple ? array_keys($values) : key($values);
}
$selected = $this->selected($this->default);
// Setup options
$options = ['id' => $this->name, 'name' => $this->name . '[]', 'style' => 'width: 300px;', 'class' => 'selectpicker'];
$extra = ['title' => 'Not selected'];
if ($this->multiple) {
$extra['multiple'] = 'multiple';
}
if ($this->placeholder) {
$extra['title'] = strval($this->placeholder);
}
$options = array_merge($options, $extra);
if (!$this->method) {
$this->method = 'get';
}
// Render
echo Html::beginForm(Url::canonical(), $this->method, ['data-pjax' => '1', 'id' => $this->name]);
echo Html::beginTag('select', $options, ['data-pjax' => '1']);
echo Html::renderSelectOptions($selected, $values);
echo Html::endTag("select");
echo Html::endForm();
parent::run();
}
示例3: 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);
}
示例4: 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>";
}
示例5: run
public function run()
{
echo Html::beginForm(Url::to([$this->actionUrl]), 'post', []);
if (!empty($this->returnUrl)) {
echo Html::hiddenInput('returnUrl', $this->returnUrl);
}
echo Html::dropDownList('language', Yii::$app->language, Yii::$app->czaHelper->getEnabledLangs(), ['id' => $this->htmlId(), 'onchange' => 'this.form.submit()']);
echo Html::endForm();
}
示例6: honeypot
protected function honeypot()
{
$field = Html::beginTag('div', ['class' => '', 'style' => 'display:none']);
$field .= Html::label(Yii::t('app', 'Excuse me, but leave this field in blank'), "_email", ['class' => 'control-label']);
$field .= Html::textInput("_email", null, ['id' => '_email', 'class' => 'form-control']);
$field .= Html::endTag('div') . ' ';
$field .= Html::endForm();
return $field;
}
示例7: renderNavItem
/**
* @return string
*/
public function renderNavItem()
{
$output = '<li>' . Html::beginForm($this->action, $this->method, $this->formOptions) . '<div class="input-group">';
$output .= Html::input('text', $this->name, $this->value, $this->inputOptions);
$output .= '<div class="input-group-btn">';
$output .= Html::button('<i class="glyphicon glyphicon-search"></i>', $this->buttonOptions);
$output .= '</div></div>' . Html::endForm() . '</li>';
return $output;
}
示例8: _getList
private function _getList()
{
$menuItems = [];
if (\Yii::$app->user->isGuest) {
// $menuItems[] = ['label' => 'Signup', 'visible' => \humanized\user\Module::getInstance()->params['enableSignUp'], 'url' => ['/user/account/signup']];
$menuItems[] = ['label' => 'Login', 'url' => ['/user/account/login']];
} else {
$menuItems[] = '<li>' . Html::beginForm(['/user/account/logout'], 'post') . Html::submitButton('Logout (' . \Yii::$app->user->identity->email . ')', ['class' => 'btn btn-link']) . Html::endForm() . '</li>';
}
return $urls;
}
示例9: renderSortLinks
/**
* Renders the sort links.
* @return string the rendering result
*/
protected function renderSortLinks()
{
$attributes = empty($this->attributes) ? array_keys($this->sort->attributes) : $this->attributes;
$links = [];
foreach ($attributes as $key => $name) {
$links[$name] = $name;
}
echo Html::beginForm(null, 'get', []);
echo Html::dropDownList('sort', null, $links, ['prompt' => 'Sortiraj po']);
echo Html::submitButton('<i class="fa fa-sort"></i>', ['class' => 'btn btn-default margin-left-5']);
echo Html::endForm();
}
示例10: run
/**
* Runs the widget.
*/
public function run()
{
$popover = '';
$popover .= Html::beginForm($this->action);
if ($this->content) {
$popover .= $this->content;
}
$popover .= Html::submitButton($this->btnText, ['class' => 'btn btn-success']);
$popover .= Html::hiddenInput('id', $this->model['id']);
$popover .= Html::endForm();
$this->content = $popover;
return parent::run();
}
示例11: renderForm
public function renderForm()
{
$action = ArrayHelper::remove($this->formOptions, 'action', '');
$method = ArrayHelper::remove($this->formOptions, 'method', 'post');
if (!isset($this->formOptions['id'])) {
$this->formOptions['id'] = 'msg-form';
}
$content = Html::beginForm($action, $method, $this->formOptions);
if (is_string($this->formView)) {
$content .= $this->getView()->render($this->formView, array_merge(['widget' => $this], $this->formParams));
} else {
$content .= call_user_func($this->formView, $this);
}
$content .= Html::endForm();
return $content;
}
示例12: run
/**
* @inheritdoc
*/
public function run()
{
if (!empty($this->_fields)) {
throw new InvalidCallException('Each beginField() should have a matching endField() call.');
}
if ($this->enableClientScript) {
$id = $this->options['id'];
$options = Json::htmlEncode($this->getClientOptions());
$attributes = Json::htmlEncode($this->attributes);
$view = $this->getView();
ActiveFormAsset::register($view);
$view->registerJs("jQuery('#{$id}').yiiActiveForm({$attributes}, {$options});");
}
echo Html::endForm();
$this->registerClientEvents();
}
示例13: buildForm
private function buildForm()
{
$id = $this->_config['formId'];
$opts = [];
if ($id != '') {
$opts['id'] = $id;
}
$form = Html::beginForm($this->_action, 'post', $opts);
$form .= Html::hiddenInput('formid', $this->blockId);
$form .= $this->renderFields();
$form .= $this->renderCaptcha();
$form .= $this->renderNote();
$form .= Html::tag('div', Html::submitButton('Отправить'));
$form .= Html::endForm();
$form .= Html::tag('div', '', ['id' => 'feedback-message']);
$this->registerScript();
return $form;
}
示例14: end
public static function end()
{
$w = self::$stack[count(self::$stack) - 1];
$view = $w->getView();
if ($c = count($w->structurePath) > 0) {
throw new \yii\base\Exception(sprintf("%d unclosed relations", $c));
}
echo Html::endForm();
$w->createMappings();
// if we don't have any data, initialize empty attributes, otherwise attributes are not created by mapping
if (empty($w->data)) {
foreach ($w->structure as $key => $value) {
foreach ($value as $key2 => $value2) {
$w->data[$key2] = null;
}
}
}
if ($w->bind) {
$w->bind($w->data, $w->errors);
}
parent::end();
}
示例15: renderPageButtons
/**
* Renders the page buttons.
*
* @return string the rendering result
*/
protected function renderPageButtons()
{
// <div class="pagination" rel="jbsxBox" totalCount="<?php echo $totalCount;"
// numPerPage=" echo $numPerPage;" pageNumShown="5"
// currentPage=" echo $currentPage;"></div>
//总条数
$totalCount = $this->pagination->totalCount;
// 总页数
$pageCount = $this->pagination->getPageCount();
// 当前页
$currentPage = $this->pagination->getPage() + 1;
// 每页大小
$pageSize = $this->pagination->getPageSize();
$options = ArrayHelper::merge(['rel' => $this->rel, 'totalCount' => $totalCount, 'numPerPage' => $pageSize, 'currentPage' => $currentPage, 'pageNumShown' => 5, 'targetType' => $this->targetType], $this->options);
$pagerForm = '';
$pagerForm .= Html::beginForm(Yii::$app->request->absoluteUrl, 'POST', ['id' => 'pagerForm']);
$pagerForm .= Html::hiddenInput('pageNum', 1);
$pagerForm .= Html::hiddenInput('numPerPage', $pageSize);
$pagerForm .= Html::endForm();
$html = '<div class="' . $this->options['class'] . '" targetType="' . $this->targetType . '" totalCount="' . $totalCount . '" numPerPage="' . $pageSize . '" pageNumShown="10" currentPage="' . $currentPage . '"></div>';
return $pagerForm . $html;
//return $pagerForm.Html::tag('div', '',$options);
}