<?php use yii\bootstrap\ActiveForm; use unclead\widgets\TabularInput; use yii\helpers\Html; use unclead\widgets\examples\models\Item; /* @var $this \yii\web\View */ /* @var $models Item[] */ ?> <?php $form = \yii\bootstrap\ActiveForm::begin(['id' => 'tabular-form', 'enableAjaxValidation' => true, 'enableClientValidation' => false, 'validateOnChange' => false, 'validateOnSubmit' => true, 'validateOnBlur' => false, 'options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo TabularInput::widget(['models' => $models, 'attributeOptions' => ['enableAjaxValidation' => true, 'enableClientValidation' => false, 'validateOnChange' => false, 'validateOnSubmit' => true, 'validateOnBlur' => false], 'columns' => [['name' => 'title', 'title' => 'Title', 'type' => \unclead\widgets\MultipleInputColumn::TYPE_TEXT_INPUT], ['name' => 'description', 'title' => 'Description'], ['name' => 'file', 'title' => 'File', 'type' => \vova07\fileapi\Widget::className(), 'options' => ['settings' => ['url' => ['site/fileapi-upload']]]], ['name' => 'date', 'type' => \kartik\date\DatePicker::className(), 'title' => 'Day', 'options' => ['pluginOptions' => ['format' => 'dd.mm.yyyy', 'todayHighlight' => true]], 'headerOptions' => ['style' => 'width: 250px;', 'class' => 'day-css-class']]]]); ?> <?php echo Html::submitButton('Update', ['class' => 'btn btn-success']); ActiveForm::end();
break; case Content::ATTR_TYPE_STRING: echo $form->field($model, $attr)->textInput(isset($value['config']) ? $value['config'] : []); break; case Content::ATTR_TYPE_INTEGER: echo $form->field($model, $attr)->input('number', isset($value['config']) ? $value['config'] : []); break; case Content::ATTR_TYPE_URL: echo $form->field($model, $attr, ['template' => '{label}<div class="input-group"><span class="input-group-addon attached-button-chain"><i class="icon fa fa-chain"></i></span>{input}</div> {hint}{error}'])->textInput(isset($value['config']) ? $value['config'] : []); $urlAttribute = $attr; break; case Content::ATTR_TYPE_ADVANCED_TEXT: echo $form->field($model, $attr, ['options' => ['class' => 'form-group col-sm-12']])->widget(Widget::className(), isset($value['config']) ? $value['config'] : []); break; case Content::ATTR_TYPE_IMAGE: echo $form->field($model, $attr)->widget(FileAPI::className(), isset($value['config']) ? $value['config'] : []); break; case Content::ATTR_TYPE_TEXT: echo $form->field($model, $attr)->textarea(isset($value['config']) ? $value['config'] : []); break; case Content::ATTR_TYPE_DATE: echo $form->field($model, $attr)->widget(DateTimePicker::classname(), isset($value['config']) ? $value['config'] : []); break; case Content::ATTR_TYPE_BOOLEAN: echo $form->field($model, $attr)->checkbox(); break; case Content::ATTR_TYPE_DROPDOWN: echo $form->field($model, $attr)->dropDownList(isset($value['items']) ? $value['items'] : [], isset($value['config']) ? $value['config'] : []); break; default: break;
* Update profile page view. * * @var \yii\web\View $this View * @var \yii\widgets\ActiveForm $form Form * @var \vova07\users\models\frontend\User $model Model */ use vova07\fileapi\Widget; use vova07\users\Module; use yii\helpers\Html; use yii\widgets\ActiveForm; $this->title = Module::t('users', 'FRONTEND_UPDATE_TITLE'); $this->params['breadcrumbs'] = [Module::t('users', 'FRONTEND_SETTINGS_LABEL'), $this->title]; $this->params['contentId'] = 'error'; $form = ActiveForm::begin(['options' => ['class' => 'center']]); ?> <fieldset class="registration-form"> <?php echo $form->field($model, 'name')->textInput(['placeholder' => $model->getAttributeLabel('name')])->label(false); ?> <?php echo $form->field($model, 'surname')->textInput(['placeholder' => $model->getAttributeLabel('surname')])->label(false); ?> <?php echo $form->field($model, 'avatar_url')->widget(Widget::className(), ['settings' => ['url' => ['fileapi-upload']], 'crop' => true, 'cropResizeWidth' => 100, 'cropResizeHeight' => 100])->label(false); ?> <?php echo Html::submitButton(Module::t('users', 'FRONTEND_UPDATE_SUBMIT'), ['class' => 'btn btn-primary pull-right']); ?> </fieldset> <?php ActiveForm::end();
<div class="row"> <div class="col-lg-5"> <?php $form = ActiveForm::begin(['id' => 'form-update', 'options' => ['enctype' => 'multipart/form-data']]); ?> <?php if ($profile->profile_image != '') { ?> <?php //echo '<br>' . Html::a(Yii::t('app', '<span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Delete Image'), ['delete-image', 'id' => $profile->id], ['class' => 'btn btn-danger']) . ' ' ?> <?php } echo $form->field($profile, 'profile_image')->widget(FileAPI::className(), ['settings' => ['url' => ['imagetest/fileapi-upload'], 'autoUpload' => true], 'crop' => true, 'cropResizeWidth' => 200, 'cropResizeHeight' => 200]); ?> <?php echo $form->field($profile, 'first_name'); ?> <?php echo $form->field($profile, 'last_name'); ?> <?php echo $form->field($profile, 'gender'); ?> <?php
/** * @inheritdoc */ public function run() { if (Yii::$app->request->isPost) { $file = UploadedFile::getInstanceByName($this->paramName); $model = new DynamicModel(compact('file')); $model->addRule('file', $this->_validator, $this->validatorOptions)->validate(); if ($model->hasErrors()) { $result = ['error' => $model->getFirstError('file')]; } else { if ($this->unique === true && $model->file->extension) { $model->file->name = uniqid() . '.' . $model->file->extension; } if ($model->file->saveAs($this->path . $model->file->name)) { $result = ['name' => $model->file->name]; } else { $result = ['error' => Widget::t('fileapi', 'ERROR_CAN_NOT_UPLOAD_FILE')]; } } Yii::$app->response->format = Response::FORMAT_JSON; return $result; } else { throw new BadRequestHttpException('Only POST is allowed'); } }
<div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Сохранить' : 'Изменить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary', 'onclick' => "\$('#file-input').fileinput('upload');"]); ?> </div> <?php echo $form->field($model, 'category_id')->dropDownList(Category::getList()); ?> <?php echo $form->field($model, 'file_schema')->widget(FileAPI::className(), ['settings' => ['url' => ['/part/fileapi-upload']]]); ?> <?php echo $form->field($model, 'file_foto')->widget(FileAPI::className(), ['settings' => ['url' => ['/part/fileapi-upload']]]); ?> <?php /*<?= $form->field($model, 'logo')->fileInput() ?>*/ ?> <?php echo $form->field($model, 'kit_code')->textInput(['maxlength' => 255]); ?> <?php echo $form->field($model, 'name')->textInput(['maxlength' => 255]); ?> <?php
</div> <div class="col-sm-6"> <?php echo $form->field($model, 'updatedAtJui')->widget(DatePicker::className(), ['options' => ['class' => 'form-control'], 'clientOptions' => ['dateFormat' => 'dd.mm.yy', 'changeMonth' => true, 'changeYear' => true]]); ?> </div> </div> <div class="row"> <div class="col-sm-6"> <?php echo $form->field($model, 'preview_url')->widget(FileAPI::className(), ['settings' => ['url' => ['/blogs/default/fileapi-upload']]]); ?> </div> <div class="col-sm-6"> <?php echo $form->field($model, 'image_url')->widget(FileAPI::className(), ['settings' => ['url' => ['/blogs/default/fileapi-upload']]]); ?> </div> </div> <div class="row"> <div class="col-sm-12"> <?php echo $form->field($model, 'snippet')->widget(Imperavi::className(), ['settings' => ['minHeight' => 200, 'imageGetJson' => Url::to(['/blogs/default/imperavi-get']), 'imageUpload' => Url::to(['/blogs/default/imperavi-image-upload']), 'fileUpload' => Url::to(['/blogs/default/imperavi-file-upload'])]]); ?> </div> </div> <div class="row"> <div class="col-sm-12"> <?php echo $form->field($model, 'content')->widget(Imperavi::className(), ['settings' => ['minHeight' => 300, 'imageGetJson' => Url::to(['/blogs/default/imperavi-get']), 'imageUpload' => Url::to(['/blogs/default/imperavi-image-upload']), 'fileUpload' => Url::to(['/blogs/default/imperavi-file-upload'])]]); ?>
<?php echo $form->field($model, 'verifyCode')->widget(Captcha::className(), ['captchaAction' => '/user/signup/captcha', 'template' => '<br />{image}<br />{input}']); ?> <div class="form-group"> <?php echo Html::submitButton(\Yii::t('main', 'Signup'), ['class' => 'btn btn-success btn-block', 'name' => 'signup-button']); ?> </div> </div> <div > <?php echo $form->field($model, 'avatar')->widget(FileAPI::className(), ['settings' => ['url' => ['fileapi-upload']], 'crop' => true, 'cropResizeWidth' => 100, 'cropResizeHeight' => 100]); ?> </div> <div > <?php echo $form->field($model, 'firstname'); ?> <?php echo $form->field($model, 'lastname'); ?> </div> </div> <?php ActiveForm::end();
?> <?php echo $form->field($profile, 'firstname')->textInput(['maxlength' => true]); ?> <?php echo $form->field($profile, 'lastname')->textInput(['maxlength' => true]); ?> <?php echo $form->field($profile, 'birthday')->widget(DateTimeWidget::className(), ['phpDatetimeFormat' => 'yyyy-MM-dd\'T\'HH:mm:ssZZZZZ']); ?> <?php echo $form->field($profile, 'avatar_path')->widget(Widget::className(), ['settings' => ['url' => ['/site/fileapi-upload']], 'crop' => true, 'cropResizeWidth' => 100, 'cropResizeHeight' => 100]); ?> <?php echo $form->field($profile, 'gender')->dropDownlist([UserProfile::GENDER_MALE => Yii::t('backend', 'Male'), UserProfile::GENDER_FEMALE => Yii::t('backend', 'Female')], ['prompt' => '']); ?> <?php echo $form->field($profile, 'website')->textInput(['maxlength' => true]); ?> <?php echo $form->field($profile, 'other')->textarea(['rows' => 6, 'maxlength' => true]); ?> <div class="form-group">
<?php if ($crop === true) { ?> <div id="modal-crop" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel"><?php echo Widget::t('fileapi', 'MODAL_TITLE'); ?> </h4> </div> <div class="modal-body"> <div id="modal-preview"></div> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo Widget::t('fileapi', 'MODAL_CANCEL'); ?> </button> <button type="button" class="btn btn-primary crop"><?php echo Widget::t('fileapi', 'MODAL_SAVE'); ?> </button> </div> </div> </div> </div> <?php }
<?php echo $form->field($profile, 'bonus_balance')->textInput(); ?> </div> <div class="col-sm-3"> <?php echo $form->field($user, 'status')->dropDownList($user->getStatusArray(), ['prompt' => '']); ?> </div> <div class="col-sm-3"> <?php echo $form->field($profile, 'avatar_url')->widget(FileAPI::className(), ['crop' => true, 'cropResizeWidth' => 100, 'cropResizeHeight' => 100, 'settings' => ['url' => ['fileapi-upload'], 'imageSize' => ['minWidth' => 100, 'minHeight' => 100]]]); ?> </div> </div> </div> </div> <div class="form-group"> <?php echo Html::submitButton($user->isNewRecord ? Module::t('user-admin', 'Create') : Module::t('user-admin', 'Update'), ['class' => $user->isNewRecord ? 'btn btn-primary btn-large' : 'btn btn-success btn-large']); ?> </div> <?php ActiveForm::end(); ?>
<?php echo $form->field($model, 'content')->textarea(['rows' => 3])->label('内容'); ?> </div> <div class="news"> <?php echo $form->field($model, 'title')->textInput(['maxlength' => 256])->label('标题'); ?> <?php echo $form->field($model, 'description')->textarea(['rows' => 3])->label('描述'); ?> <?php echo $form->field($model, 'picUrl')->label('图片')->widget(Widget::className(), ['settings' => ['url' => ['fileapi-upload']], 'crop' => false, 'cropResizeWidth' => 100, 'cropResizeHeight' => 100]); ?> <?php echo $form->field($model, 'url')->textInput(['maxlength' => 512])->label('原文链接地址'); ?> </div> <div class="forward"> <?php echo $form->field($model, 'forward_url')->textInput(['maxlength' => 256])->label('URL'); ?> <?php echo $form->field($model, 'token')->textInput(['maxlength' => 64])->label('Token'); ?> </div>