Commit 1face72c73af14409b4402e14c107f180456cdf2

Authored by Yarik
1 parent 57e9745b

test

common/config/main-local.php
... ... @@ -3,9 +3,9 @@ return [
3 3 'components' => [
4 4 'db' => [
5 5 'class' => 'yii\db\Connection',
6   - 'dsn' => 'pgsql:host=195.248.225.149;port=5432;dbname=mfp',
7   - 'username' => 'test33',
8   - 'password' => 'E4q2N7i9',
  6 + 'dsn' => 'pgsql:host=127.0.0.1;port=5432;dbname=mfp_local',
  7 + 'username' => 'postgres',
  8 + 'password' => '',
9 9 'schemaMap' => [
10 10 'pgsql'=> [
11 11 'class'=>'yii\db\pgsql\Schema',
... ...
common/config/main.php
... ... @@ -13,7 +13,7 @@ return [
13 13 ],
14 14 ],
15 15 'bootstrap' => [
16   - 'options',
  16 + 'options'
17 17 ],
18 18 'components' => [
19 19 'cache' => [
... ...
common/models/UserInfo.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +
  7 +/**
  8 + * This is the model class for table "user_info".
  9 + *
  10 + * @property integer $user_id
  11 + * @property integer $view_count
  12 + * @property string $busy
  13 + * @property string $date_visit
  14 + * @property string $experience
  15 + * @property string $rank
  16 + * @property string $salary
  17 + * @property string $job
  18 + * @property string $location
  19 + * @property string $soft
  20 + * @property integer $user_info_id
  21 + * @property string $guarantee
  22 + * @property integer $contract
  23 + * @property integer $estimate
  24 + * @property integer $purchase
  25 + * @property integer $delivery
  26 + * @property double $prepayment
  27 + * @property string $about
  28 + */
  29 +class UserInfo extends \yii\db\ActiveRecord
  30 +{
  31 + /**
  32 + * @inheritdoc
  33 + */
  34 + public static function tableName()
  35 + {
  36 + return 'user_info';
  37 + }
  38 +
  39 + /**
  40 + * @inheritdoc
  41 + */
  42 + public function rules()
  43 + {
  44 + return [
  45 + [['user_id', 'view_count', 'contract', 'estimate', 'purchase', 'delivery'], 'integer'],
  46 + [['date_visit'], 'safe'],
  47 + [['experience', 'soft', 'guarantee', 'about'], 'string'],
  48 + [['prepayment'], 'number'],
  49 + [['busy', 'rank', 'location'], 'string', 'max' => 50],
  50 + [['salary', 'job'], 'string', 'max' => 255]
  51 + ];
  52 + }
  53 +
  54 + /**
  55 + * @inheritdoc
  56 + */
  57 + public function attributeLabels()
  58 + {
  59 + return [
  60 + 'user_id' => Yii::t('app', 'User ID'),
  61 + 'view_count' => Yii::t('app', 'View Count'),
  62 + 'busy' => Yii::t('app', 'Busy'),
  63 + 'date_visit' => Yii::t('app', 'Date Visit'),
  64 + 'experience' => Yii::t('app', 'Experience'),
  65 + 'rank' => Yii::t('app', 'Rank'),
  66 + 'salary' => Yii::t('app', 'Salary'),
  67 + 'job' => Yii::t('app', 'Job'),
  68 + 'location' => Yii::t('app', 'Location'),
  69 + 'soft' => Yii::t('app', 'Soft'),
  70 + 'user_info_id' => Yii::t('app', 'User Info ID'),
  71 + 'guarantee' => Yii::t('app', 'Guarantee'),
  72 + 'contract' => Yii::t('app', 'Contract'),
  73 + 'estimate' => Yii::t('app', 'Estimate'),
  74 + 'purchase' => Yii::t('app', 'Purchase'),
  75 + 'delivery' => Yii::t('app', 'Delivery'),
  76 + 'prepayment' => Yii::t('app', 'Prepayment'),
  77 + 'about' => Yii::t('app', 'About'),
  78 + ];
  79 + }
  80 +}
... ...
common/models/UserInfoSearch.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use common\models\UserInfo;
  9 +
  10 +/**
  11 + * UserInfoSearch represents the model behind the search form about `common\models\UserInfo`.
  12 + */
  13 +class UserInfoSearch extends UserInfo
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['user_id', 'view_count', 'user_info_id', 'contract', 'estimate', 'purchase', 'delivery'], 'integer'],
  22 + [['busy', 'date_visit', 'experience', 'rank', 'salary', 'job', 'location', 'soft', 'guarantee', 'about'], 'safe'],
  23 + [['prepayment'], 'number'],
  24 + ];
  25 + }
  26 +
  27 + /**
  28 + * @inheritdoc
  29 + */
  30 + public function scenarios()
  31 + {
  32 + // bypass scenarios() implementation in the parent class
  33 + return Model::scenarios();
  34 + }
  35 +
  36 + /**
  37 + * Creates data provider instance with search query applied
  38 + *
  39 + * @param array $params
  40 + *
  41 + * @return ActiveDataProvider
  42 + */
  43 + public function search($params)
  44 + {
  45 + $query = UserInfo::find();
  46 +
  47 + $dataProvider = new ActiveDataProvider([
  48 + 'query' => $query,
  49 + ]);
  50 +
  51 + $this->load($params);
  52 +
  53 + if (!$this->validate()) {
  54 + // uncomment the following line if you do not want to return any records when validation fails
  55 + // $query->where('0=1');
  56 + return $dataProvider;
  57 + }
  58 +
  59 + $query->andFilterWhere([
  60 + 'user_id' => $this->user_id,
  61 + 'view_count' => $this->view_count,
  62 + 'date_visit' => $this->date_visit,
  63 + 'user_info_id' => $this->user_info_id,
  64 + 'contract' => $this->contract,
  65 + 'estimate' => $this->estimate,
  66 + 'purchase' => $this->purchase,
  67 + 'delivery' => $this->delivery,
  68 + 'prepayment' => $this->prepayment,
  69 + ]);
  70 +
  71 + $query->andFilterWhere(['like', 'busy', $this->busy])
  72 + ->andFilterWhere(['like', 'experience', $this->experience])
  73 + ->andFilterWhere(['like', 'rank', $this->rank])
  74 + ->andFilterWhere(['like', 'salary', $this->salary])
  75 + ->andFilterWhere(['like', 'job', $this->job])
  76 + ->andFilterWhere(['like', 'location', $this->location])
  77 + ->andFilterWhere(['like', 'soft', $this->soft])
  78 + ->andFilterWhere(['like', 'guarantee', $this->guarantee])
  79 + ->andFilterWhere(['like', 'about', $this->about]);
  80 +
  81 + return $dataProvider;
  82 + }
  83 +}
... ...
common/modules/blog/Module.php
1 1 <?php
2 2 namespace common\modules\blog;
3 3  
  4 +use yii\base\BootstrapInterface;
  5 +
4 6 class Module extends \yii\base\Module
5 7 {
6 8 public function init()
... ... @@ -9,4 +11,5 @@ class Module extends \yii\base\Module
9 11  
10 12 \Yii::configure($this, require(__DIR__.'/config.php'));
11 13 }
  14 +
12 15 }
... ...
frontend/controllers/OptionController.php
... ... @@ -61,7 +61,7 @@ class OptionController extends Controller
61 61 */
62 62 public function actionCreate()
63 63 {
64   - $form[0] = Option::create(\Yii::$app->request->post(), 'User', 10, [['name' => 'phone', 'template' => 'text', 'translate' => true], ['name' => 'adres', 'template' => 'text', 'translate' => false]]);
  64 + $form[0] = Option::create(\Yii::$app->request->post(), 'User', 10, [['name' => 'phone', 'template' => 'text', 'translate' => true], ['name' => 'adres', 'template' => 'text', 'translate' => false]], true);
65 65 if($form[0]['success'] == false) {
66 66 return $this->render('create', ['forms' => $form]);
67 67 } else {
... ...
frontend/controllers/UserInfoController.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace frontend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\UserInfo;
  7 +use common\models\UserInfoSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +
  12 +/**
  13 + * UserInfoController implements the CRUD actions for UserInfo model.
  14 + */
  15 +class UserInfoController extends Controller
  16 +{
  17 + public function behaviors()
  18 + {
  19 + return [
  20 + 'verbs' => [
  21 + 'class' => VerbFilter::className(),
  22 + 'actions' => [
  23 + 'delete' => ['post'],
  24 + ],
  25 + ],
  26 + ];
  27 + }
  28 +
  29 + /**
  30 + * Lists all UserInfo models.
  31 + * @return mixed
  32 + */
  33 + public function actionIndex()
  34 + {
  35 + $searchModel = new UserInfoSearch();
  36 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  37 +
  38 + return $this->render('index', [
  39 + 'searchModel' => $searchModel,
  40 + 'dataProvider' => $dataProvider,
  41 + ]);
  42 + }
  43 +
  44 + /**
  45 + * Displays a single UserInfo model.
  46 + * @param integer $id
  47 + * @return mixed
  48 + */
  49 + public function actionView($id)
  50 + {
  51 + return $this->render('view', [
  52 + 'model' => $this->findModel($id),
  53 + ]);
  54 + }
  55 +
  56 + /**
  57 + * Creates a new UserInfo model.
  58 + * If creation is successful, the browser will be redirected to the 'view' page.
  59 + * @return mixed
  60 + */
  61 + public function actionCreate()
  62 + {
  63 + $model = new UserInfo();
  64 +
  65 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  66 + return $this->redirect(['view', 'id' => $model->user_info_id]);
  67 + } else {
  68 + return $this->render('create', [
  69 + 'model' => $model,
  70 + ]);
  71 + }
  72 + }
  73 +
  74 + /**
  75 + * Updates an existing UserInfo model.
  76 + * If update is successful, the browser will be redirected to the 'view' page.
  77 + * @param integer $id
  78 + * @return mixed
  79 + */
  80 + public function actionUpdate($id)
  81 + {
  82 + $model = $this->findModel($id);
  83 +
  84 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  85 + return $this->redirect(['view', 'id' => $model->user_info_id]);
  86 + } else {
  87 + return $this->render('update', [
  88 + 'model' => $model,
  89 + ]);
  90 + }
  91 + }
  92 +
  93 + /**
  94 + * Deletes an existing UserInfo model.
  95 + * If deletion is successful, the browser will be redirected to the 'index' page.
  96 + * @param integer $id
  97 + * @return mixed
  98 + */
  99 + public function actionDelete($id)
  100 + {
  101 + $this->findModel($id)->delete();
  102 +
  103 + return $this->redirect(['index']);
  104 + }
  105 +
  106 + /**
  107 + * Finds the UserInfo model based on its primary key value.
  108 + * If the model is not found, a 404 HTTP exception will be thrown.
  109 + * @param integer $id
  110 + * @return UserInfo the loaded model
  111 + * @throws NotFoundHttpException if the model cannot be found
  112 + */
  113 + protected function findModel($id)
  114 + {
  115 + if (($model = UserInfo::findOne($id)) !== null) {
  116 + return $model;
  117 + } else {
  118 + throw new NotFoundHttpException('The requested page does not exist.');
  119 + }
  120 + }
  121 +}
... ...
frontend/views/user-info/_form.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\UserInfo */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="user-info-form">
  12 +
  13 + <?php $form = ActiveForm::begin(); ?>
  14 +
  15 + <?= $form->field($model, 'user_id')->textInput() ?>
  16 +
  17 + <?= $form->field($model, 'view_count')->textInput() ?>
  18 +
  19 + <?= $form->field($model, 'busy')->textInput(['maxlength' => true]) ?>
  20 +
  21 + <?= $form->field($model, 'date_visit')->textInput() ?>
  22 +
  23 + <?= $form->field($model, 'experience')->textInput() ?>
  24 +
  25 + <?= $form->field($model, 'rank')->textInput(['maxlength' => true]) ?>
  26 +
  27 + <?= $form->field($model, 'salary')->textInput(['maxlength' => true]) ?>
  28 +
  29 + <?= $form->field($model, 'job')->textInput(['maxlength' => true]) ?>
  30 +
  31 + <?= $form->field($model, 'location')->textInput(['maxlength' => true]) ?>
  32 +
  33 + <?= $form->field($model, 'soft')->textInput() ?>
  34 +
  35 + <?= $form->field($model, 'guarantee')->textInput() ?>
  36 +
  37 + <?= $form->field($model, 'contract')->textInput() ?>
  38 +
  39 + <?= $form->field($model, 'estimate')->textInput() ?>
  40 +
  41 + <?= $form->field($model, 'purchase')->textInput() ?>
  42 +
  43 + <?= $form->field($model, 'delivery')->textInput() ?>
  44 +
  45 + <?= $form->field($model, 'prepayment')->textInput() ?>
  46 +
  47 + <?= $form->field($model, 'about')->textarea(['rows' => 6]) ?>
  48 +
  49 + <div class="form-group">
  50 + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  51 + </div>
  52 +
  53 + <?php ActiveForm::end(); ?>
  54 +
  55 +</div>
... ...
frontend/views/user-info/_search.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\UserInfoSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="user-info-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'user_id') ?>
  19 +
  20 + <?= $form->field($model, 'view_count') ?>
  21 +
  22 + <?= $form->field($model, 'busy') ?>
  23 +
  24 + <?= $form->field($model, 'date_visit') ?>
  25 +
  26 + <?= $form->field($model, 'experience') ?>
  27 +
  28 + <?php // echo $form->field($model, 'rank') ?>
  29 +
  30 + <?php // echo $form->field($model, 'salary') ?>
  31 +
  32 + <?php // echo $form->field($model, 'job') ?>
  33 +
  34 + <?php // echo $form->field($model, 'location') ?>
  35 +
  36 + <?php // echo $form->field($model, 'soft') ?>
  37 +
  38 + <?php // echo $form->field($model, 'user_info_id') ?>
  39 +
  40 + <?php // echo $form->field($model, 'guarantee') ?>
  41 +
  42 + <?php // echo $form->field($model, 'contract') ?>
  43 +
  44 + <?php // echo $form->field($model, 'estimate') ?>
  45 +
  46 + <?php // echo $form->field($model, 'purchase') ?>
  47 +
  48 + <?php // echo $form->field($model, 'delivery') ?>
  49 +
  50 + <?php // echo $form->field($model, 'prepayment') ?>
  51 +
  52 + <?php // echo $form->field($model, 'about') ?>
  53 +
  54 + <div class="form-group">
  55 + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
  56 + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
  57 + </div>
  58 +
  59 + <?php ActiveForm::end(); ?>
  60 +
  61 +</div>
... ...
frontend/views/user-info/create.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\UserInfo */
  8 +
  9 +$this->title = Yii::t('app', 'Create User Info');
  10 +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'User Infos'), 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="user-info-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
frontend/views/user-info/index.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\UserInfoSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = Yii::t('app', 'User Infos');
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="user-info-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a(Yii::t('app', 'Create User Info'), ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 +
  22 + <?= GridView::widget([
  23 + 'dataProvider' => $dataProvider,
  24 + 'filterModel' => $searchModel,
  25 + 'columns' => [
  26 + ['class' => 'yii\grid\SerialColumn'],
  27 +
  28 + 'user_id',
  29 + 'view_count',
  30 + 'busy',
  31 + 'date_visit',
  32 + 'experience',
  33 + // 'rank',
  34 + // 'salary',
  35 + // 'job',
  36 + // 'location',
  37 + // 'soft',
  38 + // 'user_info_id',
  39 + // 'guarantee',
  40 + // 'contract',
  41 + // 'estimate',
  42 + // 'purchase',
  43 + // 'delivery',
  44 + // 'prepayment',
  45 + // 'about:ntext',
  46 +
  47 + ['class' => 'yii\grid\ActionColumn'],
  48 + ],
  49 + ]); ?>
  50 +
  51 +</div>
... ...
frontend/views/user-info/update.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\UserInfo */
  7 +
  8 +$this->title = Yii::t('app', 'Update {modelClass}: ', [
  9 + 'modelClass' => 'User Info',
  10 +]) . ' ' . $model->user_info_id;
  11 +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'User Infos'), 'url' => ['index']];
  12 +$this->params['breadcrumbs'][] = ['label' => $model->user_info_id, 'url' => ['view', 'id' => $model->user_info_id]];
  13 +$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
  14 +?>
  15 +<div class="user-info-update">
  16 +
  17 + <h1><?= Html::encode($this->title) ?></h1>
  18 +
  19 + <?= $this->render('_form', [
  20 + 'model' => $model,
  21 + ]) ?>
  22 +
  23 +</div>
... ...
frontend/views/user-info/view.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\UserInfo */
  8 +
  9 +$this->title = $model->user_info_id;
  10 +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'User Infos'), 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="user-info-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->user_info_id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->user_info_id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'user_id',
  32 + 'view_count',
  33 + 'busy',
  34 + 'date_visit',
  35 + 'experience',
  36 + 'rank',
  37 + 'salary',
  38 + 'job',
  39 + 'location',
  40 + 'soft',
  41 + 'user_info_id',
  42 + 'guarantee',
  43 + 'contract',
  44 + 'estimate',
  45 + 'purchase',
  46 + 'delivery',
  47 + 'prepayment',
  48 + 'about:ntext',
  49 + ],
  50 + ]) ?>
  51 +
  52 +</div>
... ...