コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = BienesMarcas::find();
     $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;
     }
     $query->andFilterWhere(['id_marca' => $this->id_marca]);
     $query->andFilterWhere(['like', 'marca', $this->marca])->andFilterWhere(['like', 'fabricante', $this->fabricante]);
     return $dataProvider;
 }
コード例 #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdMarca()
 {
     return $this->hasOne(BienesMarcas::className(), ['id_marca' => 'id_marca']);
 }
コード例 #3
0
 /**
  * Finds the BienesMarcas model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return BienesMarcas the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = BienesMarcas::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #4
0
ファイル: _form.php プロジェクト: aitanz/BienesPublicos_
        <?php 
echo $form->field($model, 'otro_estado')->textInput();
?>
                 </div></div>
        <?php 
echo $form->field($model, 'descripcion_es')->textInput();
?>
        <?php 
echo $form->field($model, 'serial')->textInput();
?>
          <div class="main row" style="text-align:center;">
                <div class="col-md-6 column">

                    
                        <?php 
$Marcas = ArrayHelper::map(\app\modules\bienes\models\BienesMarcas::find()->all(), 'id_marca', 'marca');
echo $form->field($model, 'codigo_marca')->dropDownList($Marcas, ['prompt' => 'Porfavor elija una', 'onchange' => '
                        $.get( "' . Url::toRoute('bienes/marcas') . '", { id_marca: $(this).val() } )
                            .done(function( data ) {
                                $( "#' . Html::getInputId($model, 'codigo_modelo') . '" ).html(data);
                            }
                        );
                    ']);
?>
                     </div>
             <div class="col-md-6 column">
             
                        <?php 
$Modelos = ArrayHelper::map(\app\modules\bienes\models\BienesModelos::find()->all(), 'id_modelo', 'descripcion');
echo $form->field($model, 'codigo_modelo')->dropDownList($Modelos, ['prompt' => 'Porfavor elija una']);
?>