/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CsObjectProperties::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, 'object_id' => $this->object_id, 'property_id' => $this->property_id, 'property_unit_id' => $this->property_unit_id, 'property_unit_imperial_id' => $this->property_unit_imperial_id, 'input_type' => $this->input_type, 'value_min' => $this->value_min, 'value_max' => $this->value_max, 'step' => $this->step, 'display_order' => $this->display_order, 'multiple_values' => $this->multiple_values, 'specific_values' => $this->specific_values, 'read_only' => $this->read_only, 'required' => $this->required]);
     $query->andFilterWhere(['like', 'property_class', $this->property_class])->andFilterWhere(['like', 'property_type', $this->property_type])->andFilterWhere(['like', 'value_default', $this->value_default])->andFilterWhere(['like', 'pattern', $this->pattern]);
     return $dataProvider;
 }
 /**
  * Displays a single CsObjects model.
  * @param string $id
  * @return mixed
  */
 public function actionView($id)
 {
     $model = $this->findModel($id);
     $query = \common\models\CsObjectProperties::find()->where(['object_id' => $model->id]);
     if ($model->getPath($model)) {
         foreach ($model->getPath($model) as $key => $objectpp) {
             if ($objectPropertiespp = $objectpp->objectProperties) {
                 foreach ($objectPropertiespp as $objectPropertypp) {
                     if ($objectPropertypp->property_class != 'private') {
                         $query->orWhere(['object_id' => $objectpp->id]);
                     }
                 }
             }
         }
     }
     return $this->render('view', ['model' => $model, 'products' => new ActiveDataProvider(['query' => \common\models\CsProducts::find()->where(['object_id' => $model->id])]), 'issues' => new ActiveDataProvider(['query' => \common\models\CsObjectIssues::find()->where(['object_id' => $model->id])]), 'properties' => new ActiveDataProvider(['query' => $query->orderBy('property_type')->groupBy('id')]), 'methods' => new ActiveDataProvider(['query' => \common\models\CsServices::find()->where(['object_id' => $model->id])])]);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getObjectProperty()
 {
     return $this->hasOne(CsObjectProperties::className(), ['id' => 'object_property_id']);
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getObjectProperties()
 {
     return $this->hasMany(CsObjectProperties::className(), ['object_id' => '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])])]);
 }
 /**
  * Finds the CsObjectProperties model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return CsObjectProperties the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = CsObjectProperties::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #7
0
use kartik\widgets\ActiveForm;
use kartik\switchinput\SwitchInput;
use kartik\widgets\DatePicker;
use kartik\select2\Select2;
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