コード例 #1
0
 /**
  * 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 Programa the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Programa::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #2
0
ファイル: SiteController.php プロジェクト: jencina/havanatur
 public function actionPrograma()
 {
     Yii::app()->controller->menu_activo = 'programa';
     $id = Yii::app()->request->getParam('id');
     $model = Programa::model()->findByPK($id);
     $condiciones = Condiciones::model()->findAll();
     $imagenes = array();
     foreach ($model->programaImagens as $imagen) {
         $imagenes[] = array('div' => '<div style="height:400px;background-image: url(' . "'" . Yii::app()->request->baseUrl . '/images/programa/' . $imagen->imagen . "'" . ')"></div>');
     }
     $criteria = new CDbCriteria();
     $criteria->params = array(':id' => $id);
     $criteria->condition = 'programa_id=:id';
     $dataProvider = new CActiveDataProvider('ProgramaCombinacion', array('pagination' => array('pageSize' => 5), 'criteria' => $criteria));
     // renders the view file 'protected/views/site/index.php'
     // using the default layout 'protected/views/layouts/main.php'
     $this->render('programa', array('model' => $model, 'imagenes' => $imagenes, 'combi' => $dataProvider, 'condiciones' => $condiciones));
 }
コード例 #3
0
ファイル: main.php プロジェクト: jencina/havanatur



        <div class="container" id="page">



            <div id="mainmenu" class="row">

<?php 
$programas = Programa::model()->findAll(array('condition' => 'activo =1 and programa_tipo_id = ' . $this->programas));
$bloqueos = Programa::model()->findAll(array('condition' => 'activo =1 and programa_tipo_id = ' . $this->bloqueos));
$otroDestinos = Programa::model()->findAll(array('condition' => 'activo =1 and programa_tipo_id = ' . $this->otroDestino));
$turismoSaluds = Programa::model()->findAll(array('condition' => 'activo =1 and programa_tipo_id = ' . $this->turismoSalud));
$otroServicios = Programa::model()->findAll(array('condition' => 'activo =1 and programa_tipo_id = ' . $this->otroServicio));
$quienesSomos = Contenido::model()->findAllByAttributes(array('contenido_tipo_id' => $this->quienessomos));
$informaciones = Contenido::model()->findAllByAttributes(array('contenido_tipo_id' => $this->informaciones));
$otros = Contenido::model()->findAllByAttributes(array('contenido_tipo_id' => $this->otros));
$turismos = Contenido::model()->findAllByAttributes(array('contenido_tipo_id' => $this->turismo));
$programa = array();
foreach ($programas as $pro) {
    $programa[] = array('label' => $pro->nombre, 'url' => array('site/programa', 'id' => $pro->id));
}
$bloqueo = array();
foreach ($bloqueos as $blo) {
    $bloqueo[] = array('label' => $blo->nombre, 'url' => array('site/programa', 'id' => $blo->id));
}
/* $otroDestino = array();

  foreach($otroDestinos as $otro){