示例#1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = TipoHora::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'nombre', $this->nombre]);
     return $dataProvider;
 }
示例#2
0
use app\models\Profesional;
use kartik\date\DatePicker;
use kartik\time\TimePicker;
/* @var $this yii\web\View */
/* @var $model app\models\Hora */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="hora-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'tipo_hora_id')->dropDownList(ArrayHelper::map(TipoHora::find()->all(), 'id', 'nombre'), ['prompt' => 'Seleccionar Tipo de Hora', 'style' => 'width:300px']);
?>

    <?php 
echo $form->field($model, 'profesional_id')->dropDownList(ArrayHelper::map(Profesional::find()->all(), 'id', 'Nombres'), ['prompt' => 'Seleccionar Profesional', 'style' => 'width:300px']);
?>

    <?php 
echo $form->field($model, 'administrador_id')->dropDownList(ArrayHelper::map(Administrador::find()->all(), 'id', 'Nombres'), ['prompt' => 'Seleccionar Administrador', 'style' => 'width:300px']);
?>

    <?php 
echo $form->field($model, 'hora_inicio')->widget(TimePicker::className(), ['pluginOptions' => ['format' => 'HH:MM', 'showMeridian' => false, 'minuteStep' => 1], 'options' => ['style' => 'width:260px'], 'addonOptions' => ['asButton' => true, 'inline-addon' => true]]);
?>

    <?php 
 /**
  * Finds the TipoHora model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return TipoHora the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = TipoHora::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#4
0
 public function getNombreTipoHora()
 {
     $tipo_hora = TipoHora::find()->where(['id' => $this->tipo_hora_id])->one();
     return $tipo_hora->nombre;
 }