/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = PaginasPlantilla::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' => $this->id]);
     $query->andFilterWhere(['like', 'nombre', $this->nombre]);
     return $dataProvider;
 }
Beispiel #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPlantillas()
 {
     return $this->hasOne(PaginasPlantilla::className(), ['id' => 'plantilla']);
 }
 /**
  * Finds the PaginasPlantilla model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return PaginasPlantilla the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = PaginasPlantilla::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #4
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\PaginasCategorias;
use common\models\PaginasPlantilla;
/* @var $this yii\web\View */
/* @var $model common\models\Paginas */
/* @var $form yii\widgets\ActiveForm */
$categorias = new PaginasCategorias();
$plantillas = new PaginasPlantilla();
$this->registerJsFile('@web/js/core/demo/DemoFormEditors.js', ['depends' => [\backend\assets\BackendAsset::className()]]);
$this->registerJsFile('@web/js/core/demo/DemoFormComponents.js', ['depends' => [\backend\assets\BackendAsset::className()]]);
?>


    <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data', 'class' => 'enviarForm']]);
?>


<div class="form-group">
    <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
</div>


<!-- BEGIN CONTENIDO -->
    <div class="row">
        <div class="col-lg-12">