<?php echo $form->field($model, 'complect', ['options' => ['class' => '']])->textarea(['rows' => 1]); ?> <?php echo $form->field($model, 'description', ['options' => ['class' => '']])->textarea(['rows' => 1]); ?> <?php echo $form->field($model, 'characteristics', ['options' => ['class' => '']])->textarea(['rows' => 1]); ?> <?php echo $form->field($model, 'doc_links', ['options' => ['class' => '']])->textarea(['rows' => 1]); ?> </div> <div class="form-group col-md-4"> <?php echo $form->field($model, 'category_id', ['options' => ['class' => '']])->dropDownList(Category::getList()); ?> <?php echo $form->field($model, 'serial', ['options' => ['class' => '']])->textInput(['maxlength' => true]); ?> <?php /* = $form->field($model, 'status', ['options'=>['class'=>'']])->textInput() */ ?> <?php echo $form->field($model, 'condition', ['options' => ['class' => '']])->dropDownList(Condition::getList()); ?> <?php echo $form->field($model, 'provided_by', ['options' => ['class' => '']])->dropDownList($providers); ?> <?php /* = $form->field($model, 'fixed_by', ['options'=>['class'=>'']])->textInput(['maxlength' => true]) */
?> <div class="part-form"> <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> <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
public function actionEditcategory($id) { $category = Category::findOne(['id' => $id]); if (!$category) { return $this->run('error'); } if (\Yii::$app->request->post("Category")) { $category->attributes = \Yii::$app->request->post("Category"); $category->save(); } return $this->render('category_edit', ['category' => $category, 'parents' => Category::getList()]); }
<h1>Посты</h1> <?php $form = new \yii\bootstrap\ActiveForm(); $form->begin(); echo $form->field($post, 'category')->dropDownList(\common\models\Category::getList()), $form->field($post, 'premium'), $form->field($post, 'title'), $form->field($post, 'content')->textarea(), $form->field($post, 'price'), $form->field($post, 'phone'), $form->field($post, 'email'); ?> <button class="btn btn-default" type="submit">Сохранить</button> <?php $form->end();
public function actionCreatepost() { if (\Yii::$app->user->isGuest) { return $this->run('site/login'); } $post = new Post(); $data = \Yii::$app->request->post("Post"); if (!empty($data)) { $post->load(\Yii::$app->request->post()); } if (!empty($data) && $post->validate() && $post->save()) { return $this->render('create_post_success', ['post' => $post]); } else { return $this->render('create_post', ['post' => $post, 'categoryList' => Category::getList()]); } }