/**
  * 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;
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getChildrenPropertyModels()
 {
     return $this->hasMany(CsPropertyValues::className(), ['id' => 'property_value_id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPropertyValue()
 {
     return $this->hasOne(CsPropertyValues::className(), ['id' => 'property_value_id']);
 }
 /**
  * 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])])]);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function value()
 {
     return \common\models\CsPropertyValues::findOne($this->value);
 }
 /**
  * Finds the CsPropertyModels model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return CsPropertyModels the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = CsPropertyValues::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #7
0
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;">
Example #8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPropertyValues()
 {
     return $this->hasMany(CsPropertyValues::className(), ['property_id' => 'id']);
 }