当前位置: 首页>>代码示例>>PHP>>正文


PHP Pagina::save方法代码示例

本文整理汇总了PHP中Pagina::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Pagina::save方法的具体用法?PHP Pagina::save怎么用?PHP Pagina::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pagina的用法示例。


在下文中一共展示了Pagina::save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Pagina();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Pagina'])) {
         $model->attributes = $_POST['Pagina'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->pagina_id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:franksuarez,项目名称:fructiferia-yii,代码行数:17,代码来源:PaginaController.php

示例2: createAction

 /**
  * Creates a new pagina
  */
 public function createAction()
 {
     if (!$this->request->isPost()) {
         return $this->dispatcher->forward(array("controller" => "pagina", "action" => "index"));
     }
     $pagina = new Pagina();
     $pagina->setPaginaNombrecontrolador($this->request->getPost("pagina_nombreControlador"));
     $pagina->setPaginaNombreaccion($this->request->getPost("pagina_nombreAccion"));
     if (!$pagina->save()) {
         foreach ($pagina->getMessages() as $message) {
             $this->flash->error($message);
         }
         return $this->dispatcher->forward(array("controller" => "pagina", "action" => "new"));
     }
     $this->flash->success("pagina was created successfully");
     return $this->dispatcher->forward(array("controller" => "pagina", "action" => "index"));
 }
开发者ID:munozdaniel,项目名称:sya,代码行数:20,代码来源:PaginaController.php

示例3: guardar

 public function guardar()
 {
     $dir = $this->imageRoute;
     $image_base = Yii::getPathOfAlias('webroot') . '/images/';
     if ($this->validate()) {
         if (isset($this->id)) {
             //Actualizando
             $micrositio = Micrositio::model()->findByPk($this->id);
         } else {
             //Nuevo registro
             $micrositio = new Micrositio();
         }
         $transaccion = $micrositio->dbConnection->beginTransaction();
         $micrositio->seccion_id = 3;
         //Especiales
         $micrositio->nombre = $this->nombre;
         if ($this->imagen != $micrositio->background) {
             if (file_exists($image_base . $micrositio->background)) {
                 @unlink($image_base . $micrositio->background);
             }
             $micrositio->background = $dir . $this->imagen;
         }
         if ($this->imagen_mobile != $micrositio->background_mobile) {
             if (file_exists($image_base . $micrositio->background_mobile)) {
                 @unlink($image_base . $micrositio->background_mobile);
             }
             $micrositio->background_mobile = $dir . $this->imagen_mobile;
         }
         if ($this->miniatura != $micrositio->miniatura) {
             if (file_exists($image_base . $micrositio->miniatura)) {
                 @unlink($image_base . $micrositio->miniatura);
             }
             $micrositio->miniatura = $dir . $this->miniatura;
         }
         $micrositio->destacado = $this->destacado;
         $micrositio->estado = $this->estado;
         if (!$micrositio->save(false)) {
             $transaccion->rollback();
         }
         $micrositio_id = $micrositio->getPrimaryKey();
         if (isset($this->id)) {
             $pagina = Pagina::model()->findByAttributes(array('micrositio_id' => $micrositio_id));
         } else {
             $pagina = new Pagina();
             $pagina->micrositio_id = $micrositio_id;
             $pagina->tipo_pagina_id = 10;
             //Página bloques
         }
         $pagina->nombre = $this->nombre;
         $pagina->meta_descripcion = $this->meta_descripcion;
         $pagina->clase = NULL;
         $pagina->destacado = $this->destacado;
         $pagina->estado = $this->estado == 2 ? 1 : $this->estado;
         if (!$pagina->save(false)) {
             $transaccion->rollback();
         }
         $pagina_id = $pagina->getPrimaryKey();
         if (isset($this->id)) {
             //Actualizando
             $pgB = PgBloques::model()->findByAttributes(array('pagina_id' => $pagina_id));
         } else {
             if (!$micrositio->asignar_pagina($pagina)) {
                 $transaccion->rollback();
             }
             $pgB = new PgBloques();
             $pgB->pagina_id = $pagina_id;
         }
         $pgB->estado = $this->estado;
         if (!$pgB->save(false)) {
             $transaccion->rollback();
             return false;
         } else {
             $transaccion->commit();
             $this->id = $micrositio_id;
             return true;
         }
     } else {
         return false;
     }
 }
开发者ID:Telemedellin,项目名称:tm,代码行数:80,代码来源:EspecialesForm.php

示例4: test2

 public function test2()
 {
     /**
      * Consultas:
      * 
      * SELECT MAX(id) AS max FROM test_a004_pagina
      * 
      * INSERT INTO test_a004_pagina ( titulo ,contenido ,class ,deleted ,owner_id ,id ) VALUES ('Pagina raiz' ,'This step is usually done transparently as most compilers perform it and then invoke the assembler themselves, so you don\'t really have to worry about it. It can be useful later on if you\'re trying to...' ,'Pagina' ,'0' ,NULL ,'1' );
      * 
      * SELECT MAX(id) AS max FROM test_a004_pagina
      * 
      * INSERT INTO test_a004_pagina ( titulo ,contenido ,class ,deleted ,owner_id ,id ) VALUES ('Subpagina de raiz 1' ,'This step is usually done transparently as most compilers perform it and then invoke the assembler themselves, so you don\'t really have to worry about it. It can be useful later on if you\'re trying to...' ,'Pagina' ,'0' ,'1' ,'2' );
      * 
      * SELECT MAX(id) AS max FROM test_a004_pagina
      * 
      * INSERT INTO test_a004_pagina ( titulo ,contenido ,class ,deleted ,owner_id ,id ) VALUES ('Sub subpagina de raiz 1' ,'This step is usually done transparently as most compilers perform it and then invoke the assembler themselves, so you don\'t really have to worry about it. It can be useful later on if you\'re trying to...' ,'Pagina' ,'0' ,'2' ,'3' );
      *
      * SELECT count(id) as cant FROM test_a004_pagina_subpages_test_a004_pagina WHERE (test_a004_pagina_subpages_test_a004_pagina.owner_id=2 AND test_a004_pagina_subpages_test_a004_pagina.ref_id=3)
      * 
      * SELECT MAX(id) AS max FROM test_a004_pagina_subpages_test_a004_pagina
      * 
      * INSERT INTO test_a004_pagina_subpages_test_a004_pagina ( owner_id ,ref_id ,type ,ord ,class ,deleted ,id ) VALUES ('2' ,'3' ,'2' ,NULL ,'ObjectReference' ,'0' ,'1' );
      * 
      * SELECT MAX(id) AS max FROM test_a004_pagina
      * 
      * INSERT INTO test_a004_pagina ( titulo ,contenido ,class ,deleted ,owner_id ,id ) VALUES ('Sub subpagina de raiz 2' ,'This step is usually done transparently as most compilers perform it and then invoke the assembler themselves, so you don\'t really have to worry about it. It can be useful later on if you\'re trying to...' ,'Pagina' ,'0' ,'2' ,'4' );
      * 
      * SELECT count(id) as cant FROM test_a004_pagina_subpages_test_a004_pagina WHERE (test_a004_pagina_subpages_test_a004_pagina.owner_id=2 AND test_a004_pagina_subpages_test_a004_pagina.ref_id=4)
      * 
      * SELECT MAX(id) AS max FROM test_a004_pagina_subpages_test_a004_pagina
      * 
      * INSERT INTO test_a004_pagina_subpages_test_a004_pagina ( owner_id ,ref_id ,type ,ord ,class ,deleted ,id ) VALUES ('2' ,'4' ,'2' ,NULL ,'ObjectReference' ,'0' ,'2' );
      * 
      * SELECT count(id) as cant FROM test_a004_pagina_subpages_test_a004_pagina WHERE (test_a004_pagina_subpages_test_a004_pagina.owner_id=1 AND test_a004_pagina_subpages_test_a004_pagina.ref_id=2)
      * 
      * SELECT MAX(id) AS max FROM test_a004_pagina_subpages_test_a004_pagina
      * 
      * INSERT INTO test_a004_pagina_subpages_test_a004_pagina ( owner_id ,ref_id ,type ,ord ,class ,deleted ,id ) VALUES ('1' ,'2' ,'2' ,NULL ,'ObjectReference' ,'0' ,'3' );
      * 
      * SELECT id FROM test_a004_pagina WHERE id=2
      * 
      * UPDATE test_a004_pagina SET titulo='Subpagina de raiz 1' ,contenido='This step is usually done transparently as most compilers perform it and then invoke the assembler themselves, so you don\'t really have to worry about it. It can be useful later on if you\'re trying to...' ,class='Pagina' ,deleted='0' ,owner_id='1' WHERE id=2
      * 
      * 
      */
     $p1 = new Pagina(array("titulo" => "Pagina raiz", "contenido" => "This step is usually done transparently as most compilers perform it and then invoke the assembler themselves, so you don't really have to worry about it. It can be useful later on if you're trying to..."));
     $p11 = new Pagina(array("titulo" => "Subpagina de raiz 1", "contenido" => "This step is usually done transparently as most compilers perform it and then invoke the assembler themselves, so you don't really have to worry about it. It can be useful later on if you're trying to...", "owner" => $p1));
     $p111 = new Pagina(array("titulo" => "Sub subpagina de raiz 1", "contenido" => "This step is usually done transparently as most compilers perform it and then invoke the assembler themselves, so you don't really have to worry about it. It can be useful later on if you're trying to...", "owner" => $p11));
     $p112 = new Pagina(array("titulo" => "Sub subpagina de raiz 2", "contenido" => "This step is usually done transparently as most compilers perform it and then invoke the assembler themselves, so you don't really have to worry about it. It can be useful later on if you're trying to...", "owner" => $p11));
     // subpaginas de p11
     $p11->addToSubpages($p111);
     $p11->addToSubpages($p112);
     // subpaginas de p1
     $p1->addToSubpages($p11);
     // Guarda en cascada porque el lado con cardinalidad 1 de la relacion
     // es el responsable del lado con cardinalidad *.
     $this->assert($p1->save(), 'TestCaseA004.test2: Test salvar hasMany en cascada', array('errors' => print_r($p1->getErrors(), true)));
     // TODO: en el test verificar que se guardo todo y que puedo cargar las relaciones ok
 }
开发者ID:fkali,项目名称:yupp,代码行数:59,代码来源:apps.tests.tests.TestCaseA004.class.php

示例5: actionSalvarPagina

 /**
  * Action Página : SAVE
  */
 public function actionSalvarPagina()
 {
     $dadosPost = Yii::app()->request->rawBody;
     $parametros = CJSON::decode($dadosPost, true);
     if (isset($parametros['id']) && $parametros['id'] != '') {
         $pagina = Pagina::model()->findByPk($parametros['id']);
     } else {
         $pagina = new Pagina();
     }
     $pagina->nome = $parametros['nome'];
     $pagina->posicao = $parametros['posicao'];
     $response = array();
     if ($pagina->save() === false) {
         $response['success'] = false;
         $response['errors'] = $pagina->errors;
     } else {
         $response['success'] = true;
         $response['pagina'] = $pagina;
     }
     header('Content-type: application/json; charset=utf-8');
     echo CJSON::encode($response);
     Yii::app()->end();
 }
开发者ID:jonaskreling,项目名称:haras,代码行数:26,代码来源:HarasController.php

示例6: actionCrear

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCrear($id, $tipo_pagina_id = 2)
 {
     if (!isset(Yii::app()->session['dirpa'])) {
         Yii::app()->session['dirpa'] = 'backgrounds/paginas/' . date('Y') . '/' . date('m') . '/';
     }
     $micrositio = $id ? Micrositio::model()->with('seccion')->findByPk($id)->id : 0;
     $model = new Pagina();
     $model->micrositio_id = $micrositio;
     $ppc = TipoPagina::model()->findByPk($tipo_pagina_id)->tabla;
     if (!$ppc) {
         throw new Exception(400, "tipo_pagina_id incorrecto");
     }
     $contenido = new $ppc();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Pagina'])) {
         $model->attributes = $_POST['Pagina'];
         $m = Micrositio::model()->with('seccion')->findByPk($_POST['Pagina']['micrositio_id']);
         $model->tipo_pagina_id = $tipo_pagina_id;
         if (isset(Yii::app()->session['dirpa'])) {
             $dirpa = Yii::app()->session['dirpa'];
         }
         $model->background = $_POST['Pagina']['background'] != '' ? $dirpa . $_POST['Pagina']['background'] : NULL;
         $model->background_mobile = $_POST['Pagina']['background_mobile'] != '' ? $dirpa . $_POST['Pagina']['background_mobile'] : NULL;
         $model->miniatura = $_POST['Pagina']['miniatura'] ? $dirpa . $_POST['Pagina']['miniatura'] : NULL;
         if ($model->save()) {
             if (isset($_POST['PgGenericaSt'])) {
                 $contenido->texto = $_POST['PgGenericaSt']['texto'];
             }
             if (isset($_POST['PgArticuloBlog'])) {
                 $contenido->posicion = $_POST['PgArticuloBlog']['posicion'];
                 $contenido->entradilla = $_POST['PgArticuloBlog']['entradilla'];
                 $contenido->texto = $_POST['PgArticuloBlog']['texto'];
                 $contenido->enlace = $_POST['PgArticuloBlog']['enlace'];
                 $contenido->comentarios = $_POST['PgArticuloBlog']['comentarios'];
             }
             if (isset($_POST['PgDocumental'])) {
                 $contenido = PgDocumental::model()->findByPk($_POST['PgDocumental']['id']);
                 $contenido->titulo = $_POST['PgDocumental']['titulo'];
                 $contenido->duracion = $_POST['PgDocumental']['duracion'];
                 $contenido->anio = $_POST['PgDocumental']['anio'];
                 $contenido->sinopsis = $_POST['PgDocumental']['sinopsis'];
             }
             if (isset($_POST['PgFiltro'])) {
                 $contenido->descripcion = $_POST['PgFiltro']['descripcion'];
             }
             if (isset($_POST['PgBloques'])) {
             }
             if (isset($_POST['PgEventos'])) {
                 $contenido->descripcion = $_POST['PgEventos']['descripcion'];
             }
             if (isset($_POST['PgBlog'])) {
                 $contenido->ver_fechas = $_POST['PgBlog']['ver_fechas'];
             }
             if (isset($_POST['PgFormularioJf'])) {
                 $contenido->formulario_id = $_POST['PgFormularioJf']['formulario_id'];
             }
             $contenido->estado = $_POST['Pagina']['estado'];
             $contenido->pagina_id = $model->getPrimaryKey();
             if ($contenido->save()) {
                 $this->redirect(array('view', 'id' => $model->id));
             } else {
                 $model->delete();
             }
         }
     }
     $this->render('crear', array('model' => $model, 'partial' => $ppc, 'contenido' => $contenido));
 }
开发者ID:Telemedellin,项目名称:tm,代码行数:72,代码来源:PaginaController.php

示例7: guardar

 public function guardar()
 {
     $dir = $this->imageRoute;
     $image_base = Yii::getPathOfAlias('webroot') . '/images/';
     if ($this->validate()) {
         if (isset($this->id)) {
             //Actualizando
             $pagina = Pagina::model()->findByPk($this->id);
         } else {
             //Nuevo registro
             $pagina = new Pagina();
         }
         $transaccion = $pagina->dbConnection->beginTransaction();
         $pagina->micrositio_id = 2;
         //Novedades
         $pagina->tipo_pagina_id = 3;
         //Novedad
         $pagina->nombre = $this->nombre;
         $pagina->clase = NULL;
         $pagina->estado = $this->estado;
         $pagina->destacado = $this->destacado;
         if ($this->imagen != $pagina->background) {
             if (file_exists($image_base . $pagina->background)) {
                 @unlink($image_base . $pagina->background);
             }
             $pagina->background = $dir . $this->imagen;
         }
         if ($this->imagen_mobile != $pagina->background_mobile) {
             if (file_exists($image_base . $pagina->background_mobile)) {
                 @unlink($image_base . $pagina->background_mobile);
             }
             $pagina->background_mobile = $dir . $this->imagen_mobile;
         }
         if ($this->miniatura != $pagina->miniatura) {
             if (file_exists($image_base . $pagina->miniatura)) {
                 @unlink($image_base . $pagina->miniatura);
             }
             $pagina->miniatura = $dir . $this->miniatura;
         }
         if (!$pagina->save(false)) {
             $transaccion->rollback();
         }
         $pagina_id = $pagina->getPrimaryKey();
         if (isset($this->id)) {
             //Actualizando
             $pgAB = PgArticuloBlog::model()->findByAttributes(array('pagina_id' => $pagina_id));
         } else {
             //Nuevo registro
             $pgAB = new PgArticuloBlog();
         }
         $pgAB->pagina_id = $pagina_id;
         $pgAB->entradilla = $this->entradilla;
         $pgAB->texto = $this->texto;
         $pgAB->enlace = $this->enlace;
         $pgAB->comentarios = $this->comentarios;
         $pgAB->posicion = $this->posicion;
         $pgAB->estado = $this->estado ? 1 : 0;
         if (!$pgAB->save(false)) {
             $transaccion->rollback();
             return false;
         } else {
             $transaccion->commit();
             $this->id = $pagina_id;
             return true;
         }
     } else {
         return false;
     }
 }
开发者ID:Telemedellin,项目名称:tm,代码行数:69,代码来源:NovedadesForm.php


注:本文中的Pagina::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。