コード例 #1
0
 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
0
ファイル: _form.php プロジェクト: lowbase/yii2-document
    <div class="row">
        <div class="col-lg-6">
            <?php 
echo $form->field($model, 'image')->widget(InputFile::className(), ['controller' => 'elfinder', 'filter' => 'image', 'template' => '<div class="input-group">
                                                {input}<span class="input-group-btn">{button}</span>
                                            </div>', 'options' => ['class' => 'form-control'], 'buttonName' => Yii::t('document', 'Выбрать файл'), 'buttonOptions' => ['class' => 'btn btn-default'], 'multiple' => false]);
?>
        </div>
        <div class="col-lg-6">
            <?php 
echo $form->field($model, 'position')->textInput(['maxlength' => true]);
?>
        </div>
    </div>

    <div id = "lb-document-module-fields">
        <?php 
echo $this->render('_fields', ['model' => $model]);
?>
    </div>

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

</div>

<?php 
$document_id = $model->isNewRecord ? 0 : $model->id;
$this->registerJs("\n    \$('.repeat-name').click(function(){\n        var text = \$('#document-name').val();\n        \$('#document-title').val(text);\n    });\n    \$('.translate-name').click(function(){\n        var text = \$('#document-name').val().toLowerCase();\n        result = translit(text);\n    \$('#document-alias').val(result);\n    });\n    \$('.translate-title').click(function(){\n        var text = \$('#document-title').val().toLowerCase();\n        result = translit(text);\n    \$('#document-alias').val(result);\n    });\n\n    \$('.template_id').change(function(){\n        var template_id = \$(this).val();\n        \$.ajax({\n            url: '" . Url::to(['document/change']) . "',\n            type: 'POST',\n            data: {\n                'id' : " . $document_id . ",\n                'template_id' : template_id\n            },\n            success: function(data){\n                \$('#lb-document-module-fields').html(data);\n            }\n        });\n    });\n");
コード例 #3
0
ファイル: _form.php プロジェクト: rzamarripa/du
				  <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>
コード例 #4
0
ファイル: view.php プロジェクト: Razzwan/dotplant2
    }
    ?>
    <?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 () {
コード例 #5
0
ファイル: borrow.php プロジェクト: jh27408079/magenet
<?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');
コード例 #6
0
ファイル: BaseForm.php プロジェクト: imagis/yii2-user
 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();
 }