本文整理汇总了PHP中kartik\widgets\ActiveForm::begin方法的典型用法代码示例。如果您正苦于以下问题:PHP ActiveForm::begin方法的具体用法?PHP ActiveForm::begin怎么用?PHP ActiveForm::begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kartik\widgets\ActiveForm
的用法示例。
在下文中一共展示了ActiveForm::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$form = ActiveForm::begin($this->formOptions);
$column = [];
$options = $this->attributeOptions;
if (!isset($options['fieldConfig'])) {
$options['fieldConfig'] = [];
}
if (!isset($options['fieldConfig']['template'])) {
$options['fieldConfig']['template'] = "{input}\n{hint}\n{error}";
}
switch ($this->type) {
case EditableType::TYPE_TEXT:
$column[$this->attribute] = ExtForm::textField($options);
break;
}
echo Form::widget(['model' => $this->model, 'form' => $form, 'attributes' => $column]);
ActiveForm::end();
}
示例2: function
$buttons = '<div class="btn-group">';
$buttons .= '<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">' . Yii::t('igolf', 'Add points') . ' <span class="caret"></span></button>';
$buttons .= '<ul class="dropdown-menu" role="menu">';
foreach ([1, 2, 5, 10, 20, 50] as $cnt) {
$buttons .= '<li>' . Html::a(Yii::t('igolf', 'Add {0, number} points', $cnt), ['rule/addpoints', 'rule_id' => $rule->id, 'count' => $cnt]) . '</a></li>';
}
$buttons .= '</ul>';
$buttons .= '</div> ';
if ($rule->getPoints()->count() > 0) {
$buttons .= Html::submitButton(Yii::t('igolf', 'Update Points'), ['class' => 'btn btn-primary']);
}
?>
<div class="point-index">
<?php
$form = ActiveForm::begin(['action' => Url::to(['/admin/point/updates'])]);
echo TabularForm::widget(['form' => $form, 'dataProvider' => $dataProvider, 'serialColumn' => false, 'actionColumn' => ['template' => '{delete}', 'controller' => 'point', 'buttons' => ['delete' => function ($url, $model) {
return Html::a('<i class="glyphicon glyphicon-trash"></i>', $url, ['class' => 'btn', 'data-confirm' => Yii::t('igolf', 'Are you sure to delete this point?'), 'title' => Yii::t('igolf', 'Delete')]);
}], 'urlCreator' => function ($action, $model, $key, $index) {
$url = '';
switch ($action) {
case 'delete':
$url = Url::to(['point/delete-get', 'id' => $model->id]);
break;
}
return $url;
}], 'checkboxColumn' => false, 'gridSettings' => ['floatHeader' => true, 'panel' => ['heading' => '<h4>' . $this->title . '</h4>', 'footer' => $buttons]], 'attributes' => ['position' => ['type' => TabularForm::INPUT_TEXT], 'points' => ['type' => TabularForm::INPUT_TEXT]]]);
ActiveForm::end();
?>
</div>
示例3:
<?php
use kartik\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\calendar\event */
/* @var $form yii\widgets\ActiveForm */
?>
<modal title="<?php
echo Yii::t('app', 'TITLE FORM');
?>
" visible="showModal"
style="display: none;">
<?php
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>
<ul class="nav nav-tabs">
<li class="active"><a href="#tab1" data-toggle="tab"><?php
echo Yii::t('app', 'Inviation');
?>
</a></li>
<li><a href="#tab2" data-toggle="tab"><?php
echo Yii::t('app', 'Event');
?>
</a></li>
</ul>
<div class="tab-content">
<br />
<?php
echo $this->render('_event', ['form' => $form, 'event' => $event, 'model_remind' => $model_remind, 'model_file' => $model_file]);
示例4:
<?php
use yii\helpers\Html;
use kartik\widgets\ActiveForm;
use kartik\builder\Form;
use kartik\datecontrol\DateControl;
use kartik\widgets\Select2;
/**
* @var yii\web\View $this
* @var common\models\empresa\Osconfemp $model
* @var yii\widgets\ActiveForm $form
*/
?>
<div class="osconfemp-form">
<?php
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL]);
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['coe_nombre' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\yii\\widgets\\MaskedInput', 'options' => ['mask' => 'A{3,10}9{0,5}']], 'coe_descri' => ['type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Descripción...', 'maxlength' => 60]], 'coe_tipo' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => Select2::classname(), 'options' => ['data' => Yii::$app->orcsis->getOpcTab($model->tableName(), 'coe_tipo'), 'options' => ['placeholder' => 'Enter Tipo de Dato...']]], 'coe_data' => ['type' => Form::INPUT_TEXTAREA, 'options' => ['placeholder' => 'Enter Coe Data...', 'rows' => 6]]]]);
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
ActiveForm::end();
?>
</div>
示例5:
<?php
use yii\helpers\Html;
use yii\helpers\Url;
use kartik\widgets\ActiveForm;
use kartik\switchinput\SwitchInput;
use kartik\widgets\DatePicker;
use kartik\select2\Select2;
use yii\helpers\ArrayHelper;
use kartik\widgets\FileInput;
?>
<?php
$form = kartik\widgets\ActiveForm::begin(['id' => 'form-horizontal', 'type' => ActiveForm::TYPE_HORIZONTAL, 'fullSpan' => 7, 'formConfig' => ['labelSpan' => 3, 'deviceSize' => ActiveForm::SIZE_MEDIUM], 'options' => ['enctype' => 'multipart/form-data']]);
?>
<?php
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>
<?php
echo $form->field($model_trans, 'name')->input(['value' => $model->name]);
?>
<?php
echo $form->field($model_trans, 'body')->textArea(['rows' => 4]);
?>
<div class="row" style="margin:20px;">
<div class="col-md-offset-3">
示例6:
/* @var $model app\models\Operator */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="sintret-update">
<div class="page-header">
<h1>Parsing Excel test</h1>
</div>
<div class="test-form">
<div class="test-form">
<?php
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]);
?>
<div class="row">
<div class="col-md-10">
<?php
echo $form->field($model, 'fileori')->widget(FileInput::classname(), ['options' => ['accept' => '.xls']]);
?>
</div>
</div>
<div class="row">
<div class="col-md-10 col-md-offset-1">
示例7:
use yii\helpers\Html;
use kartik\widgets\ActiveForm;
use kartik\form\ActiveField;
use yii\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $model app\models\CommentForm */
/* @var $form ActiveForm */
?>
<div class="site-_comment">
<h3> Оставьте пожалйуста отзыв о проекте</h3>
<?php
Pjax::begin();
?>
<?php
$form = ActiveForm::begin(['action' => '/site/add-review.html']);
?>
<?php
echo $form->field($model, 'content', ['hintType' => ActiveField::HINT_SPECIAL, 'hintSettings' => ['placement' => 'right', 'onLabelClick' => true, 'onLabelHover' => false]])->textArea(['id' => 'comment', 'placeholder' => 'Напишите отзыв..', 'rows' => 4])->hint('Enter your <b>corporate website link</b> for a valid registration.')->label(false);
?>
<div class="form-group">
<div class="text-right">
<?php
echo Html::submitButton('Отправить', ['class' => 'btn btn-success', 'onclick' => 'add_review();return false;']);
?>
</div>
</div>
<?php
ActiveForm::end();
示例8:
return $laba_rugi;
}, 'pageSummary' => true, 'pageSummaryFunc' => GridView::F_SUM, 'footer' => number_format($total_laba_rugi, 2)]]]);
?>
<?php
ActiveForm::end();
?>
<div class="row">
<div class="col-md-9">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Simulasi Pembelian & Penjualan Saham</h3>
</div>
<div class="panel-body">
<?php
$form = ActiveForm::begin(['options' => ['data-pjax' => true]]);
?>
<div>
<?php
echo $form->field($simulation, 'tipe')->widget(SwitchInput::classname(), ['pluginOptions' => ['onText' => 'Pembelian', 'offText' => 'Penjualan']])->label('Pilih tipe simulasi');
?>
</div>
<div class="row">
<div class="col-xs-6">
<div class="row">
<div class="col-xs-6">
<?php
echo $form->field($simulation, 'jml_lot')->widget(MaskedInput::classname(), ['clientOptions' => ['alias' => 'numeric', 'groupSeparator' => ',', 'radixPoint' => '.', 'autoGroup' => true, 'removeMaskOnSubmit' => true]]);
?>
</div>
示例9: strlen
CSS;
$this->registerCss($css);
?>
<div class="personal-form">
<div class="row">
<div class="col-sm-3 pull-right">
<?php
echo \common\components\cropper\CropAvatarWidget::widget(['imgSrc' => strlen($model->picture_name) > 14 ? Yii::$app->homeUrl . '/uploads/personCardPhoto/' . $model->personal_id . '/' . $model->picture_name : '', 'imgSavePath' => '/uploads/personCardPhoto/' . $model->personal_id . '/', 'imgClass' => 'profile-user-img img-responsive img-rounded', 'imgCropType' => common\components\cropper\CropAvatarWidget::PERSON_AVATAR, 'imgPersonalID' => $model->personal_id]);
?>
</div>
<div class="col-sm-9">
<?php
$form = ActiveForm::begin(['id' => 'personal-form']);
?>
<div class="row">
<div class="col-sm-12">
<?php
echo Html::submitButton('保 存', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-info']);
?>
</div>
</div>
<?php
echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 6, 'attributes' => ['personal_id' => ['type' => Form::INPUT_HIDDEN, 'label' => false, 'columnOptions' => ['colspan' => 0]], 's_date' => ['type' => Form::INPUT_TEXT, 'columnOptions' => ['colspan' => 2], 'options' => ['placeholder' => '请输入登记日期..', 'maxlength' => 8]], 'code1' => ['type' => Form::INPUT_TEXT, 'columnOptions' => ['colspan' => 2], 'options' => ['placeholder' => '请输入员工编码..', 'maxlength' => 36]], 'name1' => ['type' => Form::INPUT_TEXT, 'columnOptions' => ['colspan' => 2], 'options' => ['placeholder' => '请输入员工姓名..', 'maxlength' => 50]]]]);
?>
</div>
<div class="col-sm-12">
<?php
示例10:
<?php
use yii\bootstrap\Html;
use kartik\widgets\ActiveForm;
use kartik\daterange\DateRangePicker;
?>
<div class="row m-b-sm">
<div class="col-lg-12">
<?php
$form = ActiveForm::begin(['id' => 'chart-form', 'method' => 'get']);
echo $form->field($model, 'datetime_range')->widget(DateRangePicker::className(), ['name' => 'UserJobStats[datetime_range]', 'value' => '1', 'presetDropdown' => true, 'hideInput' => true, 'pluginOptions' => ['format' => 'Y-m-d', 'separator' => '/', 'opens' => 'center'], 'convertFormat' => true]);
echo Html::button(Yii::t('job', 'Statistics'), ['class' => 'btn btn-success', 'onclick' => '$("#chart-form").submit();']);
ActiveForm::end();
?>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5><?php
echo Yii::t('job', 'Chart');
?>
</h5>
<div class="ibox-tools">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
</a>
<a class="close-link">
<i class="fa fa-times"></i>
示例11:
<?php
$this->beginBlock('submit');
?>
<div class="form-group no-margin">
<?php
echo Html::submitButton(Icon::show('save') . Yii::t('app', 'Save'), ['class' => 'btn btn-success']);
?>
</div>
<?php
$this->endBlock('submit');
?>
<div class="row">
<div class="col-md-4" id="jstree-more">
<?php
$form = ActiveForm::begin(['id' => 'newsletter_config', 'type' => ActiveForm::TYPE_VERTICAL, 'method' => 'get']);
?>
<?php
BackendWidget::begin(['title' => Yii::t('app', 'Newsletter config'), 'icon' => 'cogs', 'footer' => $this->blocks['submit']]);
?>
<?php
echo $form->field($model, 'isActive')->textInput()->widget(\kartik\widgets\SwitchInput::className());
?>
<?php
BackendWidget::end();
?>
<?php
ActiveForm::end();
?>
示例12:
use kartik\widgets\ActiveForm;
use yii\helpers\Html;
/**
* @var yii\web\View $this
* @var app\modules\seo\models\Config $model
* @var yii\widgets\ActiveForm $form
*/
?>
<div class="<?php
echo $model->key;
?>
-form">
<?php
$form = ActiveForm::begin(['id' => $model->key . '-form']);
?>
<?php
echo $form->field($model, 'key', ['template' => '{input}'])->input('hidden');
?>
<?php
echo $form->field($model, 'value', ['template' => '{input}'])->textarea(['rows' => '25']);
?>
<div class="form-group">
<?php
echo Html::submitButton(Yii::t('app', 'Update'), ['class' => 'btn btn-primary']);
?>
</div>
示例13:
<!-- Modal -->
<div class="modal modal-primary fade" id="myModal_create_cat" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button aria-label="Close" data-dismiss="modal" class="close" type="button"><span aria-hidden="true">×</span></button>
<h4 id="myModalLabel2" class="modal-title">Add Product Specification</h4>
</div>
<div class="modal-body">
<div class="countries-form">
<?php
$form = ActiveForm::begin(['id' => 'product_spec-form-update', 'enableAjaxValidation' => false, 'enableClientValidation' => true]);
?>
<label>Item Name</label>
<?php
echo Select2::widget(['model' => $model_q, 'attribute' => 'item_name', 'data' => ArrayHelper::map(ProductSpecItem::find()->asArray()->all(), 'name', 'name'), 'options' => ['placeholder' => 'Select Item Name ...', 'multiple' => false], 'pluginOptions' => ['allowClear' => true]]);
?>
<?php
echo $form->field($model_q, 'item_val')->textInput(['maxlength' => 200]);
?>
<input type="hidden" maxlength="200" name="ProductSpecification[cat_create]" class="form-control" value="ok">
<input type="hidden" maxlength="200" name="ProductSpecification[product_id]" class="form-control" value="<?php
echo $model->id;
?>
">
示例14: if
<!-- widget edit box -->
<div class="jarviswidget-editbox">
<!-- This area used as dropdown edit box -->
</div>
<!-- end widget edit box -->
<!-- widget content -->
<div class="widget-body">
<div class="row">
<DIV id='observacionesAtras' class="alert alert-danger" role="alert" <?php if(empty($model->observaciones) || trim($model->observaciones)=='') echo 'style="display:none;"'; ?> >
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<strong>Observaciones: </strong>
<?= $model->observaciones ?>
</DIV>
<?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data', 'id'=> 'wizard-1','novalidat'=>'novalidate']]) ?>
<div id="bootstrap-wizard-1" class="col-sm-12">
<div class="form-bootstrapWizard">
<ul class="bootstrapWizard form-wizard">
<li class="active" data-target="#step1" style="width:16.666666666667%">
<a id="btntab1" href="#tab1" data-toggle="tab" > <span class="step">1</span> <span class="title">Solicitud</span> </a>
</li>
<li data-target="#step2" style="width:16.666666666667%">
<a id="btntab2" href="#tab2" data-toggle="tab" disabled="disabled"> <span class="step">2</span> <span class="title">Documentos</span> </a>
</li>
<li data-target="#step3" style="width:16.666666666667%">
<a id="btntab3" href="#tab3" data-toggle="tab" disabled="disabled"> <span class="step">3</span> <span class="title">Revisión</span> </a>
</li>
<li data-target="#step4" style="width:16.666666666667%">
<a id="btntab4" href="#tab4" data-toggle="tab" disabled="disabled"> <span class="step">4</span> <span class="title">Pago</span> </a>
</li>
示例15: array_reduce
$feed_settings['properties_map'] = array_reduce(array_reduce($prop_group, function ($result, $i) {
if (isset($result[$i['pgname']])) {
$result[$i['pgname']]['html'] .= '<option value="' . addslashes(htmlspecialchars($i['id'])) . '">' . addslashes(htmlspecialchars($i['name'])) . '</option>';
$result[$i['pgname']]['fields'][$i['pgname']][$i['id']] = $i['name'];
$result[$i['pgname']]['name'] = $i['pgname'];
}
return $result;
}, array_fill_keys(array_unique(array_column($prop_group, 'pgname')), ['fields' => [], 'html' => '', 'name' => ''])), function ($result, $i) {
$result['fields'] = array_replace($result['fields'], $i['fields']);
$result['html'] .= '<optgroup label="' . addslashes(addslashes($i['name'])) . '">' . addslashes(addslashes($i['html'])) . '</optgroup>';
return $result;
}, $feed_settings['properties_map']);
?>
<?php
$form = \kartik\widgets\ActiveForm::begin(['id' => 'yml-form', 'type' => \kartik\widgets\ActiveForm::TYPE_HORIZONTAL]);
?>
<div class="row">
<div class="col-md-6">
<?php
BackendWidget::begin(['title' => Yii::t('app', 'Settings for shop section'), 'icon' => 'cogs']);
?>
<?php
echo $form->field($model, 'shop_host');
?>
<?php
echo $form->field($model, 'shop_name');
?>
<?php
echo $form->field($model, 'shop_description')->textarea();
?>