Пример #1
0
 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.');
     }
 }
Пример #2
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 the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Reserva::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }