diff --git a/common/config/main-local.php b/common/config/main-local.php index f47e800..fc2943b 100644 --- a/common/config/main-local.php +++ b/common/config/main-local.php @@ -3,9 +3,9 @@ return [ 'components' => [ 'db' => [ 'class' => 'yii\db\Connection', - 'dsn' => 'pgsql:host=195.248.225.149;port=5432;dbname=mfp', - 'username' => 'test33', - 'password' => 'E4q2N7i9', + 'dsn' => 'pgsql:host=127.0.0.1;port=5432;dbname=mfp_local', + 'username' => 'postgres', + 'password' => '', 'schemaMap' => [ 'pgsql'=> [ 'class'=>'yii\db\pgsql\Schema', diff --git a/common/config/main.php b/common/config/main.php index 9165a96..f2c61fe 100644 --- a/common/config/main.php +++ b/common/config/main.php @@ -13,7 +13,7 @@ return [ ], ], 'bootstrap' => [ - 'options', + 'options' ], 'components' => [ 'cache' => [ diff --git a/common/models/UserInfo.php b/common/models/UserInfo.php new file mode 100644 index 0000000..accd2d8 --- /dev/null +++ b/common/models/UserInfo.php @@ -0,0 +1,80 @@ + 50], + [['salary', 'job'], 'string', 'max' => 255] + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'user_id' => Yii::t('app', 'User ID'), + 'view_count' => Yii::t('app', 'View Count'), + 'busy' => Yii::t('app', 'Busy'), + 'date_visit' => Yii::t('app', 'Date Visit'), + 'experience' => Yii::t('app', 'Experience'), + 'rank' => Yii::t('app', 'Rank'), + 'salary' => Yii::t('app', 'Salary'), + 'job' => Yii::t('app', 'Job'), + 'location' => Yii::t('app', 'Location'), + 'soft' => Yii::t('app', 'Soft'), + 'user_info_id' => Yii::t('app', 'User Info ID'), + 'guarantee' => Yii::t('app', 'Guarantee'), + 'contract' => Yii::t('app', 'Contract'), + 'estimate' => Yii::t('app', 'Estimate'), + 'purchase' => Yii::t('app', 'Purchase'), + 'delivery' => Yii::t('app', 'Delivery'), + 'prepayment' => Yii::t('app', 'Prepayment'), + 'about' => Yii::t('app', 'About'), + ]; + } +} diff --git a/common/models/UserInfoSearch.php b/common/models/UserInfoSearch.php new file mode 100644 index 0000000..768a6b2 --- /dev/null +++ b/common/models/UserInfoSearch.php @@ -0,0 +1,83 @@ + $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([ + 'user_id' => $this->user_id, + 'view_count' => $this->view_count, + 'date_visit' => $this->date_visit, + 'user_info_id' => $this->user_info_id, + 'contract' => $this->contract, + 'estimate' => $this->estimate, + 'purchase' => $this->purchase, + 'delivery' => $this->delivery, + 'prepayment' => $this->prepayment, + ]); + + $query->andFilterWhere(['like', 'busy', $this->busy]) + ->andFilterWhere(['like', 'experience', $this->experience]) + ->andFilterWhere(['like', 'rank', $this->rank]) + ->andFilterWhere(['like', 'salary', $this->salary]) + ->andFilterWhere(['like', 'job', $this->job]) + ->andFilterWhere(['like', 'location', $this->location]) + ->andFilterWhere(['like', 'soft', $this->soft]) + ->andFilterWhere(['like', 'guarantee', $this->guarantee]) + ->andFilterWhere(['like', 'about', $this->about]); + + return $dataProvider; + } +} diff --git a/common/modules/blog/Module.php b/common/modules/blog/Module.php index 9a800a5..8752f7e 100644 --- a/common/modules/blog/Module.php +++ b/common/modules/blog/Module.php @@ -1,6 +1,8 @@ request->post(), 'User', 10, [['name' => 'phone', 'template' => 'text', 'translate' => true], ['name' => 'adres', 'template' => 'text', 'translate' => false]]); + $form[0] = Option::create(\Yii::$app->request->post(), 'User', 10, [['name' => 'phone', 'template' => 'text', 'translate' => true], ['name' => 'adres', 'template' => 'text', 'translate' => false]], true); if($form[0]['success'] == false) { return $this->render('create', ['forms' => $form]); } else { diff --git a/frontend/controllers/UserInfoController.php b/frontend/controllers/UserInfoController.php new file mode 100644 index 0000000..b905472 --- /dev/null +++ b/frontend/controllers/UserInfoController.php @@ -0,0 +1,121 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['post'], + ], + ], + ]; + } + + /** + * Lists all UserInfo models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new UserInfoSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single UserInfo model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new UserInfo model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new UserInfo(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->user_info_id]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing UserInfo model. + * If update is successful, the browser will be redirected to the 'view' page. + * @param integer $id + * @return mixed + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->user_info_id]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing UserInfo model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * @param integer $id + * @return mixed + */ + public function actionDelete($id) + { + $this->findModel($id)->delete(); + + return $this->redirect(['index']); + } + + /** + * Finds the UserInfo model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return UserInfo the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = UserInfo::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/frontend/views/user-info/_form.php b/frontend/views/user-info/_form.php new file mode 100644 index 0000000..bb81e2d --- /dev/null +++ b/frontend/views/user-info/_form.php @@ -0,0 +1,55 @@ + + +
+ + + + field($model, 'user_id')->textInput() ?> + + field($model, 'view_count')->textInput() ?> + + field($model, 'busy')->textInput(['maxlength' => true]) ?> + + field($model, 'date_visit')->textInput() ?> + + field($model, 'experience')->textInput() ?> + + field($model, 'rank')->textInput(['maxlength' => true]) ?> + + field($model, 'salary')->textInput(['maxlength' => true]) ?> + + field($model, 'job')->textInput(['maxlength' => true]) ?> + + field($model, 'location')->textInput(['maxlength' => true]) ?> + + field($model, 'soft')->textInput() ?> + + field($model, 'guarantee')->textInput() ?> + + field($model, 'contract')->textInput() ?> + + field($model, 'estimate')->textInput() ?> + + field($model, 'purchase')->textInput() ?> + + field($model, 'delivery')->textInput() ?> + + field($model, 'prepayment')->textInput() ?> + + field($model, 'about')->textarea(['rows' => 6]) ?> + +
+ isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/frontend/views/user-info/_search.php b/frontend/views/user-info/_search.php new file mode 100644 index 0000000..5f6c260 --- /dev/null +++ b/frontend/views/user-info/_search.php @@ -0,0 +1,61 @@ + + + diff --git a/frontend/views/user-info/create.php b/frontend/views/user-info/create.php new file mode 100644 index 0000000..14b653f --- /dev/null +++ b/frontend/views/user-info/create.php @@ -0,0 +1,21 @@ +title = Yii::t('app', 'Create User Info'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'User Infos'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/frontend/views/user-info/index.php b/frontend/views/user-info/index.php new file mode 100644 index 0000000..6132f44 --- /dev/null +++ b/frontend/views/user-info/index.php @@ -0,0 +1,51 @@ +title = Yii::t('app', 'User Infos'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ render('_search', ['model' => $searchModel]); ?> + +

+ 'btn btn-success']) ?> +

+ + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'user_id', + 'view_count', + 'busy', + 'date_visit', + 'experience', + // 'rank', + // 'salary', + // 'job', + // 'location', + // 'soft', + // 'user_info_id', + // 'guarantee', + // 'contract', + // 'estimate', + // 'purchase', + // 'delivery', + // 'prepayment', + // 'about:ntext', + + ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> + +
diff --git a/frontend/views/user-info/update.php b/frontend/views/user-info/update.php new file mode 100644 index 0000000..1a622cc --- /dev/null +++ b/frontend/views/user-info/update.php @@ -0,0 +1,23 @@ +title = Yii::t('app', 'Update {modelClass}: ', [ + 'modelClass' => 'User Info', +]) . ' ' . $model->user_info_id; +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'User Infos'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->user_info_id, 'url' => ['view', 'id' => $model->user_info_id]]; +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/frontend/views/user-info/view.php b/frontend/views/user-info/view.php new file mode 100644 index 0000000..5381041 --- /dev/null +++ b/frontend/views/user-info/view.php @@ -0,0 +1,52 @@ +title = $model->user_info_id; +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'User Infos'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ $model->user_info_id], ['class' => 'btn btn-primary']) ?> + $model->user_info_id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ]) ?> +

+ + $model, + 'attributes' => [ + 'user_id', + 'view_count', + 'busy', + 'date_visit', + 'experience', + 'rank', + 'salary', + 'job', + 'location', + 'soft', + 'user_info_id', + 'guarantee', + 'contract', + 'estimate', + 'purchase', + 'delivery', + 'prepayment', + 'about:ntext', + ], + ]) ?> + +
-- libgit2 0.21.4