Exemple #1
0
 /**
  * Creates a new PaginasCategorias model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return string|\yii\web\Response
  */
 public function run()
 {
     $model = new PaginasCategorias();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->controller->redirect(['view', 'id' => $model->idcategoria]);
     } else {
         return $this->controller->render('create', ['model' => $model]);
     }
 }
Exemple #2
0
 /**
  * Creates a new Paginas model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return string|\yii\web\Response
  */
 public function run($categoria = null)
 {
     $model = new Paginas();
     $modelCategoria = new PaginasCategorias();
     if (!empty($categoria)) {
         $model->categoria = $modelCategoria->obtenerIdCategoria($categoria);
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->controller->redirect(['detalle', 'id' => $model->idpagina]);
     } else {
         return $this->controller->render('create', ['model' => $model]);
     }
 }
Exemple #3
0
 /**
  * Finds the PaginasCategorias model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return PaginasCategorias the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = PaginasCategorias::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = PaginasCategorias::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(['idcategoria' => $this->idcategoria, 'padre' => $this->padre, 'estado' => $this->estado]);
     $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'descripcion', $this->descripcion])->andFilterWhere(['like', 'icono', $this->icono])->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'meta_titulo', $this->meta_titulo])->andFilterWhere(['like', 'meta_palabras', $this->meta_palabras])->andFilterWhere(['like', 'meta_descripcion', $this->meta_descripcion]);
     return $dataProvider;
 }
Exemple #5
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\PaginasCategorias;
use kartik\tree\TreeView;
/* @var $this yii\web\View */
/* @var $model common\models\PaginasCategorias */
/* @var $form yii\widgets\ActiveForm */
$categorias = new PaginasCategorias();
//echo '<pre>';print_r(['sd',$categorias->listadoCategoriasJerarquia()]);die();
$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']]);
?>

<!-- BEGIN CONTENIDO -->
<div class="row">
    <div class="col-lg-12">
        <h4>Información General</h4>
    </div><!--end .col -->
    <div class="col-lg-3 col-md-4">
        <article class="margin-bottom-xxl">
            <p>
                Utiliza este apartado para establecer un título y subtítulo a tu página de inicio. Recuerda que es muy importante que el usuario se sienta identificado con lo que está buscanso, por ello te recomendamos utilizar títulos descriptivos.
            </p>
        </article>
    </div><!--end .col -->
Exemple #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCategorias()
 {
     return $this->hasOne(PaginasCategorias::className(), ['idcategoria' => 'categoria']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getHijos()
 {
     return $this->hasMany(PaginasCategorias::className(), ['padre' => 'idcategoria']);
 }