示例#1
0
 /**
  * Displays static page.
  * @param $slug
  * @return string
  * @throws NotFoundHttpException
  */
 public function run($slug)
 {
     $model = new Paginas();
     if (($pagina = $model->obtenerPaginaPorSlug($slug)) === null) {
         throw new NotFoundHttpException('La página solicitada no existe.');
     }
     return $this->controller->render('pagina-estatica', ['model' => $pagina]);
 }
示例#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]);
     }
 }
示例#3
0
 /**
  * Crear una pagina en la categoria ayuda
  */
 public function actionCrearPaginaAyuda($categoria = null)
 {
     $categoria = !empty($categoria) ? intval($categoria) : 12;
     $model = new Paginas();
     $model->titulo = 'App probando desde consola';
     $model->contenido = 'App probando desde consola';
     $model->categoria = $categoria;
     $model->autor = 4;
     $model->estado = 'publicado';
     $model->tipo = 'pagina';
     $model->contenido = 'App probando desde consola';
     if ($model->save()) {
         echo "Pagina ayuda creada " . $model->idpagina;
     }
 }
示例#4
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 = Paginas::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#5
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Paginas::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_pag' => $this->id_pag, 'meta_id' => $this->meta_id, 'imagen_id' => $this->imagen_id, 'autor_id' => $this->autor_id, 'creado' => $this->creado, 'actualizado' => $this->actualizado]);
     $query->andFilterWhere(['like', 'titulo', $this->titulo])->andFilterWhere(['like', 'contenido', $this->contenido])->andFilterWhere(['like', 'estado', $this->estado])->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'meta_keywords', $this->meta_keywords])->andFilterWhere(['like', 'meta_description', $this->meta_description])->andFilterWhere(['like', 'meta_code_css', $this->meta_code_css])->andFilterWhere(['like', 'meta_code_js', $this->meta_code_js]);
     return $dataProvider;
 }
示例#6
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Paginas::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(['idpagina' => $this->idpagina, 'categoria' => $this->categoria, 'padre' => $this->padre, 'plantilla' => $this->plantilla, 'autor' => $this->autor, 'fechacreado' => $this->fechacreado, 'fechaactualizado' => $this->fechaactualizado]);
     $query->andFilterWhere(['like', 'titulo', $this->titulo])->andFilterWhere(['like', 'contenido', $this->contenido])->andFilterWhere(['like', 'leermas', $this->leermas])->andFilterWhere(['like', 'slug', $this->slug])->andFilterWhere(['like', 'estado', $this->estado])->andFilterWhere(['like', 'tipo', $this->tipo])->andFilterWhere(['like', 'meta_titulo', $this->meta_titulo])->andFilterWhere(['like', 'meta_palabras', $this->meta_palabras])->andFilterWhere(['like', 'meta_descripcion', $this->meta_descripcion]);
     return $dataProvider;
 }
示例#7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPagina0()
 {
     return $this->hasOne(Paginas::className(), ['idpagina' => 'pagina']);
 }
示例#8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPaginas()
 {
     return $this->hasMany(Paginas::className(), ['plantilla' => 'id']);
 }
示例#9
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getContenido1()
 {
     return $this->hasOne(Paginas::className(), ['idpagina' => 'contenido']);
 }
示例#10
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdPags()
 {
     return $this->hasMany(Paginas::className(), ['id_pag' => 'id_pag'])->viaTable('paginas_categoria', ['id_categoria' => 'id_categoria']);
 }
示例#11
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPaginas()
 {
     return $this->hasMany(Paginas::className(), ['categoria' => 'idcategoria']);
 }