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


PHP Pagina::model方法代码示例

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


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

示例1: getMenuServicos

 public static function getMenuServicos()
 {
     //Carrega o submenu de pesquisadores
     $servicos = Pagina::model()->findALL(array('order' => 'titulo', 'condition' => "tipo = 'serviço'"));
     $menuServicos = array();
     $itemServico = array();
     for ($i = 0; $i < count($servicos); $i++) {
         $itemServico["label"] = $servicos[$i]->titulo;
         $itemServico["url"] = array("/pagina/" . $servicos[$i]->cod_pagina);
         $menuServicos[] = $itemServico;
     }
     return $menuServicos;
 }
开发者ID:elikristina,项目名称:portalcegov,代码行数:13,代码来源:Pagina.php

示例2: actionCrear

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCrear($id)
 {
     $horario = new Horario();
     if ($id) {
         $micrositio = Micrositio::model()->findByPk($id);
         $pagina = Pagina::model()->findByAttributes(array('micrositio_id' => $micrositio->id));
         $pgPrograma = PgPrograma::model()->findByAttributes(array('pagina_id' => $pagina->id));
         $horario->pg_programa_id = $pgPrograma->id;
     }
     if (isset($_POST['Horario'])) {
         $horario->attributes = $_POST['Horario'];
         $horario->hora_inicio = date('Gi', strtotime($horario->hora_inicio));
         $horario->hora_fin = date('Gi', strtotime($horario->hora_fin));
         if ($horario->save()) {
             Yii::app()->user->setFlash('success', Horarios::getDiaSemana($horario->dia_semana) . ' ' . Horarios::hora($horario->hora_inicio) . ' guardado con éxito');
             $this->redirect(array('programas/view', 'id' => $pgPrograma->pagina->micrositio_id));
         }
         //if($horario->save())
     }
     //if(isset($_POST['Horario']))
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $this->render('crear', array('model' => $horario));
 }
开发者ID:Telemedellin,项目名称:tm,代码行数:28,代码来源:HorarioController.php

示例3: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $telemedellinForm = new TelemedellinForm();
     $telemedellinForm->id = $id;
     if (isset($_POST['TelemedellinForm'])) {
         $telemedellinForm->attributes = $_POST['TelemedellinForm'];
         if ($telemedellinForm->guardar()) {
             Yii::app()->user->setFlash('success', 'Micrositio ' . $telemedellinForm->nombre . ' guardado con éxito');
             $this->redirect(array('view', 'id' => $telemedellinForm->id));
         } else {
             Yii::app()->user->setFlash('warning', 'Micrositio ' . $telemedellinForm->nombre . ' no se pudo guardar');
         }
         //if($telemedellinForm->guardar())
     }
     //if(isset($_POST['TelemedellinForm']))
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $micrositio = Micrositio::model()->with('url', 'pagina')->findByPk($id);
     $pagina = Pagina::model()->with('url', 'pgGenericaSts')->findByAttributes(array('micrositio_id' => $micrositio->id));
     //$pgGst = PgGenericaSt::model()->findByAttributes(array('pagina_id' => $pagina->id));
     $telemedellinForm->set_fields($micrositio, $pagina);
     $this->render('modificar', array('model' => $telemedellinForm));
 }
开发者ID:Telemedellin,项目名称:tm,代码行数:28,代码来源:TelemedellinController.php

示例4: 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

示例5: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Pagina::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:elikristina,项目名称:portalcegov,代码行数:13,代码来源:PaginaController.php

示例6: actionDeletarPagina

 /**
  * Action Página : DELETE
  */
 public function actionDeletarPagina()
 {
     $dadosPost = Yii::app()->request->rawBody;
     $parametros = CJSON::decode($dadosPost, true);
     $pagina = Pagina::model()->findByPk($parametros['id']);
     $response = array();
     if ($pagina->delete() === 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,代码行数:20,代码来源:HarasController.php

示例7:

<?php

$paginasMenu = Pagina::model()->findAll();
//echo "<pre>"; print_r($_SESSION['carro']); echo "</pre>";
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <link href="<?php 
echo Yii::app()->baseUrl;
?>
/css/reset.css" rel="stylesheet" type="text/css" />
        <link href="<?php 
echo Yii::app()->baseUrl;
?>
/css/960_24_col.css" rel="stylesheet" type="text/css" />
        <link href="<?php 
echo Yii::app()->baseUrl;
?>
/css/text.css" rel="stylesheet" type="text/css" />
        <link href="<?php 
echo Yii::app()->baseUrl;
?>
/css/sitio.principal.css" rel="stylesheet" type="text/css" />
        <link href="<?php 
echo Yii::app()->baseUrl;
?>
/js/jquery.fancybox/jquery.fancybox.css" rel="stylesheet" type="text/css" />
        <link href="<?php 
开发者ID:franksuarez,项目名称:fructiferia-yii,代码行数:31,代码来源:sitio.php

示例8: run

 public function run($args)
 {
     $horarios = Horario::model()->with('pgPrograma')->findAll(array('order' => 'dia_semana ASC, hora_inicio ASC', 'condition' => 'pgPrograma.estado = 2'));
     foreach ($horarios as $horario) {
         $pagina = Pagina::model()->findByPk($horario->pgPrograma->pagina_id);
         $micrositio_id = $pagina->micrositio_id;
         $tipo_emision_id = $horario->tipo_emision_id;
         $dia_semana = $horario->dia_semana;
         $hora_inicio = $horario->hora_inicio;
         $hora_fin = $horario->hora_fin;
         $estado = 1;
         date_default_timezone_set('America/Bogota');
         setlocale(LC_ALL, 'es_ES.UTF-8');
         $sts = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
         // set current date
         // parse about any English textual datetime description into a Unix timestamp
         $ts = $sts;
         // calculate the number of days since Monday
         $dow = date('w', $ts);
         $offset = $dow - 1;
         if ($offset < 0) {
             $offset = 6;
         }
         // calculate timestamp for the Monday
         $ts = $ts - $offset * 86400;
         $semana = array();
         // loop from Monday till Sunday
         for ($i = 0; $i < 7; $i++, $ts += 86400) {
             $semana[] = $ts;
         }
         $hora_inicio = $semana[$dia_semana - 1] + Horarios::hora_a_timestamp($hora_inicio);
         $hora_fin = $semana[$dia_semana - 1] + Horarios::hora_a_timestamp($hora_fin);
         /* PILAS AQUÍ, FESTIVO /**/
         $tts = mktime(0, 0, 0, date('m', $hora_inicio), date('d', $hora_inicio), date('Y', $hora_inicio));
         if ($tts == mktime(0, 0, 0, 3, 23, date('Y'))) {
             continue;
         }
         if ($tts == mktime(0, 0, 0, 4, 2, date('Y'))) {
             continue;
         }
         if ($tts == mktime(0, 0, 0, 4, 3, date('Y'))) {
             continue;
         }
         if ($tts == mktime(0, 0, 0, 5, 1, date('Y'))) {
             continue;
         }
         if ($tts == mktime(0, 0, 0, 5, 18, date('Y'))) {
             continue;
         }
         if ($tts == mktime(0, 0, 0, 6, 8, date('Y'))) {
             continue;
         }
         if ($tts == mktime(0, 0, 0, 6, 15, date('Y'))) {
             continue;
         }
         if ($tts == mktime(0, 0, 0, 6, 29, date('Y'))) {
             continue;
         }
         if ($tts == mktime(0, 0, 0, 7, 20, date('Y'))) {
             continue;
         }
         if ($tts == mktime(0, 0, 0, 8, 7, date('Y'))) {
             continue;
         }
         if ($tts == mktime(0, 0, 0, 8, 17, date('Y'))) {
             continue;
         }
         if ($tts == mktime(0, 0, 0, 10, 12, date('Y'))) {
             continue;
         }
         if ($tts == mktime(0, 0, 0, 11, 2, date('Y'))) {
             continue;
         }
         if ($tts == mktime(0, 0, 0, 11, 16, date('Y'))) {
             continue;
         }
         if ($tts == mktime(0, 0, 0, 12, 8, date('Y'))) {
             continue;
         }
         if ($tts == mktime(0, 0, 0, 12, 25, date('Y'))) {
             continue;
         }
         $p = new Programacion();
         if (!$p->exists(array('condition' => 'hora_inicio=' . $hora_inicio . ' AND hora_fin=' . $hora_fin . ' AND estado=1'))) {
             $p->micrositio_id = $micrositio_id;
             $p->hora_inicio = $hora_inicio;
             $p->hora_fin = $hora_fin;
             $p->tipo_emision_id = $tipo_emision_id;
             $p->estado = $estado;
             $p->save();
             if ($p) {
                 echo '+ Guardado ' . $pagina->nombre . ' ' . $hora_inicio . '<br />' . "\r\n";
             }
         } else {
             echo '- Existía ' . $pagina->nombre . '<br />' . "\r\n";
         }
     }
     return 0;
 }
开发者ID:Telemedellin,项目名称:tm,代码行数:99,代码来源:ProgramacionCommand.php

示例9: getNovedades

 public function getNovedades()
 {
     return Pagina::model()->listarNovedades($this->max);
 }
开发者ID:Telemedellin,项目名称:tm,代码行数:4,代码来源:Novedades.php

示例10: afterFind

 protected function afterFind()
 {
     $this->articulos = Pagina::model()->findAllByAttributes(array('micrositio_id' => $this->pagina->micrositio_id, 'tipo_pagina_id' => 3, 'estado' => 2), array('order' => 'creado DESC'));
     return parent::afterFind();
 }
开发者ID:Telemedellin,项目名称:tm,代码行数:5,代码来源:PgBlog.php

示例11: beforeDelete

 protected function beforeDelete()
 {
     $this->transaccion = $this->dbConnection->getCurrentTransaction();
     if ($this->transaccion === null) {
         $this->transaccion = $this->dbConnection->beginTransaction();
     }
     try {
         $this->pagina_id = NULL;
         $this->save(NULL);
         foreach ($this->paginas as $pagina) {
             $p = Pagina::model()->findByPk($pagina->id);
             $p->delete();
         }
         foreach ($this->albumFotos as $albumFoto) {
             $af = AlbumFoto::model()->findByPk($albumFoto->id);
             $af->delete();
         }
         foreach ($this->albumVideos as $albumVideo) {
             $av = AlbumVideo::model()->findByPk($albumVideo->id);
             $av->delete();
         }
         foreach ($this->programacions as $programacion) {
             $pr = Programacion::model()->findByPk($programacion->id);
             $pr->delete();
         }
         foreach ($this->redSocials as $redSocial) {
             $r = RedSocial::model()->findByPk($redSocial->id);
             $r->delete();
         }
         return parent::beforeDelete();
     } catch (Exception $e) {
         $this->transaccion->rollback();
         return false;
     }
 }
开发者ID:Telemedellin,项目名称:tm,代码行数:35,代码来源:Micrositio.php

示例12: 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

示例13: actionPagina

 public function actionPagina()
 {
     if (!$_GET['id']) {
         throw new CHttpException(404, 'No se encontró la página solicitada');
     }
     $pagina_id = $_GET['id'];
     $pagina = Pagina::model()->findByPk($pagina_id, array('condition' => 't.estado <> 0', 'order' => 'nombre ASC'));
     $json = '{';
     $json .= '"id":"' . CHtml::encode($pagina->id) . '",';
     $json .= '"nombre":"' . CHtml::encode($pagina->nombre) . '"';
     $json .= '}';
     $this->_sendResponse(200, $json, 'application/json');
     Yii::app()->end();
 }
开发者ID:Telemedellin,项目名称:tm,代码行数:14,代码来源:ApiController.php

示例14: actionPagina

 public function actionPagina($id)
 {
     $this->layout = 'sitio';
     $pagina = Pagina::model()->findByPk($id);
     $this->render('pagina', array('pagina' => $pagina));
 }
开发者ID:franksuarez,项目名称:fructiferia-yii,代码行数:6,代码来源:SiteController.php

示例15: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Url the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Pagina::model()->with('url', 'pgArticuloBlogs')->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:Telemedellin,项目名称:tm,代码行数:15,代码来源:NovedadesController.php


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