Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Colaborador::find();
     // add conditions that should always apply here
     $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->joinWith('comunasComuna');
     // grid filtering conditions
     $query->andFilterWhere(['id' => $this->id, 'rut' => $this->rut, 'fechaIngreso' => $this->fechaIngreso, 'fechaNac' => $this->fechaNac, 'rbac' => $this->rbac]);
     $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'apellido1', $this->apellido1])->andFilterWhere(['like', 'apellido2', $this->apellido2])->andFilterWhere(['like', 'correo', $this->correo])->andFilterWhere(['like', 'telefono', $this->telefono])->andFilterWhere(['like', 'direccion', $this->direccion])->andFilterWhere(['like', 'comunas.comuna_nombre', $this->comunas_comuna_id])->andFilterWhere(['like', 'nroCta', $this->nroCta]);
     return $dataProvider;
 }
 /**
  * Finds the Colaborador model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Colaborador the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Colaborador::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getColaborador()
 {
     return $this->hasOne(Colaborador::className(), ['id' => 'colaborador_id']);
 }
Example #4
0
?>

<div class="taller-form">

    <?php 
$form = ActiveForm::begin(['enableAjaxValidation' => true]);
?>

    <div class="col-md-4"> <?php 
echo $form->field($model, 'nombre')->textInput(['maxlength' => true]);
?>
 </div>


   <div class="col-md-4"><?php 
echo $form->field($model, 'colaborador_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Colaborador::find()->all(), 'id', 'nombre'), 'language' => 'en', 'hideSearch' => false, 'options' => ['placeholder' => 'Profesor'], 'pluginOptions' => ['allowClear' => true]]);
?>
</div>


    
   <div class="col-md-4"><?php 
echo $form->field($model, 'entidad_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Entidad::find()->all(), 'id', 'nombre'), 'language' => 'en', 'hideSearch' => false, 'options' => ['placeholder' => 'Seleccionar Entidad'], 'pluginOptions' => ['allowClear' => true]]);
?>
</div>

   
   <div class="col-md-4"><?php 
echo $form->field($model, 'comunas_comuna_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Comunas::find()->all(), 'comuna_id', 'comuna_nombre'), 'language' => 'en', 'hideSearch' => false, 'options' => ['placeholder' => 'Seleccionar Comuna'], 'pluginOptions' => ['allowClear' => true]]);
?>
</div>