/** * 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) { $model = $this->loadModel($id); $intervalos = Intervalo::model()->findAll(); $profesionales = Profesional::model()->findAll(); $intHelper = array(); foreach ($intervalos as $intervalo) { $intHelper[$intervalo->intervalo_id] = $intervalo->intervalo_inicio . " - " . $intervalo->intervalo_termino; } $proHelper = array(); foreach ($profesionales as $profesional) { $proHelper[$profesional->profesional_id] = $profesional->profesional_nombre . " " . $profesional->profesional_apellido_paterno . " " . $profesional->profesional_apellido_materno; } // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['DiaIntervaloProfesional'])) { $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'] . "\n AND sucursal_id = " . $_POST['DiaIntervaloProfesional']['sucursal_id'] . " "; $objIntervalo = DiaIntervaloProfesional::model()->findBySql($sql); //echo "<pre>"; print_r($objIntervalo); echo "</pre>"; exit(); if (isset($objIntervalo)) { yii::app()->user->setFlash('errorIntervaloExiste', 'El intervalo existe'); } else { $model->attributes = $_POST['DiaIntervaloProfesional']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->dia_intervalo_profesional_id)); } } } $this->render('update', array('model' => $model, 'intHelper' => $intHelper, 'proHelper' => $proHelper)); }
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.'); } }
/** * 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 Profesional the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Profesional::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
echo $form->errorSummary($model); ?> <fieldset> <?php echo $form->hiddenField($model, 'idsociedad'); ?> <?php echo "<div class='control-group'>"; echo $form->labelEx($model, 'idsocio', array('class' => 'control-label')); echo "<div class='controls'>"; $this->widget('yiiwheels.widgets.select2.WhSelect2', array( 'model' => $model, 'attribute' => 'idsocio', 'language' => 'es', 'data' => CHtml::listData(Profesional::model()->findAll(array('order' => 'nombre')), 'identidad', 'nombrecomp'), 'htmlOptions' => array( 'style' => 'width:220px', ), )); echo "</div></div>"; ?> <?php echo $form->textFieldControlGroup($model, 'participacion', array('size' => 6, 'maxlength' => 6)); ?> <?php echo $form->textFieldControlGroup($model, 'porcjubil', array('size' => 6, 'maxlength' => 6)); ?> </fieldset> <div class="form-actions">