/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = CsPropertyValues::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions $query->andFilterWhere(['id' => $this->id, 'property_id' => $this->property_id, 'selected_value' => $this->selected_value, 'file_id' => $this->file_id]); $query->andFilterWhere(['like', 'value', $this->value])->andFilterWhere(['like', 'hint', $this->hint]); return $dataProvider; }
/** * Displays a single CsProperties model. * @param integer $id * @return mixed */ public function actionView($id) { return $this->render('view', ['model' => $this->findModel($id), 'propertyValues' => new ActiveDataProvider(['query' => CsPropertyValues::find()->filterWhere(['property_id' => $id])]), 'industryProperties' => new ActiveDataProvider(['query' => CsIndustryProperties::find()->filterWhere(['property_id' => $id])]), 'actionProperties' => new ActiveDataProvider(['query' => CsActionProperties::find()->filterWhere(['property_id' => $id])]), 'objectProperties' => new ActiveDataProvider(['query' => CsObjectProperties::find()->filterWhere(['property_id' => $id])])]); }
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, 'object_property_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\common\models\CsObjectProperties::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'Izaberite...'], 'language' => 'sr-Latn', 'changeOnReset' => false]); ?> <?php echo $form->field($model, 'property_value_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\common\models\CsPropertyValues::find()->all(), 'id', 'value'), 'options' => ['placeholder' => 'Izaberite...'], 'language' => 'sr-Latn', 'changeOnReset' => false, 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'object_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\common\models\CsObjects::find()->all(), 'id', 'tName'), 'options' => ['placeholder' => 'Izaberite...'], 'language' => 'sr-Latn', 'changeOnReset' => false, 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'value_type')->dropDownList(['value' => 'value', 'model' => 'model', 'part' => 'part', 'other' => 'other'], ['style' => 'width:50%']); ?> <?php echo $form->field($model, 'selected_value')->checkbox(); ?> <div class="row" style="margin:20px;">