本文整理汇总了PHP中kartik\widgets\ActiveForm类的典型用法代码示例。如果您正苦于以下问题:PHP ActiveForm类的具体用法?PHP ActiveForm怎么用?PHP ActiveForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ActiveForm类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: actionUpdate
/**
* Updates an existing Questionnaire model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if (\Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
\Yii::$app->response->format = 'json';
return \kartik\widgets\ActiveForm::validate($model);
}
$persondetails = \app\models\Participant::findOne(['pk_person' => $model->fk_person]);
if ($model->load(Yii::$app->request->post())) {
$model->creation_name = Yii::$app->user->identity->username;
$model->altered = 1;
$persondetails->filtered = $persondetails->filtered + 1;
$model->hbp_med_list = $_POST['Questionnaire']['enalapril'] . "," . $_POST['Questionnaire']['atenolol'] . ", " . $_POST['Questionnaire']['propranolol'] . "," . $_POST['Questionnaire']['hydrochlorthiazide'] . "," . $_POST['Questionnaire']['frusemide'] . "," . $_POST['Questionnaire']['aldactone'] . "," . $_POST['Questionnaire']['methyldopa'] . "," . $_POST['Questionnaire']['nifedipine'] . "," . $_POST['Questionnaire']['hydralazine'];
if ($_POST['Questionnaire']['own_none'] == 1) {
$model->household_own = "0,0,0,0,0,0,1";
} else {
$model->household_own = $_POST['Questionnaire']['car'] . "," . $_POST['Questionnaire']['refridgerator'] . ", " . $_POST['Questionnaire']['bicycle'] . "," . $_POST['Questionnaire']['radio'] . "," . $_POST['Questionnaire']['television'] . "," . $_POST['Questionnaire']['own_none'];
}
$persondetails->filtered = 1;
if ($model->save(FALSE) && $persondetails->save(FALSE)) {
Yii::$app->session->setFlash('success', 'The questionnaire saved successfully');
return $this->redirect(['participant/apptmnts']);
}
} else {
return $this->render('update', ['model' => $model, 'persondetails' => $persondetails]);
}
}
开发者ID:jibendi,项目名称:shinda2,代码行数:33,代码来源:QuestionnaireController.php
示例2: init
/**
* 初始化
*/
public function init()
{
Yii::$container->set('yii\\widgets\\LinkPager', ['firstPageLabel' => '首页', 'lastPageLabel' => '尾页', 'prevPageLabel' => '上页', 'nextPageLabel' => '下页', 'hideOnSinglePage' => false, 'options' => ['class' => 'pagination pull-right']]);
Yii::$container->set('yii\\data\\Pagination', ['defaultPageSize' => 15]);
Yii::$container->set('yii\\grid\\ActionColumn', ['template' => '{update} {delete}']);
Yii::$container->set(ActiveForm::className(), ['type' => ActiveForm::TYPE_HORIZONTAL]);
Yii::$container->set('yii\\captcha\\Captcha', ['captchaAction' => 'home/captcha']);
Yii::$container->set('yii\\captcha\\CaptchaValidator', ['captchaAction' => 'home/captcha']);
Yii::$container->set('backend\\behaviors\\TestBehavior', ['msg' => 'xxxxxxx']);
}
开发者ID:tqsq2005,项目名称:yga,代码行数:13,代码来源:BackendController.php
示例3: run
/**
* @inheritdoc
* @param int $id
* @return int|mixed
* @throws NotFoundHttpException
*/
public function run($id)
{
/** @var Form|HasProperties $form */
if (null === ($form = Form::findById($id))) {
throw new NotFoundHttpException();
}
$post = Yii::$app->request->post();
$form->abstractModel->setAttrubutesValues($post);
/** @var AbstractModel|SpamCheckerBehavior $model */
$model = $form->getAbstractModel();
if (Yii::$app->request->isAjax && isset($post['ajax'])) {
Yii::$app->response->format = Response::FORMAT_JSON;
return ActiveForm::validate($model);
}
/** @var \app\models\Object $object */
$object = Object::getForClass(Form::className());
$propGroups = ObjectPropertyGroup::find()->where(['and', 'object_id = :object', 'object_model_id = :id'], [':object' => $object->id, ':id' => $id])->asArray()->all();
$propIds = ArrayHelper::getColumn($propGroups, 'property_group_id');
// Spam checking
$activeSpamChecker = SpamChecker::getActive();
$data = [];
$haveSpam = false;
if ($activeSpamChecker !== null && !empty($activeSpamChecker->api_key)) {
$data[$activeSpamChecker->name]['class'] = $activeSpamChecker->behavior;
$data[$activeSpamChecker->name]['value']['key'] = $activeSpamChecker->api_key;
$properties = Property::getForGroupId($propIds[0]);
foreach ($properties as $prop) {
if (!isset($activeSpamChecker->{$prop->interpret_as}) || empty($activeSpamChecker->{$prop->interpret_as})) {
continue;
}
$data[$activeSpamChecker->name]['value'][$activeSpamChecker->{$prop->interpret_as}] = is_array($post[$form->abstractModel->formName()][$prop->key]) ? implode(' ', $post[$form->abstractModel->formName()][$prop->key]) : $post[$form->abstractModel->formName()][$prop->key];
}
$model->attachBehavior('spamChecker', ['class' => SpamCheckerBehavior::className(), 'data' => $data]);
$haveSpam = $model->isSpam();
}
$date = new \DateTime();
/** @var Submission|HasProperties $submission */
$submission = new Submission(['form_id' => $form->id, 'date_received' => $date->format('Y-m-d H:i:s'), 'ip' => Yii::$app->request->userIP, 'user_agent' => Yii::$app->request->userAgent, 'spam' => (int) $haveSpam]);
if (false === Yii::$app->user->isGuest) {
$submission->processed_by_user_id = Yii::$app->user->identity->getId();
}
if (!($form->abstractModel->validate() && $submission->save())) {
return "0";
}
if (isset($post[$form->abstractModel->formName()])) {
$data = ['AddPropetryGroup' => [$submission->formName() => array_keys($form->getPropertyGroups())], $submission->abstractModel->formName() => $post[$form->abstractModel->formName()]];
if (isset($_FILES[$form->abstractModel->formName()])) {
$_FILES[$submission->abstractModel->formName()] = $_FILES[$form->abstractModel->formName()];
}
$submission->saveProperties($data);
}
return $submission->id;
}
开发者ID:xuantienvp,项目名称:dotplant2,代码行数:59,代码来源:SubmitFormAction.php
示例4: 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();
}
开发者ID:hanterrian,项目名称:field-extensions,代码行数:19,代码来源:FormWidget.php
示例5:
<?php
use yii\helpers\Html;
use kartik\widgets\ActiveForm;
use kartik\widgets\ActiveField;
use yii\helpers\ArrayHelper;
use yii\web\Session;
use yii\bootstrap\Modal;
/* @var $this yii\web\View */
/* @var $model frontend\models\Presentations */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="presentations-search" style="margin-top:10px; margin-bottom:10px;">
<?php
$form = kartik\widgets\ActiveForm::begin(['id' => 'form-horizontal-presentation-search', 'action' => ['index'], 'method' => 'get', 'type' => ActiveForm::TYPE_VERTICAL]);
?>
<h4 class="gray-color">Filteri pretrage
<div class="float-right"><?php
echo Html::resetButton(Yii::t('app', '<i class="fa fa-stop-circle"></i> Resetuj filtere'), ['class' => 'btn btn-link']);
?>
<?php
echo Html::button(Yii::t('app', '<i class="fa fa-undo"></i> Poništi sve filtere'), ['class' => 'btn btn-link', 'name' => 'clear', 'onclick' => 'clearForm(this.form);']);
?>
</div>
</h4>
<fieldset class="settings mini">
<?php
echo $this->render('searchParts/title.php', ['form' => $form, 'model' => $model, 'service' => $service]);
?>
<?php
开发者ID:bokko79,项目名称:servicemapp,代码行数:31,代码来源:_filters.php
示例6:
<?php
/**
* ┏┓ ┏┓
* ┏┛┻━━━┛┻┓
* ┃ ┃
* ┃ ━ ┃
* ┃ ┳┛ ┗┳ ┃
* ┃ ┃
* ┃ ┻ ┃
* ┃ ┃
* ┗━┓ ┏━┛
* ┃ ┃ 神兽保佑
* ┃ ┃ 代码无BUG!
* ┃ ┗━━━┓
* ┃ ┣┓
* ┃ ┏┛
* ┗┓┓┏━┳┓┏┛
* ┃┫┫ ┃┫┫
* ┗┻┛ ┗┻┛
*/
use kartik\widgets\ActiveForm;
$form = ActiveForm::begin(['id' => 'userform']);
echo $form->field($model, 'username')->textInput();
echo $form->field($model, 'password')->passwordInput();
echo $form->field($model, 'password_repeat')->passwordInput();
$form->end();
开发者ID:tqsq2005,项目名称:yga,代码行数:27,代码来源:loadhtml.php
示例7: actionCheckcustomeruniquecode
/**
*Check customer code is unique // use with Active form and field ajax validation
*/
public function actionCheckcustomeruniquecode()
{
if (Yii::$app->request->isAjax) {
$model = new Customer();
if ($model->load(Yii::$app->request->post())) {
Yii::$app->response->format = Response::FORMAT_JSON;
return ActiveForm::validate($model);
}
} else {
throw new NotFoundHttpException();
}
}
开发者ID:hoangec,项目名称:hocyii2,代码行数:15,代码来源:CustomerController.php
示例8:
<?php
use kartik\icons\Icon;
use kartik\widgets\ActiveForm;
use kartik\widgets\Select2;
use yii\helpers\Html;
?>
<div class="well">
<?php
echo $this->render('alert');
?>
<?php
$form = ActiveForm::begin(['id' => 'DatabaseChoose', 'action' => \yii\helpers\Url::to(['']), 'type' => ActiveForm::TYPE_HORIZONTAL, 'enableClientScript' => false, 'enableClientValidation' => true, 'options' => ['onkeypress' => "return event.keyCode != 13;"]]);
echo $form->errorSummary($model, ['class' => 'alert alert-danger']);
?>
<?php
echo $form->field($model, 'type')->widget(Select2::classname(), ['data' => $model->getTypes(), 'options' => ['placeholder' => $model->getAttributeLabel('type'), 'name' => 'DatabaseChoose[type]'], 'pluginOptions' => ['allowClear' => false, 'minimumResultsForSearch' => '-1']]);
?>
<?php
echo \yii\bootstrap\Button::widget(['id' => 'backButton', 'label' => Icon::show('arrow-circle-left') . Yii::t('install', 'Back'), 'encodeLabel' => false, 'options' => ['class' => 'btn btn-info', 'onClick' => new \yii\web\JsExpression("\n \$('#stepsMenu a:eq({$previousStep})').click();\n return false;")]]);
echo Html::a(Icon::show('arrow-circle-right') . Yii::t('install', 'Continue'), '', ['class' => 'btn btn-info', 'style' => 'margin-left: 10px;', 'onClick' => new \yii\web\JsExpression("\n \$('#DatabaseChoose').submit();\n return false;")]);
?>
</div>
开发者ID:fourteenmeister,项目名称:yii2-install,代码行数:23,代码来源:step-3.php
示例9: run
/**
* @param int $id
* @return int|mixed
* @throws NotFoundHttpException
*/
public function run($id)
{
/** @var Form|HasProperties $form */
if (null === ($form = Form::findById($id))) {
throw new NotFoundHttpException();
}
$post = \Yii::$app->request->post();
$form->abstractModel->setAttrubutesValues($post);
/** @var AbstractModel|SpamCheckerBehavior $model */
$model = $form->getAbstractModel();
if (\Yii::$app->request->isAjax && isset($post['ajax'])) {
\Yii::$app->response->format = Response::FORMAT_JSON;
return ActiveForm::validate($model);
}
/** @var \app\models\Object $object */
$object = Object::getForClass(Form::className());
$propGroups = ObjectPropertyGroup::find()->where(['and', 'object_id = :object', 'object_model_id = :id'], [':object' => $object->id, ':id' => $id])->asArray()->all();
$propIds = ArrayHelper::getColumn($propGroups, 'property_group_id');
// Spam checking
$activeSpamChecker = SpamChecker::getActive();
$data = [];
$spamResult = [];
if ($activeSpamChecker !== null && !empty($activeSpamChecker->api_key)) {
$data[$activeSpamChecker->name]['class'] = $activeSpamChecker->behavior;
$data[$activeSpamChecker->name]['value']['key'] = $activeSpamChecker->api_key;
$properties = Property::getForGroupId($propIds[0]);
foreach ($properties as $prop) {
if (!isset($activeSpamChecker->{$prop->interpret_as}) || empty($activeSpamChecker->{$prop->interpret_as})) {
continue;
}
$data[$activeSpamChecker->name]['value'][$activeSpamChecker->{$prop->interpret_as}] = is_array($post[$form->abstractModel->formName()][$prop->key]) ? implode(' ', $post[$form->abstractModel->formName()][$prop->key]) : $post[$form->abstractModel->formName()][$prop->key];
}
$model->attachBehavior('spamChecker', ['class' => SpamCheckerBehavior::className(), 'data' => $data]);
$spamResult = $model->check();
}
$haveSpam = false;
if (is_array($spamResult) === true) {
foreach ($spamResult as $result) {
if (ArrayHelper::getValue($result, 'ok', false) === true) {
$haveSpam = $haveSpam || ArrayHelper::getValue($result, 'is_spam', false);
}
}
}
$date = new \DateTime();
/** @var Submission|HasProperties $submission */
$submission = new Submission(['form_id' => $form->id, 'date_received' => $date->format('Y-m-d H:i:s'), 'ip' => Yii::$app->request->userIP, 'user_agent' => Yii::$app->request->userAgent, 'spam' => (int) $haveSpam]);
if (false === Yii::$app->user->isGuest) {
$submission->processed_by_user_id = Yii::$app->user->identity->getId();
}
if (!($form->abstractModel->validate() && $submission->save())) {
return "0";
}
if (isset($post[$form->abstractModel->formName()])) {
$data = ['AddPropetryGroup' => [$submission->formName() => array_keys($form->getPropertyGroups())], $submission->abstractModel->formName() => $post[$form->abstractModel->formName()]];
if (isset($_FILES[$form->abstractModel->formName()])) {
$_FILES[$submission->abstractModel->formName()] = $_FILES[$form->abstractModel->formName()];
}
$submission->saveProperties($data);
}
if ($haveSpam === false) {
if (!empty($form->email_notification_addresses)) {
try {
$emailView = !empty($form->email_notification_view) ? $form->email_notification_view : '@app/widgets/form/views/email-template.php';
Yii::$app->mail->compose($emailView, ['form' => $form, 'submission' => $submission])->setTo(explode(',', $form->email_notification_addresses))->setFrom(Yii::$app->mail->getMailFrom())->setSubject($form->name . ' #' . $submission->id)->send();
} catch (\Exception $e) {
// do nothing
}
}
}
return $submission->id;
}
开发者ID:keyeMyria,项目名称:dotplant2,代码行数:76,代码来源:SubmitFormAction.php
示例10:
<?php
echo $form->field($model, 'out_account_id')->dropDownList($persons);
?>
<?php
echo $form->field($model, 'in_account_id')->dropDownList($me);
?>
<?php
echo $form->field($model, 'create_time')->widget('kartik\\widgets\\DateTimePicker');
?>
<?php
echo $form->field($model, 'over_time')->widget('kartik\\widgets\\DatePicker', ['pluginOptions' => ['format' => 'yyyy-m-d']]);
?>
<?php
echo $form->field($model, 'description')->textInput();
?>
<?php
echo Html::submitButton('Create', ['class' => 'btn btn-success']);
?>
<?php
$form = ActiveForm::end();
?>
<?php
echo Html::a('返回', '/index.php?r=fund/currency/index');
开发者ID:jh27408079,项目名称:magenet,代码行数:30,代码来源:borrow.php
示例11: foreach
}
?>
<?php
$properties = \app\models\Property::getForGroupId($group->id);
?>
<?php
foreach ($properties as $property) {
?>
<?php
echo $property->handler($form, $model->abstractModel, [], 'frontend_edit_view');
?>
<?php
}
}
echo Html::submitButton(Yii::t('app', 'Send'), ['class' => 'btn btn-primary']);
\kartik\widgets\ActiveForm::end();
\yii\bootstrap\Modal::end();
?>
<?php
$js = <<<JS
"use strict";
\$('#orderchat-message').keypress(function (event) {
if (event.keyCode == 10) {
\$(this).parents('form').eq(0).submit();
}
});
\$('body').on('editableSuccess', function () {
location.reload();
});
\$('#print-button').click(function () {
开发者ID:Razzwan,项目名称:dotplant2,代码行数:31,代码来源:view.php
示例12: join
use yii\helpers\ArrayHelper;
use kartik\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model app\models\Bank */
$this->title = 'Platzhalter für:';
$this->params['breadcrumbs'][] = ['label' => 'Banken', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$model = new \app\models\Alias();
?>
<div class="bank-view">
<h4><?php
echo join(', ', ArrayHelper::map($banks, 'b_id', 'bezeichnung'));
?>
</h4>
<?php
$form = ActiveForm::begin(['method' => 'post']);
?>
<table class="table table-bordered">
<tr>
<th>Platzhalter</th>
<th>Ersetzen durch</th>
<th>Funktionen</th>
</tr>
<?php
foreach ($aliases as $key => $alias) {
?>
<?php
if ($alias['cnt'] == count($banks)) {
?>
<tr>
开发者ID:emotionbanker,项目名称:emotionbanking,代码行数:31,代码来源:alias.php
示例13:
<?php
use yii\helpers\Html;
use yii\helpers\Url;
use kartik\widgets\ActiveForm;
use kartik\widgets\ActiveField;
use yii\helpers\ArrayHelper;
?>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<?php
$form = kartik\widgets\ActiveForm::begin(['id' => 'form-vertical', 'method' => 'get', 'type' => ActiveForm::TYPE_VERTICAL]);
?>
<?php
if ($service->object_ownership == 'user') {
?>
<p class="hint">Možete izabrati više vrsta.</p>
<div class="enclosedCheckboxes">
<div class="checkbox"><label><input type="checkbox" id="ckbCheckAll<?php
echo $service->id;
?>
"> <i>Izaberite/Poništite sve</i></label></div>
<?php
echo $form->field($model, 'object_models[]')->checkboxList($service->objectModelsList, ['unselect' => null, 'class' => 'column3 multiselect'])->label(false);
?>
</div>
<?php
} else {
?>
开发者ID:bokko79,项目名称:servicemapp,代码行数:31,代码来源:presentation-oms.php
示例14:
* ┃ ┃ 代码无BUG!
* ┃ ┗━━━┓
* ┃ ┣┓
* ┃ ┏┛
* ┗┓┓┏━┳┓┏┛
* ┃┫┫ ┃┫┫
* ┗┻┛ ┗┻┛
*/
use kartik\widgets\ActiveForm;
use yii\helpers\Url;
use yii\helpers\Html;
?>
<div class="col-lg-6">
<?php
$form = ActiveForm::begin(['validationUrl' => Url::toRoute(['rbac/validateitemname'])]);
?>
<?php
echo $form->field($model, 'name', ['enableAjaxValidation' => true])->textInput();
?>
<?php
echo $form->field($model, 'description')->textarea();
?>
<?php
echo Html::hiddenInput('id', $model->name);
?>
<div class="form-group center">
<?php
echo Html::submitButton('提交', ['class' => 'btn btn-lg btn-primary']);
开发者ID:tqsq2005,项目名称:yga,代码行数:31,代码来源:_form.php
示例15: actionCreateAjax
public function actionCreateAjax($selector = 'selectorPersonas')
{
// si no se especifica el parametro $selector se toma 'selectorPersonas' por defecto, esto comportamiento contempla
// el caso de que en el mismo form se use mas de un select2 para buscar personas (por ejemplo personas/change)
$model = new Personas();
$model->id_tipo_doc = 96;
// DNI por defecto
$model->estado = Personas::ESTADO_ACTIVO;
// Al estar habilitado la validation ajax, $_POST['ajax'] viene seteado, si vino por el submit, esta variable no existe
// Siempre se devuelve el validate
if (isset($_POST['ajax'])) {
Yii::$app->response->format = 'json';
$model->load(Yii::$app->request->post());
return ActiveForm::validate($model);
}
// si no viene seteado $_POST['ajax'] se asume que se entro por el submit
if ($model->load(Yii::$app->request->post())) {
if ($model->save()) {
Yii::$app->response->format = 'json';
return ['modelP' => $model];
} else {
Yii::$app->response->format = 'json';
return ActiveForm::validate($model);
}
}
return $this->renderAjax('createajax', ['model' => $model, 'selector' => $selector]);
}
开发者ID:ibergonzi,项目名称:country,代码行数:27,代码来源:PersonasController.php
示例16:
/* @var $searchModel app\models\StaticPadeTableSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = 'Статические страницы';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="static-page-table-index">
<h1><?php
echo Html::encode($this->title);
?>
<?php
echo Html::a("<span class='glyphicon glyphicon-plus'>", ['create'], ['class' => 'btn btn-success', 'data-toggle' => "tooltip", 'data-placement' => "top", 'title' => "Создать страницу"]);
?>
</h1>
<?php
// echo $this->render('_search', ['model' => $searchModel]);
?>
<?php
echo SortableInput::widget(['name' => 'sort_list_2', 'value' => $value, 'items' => $list, 'hideInput' => false, 'options' => ['class' => 'form-control', 'readonly' => true, 'form' => 'sort']]);
?>
<?php
$form = ActiveForm::begin(['id' => 'sort']);
?>
<br>
<div class="form-group">
<?php
echo Html::submitButton('Сохранить порядок', ['class' => 'btn btn-primary btn-block']);
?>
</div>
</div>
开发者ID:dosh93,项目名称:shop,代码行数:30,代码来源:index.php
示例17: run
public function run()
{
$options = ['model' => $this->model, 'form' => $this->_form, 'attributes' => $this->attributes] + $this->options;
echo Form::widget($options);
if ($this->buttons != null) {
$tag = ArrayHelper::remove($this->buttonsContainer, 'tag', 'div');
echo Html::tag($tag, $this->_buttons, $this->buttonsContainer);
}
ActiveForm::end();
}
开发者ID:imagis,项目名称:yii2-user,代码行数:10,代码来源:BaseForm.php
示例18:
<?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">
开发者ID:bokko79,项目名称:servicemapp,代码行数:31,代码来源:_form.php
示例19:
<div class="panel-heading">
<h3 class="panel-title">Observaciones</h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-12">
<?= $form->field($model,'observaciones',[ 'showLabels'=>false,
'showErrors'=>false,
//'addon' => ['prepend' => ['content'=>'<i class="fa fa-envelope fa-lg fa-fw"></i>']],
'options'=>['class' => 'form-group']]
)->textarea([
'class' => 'form-control input-lg',
'placeholder'=>$model->getAttributeLabel('observaciones'),
'name'=>'observaciones',
'id'=>'observaciones'
]
);?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Guardar' : 'Guardar cambios', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>
</div>
开发者ID:rzamarripa,项目名称:du,代码行数:31,代码来源:_form.php
示例20:
<?php
use app\backend\widgets\BackendWidget;
use yii\helpers\Html;
/**
* @var \yii\web\View $this
* @var \app\modules\shop\models\Order $model
*/
$this->title = Yii::t('app', 'New order');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Orders'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$form = \kartik\widgets\ActiveForm::begin(['method' => 'post', 'type' => \kartik\form\ActiveForm::TYPE_HORIZONTAL, 'options' => ['class' => 'form-order-backend-create']]);
BackendWidget::begin(['icon' => 'info-circle', 'title' => Yii::t('app', 'Order information'), 'footer' => Html::submitButton(Yii::t('app', 'Create'), ['class' => 'btn btn-success'])]);
?>
<div class="row">
<div class="col-md-4">
<?php
$_jsTemplateResultFunc = <<<'JSCODE'
function (data) {
if (data.loading) return data.text;
var tpl = '<div class="s2customer-result">' +
'<strong>' + (data.username || '') + '</strong>' +
'<div>' + (data.first_name || '') + ' ' + (data.last_name || '') + ' (' + (data.email || '') + ')</div>' +
'</div>';
return tpl;
}
JSCODE;
echo \app\backend\widgets\Select2Ajax::widget(['form' => $form, 'model' => $model, 'modelAttribute' => 'user_id', 'initialData' => [$model->user_id => null !== $model->user ? $model->user->username : 'Guest'], 'multiple' => false, 'searchUrl' => \yii\helpers\Url::toRoute(['ajax-user']), 'pluginOptions' => ['allowClear' => false, 'escapeMarkup' => new \yii\web\JsExpression('function (markup) {return markup;}'), 'templateResult' => new \yii\web\JsExpression($_jsTemplateResultFunc), 'templateSelection' => new \yii\web\JsExpression('function (data) {return data.username || data.text;}')]]);
echo Html::tag('div', Html::a(Yii::t('app', 'Clear'), '#clear', ['data-sel' => 'order-user_id', 'class' => 'col-md-offset-2']));
?>
开发者ID:yii2ApplicationCollect,项目名称:dotplant2,代码行数:31,代码来源:create.php
注:本文中的kartik\widgets\ActiveForm类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论