示例#1
0
 public function actionSignup()
 {
     if (Yii::$app->user->identity->username == "zama") {
         $model = new SignupForm();
         $empleado = new Empleado();
         if ($model->load(Yii::$app->request->post()) && $empleado->load(Yii::$app->request->post())) {
             $empleado->estatus_did = 1;
             if ($empleado->validate() && $model->validate()) {
                 $empleado->save();
                 $model->empleado_did = $empleado->id;
                 if ($user = $model->signup()) {
                     if (Yii::$app->getUser()->login($user)) {
                         return $this->goHome();
                     }
                 }
             }
         }
         return $this->render('signup', ['model' => $model, 'empleado' => $empleado]);
     } else {
         return $this->goHome();
     }
 }
示例#2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Empleado::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, 'estatus_did' => $this->estatus_did]);
     $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'apellidos', $this->apellidos])->andFilterWhere(['like', 'celular', $this->celular])->andFilterWhere(['like', 'puesto', $this->puesto])->andFilterWhere(['like', 'direccion', $this->direccion]);
     return $dataProvider;
 }
示例#3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Empleado::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(['empleado_id' => $this->empleado_id, 'rut' => $this->rut, 'telefono' => $this->telefono]);
     $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'apellido', $this->apellido]);
     return $dataProvider;
 }
示例#4
0
 public function actionImprimir()
 {
     // get your HTML raw content without any layouts or scrip
     $Empleado = Empleado::find()->all();
     $pdf = Yii::$app->pdf;
     $pdf->content = $this->renderPartial('_imprimir', ['Empleado' => $Empleado]);
     return $pdf->render();
 }
示例#5
0
 /**
  * Finds the Empleado model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Empleado the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Empleado::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdEmpleado()
 {
     return $this->hasOne(Empleado::className(), ['Id' => 'id_empleado']);
 }
示例#7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEmpleado()
 {
     return $this->hasOne(Empleado::className(), ['id' => 'id']);
 }
示例#8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getEmpleado()
 {
     return $this->hasMany(Empleado::className(), ['departamento_did' => 'id']);
 }