Beispiel #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Horarios::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_horario' => $this->id_horario]);
     $query->andFilterWhere(['like', 'dia', $this->dia])->andFilterWhere(['like', 'hora_inicio', $this->hora_inicio])->andFilterWhere(['like', 'hora_fin', $this->hora_fin]);
     return $dataProvider;
 }
Beispiel #2
0
 /**
  * Finds the Horarios model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Horarios the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Horarios::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Beispiel #3
0
<a href="<?php 
echo Url::toRoute("alumnos/search");
?>
">Enviar mail masivo</a>
<div class="alumnos-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>
    <?php 
// echo $this->render('_search', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a('Create Alumnos', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'p_nombre', 's_nombre', 'p_apellido', 's_apellido', ['attribute' => 'mail', 'format' => 'raw', 'value' => function ($data) {
    return Html::a($data->mail, ['/site/contact', 'id' => $data->mail, 'usr' => $data->p_nombre . ' ' . $data->p_apellido]);
}], 'servicio', ['attribute' => 'horario', 'value' => function ($model) {
    $horarios = Horarios::findOne($model->horario);
    return $horarios->dia . ': ' . $horarios->hora_inicio . '-' . $horarios->hora_fin;
}, 'filter' => ArrayHelper::map(Horarios::find()->all(), 'id_horario', 'dia')], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
Beispiel #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getHorarios()
 {
     return $this->hasOne(Horarios::className(), ['horario' => 'id_horario']);
 }
Beispiel #5
0
use yii\helpers\Html;
use yii\widgets\DetailView;
use app\models\Horarios;
/* @var $this yii\web\View */
/* @var $model app\models\Alumnos */
$this->title = $model->id;
$this->params['breadcrumbs'][] = ['label' => 'Alumnos', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="alumnos-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a('Delete', ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
?>
    </p>

    <?php 
echo DetailView::widget(['model' => $model, 'attributes' => ['id', 'p_nombre', 's_nombre', 'p_apellido', 's_apellido', 'nacimiento', 'rut', ['attribute' => 'mail', 'format' => 'raw', 'value' => Html::a($model->mail, ['update', 'id' => $model->id])], 't_fijo', 't_celular', 'direccion', 'comuna', 'servicio', 'funcion', ['attribute' => 'horario', 'value' => Horarios::findOne($model->horario)->dia . ': ' . Horarios::findOne($model->horario)->hora_inicio . ' - ' . Horarios::findOne($model->horario)->hora_fin]]]);
?>

</div>
Beispiel #6
0
?>

    <?php 
echo $form->field($model, 'comuna')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'servicio')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'funcion')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'horario')->dropDownList(ArrayHelper::map(Horarios::find()->all(), 'id_horario', function ($data) {
    return $data->dia . ': ' . $data->hora_inicio . ' - ' . $data->hora_fin;
}));
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>