Exemplo n.º 1
0
 /**
  * Finds the Impemployee model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Impemployee the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Impemployee::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     $Impemployee = new Impemployee();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(Proc::GetPreviousURLBreadcrumbsFromSession());
     } else {
         $Impemployee->load(Yii::$app->request->get(), 'Impemployee');
         $Impemployee->id_importemployee = $model->primaryKey;
         if ($Impemployee->validate()) {
             $Impemployee->save(false);
         }
         $searchModel = new ImpemployeeSearch();
         $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
         return $this->render('update', ['model' => $model, 'Impemployee' => $Impemployee, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
     }
 }
Exemplo n.º 3
0
 public function searchForimportemployee($params)
 {
     $query = Impemployee::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['idemployee.idperson.auth_user_fullname' => SORT_ASC]]]);
     $query->joinWith(['idemployee.iddolzh', 'idemployee.idpodraz', 'idemployee.idbuild']);
     $this->load($params);
     $this->id_importemployee = $params['id'];
     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(['impemployee_id' => $this->impemployee_id, 'id_importemployee' => $this->id_importemployee, 'id_employee' => $this->id_employee]);
     $query->andFilterWhere(['LIKE', 'idemployee.employee_id', $this->getAttribute('idemployee.employee_id')]);
     $query->andFilterWhere(['LIKE', 'iddolzh.dolzh_name', $this->getAttribute('idemployee.iddolzh.dolzh_name')]);
     $query->andFilterWhere(['LIKE', 'idpodraz.podraz_name', $this->getAttribute('idemployee.idpodraz.podraz_name')]);
     $query->andFilterWhere(['LIKE', 'idbuild.build_name', $this->getAttribute('idemployee.idbuild.build_name')]);
     Proc::AssignRelatedAttributes($dataProvider, ['idemployee.employee_id', 'idemployee.iddolzh.dolzh_name', 'idemployee.idbuild.build_name', 'idemployee.idpodraz.podraz_name']);
     return $dataProvider;
 }
Exemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getImpemployees()
 {
     return $this->hasMany(Impemployee::className(), ['id_importemployee' => 'importemployee_id'])->from(['impemployees' => Impemployee::tableName()]);
 }