Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CsUnits::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, 'conversion_unit' => $this->conversion_unit, 'conversion_value' => $this->conversion_value]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'oznaka', $this->oznaka])->andFilterWhere(['like', 'ozn_htmlfree', $this->ozn_htmlfree])->andFilterWhere(['like', 'measurement', $this->measurement]);
     return $dataProvider;
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getConversionUnit()
 {
     return $this->hasOne(CsUnits::className(), ['id' => 'conversion_unit']);
 }
Example #3
0
?>

    <?php 
echo $form->field($model, 'object_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\common\models\CsObjects::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'Izaberite...'], 'language' => 'sr-Latn', 'changeOnReset' => false]);
?>

    <?php 
echo $form->field($model, 'property_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\common\models\CsProperties::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'Izaberite...'], 'language' => 'sr-Latn', 'changeOnReset' => false]);
?>

        <?php 
echo $form->field($model, 'property_unit_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\common\models\CsUnits::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'Izaberite...'], 'language' => 'sr-Latn', 'changeOnReset' => false]);
?>

        <?php 
echo $form->field($model, 'property_unit_imperial_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(\common\models\CsUnits::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'Izaberite...'], 'language' => 'sr-Latn', 'changeOnReset' => false]);
?>

    <?php 
echo $form->field($model, 'property_class')->dropDownList(['public' => 'Public', 'private' => 'Private', 'protected' => 'Protected'], ['prompt' => '']);
?>

    <?php 
echo $form->field($model, 'property_type')->dropDownList(['general' => 'General', 'product' => 'Product', 'model' => 'Model', 'part' => 'Part', 'empty' => 'Empty'], ['prompt' => '']);
?>

    <?php 
echo $form->field($model, 'input_type')->dropDownList(['1' => 'number', '2' => 'radio', '21' => 'radioButton', '22' => 'radio', '23' => 'radioButton', '3' => 'select', '31' => 'select2', '32' => 'select_media', '4' => 'multiselect', '41' => 'checkboxButton', '42' => 'multiselect_select', '43' => 'multiselect_select2', '44' => 'multiselect_media', '5' => 'checkbox', '6' => 'text', '7' => 'textarea', '8' => 'slider', '9' => 'range', '10' => 'date', '11' => 'time', '12' => 'datetime', '13' => 'email', '14' => 'url', '15' => 'color', '16' => 'date range'], ['prompt' => '']);
?>

    <?php 
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUnit()
 {
     return $this->hasOne(CsUnits::className(), ['id' => 'unit_id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUnitImperial()
 {
     return $this->hasOne(CsUnits::className(), ['id' => 'property_unit_imperial_id']);
 }
Example #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPeriodUnit()
 {
     return $this->hasOne(CsUnits::className(), ['id' => 'period_unit']);
 }
Example #7
0
 /**
  * Finds the CsUnits model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return CsUnits the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = CsUnits::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }