当前位置: 首页>>代码示例>>PHP>>正文


PHP ActiveForm::end方法代码示例

本文整理汇总了PHP中yii\bootstrap\ActiveForm::end方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveForm::end方法的具体用法?PHP ActiveForm::end怎么用?PHP ActiveForm::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在yii\bootstrap\ActiveForm的用法示例。


在下文中一共展示了ActiveForm::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generate

 /**
  * @param array $config
  * @return string
  */
 public static function generate($config = [])
 {
     $reservedAttributeNames = ['plainHTML'];
     ob_start();
     $form = ActiveForm::begin($config['formConfig']);
     foreach ($config['fields'] as $attribute => $fieldConfig) {
         if (in_array($attribute, $reservedAttributeNames)) {
             echo $fieldConfig;
         } else {
             if (isset($fieldConfig['render'])) {
                 $render = $fieldConfig['render'];
                 switch ($render['type']) {
                     case 'inline':
                         $method = $render['method'];
                         $options = isset($render['options']) ? $render['options'] : [];
                         echo $form->field($fieldConfig['model'], $attribute, isset($fieldConfig['options']) ? $fieldConfig['options'] : [])->{$method}($options);
                         break;
                     case 'widget':
                         $class = $render['class'];
                         $options = isset($render['options']) ? $render['options'] : [];
                         echo $form->field($fieldConfig['model'], $attribute, isset($fieldConfig['options']) ? $fieldConfig['options'] : [])->widget($class, $options);
                         break;
                 }
             } else {
                 echo $form->field($fieldConfig['model'], $attribute, isset($fieldConfig['options']) ? $fieldConfig['options'] : []);
             }
         }
     }
     ActiveForm::end();
     $result = ob_get_contents();
     ob_end_clean();
     return $result;
 }
开发者ID:bfday,项目名称:yii2-widget-form-generator,代码行数:37,代码来源:FormGenerator.php

示例2: 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();
 }
开发者ID:asinfotrack,项目名称:yii2-comments,代码行数:12,代码来源:CommentForm.php

示例3: run

 public function run()
 {
     parent::run();
     $model = new \app\models\ProjectSimpleForm();
     $form = ActiveForm::begin(['id' => 'project-simple-form', 'action' => ['/project/simplecreate'], 'layout' => 'inline', 'validateOnChange' => false, 'validateOnBlur' => false]);
     echo $form->field($model, 'title')->textInput(['maxlength' => 255, 'class' => 'form-control input-sm'])->label(false);
     echo '<div class="form-group">' . Html::submitButton(Yii::t('app', 'Create'), ['class' => 'btn btn-sm btn-success', 'style' => 'margin: 5px 5px 5px 0;']) . Html::resetButton(Yii::t('app', 'Cancel'), ['class' => 'btn btn-xs', 'style' => 'margin: 5px;']) . '</div>';
     ActiveForm::end();
     $this->registerJs();
 }
开发者ID:sizeg,项目名称:yii2-todo,代码行数:10,代码来源:SidebarProjectFormWidget.php

示例4: api_form

 public function api_form($options = [])
 {
     $model = new Subscriber();
     $options = array_merge($this->_defaultFormOptions, $options);
     ob_start();
     $form = ActiveForm::begin(['enableAjaxValidation' => true, 'action' => Url::to(['/admin/subscribe/send']), 'layout' => 'inline']);
     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, 'email')->input('email', ['placeholder' => 'E-mail']);
     echo Html::submitButton(Yii::t('easyii/subscribe/api', 'Subscribe'), ['class' => 'btn btn-primary', 'id' => 'subscriber-send']);
     ActiveForm::end();
     return ob_get_clean();
 }
开发者ID:Brother-Simon,项目名称:easyii,代码行数:13,代码来源:Subscribe.php

示例5: run

 public function run()
 {
     $formId = $this->formOptions['id'];
     $this->getView()->registerCss("#{$formId} button {-webkit-box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.2);box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.2);}");
     $form = ActiveForm::begin(array_merge($this->defaultFormOptions, $this->formOptions));
     print Html::beginTag('div', ['class' => 'row']);
     print Html::beginTag('div', ['class' => 'col-xs-12']);
     print Html::beginTag('div', ['class' => 'input-group']);
     if ($this->inputWidget) {
         print $form->field($this->model, $this->attribute, ['template' => '{input}'])->widget($this->inputWidget, $this->inputOptions);
     } else {
         print $form->field($this->model, $this->attribute, ['template' => '{input}'])->input($this->inputType, array_merge(['placeholder' => $this->model->getAttributeLabel($this->attribute), 'class' => 'form-control'], $this->inputOptions));
     }
     print Html::beginTag('span', ['class' => 'input-group-btn']);
     print Html::submitButton(Yii::t('hipanel', 'Search'), ['class' => 'btn btn-flat ' . $this->buttonColor]);
     print Html::endTag('span');
     print Html::endTag('div');
     print Html::endTag('div');
     print Html::endTag('div');
     ActiveForm::end();
 }
开发者ID:hiqdev,项目名称:hipanel-module-dashboard,代码行数:21,代码来源:SearchForm.php

示例6:

            <?php 
$form = ActiveForm::begin(['id' => 'contact-form']);
?>
                <?php 
echo $form->field($model, 'name');
?>
                <?php 
echo $form->field($model, 'email');
?>
                <?php 
echo $form->field($model, 'subject');
?>
                <?php 
echo $form->field($model, 'body')->textArea(['rows' => 6]);
?>
                <?php 
echo $form->field($model, 'verifyCode')->widget(Captcha::className(), ['template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>']);
?>
                <div class="form-group">
                    <?php 
echo Html::submitButton('Submit', ['class' => 'btn btn-primary', 'name' => 'contact-button']);
?>
                </div>
            <?php 
ActiveForm::end();
?>
        </div>
    </div>

</div>
开发者ID:simplator,项目名称:yii2-app,代码行数:30,代码来源:contact.php

示例7:

$this->title = Yii::t('app', 'Добавление части');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Услуга: ' . $model->service->title . ' / ' . $model->lang), 'url' => ['services/update', 'id' => $model->serviceId]];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="services-parts-record-create">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
$form = \yii\bootstrap\ActiveForm::begin(['enableClientValidation' => false]);
?>

    <?php 
echo \app\modules\core\widgets\LanguageTabs::widget(['models' => $models, 'form' => $form, 'view' => $this, 'template' => '_form']);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton('Добавить', ['class' => 'btn btn-success']);
?>
    </div>

    <?php 
\yii\bootstrap\ActiveForm::end();
?>

</div>
开发者ID:ivphpan,项目名称:gwm,代码行数:30,代码来源:create.php

示例8:

<div class="site-login">
    <h1><?= Html::encode($this->title) ?></h1>

    <p>Для авторизации заполните следующий поля:</p>

    <?php $form = ActiveForm::begin([
        'id' => 'login-form',
        'options' => ['class' => 'form-horizontal'],
        'fieldConfig' => [
            'template' => "{label}\n<div class=\"col-lg-3\">{input}</div>\n<div class=\"col-lg-8\">{error}</div>",
            'labelOptions' => ['class' => 'col-lg-1 control-label'],
        ],
    ]); ?>

        <?= $form->field($model, 'username') ?>

        <?= $form->field($model, 'password')->passwordInput() ?>

        <?= $form->field($model, 'rememberMe')->checkbox([
            'template' => "<div class=\"col-lg-offset-1 col-lg-3\">{input} {label}</div>\n<div class=\"col-lg-8\">{error}</div>",
        ]) ?>

        <div class="form-group">
            <div class="col-lg-offset-1 col-lg-11">
                <?= Html::submitButton('Вход', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
            </div>
        </div>

    <?php ActiveForm::end(); ?>
</div>
开发者ID:ellinn7,项目名称:openprofosmotr,代码行数:30,代码来源:login.php

示例9:

$toolbar = Yii::$app->toolbar;
?>

<?php 
$form = ActiveForm::begin();
?>
    
    <?php 
$toolbar->save()->saveStay()->back();
if (!$model->getIsNewRecord()) {
    $url = Yii::$app->getUrlManager()->createUrlFrontend(Route::category($model));
    $toolbar->addButton(Html::a($toolbar->createText('eye', Yii::t('cms', 'Go to category')), $url, $toolbar->createButtonOptions(['target' => '_blank'])));
}
?>

    <h1><?php 
echo $title;
?>
</h1>
    
    <div class="row">
        <div class="col-md-12">
            <?php 
echo Tabs::widget(['items' => [['label' => Yii::t('cms', 'Category'), 'content' => $this->render('_tab_category', ['form' => $form, 'model' => $model, 'parents' => $parents, 'templates' => $templates])], ['label' => Yii::t('cms', 'Publishing'), 'content' => $this->render('_tab_publishing', ['form' => $form, 'model' => $model])], ['label' => Yii::t('cms', 'Images'), 'content' => $this->render('_tab_images', ['form' => $form, 'model' => $model])], ['label' => Yii::t('cms', 'Seo'), 'content' => $this->render('_tab_seo', ['form' => $form, 'model' => $model])], ['label' => Yii::t('cms', 'Info'), 'content' => $this->render('_tab_info', ['form' => $form, 'model' => $model])]]]);
?>
        </div>
    </div>

<?php 
$form = ActiveForm::end();
开发者ID:bigbrush,项目名称:yii2-cmf,代码行数:30,代码来源:edit.php

示例10: buildForm

 private function buildForm($action = 'update')
 {
     // Build form for type.
     $this->model = new CrelishDynamicJsonModel([], ['ctype' => $this->ctype, 'uuid' => $this->uuid]);
     // Save content if post request.
     if (!empty(\Yii::$app->request->post()) && !\Yii::$app->request->isAjax) {
         $oldData = [];
         // Load old data.
         if (!empty($this->model->uuid)) {
             $oldData = Json::decode(file_get_contents(\Yii::getAlias('@app/workspace/data/') . DIRECTORY_SEPARATOR . $this->ctype . DIRECTORY_SEPARATOR . $this->model->uuid . '.json'));
         }
         $this->model->attributes = $_POST['CrelishDynamicJsonModel'] + $oldData;
         if ($this->model->validate()) {
             $this->model->save();
             \Yii::$app->session->setFlash('success', 'Content saved successfully...');
             header('Location: ' . Url::to(['content/update', 'ctype' => $this->ctype, 'uuid' => $this->model->uuid]));
             exit(0);
         } else {
             $errors = $this->model->errors;
         }
     }
     ob_start();
     $form = ActiveForm::begin(['id' => 'content-form']);
     // Start output.
     echo '<div class="gc-bc--palette-clouds gc-bs--soft gc-ptb--2">';
     // Display messages.
     foreach (\Yii::$app->session->getAllFlashes() as $key => $message) {
         echo '<div class="c-alerts__alert c-alerts__alert--' . $key . '">' . $message . '</div>';
     }
     echo Html::beginTag("div", ['class' => 'o-grid']);
     // TODO: This has to be dynamicaly handled like it's done in frontend.
     //  Also the tabs and grouping mechanics have to be implemented.
     // Get the tabs (there has to be at least one).
     $tabs = $this->model->fieldDefinitions->tabs;
     //var_dump($tabs);
     foreach ($tabs as $tab) {
         // Loop through tabs.
         foreach ($tab->groups as $group) {
             // Loop through groups.
             $widthClass = !empty($group->settings->width) ? 'o-grid__cell--width-' . $group->settings->width : '';
             echo Html::beginTag('div', ['class' => 'o-grid__cell ' . $widthClass]);
             echo Html::beginTag('div', ['class' => 'c-card']);
             echo Html::tag('div', $group->label, ['class' => 'c-card__item c-card__item--divider']);
             echo Html::beginTag('div', ['class' => 'c-card__item']);
             foreach ($this->model->fieldDefinitions->fields as $field) {
                 if (!in_array($field->key, $group->fields)) {
                     continue;
                 }
                 // Build form fields.
                 $fieldOptions = !empty($field->options) ? $field->options : [];
                 if (strpos($field->type, 'widget_') !== false) {
                     $widget = str_replace('widget_', '', $field->type);
                     echo $form->field($this->model, $field->key)->widget($widget::className())->label($field->label);
                 } elseif ($field->type == 'dropDownList') {
                     echo $form->field($this->model, $field->key)->{$field->type}((array) $field->items, (array) $fieldOptions)->label($field->label);
                 } elseif ($field->type == 'matrixConnector') {
                     echo plugins\matrixconnector\MatrixConnector::widget(['formKey' => $field->key, 'data' => $this->model[$field->key]]);
                 } elseif ($field->type == 'assetConnector') {
                     echo plugins\assetconnector\AssetConnector::widget(['formKey' => $field->key, 'data' => $this->model[$field->key]]);
                 } elseif ($field->type == 'dataList') {
                     echo DataList::widget(['formKey' => $field->key, 'data' => $this->model[$field->key]]);
                 } else {
                     echo $form->field($this->model, $field->key)->{$field->type}((array) $fieldOptions)->label($field->label);
                 }
             }
             echo Html::endTag('div');
             echo Html::endTag('div');
             echo Html::endTag('div');
         }
     }
     echo Html::endTag('div');
     echo '</div>';
     ActiveForm::end();
     return ob_get_clean();
 }
开发者ID:giantbits,项目名称:yii2-crelish,代码行数:75,代码来源:ContentController.php

示例11: buildForm

 protected function buildForm($action = 'update', $settings = array())
 {
     //default settings
     $defaults = array('id' => 'content-form', 'outerClass' => 'gc-bc--palette-clouds gc-bs--soft gc-ptb--2', 'groupClass' => 'c-card', 'tabs' => []);
     $settings = $settings + $defaults;
     // Build form for type.
     $this->model = new CrelishDynamicJsonModel([], ['ctype' => $this->ctype, 'uuid' => $this->uuid]);
     // Save content if post request.
     if (in_array($action, array('update', 'create')) && !empty(\Yii::$app->request->post()) && !\Yii::$app->request->isAjax) {
         $oldData = [];
         // Load old data.
         if (!empty($this->model->uuid)) {
             $oldData = Json::decode(file_get_contents(\Yii::getAlias('@app/workspace/data/') . DIRECTORY_SEPARATOR . $this->ctype . DIRECTORY_SEPARATOR . $this->model->uuid . '.json'));
         }
         $attributes = $_POST['CrelishDynamicJsonModel'] + $oldData;
         foreach ($attributes as $key => $val) {
             foreach ($this->model->fieldDefinitions->fields as $field) {
                 if ($field->key == $key) {
                     if (isset($field->transform)) {
                         if (!isset($oldData[$key]) || $oldData[$key] != $attributes[$key]) {
                             //we need to transform!
                             $transformer = 'giantbits\\crelish\\components\\transformer\\CrelishFieldTransformer' . ucfirst(strtolower($field->transform));
                             $transformer::transform($attributes[$key]);
                         }
                     }
                     break;
                 }
             }
         }
         $this->model->attributes = $attributes;
         if ($this->model->validate()) {
             $this->model->save();
             \Yii::$app->session->setFlash('success', 'Content saved successfully...');
             header('Location: ' . Url::to(['content/update', 'ctype' => $this->ctype, 'uuid' => $this->model->uuid]));
             exit(0);
         } else {
             $errors = $this->model->errors;
         }
     }
     ob_start();
     $form = ActiveForm::begin(['id' => $settings['id']]);
     // Start output.
     echo Html::beginTag("div", ['class' => $settings['outerClass']]);
     // Display messages.
     foreach (\Yii::$app->session->getAllFlashes() as $key => $message) {
         //echo '<div class="c-alerts__alert c-alerts__alert--'.$key.'">'.$message.'</div>';
     }
     echo Html::beginTag("div", ['class' => 'o-grid']);
     // TODO: This has to be dynamicaly handled like it's done in frontend.
     //  Also the tabs and grouping mechanics have to be implemented.
     // Get the tabs (there has to be at least one).
     $tabs = $this->model->fieldDefinitions->tabs;
     //var_dump($tabs);
     foreach ($tabs as $tab) {
         // Loop through tabs.
         //check tab overrides
         if (isset($settings['tabs'][$tab->key])) {
             foreach ($settings['tabs'][$tab->key] as $key => $val) {
                 $tab->{$key} = $val;
             }
         }
         if (isset($tab->visible) && $tab->visible === false) {
             continue;
         }
         foreach ($tab->groups as $group) {
             // Loop through groups.
             $widthClass = !empty($group->settings->width) ? 'o-grid__cell--width-' . $group->settings->width : '';
             $groupSettings = property_exists($group, 'settings') ? $group->settings : null;
             echo Html::beginTag('div', ['class' => 'o-grid__cell ' . $widthClass]);
             echo Html::beginTag('div', ['class' => $settings['groupClass']]);
             if (!empty($groupSettings) && property_exists($groupSettings, 'showLabel') && $group->settings->showLabel !== false) {
                 echo Html::tag('div', $group->label, ['class' => 'c-card__item c-card__item--divider']);
             }
             echo Html::beginTag('div', ['class' => 'c-card__item']);
             foreach ($this->model->fieldDefinitions->fields as $field) {
                 if (!in_array($field->key, $group->fields)) {
                     continue;
                 }
                 // Build form fields.
                 $fieldOptions = !empty($field->options) ? $field->options : [];
                 if (strpos($field->type, 'widget_') !== false) {
                     $widget = str_replace('widget_', '', $field->type);
                     echo $form->field($this->model, $field->key)->widget($widget::className())->label($field->label);
                 } elseif ($field->type == 'dropDownList') {
                     echo $form->field($this->model, $field->key)->{$field->type}((array) $field->items, (array) $fieldOptions)->label($field->label);
                 } elseif ($field->type == 'submitButton') {
                     echo Html::submitButton($field->label, array('class' => 'c-button c-button--brand c-button--block'));
                 } else {
                     $class = 'giantbits\\crelish\\plugins\\' . strtolower($field->type) . '\\' . ucfirst($field->type);
                     // Check for crelish special fields.
                     if (class_exists($class)) {
                         echo $class::widget(['formKey' => $field->key, 'data' => $this->model[$field->key], 'field' => $field]);
                     } else {
                         echo $form->field($this->model, $field->key)->{$field->type}((array) $fieldOptions)->label($field->label);
                     }
                 }
             }
             echo Html::endTag('div');
             echo Html::endTag('div');
             echo Html::endTag('div');
//.........这里部分代码省略.........
开发者ID:giantbits,项目名称:yii2-crelish,代码行数:101,代码来源:CrelishBaseController.php

示例12: function

									</div>
-->
								</section>

								<section>
									<label class="checkbox">
										<input id="rememberMe" type="checkbox" name="LoginForm[rememberMe]">		
										<i></i>Recordarme</label>
								</section>
							</fieldset>
							<footer>
								<button type="submit" class="btn btn-primary">
									Entrar
								</button>
							</footer>
						<?php $form = ActiveForm::end(); ?>

					</div>
				</div>
		    </div>
		</div>
	</div>
	
</div>

<script type="text/javascript">
	$(function() {
	  $('#rememberMe').on('change', function(e) {
	    e.stopPropagation();
	    this.value = this.checked ? 1 : 0;
	  });
开发者ID:rzamarripa,项目名称:du,代码行数:31,代码来源:login.php

示例13:

<?php

use yii\bootstrap\ActiveForm as BootForm;
use yii\bootstrap\Html as BootHtml;
$form = BootForm::begin();
echo $form->field($model, 'email');
echo $form->field($model, 'password')->passwordInput();
echo BootHtml::submitButton('Войти', ['class' => 'btn btn-default']);
BootForm::end();
开发者ID:MaoCzedun,项目名称:AdCoin,代码行数:9,代码来源:login.php

示例14: sectionCaching

 /**
  * Prepares the caching section
  *
  * @return array the configuration of the section
  */
 protected function sectionCaching()
 {
     $ret = [];
     foreach (Yii::$app->components as $id => $component) {
         $instance = Yii::$app->{$id};
         if (!$instance instanceof Cache) {
             continue;
         }
         $title = $this->valueCode($id);
         ob_start();
         ActiveForm::begin();
         echo $this->valueCode($instance->className());
         echo $this->valueModal('Cache ' . $id, $this->valueVarDump($instance), 'Show config');
         echo Html::hiddenInput('flush-cache', $id);
         echo Html::submitButton('Flush', ['class' => 'btn btn-xs btn-danger', 'data' => ['confirm' => 'Are you sure?']]);
         ActiveForm::end();
         $ret[$title] = ob_get_clean();
     }
     return $ret;
 }
开发者ID:highestgoodlikewater,项目名称:yii2-toolbox,代码行数:25,代码来源:DebugAction.php

示例15: api_form

 public function api_form($options = [])
 {
     if (is_array($options) && count($options)) {
         $this->options = array_merge($this->options, $options);
     }
     $model = new Subscriber();
     ob_start();
     $form = ActiveForm::begin(['enableAjaxValidation' => true, 'action' => Url::to(['/admin/subscribe/send']), 'layout' => 'inline']);
     switch (Yii::$app->session->getFlash(Subscriber::FLASH_KEY)) {
         case 'success':
             Yii::$app->getView()->registerJs('alert("' . Yii::t('easyii/subscribe/api', 'You have successfully subscribed') . '");');
             break;
         case 'error':
             Yii::$app->getView()->registerJs('alert("' . Yii::t('easyii/subscribe/api', 'An error has occurred') . '");');
             break;
     }
     echo $form->field($model, 'email')->input('email', ['placeholder' => 'E-mail']);
     echo Html::submitButton(Yii::t('easyii/subscribe/api', $this->options['buttonText']), ['class' => $this->options['buttonClass'], 'id' => 'subscriber-send']);
     ActiveForm::end();
     return ob_get_clean();
 }
开发者ID:radiegtya,项目名称:easyii,代码行数:21,代码来源:Subscribe.php


注:本文中的yii\bootstrap\ActiveForm::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。