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(); } }
/** * 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; }
/** * 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; }
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(); }
/** * 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.'); } }
/** * @return \yii\db\ActiveQuery */ public function getIdEmpleado() { return $this->hasOne(Empleado::className(), ['Id' => 'id_empleado']); }
/** * @return \yii\db\ActiveQuery */ public function getEmpleado() { return $this->hasOne(Empleado::className(), ['id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getEmpleado() { return $this->hasMany(Empleado::className(), ['departamento_did' => 'id']); }