• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP form\ActiveForm类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中kartik\form\ActiveForm的典型用法代码示例。如果您正苦于以下问题:PHP ActiveForm类的具体用法?PHP ActiveForm怎么用?PHP ActiveForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: isset

//index view
$viewId = Yii::$app->request->get('view_id');
if (!isset($viewId)) {
    ?>
    <button type="button" class="btn btn-primary btn-lg" onclick="javascript: $('#address').toggle()">新建收货地址</button>
<?php 
}
?>


<div id="address"  style="display: <?php 
echo isset($viewId) ? 'block' : 'none';
?>
">
    <?php 
$form = \kartik\form\ActiveForm::begin();
/* @var \yincart\customer\models\CustomerAddress $model */
echo $form->field($model, 'province')->dropDownList($catList, ['id' => 'cat-id']);
// Child # 1
echo $form->field($model, 'city')->widget(DepDrop::classname(), ['data' => [$model->city => isset($model->cityArea) ? $model->cityArea->name : ''], 'options' => ['id' => 'subcat-id'], 'pluginOptions' => ['depends' => ['cat-id'], 'placeholder' => 'Select...', 'url' => Url::to(['/customer/get-cities'])]]);
// Child # 2
echo $form->field($model, 'district')->widget(DepDrop::classname(), ['data' => [$model->district => isset($model->districtArea) ? $model->districtArea->name : ''], 'pluginOptions' => ['depends' => ['cat-id', 'subcat-id'], 'placeholder' => 'Select...', 'url' => Url::to(['/customer/get-district'])]]);
?>

    <?php 
echo $form->field($model, 'address')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'zip_code')->textInput(['maxlength' => 255]);
?>
开发者ID:yinheark,项目名称:yincart2,代码行数:31,代码来源:delivery_address.php


示例2:

<?
/**
 * @var $model Registration
 * @var $invoice Invoice
 */

use common\models\Registration;
use common\models\Invoice;
use kartik\form\ActiveForm;
use vova07\imperavi\Widget;
use kartik\helpers\Html;

?>

<?php 
$form = ActiveForm::begin(['id' => 'credit-note-form', 'action' => Yii::$app->urlManager->createUrl(['/registration/create-credit-note/', 'code' => $model->code]), 'options' => ['target' => '_blank']]);
?>

    <div class="row">
        <div class="col-md-12">
            <?php 
echo $form->field($invoice, 'newAmount')->textInput();
?>

            <?php 
echo Html::label('Subject', 'Invoice[subject]');
?>
            <?php 
echo Widget::widget(['name' => 'Invoice[subject]', 'value' => $invoice->subject, 'settings' => ['minHeight' => 200, 'plugins' => ['clips']]]);
?>
开发者ID:vetal2409,项目名称:example,代码行数:30,代码来源:credit_note.php


示例3:

if ($mode == 'new') {
    $this->title = 'Добавление новости';
    $breadcrumb = $this->title;
}
$this->params['breadcrumbs'][] = ['url' => '/news', 'label' => 'Новости'];
$this->params['breadcrumbs'][] = $breadcrumb;
echo Html::beginTag('div', ['class' => 'col-xs-12']);
if (\Yii::$app->session->getFlash('saved', false)) {
    echo \yii\bootstrap\Alert::widget(['body' => \Yii::$app->session->getFlash('saved'), 'options' => ['class' => 'alert alert-success alert-dismissible']]);
} else {
    if (\Yii::$app->session->getFlash('error', false)) {
        echo \yii\bootstrap\Alert::widget(['body' => \Yii::$app->session->getFlash('error'), 'options' => ['class' => 'alert alert-danger alert-dismissible row col-xs-10 col-xs-offset-1']]);
    }
}
echo Html::endTag('div');
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL]);
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <?php 
echo $this->render('_news_header_buttons', ['model' => $model, 'mode' => $mode]);
?>
    </div>
    <div class="panel-body">
        <?php 
echo Html::tag('div', $form->field($model, 'title') . $form->field($model, 'category')->widget(\kartik\select2\Select2::className(), ['data' => ArrayHelper::map(Category::find()->where(['deleted' => 0])->asArray()->all(), 'id', 'title')]) . $form->field($model, 'link')->hint('Оставьте поле пустым, чтобы ссылку сгенерировала система') . $form->field($model, 'text')->widget(\yii\imperavi\Widget::className(), ['id' => 'textEditor', 'options' => ['lang' => 'ru', 'imageUpload' => '/news/upload', 'imageManagerJson' => '/news/uploaded'], 'plugins' => ['imagemanager', 'video', 'border']]) . $form->field($model, 'metaDescription')->textarea() . $form->field($model, 'metaKeywords') . $form->field($model, 'language')->dropDownList($model->getLanguages()) . $form->field($model, 'publishDate')->widget(\kartik\datetime\DateTimePicker::className(), ['pluginOptions' => ['format' => 'dd.mm.yyyy HH:ii']]) . $form->field($model, 'genre')->dropDownList($model->getGenres()) . $form->field($model, 'author'), ['class' => 'col-xs-12']), $form->field($model, 'published', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false), $form->field($model, 'favorite', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false), $form->field($model, 'deleted', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false), $form->field($model, 'moderatedComments', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false), Html::tag('div', Html::button(FontAwesome::i('save') . Html::tag('small', 'сохранить'), ['class' => 'btn btn-app btn-success', 'type' => 'submit']), ['class' => 'text-center']);
?>
    </div>
</div>
<?php 
$form->end();
开发者ID:BoBRoID,项目名称:new.k-z,代码行数:31,代码来源:news_edit.php


示例4:

			<?= $form->field($model, 'head_picture')->label(Yii::t('app', 'Upload Head Picture'))->widget(FileInput::classname(), [
		    'pluginOptions' => [
		        'uploadUrl' => Url::to(['/user/upload-head-pic']),
		        'uploadAsync' => false,
		        'allowedPreviewTypes' => ['image'],
		        'allowedFileExtensions' => ['png', 'jpg', 'jpeg'],
		        'maxFileCount' => 1,
		        'maxFileSize' => 1000,
		        'uploadExtraData' => [
		            '_csrf' => Yii::$app->request->csrfToken,
		            'User[id]' => $model->id,
		        ] 
		    ]
	   		]); ?>

	   	<?php ActiveForm::end(); ?>
   	</div>

   	<div class="col-lg-2 col-lg-offset-5 col-md-2 col-md-offset-5 col-sm-2 col-sm-offset-2 profile-save">
   		<button class="btn btn-info" onclick="profileSave()" id="profile-save-btn"><span class="fa fa-spinner fa-pulse" style="display:none"></span>保存</button>
   	</div>
		
		
	</div>

<!-- 	<div class="mengceng">
		<span class="fa fa-refresh fa-spin fa-3x gif"></span>
	</div> -->

	<script type="text/javascript">
开发者ID:songwanfu,项目名称:SummerNut,代码行数:30,代码来源:updateProfile.php


示例5: actionUpdate

 /**
  * @inheritdoc
  * */
 public function actionUpdate($id = null)
 {
     if ($id) {
         $modelObject = $this->findRecordModel($id);
     } else {
         $modelObject = Yii::createObject($this->model);
     }
     /** @var \nagser\gallery\models\GalleryRecord $modelObject * */
     if (\Yii::$app->request->isAjax) {
         if ($modelObject->load(\Yii::$app->request->post())) {
             \Yii::$app->response->format = Response::FORMAT_JSON;
             return ActiveForm::validate($modelObject);
         } else {
             return $this->renderAjax('update', ['model' => $modelObject]);
         }
     } else {
         if (Yii::$app->request->isPost) {
             $modelObject->file = Yii::$app->gallery->upload($modelObject);
             if ($modelObject->upload() and $modelObject->scenario = 'save' and $modelObject->load(\Yii::$app->request->post()) and $modelObject->save()) {
                 $this->redirect(Url::to(['view', 'id' => $modelObject->id]));
             }
         }
         return $this->render('update', ['model' => $modelObject]);
     }
 }
开发者ID:nagser,项目名称:gallery,代码行数:28,代码来源:AdminController.php


示例6: actionCopy

 public function actionCopy($id)
 {
     $model = \Yii::createObject($this->model);
     /** @var ThemesRecord $model **/
     $model = $model->findRecordModel($id);
     if (\Yii::$app->request->isAjax) {
         if ($model->load(\Yii::$app->request->post())) {
             \Yii::$app->response->format = Response::FORMAT_JSON;
             return ActiveForm::validate($model);
         } else {
             return $this->renderAjax('copy', ['model' => $model]);
         }
     } else {
         if ($model->load(\Yii::$app->request->post())) {
             $model->copy($id);
             $this->redirect(Url::to(['view', 'id' => $model->dir]));
         }
     }
 }
开发者ID:nagser,项目名称:themes,代码行数:19,代码来源:AdminController.php


示例7:

?>
</h1>
<div class="cart">
<?php 
if (!is_null($model) && $model->items_count > 0) {
    ?>
    <?php 
    echo $this->render('items', ['model' => $model, 'items' => $model->items]);
    ?>
    <div class="pull-right">
        <div class="discount-code">
        <?php 
    if ($orderCode->isNewRecord) {
        ?>
            <?php 
        $form = \kartik\form\ActiveForm::begin(['type' => \kartik\form\ActiveForm::TYPE_INLINE]);
        ?>
            <?php 
        echo $form->errorSummary($orderCode);
        ?>
            <?php 
        echo $form->field($orderCode, 'code');
        ?>
            <?php 
        echo \kartik\helpers\Html::submitButton(Yii::t('app', 'Apply code'), ['class' => 'btn btn-success']);
        ?>
            <?php 
        echo \kartik\helpers\Html::endForm();
        ?>
        <?php 
    } else {
开发者ID:yii2ApplicationCollect,项目名称:dotplant2,代码行数:31,代码来源:index.php


示例8: renderRawActiveInput

 /**
  * Renders raw active input based on the attribute settings
  *
  * @param \kartik\form\ActiveForm              $form the form instance
  * @param \yii\db\ActiveRecord|\yii\base\Model $model
  * @param string                               $attribute the name of the attribute
  * @param array                                $settings the attribute settings
  *
  * @return \kartik\form\ActiveField
  * @throws \yii\base\InvalidConfigException
  *
  */
 protected static function renderRawActiveInput($form, $model, $attribute, $settings)
 {
     $type = ArrayHelper::getValue($settings, 'type', self::INPUT_TEXT);
     $i = strpos($attribute, ']');
     $attribName = $i > 0 ? substr($attribute, $i + 1) : $attribute;
     if (!in_array($type, static::$_validInputs)) {
         throw new InvalidConfigException("Invalid input type '{$type}' configured for the attribute '{$attribName}'.'");
     }
     $fieldConfig = ArrayHelper::getValue($settings, 'fieldConfig', []);
     $options = ArrayHelper::getValue($settings, 'options', []);
     $label = ArrayHelper::getValue($settings, 'label', null);
     $hint = ArrayHelper::getValue($settings, 'hint', null);
     $field = $form->field($model, $attribute, $fieldConfig);
     if ($type === self::INPUT_TEXT || $type === self::INPUT_PASSWORD || $type === self::INPUT_TEXTAREA || $type === self::INPUT_FILE || $type === self::INPUT_HIDDEN || $type === self::INPUT_STATIC) {
         return static::getInput($field->{$type}($options), $label, $hint);
     }
     if ($type === self::INPUT_DROPDOWN_LIST || $type === self::INPUT_LIST_BOX || $type === self::INPUT_CHECKBOX_LIST || $type === self::INPUT_RADIO_LIST || $type === self::INPUT_MULTISELECT) {
         if (!isset($settings['items'])) {
             throw new InvalidConfigException("You must setup the 'items' array for attribute '{$attribName}' since it is a '{$type}'.");
         }
         return static::getInput($field->{$type}($settings['items'], $options), $label, $hint);
     }
     if ($type === self::INPUT_CHECKBOX || $type === self::INPUT_RADIO) {
         $enclosedByLabel = ArrayHelper::getValue($settings, 'enclosedByLabel', true);
         if ($label !== null) {
             $options['label'] = $label;
         }
         return static::getInput($field->{$type}($options, $enclosedByLabel), null, $hint);
     }
     if ($type === self::INPUT_HTML5) {
         $html5type = ArrayHelper::getValue($settings, 'html5type', 'text');
         return static::getInput($field->{$type}($html5type, $options), $label, $hint);
     }
     if ($type === self::INPUT_WIDGET) {
         $widgetClass = ArrayHelper::getValue($settings, 'widgetClass', []);
         if (empty($widgetClass) && !$widgetClass instanceof yii\widgets\InputWidget) {
             throw new InvalidConfigException("A valid 'widgetClass' for '{$attribute}' must be setup and extend from 'yii\\widgets\\InputWidget'.");
         }
         return static::getInput($field->{$type}($widgetClass, $options), $label, $hint);
     }
     if ($type === self::INPUT_RAW) {
         return ArrayHelper::getValue($settings, 'value', '');
     }
 }
开发者ID:hsleonis,项目名称:basetech,代码行数:56,代码来源:BaseForm.php


示例9:

}
?>
            <?php 
echo Html::a(Icon::show('arrow-circle-left') . Yii::t('app', 'Back'), Yii::$app->request->get('returnUrl', ['/review/backend/index']), ['class' => 'btn btn-default']);
?>
            <?php 
echo Html::submitButton(Icon::show('save') . Yii::t('app', 'Save'), ['class' => 'btn btn-primary', 'name' => 'action', 'value' => 'save']);
?>
        </div>
    </div>
<?php 
$this->endBlock('submit');
?>

<?php 
$form = ActiveForm::begin(['id' => 'product-form', 'type' => ActiveForm::TYPE_HORIZONTAL, 'options' => ['enctype' => 'multipart/form-data']]);
?>
    <div class="review-show">
        <?php 
if (false === $review->isNewRecord) {
    ?>
            <div class="row">
                <article class="col-xs-12 col-sm-6 col-md-6 col-lg-6"></article>
                <article class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
                    <?php 
    echo \app\properties\PropertiesWidget::widget(['model' => $submission, 'form' => $form]);
    ?>
                </article>
            </div>
        <?php 
}
开发者ID:DevGroup-ru,项目名称:dotplant2-reviews-expansion-pack,代码行数:31,代码来源:edit.php


示例10: actionCreate

 /**
  * Create a new User model. If creation is successful, the browser will
  * be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     /** @var \amnah\yii2\user\models\User $user */
     /** @var \amnah\yii2\user\models\Profile $profile */
     /** @var \amnah\yii2\user\models\Role $role */
     // AuthAssigment
     $permissoes = AuthItem::getListToDropDownList();
     $permissoesUser = null;
     // set up new user/profile objects
     $user = $this->module->model("User", ["scenario" => "register"]);
     $profile = $this->module->model("Profile");
     $mensagem = "";
     //Informa ao usuário mensagens de erro na view
     //Permissão do usuário
     $authAssignment = new AuthAssignment();
     $user->status = 1;
     // load post data
     $post = Yii::$app->request->post();
     if ($user->load($post)) {
         // ensure profile data gets loaded
         $profile->load($post);
         //Inicia a transação:
         $transaction = \Yii::$app->db->beginTransaction();
         try {
             // validate for ajax request
             if (Yii::$app->request->isAjax) {
                 Yii::$app->response->format = Response::FORMAT_JSON;
                 return ActiveForm::validate($user, $profile);
             }
             // validate for normal request
             if ($user->validate() && $profile->validate()) {
                 $itensInseridos = true;
                 // perform registration
                 $role = $this->module->model("Role");
                 if (!$user->setRegisterAttributes($role::ROLE_USER, $user::STATUS_ACTIVE)->save()) {
                     $mensagem = "Não foi possível salvar os dados";
                     $transaction->rollBack();
                     //desfaz alterações no BD
                     $itensInseridos = false;
                 }
                 if (!$profile->setUser($user->id)->save()) {
                     $mensagem = "Não foi possível salvar os dados";
                     $transaction->rollBack();
                     //desfaz alterações no BD
                     $itensInseridos = false;
                 }
                 $idUser = $user->id;
                 if (isset($post['AuthAssignment']['item_name']) && !empty($post['AuthAssignment']['item_name'])) {
                     //Guarda as permissões escolhidas
                     $roles = $post['AuthAssignment']['item_name'];
                     foreach ($roles as $role) {
                         $user->setPermissoes($role, $idUser);
                     }
                 }
                 if ($itensInseridos) {
                     $transaction->commit();
                     return $this->redirect(['view', 'id' => $user->id]);
                 }
             }
         } catch (\Exception $exception) {
             $transaction->rollBack();
             $mensagem = "Ocorreu uma falha inesperada ao tentar salvar";
         }
     }
     return $this->render("create", compact("user", "profile", "permissoes", "permissoesUser", "mensagem", "authAssignment"));
 }
开发者ID:aryangomes,项目名称:applanchonete,代码行数:71,代码来源:AdminController.php


示例11:

            <li class="list-group-item list-group-item-current"><?php 
echo Yii::t('setup', 'Create admin account');
?>
</li>
            <li class="list-group-item"><?php 
echo Yii::t('setup', 'Finished');
?>
</li>
        </ul>
    </div>
    <div class="col-sm-8 form-wrapper">
        <?php 
echo Html::tag('h4', Yii::t('setup', 'Create administrator account'), ['class' => 'step-title']);
?>
        <?php 
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_VERTICAL]);
?>
        <?php 
echo $form->field($model, 'email');
?>
        <?php 
echo $form->field($model, 'username');
?>
        <?php 
echo $form->field($model, 'password')->passwordInput();
?>
        <?php 
echo $form->field($model, 'timezone')->dropDownList($timezones, ['prompt' => Yii::t('setup', '-Select-')]);
?>
        <div class="form-action">
        <?php 
开发者ID:ramialcheikh,项目名称:easy-form-v1.2,代码行数:31,代码来源:5.php


示例12:

$this->registerJs($js);
/** @var \backend\modules\comments\models\CommentForm $model */
echo \Yii::$app->request->isAjax ? '' : Html::beginTag('div', ['class' => 'modal', 'id' => 'allInOneModal']);
?>
    <div class="modal-dialog">
        <div class="modal-content">
            <?php 
Pjax::begin(['id' => 'edit_comment', 'enablePushState' => false, 'enableReplaceState' => false, 'timeout' => 10000, 'clientOptions' => ['url' => \yii\helpers\Url::to(['/comments'])]]);
?>
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span></button>
                <h4 class="modal-title">Редактирование комментария</h4>
            </div>
            <?php 
$form = \kartik\form\ActiveForm::begin(['type' => \kartik\form\ActiveForm::TYPE_HORIZONTAL, 'id' => 'edit-comment-form', 'action' => '/comments', 'options' => ['data-pjax' => true]]);
?>
            <div class="modal-body">
                <?php 
if (\Yii::$app->session->getFlash('saved', false)) {
    echo \yii\bootstrap\Alert::widget(['body' => \Yii::$app->session->getFlash('saved'), 'options' => ['class' => 'alert alert-success alert-dismissible']]);
} else {
    if (\Yii::$app->session->getFlash('error', false)) {
        echo \yii\bootstrap\Alert::widget(['body' => \Yii::$app->session->getFlash('error'), 'options' => ['class' => 'alert alert-danger alert-dismissible row col-xs-10 col-xs-offset-1']]);
    }
}
echo $form->field($model, 'author'), $form->field($model, 'text')->textarea(), $form->field($model, 'email'), $form->field($model, 'published')->checkbox([], false), $form->field($model, 'deleted')->checkbox([], false), $form->field($model, 'commentID')->hiddenInput(['style' => 'display: none'])->label(false);
?>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Закрыть</button>
开发者ID:BoBRoID,项目名称:new.k-z,代码行数:31,代码来源:editModal.php


示例13: function

<?php

/** @var \backend\modules\quiz\models\QuizForm $model */
use kartik\form\ActiveForm;
use rmrevin\yii\fontawesome\FA;
use yii\bootstrap\Html;
$js = <<<'JS'
$('#quizAnswersList').addInputArea();

$("body").on('inputArea.added inputArea.removed', "#quizAnswersList", function(){
    $("#quizAnswersList .quizAnswersList_del")
});
JS;
$this->registerJsFile('/js/addInputArea.js', ['depends' => 'yii\\web\\JqueryAsset']);
$this->registerJs($js);
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'id' => 'edit-quiz-form', 'options' => ['data-pjax' => true, 'class' => 'editQuizForm']]);
echo $form->field($model, 'name');
?>
    <div id="quizAnswersList">
        <?php 
foreach ($model->answers as $key => $answer) {
    echo \yii\helpers\Html::tag('div', $form->field($answer, 'text', ['inputOptions' => ['name_format' => 'QuizAnswerForm[%d][text]'], 'addon' => ['append' => ['content' => Html::button(FA::icon('times'), ['class' => 'quizAnswersList_del btn btn-danger btn-sm', 'style' => 'height: 34px; width: 34px;']), 'asButton' => true]]]) . (!empty($answer->id) ? $form->field($answer, 'id', ['inputOptions' => ['name' => "QuizAnswerForm[{$key}][id]", 'name_format' => 'QuizAnswerForm[%d][id]']])->hiddenInput()->label(false) : ''), ['class' => 'quizAnswersList_var']);
}
?>
    </div>
<?php 
echo Html::button(FA::icon('plus') . ' Добавить', ['class' => 'quizAnswersList_add btn btn-success btn-sm', 'style' => 'margin: 0px auto; display: block;']) . Html::tag('br'), $form->field($model, 'dateStart')->widget(\kartik\datetime\DateTimePicker::className(), ['pluginOptions' => []]), $form->field($model, 'dateEnd')->widget(\kartik\datetime\DateTimePicker::className(), []), $form->field($model, 'published')->checkbox([], false), $form->field($model, 'deleted')->checkbox([], false), Html::tag('div', Html::button('Сохранить', ['class' => 'btn btn-success btn-lg', 'type' => 'submit']), ['class' => 'text-center']);
$form->end();
开发者ID:BoBRoID,项目名称:new.k-z,代码行数:28,代码来源:editForm.php


示例14: handleMatakuliah

/* @var $this yii\web\View */
/* @var $model backend\modules\aitk\models\AitkRequest */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="aitk-request-form">
    <style>
        #dataMahasiswa {
            display: none;
            position: relative;
        }
    </style>


    <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data'], 'id' => 'form-request']);
?>
    <!--
        <script>
            function handleMatakuliah(nama) {
    
                var name = nama.split(" ")[0];
    
                $('#ck' + name).click(function () {
                    $("." + name).remove();
                    $('.detailMatakuliah:first').clone().insertAfter(".detailMatakuliah").prop({class: name, id: name, style: "display:block"});
                    $(".control-label").prop("id", "lbl"+name);
                    if ($("#ck" + name).is(":checked")) {
                        $(".detailMatakuliah").hide();
                        
                        $("." + name).show();
开发者ID:bxcodec,项目名称:Aptikad,代码行数:31,代码来源:_addIzin.php


示例15:

<?php

use kartik\form\ActiveForm;
/** @var \backend\modules\ads\models\BannerForm $model */
$form = ActiveForm::begin(['type' => ActiveForm::TYPE_HORIZONTAL, 'id' => 'edit-ad-form', 'options' => ['data-pjax' => true]]);
echo $form->field($model, 'name'), $form->field($model, 'position')->dropDownList($model->possiblePositions), $form->field($model, 'enableDate')->widget(\kartik\datetime\DateTimePicker::className(), []), $form->field($model, 'disableDate')->widget(\kartik\datetime\DateTimePicker::className(), []), $form->field($model, 'code')->textarea(['style' => 'height: 30vh']), $form->field($model, 'state')->checkbox([], false), \yii\bootstrap\Html::tag('div', \yii\helpers\Html::button('Сохранить', ['class' => 'btn btn-success', 'type' => 'submit']), ['class' => 'text-center']);
$form->end();
开发者ID:BoBRoID,项目名称:new.k-z,代码行数:7,代码来源:editForm.php


示例16: handleMatakuliah

/* @var $this yii\web\View */
/* @var $model backend\modules\aitk\models\AitkRequest */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="aitk-request-form">
    <style>
        #dataMahasiswa {
            display: none;
            position: relative;
        }
    </style>


    <?php 
$form = ActiveForm::begin(['id' => 'form-request']);
?>
    <!--
        <script>
            function handleMatakuliah(nama) {
    
                var name = nama.split(" ")[0];
    
                $('#ck' + name).click(function () {
                    $("." + name).remove();
                    $('.detailMatakuliah:first').clone().insertAfter(".detailMatakuliah").prop({class: name, id: name, style: "display:block"});
                    $(".control-label").prop("id", "lbl"+name);
                    if ($("#ck" + name).is(":checked")) {
                        $(".detailMatakuliah").hide();
                        
                        $("." + name).show();
开发者ID:bxcodec,项目名称:Aptikad,代码行数:31,代码来源:_editByAsrama.php


示例17: run

    /**
     * @inheritdoc
     */
    public function run()
    {
        if (empty($this->options['id'])) {
            $this->options['id'] = $this->getId();
        }
        if (!isset($this->formOptions['type'])) {
            $this->formOptions['type'] = ActiveForm::TYPE_VERTICAL;
        }
        if (!isset($this->formOptions['fieldConfig'])) {
            $this->formOptions['fieldConfig'] = ['autoPlaceholder' => true];
        }
        if (!isset($this->template)) {
            $this->template = "<legend>{$this->title}</legend>\n{fields}\n{footer}";
        }
        if (!isset($this->footerTemplate)) {
            $this->footerTemplate = <<<HTML
<div class="row">
    <div class="col-sm-6 text-left">
        {left}
    </div>
    <div class="col-sm-6 text-right">
        {right}
    </div>
</div>
HTML;
        }
        $this->_form = ActiveForm::begin($this->formOptions);
        $options = ['model' => $this->model, 'form' => $this->_form, 'attributes' => $this->attributes] + $this->options;
        echo strtr($this->template, ['{fields}' => Form::widget($options), '{footer}' => $this->renderFooter()]);
        ActiveForm::end();
    }
开发者ID:communityii,项目名称:yii2-user,代码行数:34,代码来源:BaseForm.php


示例18: empty

<?php

use backend\models\Category;
use backend\models\News;
use kartik\select2\Select2;
use yii\bootstrap\Html;
use yii\helpers\ArrayHelper;
use yii\web\JsExpression;
$form = \kartik\form\ActiveForm::begin(['type' => \kartik\form\ActiveForm::TYPE_HORIZONTAL, 'id' => 'edit-rss-form', 'action' => empty($action) ? $model->isNew ? '/rss/add-feed' : '/rss/edit-feed/' . $model->id : $action, 'options' => ['data-pjax' => true, 'class' => 'editRssForm']]);
?>
    <div class="modal-body">
        <?php 
if (\Yii::$app->session->getFlash('saved', false)) {
    echo \yii\bootstrap\Alert::widget(['body' => \Yii::$app->session->getFlash('saved'), 'options' => ['class' => 'alert alert-success alert-dismissible']]);
} else {
    if (\Yii::$app->session->getFlash('error', false)) {
        echo \yii\bootstrap\Alert::widget(['body' => \Yii::$app->session->getFlash('error'), 'options' => ['class' => 'alert alert-danger alert-dismissible row col-xs-10 col-xs-offset-1']]);
    }
}
echo $form->field($model, 'name'), $form->field($model, 'description')->textarea(), $form->field($model, 'categories')->widget(Select2::className(), ['options' => ['multiple' => true], 'data' => !$model->isNew ? ArrayHelper::map(Category::find()->select('id, title')->where(['deleted' => 0])->andWhere(['in', 'id', $model->categories])->asArray()->all(), 'id', 'title') : [], 'pluginOptions' => ['ajax' => ['url' => '/categories/get-list', 'data-type' => 'json', 'data' => new JsExpression("function(params){ return {q:params.term} }")]]]), $form->field($model, 'articles')->widget(Select2::className(), ['options' => ['multiple' => true], 'data' => !$model->isNew ? ArrayHelper::map(News::find()->select('id, title')->where(['deleted' => 0])->andWhere(['in', 'id', $model->articles])->asArray()->all(), 'id', 'title') : [], 'pluginOptions' => ['ajax' => ['url' => '/news/get-list', 'data-type' => 'json', 'data' => new JsExpression('function(params){ var data = {q:params.term}, categories = $("#newsfeedform-categories").val(); if(categories !== null && categories.length > 0){ data.excludedCategories = categories;} return data; }')]]]), $form->field($model, 'published')->checkbox([], false), $form->field($model, 'id', ['options' => ['style' => 'display: none']])->hiddenInput()->label(false);
?>
    </div>
    <div class="modal-footer">
        <?php 
if (\Yii::$app->request->isAjax) {
    ?>
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">Закрыть</button><?php 
}
?>
        <?php 
echo Html::tag('div', Html::button($model->isNew ? 'Добавить ленту' : 'Сохранить изменения', ['class' => 'btn btn-success', 'type' => 'submit']), ['class' => 'text-center']);
开发者ID:BoBRoID,项目名称:new.k-z,代码行数:31,代码来源:editForm.php


示例19:

            <?php 
echo Html::submitButton(Yii::t('setup', 'Test connection'), ['class' => 'btn btn-default pull-left', 'name' => 'test']);
?>
            <?php 
if ($connectionOk) {
    ?>
                <?php 
    echo Html::submitButton(Yii::t('setup', 'Save and continue'), ['class' => 'btn btn-primary pull-right', 'name' => 'save']);
    ?>
            <?php 
}
?>
        </div>

        <?php 
ActiveForm::end();
?>
    </div>
</div>

<?php 
$advancedOptions = Yii::t('setup', 'Advanced options');
$js = <<<JS
    \$(document).ready(function(){

        \$("#advancedOptions").hide();
        \$('#toogleAdvancedOptions').click(function( e ){
            e.preventDefault(); // If you use anchors
            var SH = this.SH^=1; // "Simple toggler"
            \$(this).html(SH?'&#9660; {$advancedOptions}':'&#9654; {$advancedOptions}')
                   .css({backgroundPosition:'0 '+ (SH?-18:0) +'px'})
开发者ID:ramialcheikh,项目名称:quickforms,代码行数:31,代码来源:3.php


示例20:

<?php

/* @var $this yii\web\View */
/* @var $form yii\widgets\ActiveForm */
/* @var $generator \infinitydevphp\gii\crud\Generator */
use infinitydevphp\gii\assets\CrudGeneratorAssets;
use kartik\form\ActiveForm;
use infinitydevphp\gii\models\WidgetsCrud;
use infinitydevphp\MultipleModelValidator\widgets\MultipleInput;
use kartik\widgets\Select2;
CrudGeneratorAssets::register($this);
$form = ActiveForm::begin();
echo $form->field($generator, 'modelClass')->textInput(['id' => 'model-class']);
echo $form->field($generator, 'searchModelClass');
echo $form->field($generator, 'controllerClass');
echo $form->field($generator, 'baseControllerFrontendClass');
echo $form->field($generator, 'baseControllerBackendClass');
//echo $form->field($generator, 'moduleID');
echo $form->field($generator, 'indexWidgetType')->dropDownList(['grid' => 'GridView', 'list' => 'ListView']);
echo $form->field($generator, 'columns')->widget(MultipleInput::className(), ['attributeOptions' => ['enableAjaxValidation' => false, 'enableClientValidation' => true, 'validateOnChange' => true, 'validateOnSubmit' => true, 'validateOnBlur' => true], 'data' => $generator->columns, 'baseModel' => WidgetsCrud::className(), 'columns' => [['name' => 'fieldName', 'enableError' => true, 'title' => 'Length'], ['name' => 'widgetType', 'type' => Select2::className(), 'options' => ['data' => $generator->getWidgets()], 'title' => 'Widget Type']]]);
echo $form->field($generator, 'enableI18N')->checkbox();
echo $form->field($generator, 'messageCategory');
$form->end();
开发者ID:infinitydevphp,项目名称:infinity-gii,代码行数:23,代码来源:form.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP grid\GridView类代码示例发布时间:2022-05-23
下一篇:
PHP file\FileInput类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap