From 97fb6489c3e414573a2e143dfc57cd77b9784134 Mon Sep 17 00:00:00 2001 From: Yarik Date: Thu, 28 Jan 2016 10:41:06 +0200 Subject: [PATCH] test --- common/models/Option.php | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/OptionLang.php | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/OptionLangSearch.php | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/OptionSearch.php | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ console/migrations/m160125_151635_delete_lang_field.php | 27 +++++++++++++++++++++++++++ frontend/assets/AdminAsset.php | 2 +- frontend/assets/AppAsset.php | 2 +- frontend/controllers/OptionLangController.php | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/controllers/PerformerController.php | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/controllers/ProfileController.php | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/controllers/TenderController.php | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/controllers/VacancyController.php | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/layouts/main.php | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------- frontend/views/layouts/performer.php | 38 ++++++++++++++++++++++++++++++++++++++ frontend/views/option-lang/_form.php | 31 +++++++++++++++++++++++++++++++ frontend/views/option-lang/_search.php | 33 +++++++++++++++++++++++++++++++++ frontend/views/option-lang/create.php | 21 +++++++++++++++++++++ frontend/views/option-lang/index.php | 37 +++++++++++++++++++++++++++++++++++++ frontend/views/option-lang/update.php | 23 +++++++++++++++++++++++ frontend/views/option-lang/view.php | 38 ++++++++++++++++++++++++++++++++++++++ frontend/views/performer/blog-list.php | 183 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/performer/blog-view.php | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/performer/common.php | 339 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/performer/index.php | 8 ++++++++ frontend/views/performer/portfolio.php | 315 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/performer/search.php | 467 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/profile/search.php | 489 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/tender/index.php | 8 ++++++++ frontend/views/tender/search.php | 489 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/tender/view.php | 384 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/vacancy/search.php | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 31 files changed, 3954 insertions(+), 64 deletions(-) create mode 100644 common/models/Option.php create mode 100644 common/models/OptionLang.php create mode 100644 common/models/OptionLangSearch.php create mode 100644 common/models/OptionSearch.php create mode 100644 console/migrations/m160125_151635_delete_lang_field.php create mode 100644 frontend/controllers/OptionLangController.php create mode 100644 frontend/controllers/PerformerController.php create mode 100644 frontend/controllers/ProfileController.php create mode 100644 frontend/controllers/TenderController.php create mode 100644 frontend/controllers/VacancyController.php create mode 100644 frontend/views/layouts/performer.php create mode 100644 frontend/views/option-lang/_form.php create mode 100644 frontend/views/option-lang/_search.php create mode 100644 frontend/views/option-lang/create.php create mode 100644 frontend/views/option-lang/index.php create mode 100644 frontend/views/option-lang/update.php create mode 100644 frontend/views/option-lang/view.php create mode 100644 frontend/views/performer/blog-list.php create mode 100644 frontend/views/performer/blog-view.php create mode 100644 frontend/views/performer/common.php create mode 100644 frontend/views/performer/index.php create mode 100644 frontend/views/performer/portfolio.php create mode 100644 frontend/views/performer/search.php create mode 100644 frontend/views/profile/search.php create mode 100644 frontend/views/tender/index.php create mode 100644 frontend/views/tender/search.php create mode 100644 frontend/views/tender/view.php create mode 100644 frontend/views/vacancy/search.php diff --git a/common/models/Option.php b/common/models/Option.php new file mode 100644 index 0000000..ab31dd0 --- /dev/null +++ b/common/models/Option.php @@ -0,0 +1,88 @@ + 200] + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'model' => Yii::t('app', 'Model'), + 'option_id' => Yii::t('app', 'Option ID'), + 'model_id' => Yii::t('app', 'Model ID'), + 'name' => Yii::t('app', 'Name'), + 'template' => Yii::t('app', 'Template'), + 'option_pid' => Yii::t('app', 'Option Pid'), + 'date_add' => Yii::t('app', 'Date Add'), + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getParent() + { + return $this->hasOne(Option::className(), ['option_id' => 'option_pid']); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getChildren() + { + return $this->hasMany(Option::className(), ['option_pid' => 'option_id']); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getOptionLangs() + { + return $this->hasMany(OptionLang::className(), ['option_id' => 'option_id']); + } + + public function getValue() + { + return $this->hasOne(OptionLang::className(), ['option_id' => 'option_id'])->where(['option_lang.language_id' => 0]); + } +} diff --git a/common/models/OptionLang.php b/common/models/OptionLang.php new file mode 100644 index 0000000..1f3b390 --- /dev/null +++ b/common/models/OptionLang.php @@ -0,0 +1,67 @@ + Yii::t('app', 'Option Lang ID'), + 'option_id' => Yii::t('app', 'Option ID'), + 'language_id' => Yii::t('app', 'Language ID'), + 'value' => Yii::t('app', 'Value'), + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getLanguage() + { + return $this->hasOne(Language::className(), ['language_id' => 'language_id']); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getOption() + { + return $this->hasOne(Option::className(), ['option_id' => 'option_id']); + } +} diff --git a/common/models/OptionLangSearch.php b/common/models/OptionLangSearch.php new file mode 100644 index 0000000..f610016 --- /dev/null +++ b/common/models/OptionLangSearch.php @@ -0,0 +1,68 @@ + $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([ + 'option_lang_id' => $this->option_lang_id, + 'option_id' => $this->option_id, + 'language_id' => $this->language_id, + ]); + + $query->andFilterWhere(['like', 'value', $this->value]); + + return $dataProvider; + } +} diff --git a/common/models/OptionSearch.php b/common/models/OptionSearch.php new file mode 100644 index 0000000..14c7bff --- /dev/null +++ b/common/models/OptionSearch.php @@ -0,0 +1,71 @@ + $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([ + 'option_id' => $this->option_id, + 'model_id' => $this->model_id, + 'option_pid' => $this->option_pid, + 'date_add' => $this->date_add, + ]); + + $query->andFilterWhere(['like', 'model', $this->model]) + ->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'template', $this->template]); + + return $dataProvider; + } +} diff --git a/console/migrations/m160125_151635_delete_lang_field.php b/console/migrations/m160125_151635_delete_lang_field.php new file mode 100644 index 0000000..0b3a7a2 --- /dev/null +++ b/console/migrations/m160125_151635_delete_lang_field.php @@ -0,0 +1,27 @@ +dropColumn('option', 'translate'); + } + + public function down() + { + $this->addColumn('option', 'translate', $this->smallInteger()); + } + +// public function safeUp() +// { +// $this->dropColumn('option', 'translate'); +// } +// +// public function safeDown() +// { +// $this->addColumn('option', 'translate', $this->smallInteger()); +// } +} diff --git a/frontend/assets/AdminAsset.php b/frontend/assets/AdminAsset.php index 2173f44..551582f 100755 --- a/frontend/assets/AdminAsset.php +++ b/frontend/assets/AdminAsset.php @@ -20,7 +20,7 @@ class AdminAsset extends AssetBundle public $css = [ 'css/style.css', '/admin/css/flags32.css', - 'https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin', + //'https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin', ]; public $js = [ 'js/script.js', diff --git a/frontend/assets/AppAsset.php b/frontend/assets/AppAsset.php index d141d22..b96f39d 100755 --- a/frontend/assets/AppAsset.php +++ b/frontend/assets/AppAsset.php @@ -20,7 +20,7 @@ class AppAsset extends AssetBundle public $css = [ 'css/style.css', '/admin/css/flags32.css', - 'https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin', + //'https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin', ]; public $js = [ 'js/script.js', diff --git a/frontend/controllers/OptionLangController.php b/frontend/controllers/OptionLangController.php new file mode 100644 index 0000000..1cd5634 --- /dev/null +++ b/frontend/controllers/OptionLangController.php @@ -0,0 +1,124 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['post'], + ], + ], + ]; + } + + /** + * Lists all OptionLang models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new OptionLangSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single OptionLang model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new OptionLang model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new OptionLang(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->option_lang_id]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing OptionLang 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->option_lang_id]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing OptionLang 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 OptionLang model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return OptionLang the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = OptionLang::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/frontend/controllers/PerformerController.php b/frontend/controllers/PerformerController.php new file mode 100644 index 0000000..cd352d1 --- /dev/null +++ b/frontend/controllers/PerformerController.php @@ -0,0 +1,80 @@ + [ + 'class' => 'yii\web\ErrorAction', + ], + 'captcha' => [ + 'class' => 'yii\captcha\CaptchaAction', + 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, + ], + ]; + } + + /** + * Displays homepage. + * + * @return mixed + */ + public function actionSearch() + { + return $this->render('search'); + } + + public function actionCommon(/*$performer_id*/) + { + return $this->render('common'); + } + + public function actionPortfolio(/*$performer_id*/) + { + return $this->render('portfolio'); + } + + public function actionBlogList(/*$performer_id*/) + { + return $this->render('blog-list'); + } + + public function actionBlogView(/*$performer_id, $article_id*/) + { + return $this->render('blog-view'); + } + +} diff --git a/frontend/controllers/ProfileController.php b/frontend/controllers/ProfileController.php new file mode 100644 index 0000000..a85f779 --- /dev/null +++ b/frontend/controllers/ProfileController.php @@ -0,0 +1,58 @@ + [ + 'class' => 'yii\web\ErrorAction', + ], + 'captcha' => [ + 'class' => 'yii\captcha\CaptchaAction', + 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, + ], + ]; + } + + /** + * Displays homepage. + * + * @return mixed + */ + public function actionSearch() + { + return $this->render('search'); + } + +} diff --git a/frontend/controllers/TenderController.php b/frontend/controllers/TenderController.php new file mode 100644 index 0000000..54f958d --- /dev/null +++ b/frontend/controllers/TenderController.php @@ -0,0 +1,66 @@ + [ + 'class' => 'yii\web\ErrorAction', + ], + 'captcha' => [ + 'class' => 'yii\captcha\CaptchaAction', + 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, + ], + ]; + } + /** + * Displays homepage. + * + * @return mixed + */ + public function actionIndex() + { + return $this->render('index'); + } + + public function actionView(/*$tender_id*/) + { + return $this->render('view'); + } + + public function actionSearch() + { + return $this->render('search'); + } + +} diff --git a/frontend/controllers/VacancyController.php b/frontend/controllers/VacancyController.php new file mode 100644 index 0000000..221ef17 --- /dev/null +++ b/frontend/controllers/VacancyController.php @@ -0,0 +1,57 @@ + [ + 'class' => 'yii\web\ErrorAction', + ], + 'captcha' => [ + 'class' => 'yii\captcha\CaptchaAction', + 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, + ], + ]; + } + /** + * Displays homepage. + * + * @return mixed + */ + public function actionSearch() + { + return $this->render('search'); + } + +} diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index f15a65c..e139fb8 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -17,7 +17,7 @@ AppAsset::register($this); - + @@ -62,67 +62,60 @@ AppAsset::register($this);