public function actionAgendaProfesional()
 {
     if (isset($_POST['DatosAgenda'])) {
         $this->layout = 'sitio';
         $profesional = Profesional::model()->findByPk($_POST['DatosAgenda']['profesional-id']);
         $sucursalesProfesional = DiaIntervaloProfesional::getSucursalesProfesionalArray($_POST['DatosAgenda']['profesional-id']);
         //echo "<pre>"; print_r($sucursalesProfesional); exit();
         $intervalos = DiaIntervaloProfesional::getIntervalosProfesionalSucursalDia(isset($_POST['DatosAgenda']['dia-id']) ? $_POST['DatosAgenda']['dia-id'] : date('N'), $_POST['DatosAgenda']['profesional-id'], $_POST['DatosAgenda']['sucursal-id']);
         $objReservas = Reserva::model()->findAll('reserva_fecha = ' . isset($_POST['DatosAgenda']['fecha-seleccionada']) ? $_POST['DatosAgenda']['fecha-seleccionada'] : date('Y/m/d'));
         $reservas = array();
         foreach ($objReservas as $reserva) {
             $reservas[] = $reserva->dia_intervalo_profesional_id;
         }
         //echo "<pre>"; print_r($intervalos); exit();
         $this->render('agendaProfesional', array('profesional' => $profesional, 'intervalos' => $intervalos, 'sucursalesProfesional' => $sucursalesProfesional, 'reservas' => $reservas));
     } else {
         throw new CHttpException('no se puede mostrar la página solicitada.');
     }
 }
        <th>&nbsp;</th>
    </tr>
    <?php 
foreach ($profesionales as $profesional) {
    ?>
    <form action="<?php 
    echo CController::createUrl('site/agendaProfesional');
    ?>
" method="post">
    <tr>
        <td><?php 
    echo $profesional->getNombreCompleto();
    ?>
<input type="hidden" name="DatosAgenda[profesional-id]" value="<?php 
    echo $profesional->profesional_id;
    ?>
" /></td>
        <td><?php 
    echo DiaIntervaloProfesional::getSucursalesProfesionalSelect($profesional->profesional_id);
    ?>
</td>
        <td><?php 
    echo CHtml::submitButton('Ver Agenda', array('class' => 'btn btn-info'));
    ?>
</td>
    </tr>
    </form>
    <?php 
}
?>
</table>
 public static function intervaloExiste()
 {
     $sql = "\n            SELECT\n                    *\n            FROM\n                    dia_intervalo_profesional\n            WHERE\n                    intervalo_id = " . $_POST['DiaIntervaloProfesional']['intervalo_id'] . "\n                    AND dia_id = " . $_POST['DiaIntervaloProfesional']['dia_id'] . "\n                    AND profesional_id = " . $_POST['DiaIntervaloProfesional']['profesional_id'] . " ";
     $objIntervalo = DiaIntervaloProfesional::model()->findBySql($sql);
     if (isset($objIntervalo)) {
         return true;
     } else {
         return false;
     }
 }
 /**
  * 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 DiaIntervaloProfesional the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = DiaIntervaloProfesional::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }