From fdc1c9de786afaa8a7a7713135eaac19fefd2f8f Mon Sep 17 00:00:00 2001 From: Yarik Date: Thu, 7 Apr 2016 16:04:13 +0300 Subject: [PATCH] test --- common/components/UserStore.php | 42 ++++++++++++++++++++++++++++++++++++++++++ common/components/Validator.php | 27 +++++++++++++++++++++++++++ common/models/Portfolio.php | 5 +++++ common/models/PortfolioUser.php | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/UserSearch.php | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/modules/comment/assets/CommentAsset.php | 5 +++++ common/modules/comment/models/Comment.php | 3 +++ composer.json | 4 +++- composer.lock | 365 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------- frontend/assets/AppAsset.php | 8 ++++++-- frontend/controllers/AccountsController.php | 48 +++++++++++++++++++++++++++++++++++++++++++----- frontend/controllers/AjaxController.php | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/test/UserFixture.php | 10 ++++++++++ frontend/test/UserInfoFixture.php | 15 +++++++++++++++ frontend/test/data/user.php | 15 +++++++++++++++ frontend/test/unit/models/UserInfoTest.php | 16 ++++++++++++++++ frontend/views/accounts/_portfolio_form.php | 209 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------- frontend/views/ajax/project_user.php | 33 +++++++++++++++++++++++++++++++++ frontend/views/ajax/users.php | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/company/portfolio-view.php | 365 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------- frontend/views/site/help.php | 1 - frontend/web/css/art_box.css | 2 +- frontend/web/css/owl.carousel.css | 216 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/web/css/style.css | 24 ++++++++++++++++++++++++ frontend/web/js/jquery.scrollbox.min.js | 2 +- frontend/web/js/no-comprss/owl.carousel.js | 3069 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/web/js/owl.carousel.min.js | 2 ++ tests/_bootstrap.php | 19 ++++++++++++++++++- tests/_support/AcceptanceTester.php | 2 +- tests/_support/FunctionalTester.php | 2 +- tests/_support/Helper/Acceptance.php | 1 - tests/_support/Helper/Functional.php | 1 - tests/_support/Helper/Unit.php | 1 - tests/_support/UnitTester.php | 2 +- tests/_support/_generated/AcceptanceTesterActions.php | 2 +- tests/acceptance.suite.yml | 2 +- 36 files changed, 4594 insertions(+), 304 deletions(-) create mode 100644 common/components/UserStore.php create mode 100644 common/components/Validator.php create mode 100644 common/models/PortfolioUser.php create mode 100644 common/models/UserSearch.php create mode 100644 frontend/controllers/AjaxController.php create mode 100644 frontend/test/UserFixture.php create mode 100644 frontend/test/UserInfoFixture.php create mode 100644 frontend/test/data/user.php create mode 100644 frontend/test/unit/models/UserInfoTest.php create mode 100644 frontend/views/ajax/project_user.php create mode 100644 frontend/views/ajax/users.php create mode 100644 frontend/web/css/owl.carousel.css create mode 100644 frontend/web/js/no-comprss/owl.carousel.js create mode 100644 frontend/web/js/owl.carousel.min.js diff --git a/common/components/UserStore.php b/common/components/UserStore.php new file mode 100644 index 0000000..1c8874c --- /dev/null +++ b/common/components/UserStore.php @@ -0,0 +1,42 @@ +users[$email])){ + throw new Exception("Пользователь {$email} уже зарегистрирован"); + } + + if (strlen($pass) < 5 ){ + throw new Exception( + "Длинна пароля должна быть больше 5 символов" + ); + } + + $this->users[$email] = [ + 'pass' => $pass, + 'email' => $email, + 'name' => $name + ]; + + return true; + } + + function notifyPasswordFailure($email){ + if(isset($this->users[$email])){ + $this->users[$email]['failed'] = time(); + } + } + + function getUser($email){ + return ($this->users[$email]); + } + + + +} \ No newline at end of file diff --git a/common/components/Validator.php b/common/components/Validator.php new file mode 100644 index 0000000..a5f2d63 --- /dev/null +++ b/common/components/Validator.php @@ -0,0 +1,27 @@ +store = $store; + } + + public function validateUser($email, $pass){ + if(!is_array($user = $this->store->getUser($email))){ + return false; + } + + if($user['pass'] == $pass){ + return true; + } + + $this->store->notifyPasswordFailure($email); + + return false; + } + + +} \ No newline at end of file diff --git a/common/models/Portfolio.php b/common/models/Portfolio.php index e6a6dd4..661d928 100644 --- a/common/models/Portfolio.php +++ b/common/models/Portfolio.php @@ -187,4 +187,9 @@ { return $this->hasOne(Gallery::className(), [ 'gallery_id' => 'gallery_id' ]); } + + public function getPortfolioUsers() + { + return $this->hasMany(PortfolioUser::className(), ['portfolio_id' => 'portfolio_id'])->with('user'); + } } diff --git a/common/models/PortfolioUser.php b/common/models/PortfolioUser.php new file mode 100644 index 0000000..73ae4bb --- /dev/null +++ b/common/models/PortfolioUser.php @@ -0,0 +1,75 @@ + 255], + [['portfolio_id', 'user_id'], 'unique', 'targetAttribute' => ['portfolio_id', 'user_id'], 'message' => 'The combination of Portfolio ID and User ID has already been taken.'], + [['portfolio_id'], 'exist', 'skipOnError' => true, 'targetClass' => Portfolio::className(), 'targetAttribute' => ['portfolio_id' => 'portfolio_id']], + [['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['user_id' => 'id']], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'portfolio_user_id' => Yii::t('app', 'Portfolio User ID'), + 'portfolio_id' => Yii::t('app', 'Portfolio ID'), + 'user_id' => Yii::t('app', 'User ID'), + 'position' => Yii::t('app', 'Position'), + 'time' => Yii::t('app', 'Time'), + 'status' => Yii::t('app', 'Status'), + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getPortfolio() + { + return $this->hasOne(Portfolio::className(), ['portfolio_id' => 'portfolio_id']); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getUser() + { + return $this->hasOne(User::className(), ['id' => 'user_id']); + } +} diff --git a/common/models/UserSearch.php b/common/models/UserSearch.php new file mode 100644 index 0000000..711f105 --- /dev/null +++ b/common/models/UserSearch.php @@ -0,0 +1,116 @@ + 1, + ], + [ + [ + 'name_search', + 'surname_search', + 'specialization', + ], + 'safe', + ], + ]; + } + + /** + * @inheritdoc + */ + public function scenarios() + { + return Model::scenarios(); + } + + /** + * Creates data provider instance with search query applied + * + * @param array $params + * + * @return ActiveDataProvider + */ + public function search($params) + { + $query = User::find() + ->joinWith('userInfo'); + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + 'pagination' => new Pagination([ + 'pageSize' => 10, + ]), + 'sort' => new Sort([ + 'defaultOrder' => [ + 'id' => SORT_ASC, + ], + ]), + ]); + + $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; + } + + if(!empty( $this->specialization )) { + $specialization_id = User::find() + ->joinWith('specializations') + ->select(['user.id'], 'DISTINCT') + ->where([ + 'like', + 'LOWER(specialization.specialization_name)', + mb_strtolower($this->specialization), + ]) + ->asArray() + ->column(); + $query->andWhere(['user.id' => $specialization_id]); + } + + $query->andFilterWhere([ + 'id' => $this->id, + ]); + + $query->andFilterWhere([ + 'like', + 'LOWER(firstname)', + mb_strtolower($this->name_search), + ]) + ->andFilterWhere([ + 'like', + 'LOWER(lastname)', + mb_strtolower($this->surname_search), + ]); + + return $dataProvider; + } + } diff --git a/common/modules/comment/assets/CommentAsset.php b/common/modules/comment/assets/CommentAsset.php index edf61a8..3db5e5c 100644 --- a/common/modules/comment/assets/CommentAsset.php +++ b/common/modules/comment/assets/CommentAsset.php @@ -3,6 +3,7 @@ class CommentAsset extends \yii\web\AssetBundle { + public $sourcePath = '@common/modules/comment/resources'; public $css = [ @@ -18,4 +19,8 @@ '\yii\web\JqueryAsset', ]; + public $jsOptions = [ + 'position' => \yii\web\View::POS_READY, + ]; + } \ No newline at end of file diff --git a/common/modules/comment/models/Comment.php b/common/modules/comment/models/Comment.php index 69a0f19..ee0708a 100644 --- a/common/modules/comment/models/Comment.php +++ b/common/modules/comment/models/Comment.php @@ -133,6 +133,9 @@ parent::afterSave($insert, $changedAttributes); } + /** + * @inheritdoc + */ public static function tableName() { return '{{%comment}}'; diff --git a/composer.json b/composer.json index 7d86c55..1e929e9 100755 --- a/composer.json +++ b/composer.json @@ -29,7 +29,9 @@ "kartik-v/yii2-widget-colorinput": "*", "2amigos/yii2-transliterator-helper": "*", "rmrevin/yii2-comments": "1.4.*", - "codeception/codeception":"*" + "codeception/codeception":"*", + "yiisoft/yii2-codeception": "~2.0.0", + "bower-asset/fancybox": "^2.1" }, "require-dev": { "yiisoft/yii2-debug": "*", diff --git a/composer.lock b/composer.lock index bfaca77..e7530a4 100755 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "339705c7dacfdc2f67cc7fccc576934b", - "content-hash": "a1a45a52bb26fe4e63dfccd69d0a3991", + "hash": "663167525967cc58c1d361d1e98c002f", + "content-hash": "f093c935fec42d8be127e4a2cf8fe95f", "packages": [ { "name": "2amigos/yii2-transliterator-helper", @@ -199,6 +199,22 @@ ] }, { + "name": "bower-asset/fancybox", + "version": "v2.1.5", + "source": { + "type": "git", + "url": "https://github.com/fancyapps/fancyBox.git", + "reference": "e2248f468dc4b45f5b1ef1776bde958b2b52775d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fancyapps/fancyBox/zipball/e2248f468dc4b45f5b1ef1776bde958b2b52775d", + "reference": "e2248f468dc4b45f5b1ef1776bde958b2b52775d", + "shasum": "" + }, + "type": "bower-asset-library" + }, + { "name": "bower-asset/fontawesome", "version": "v4.5.0", "source": { @@ -413,7 +429,8 @@ }, "license": [ "MIT" - ] + ], + "time": "2015-12-31 08:33:51" }, { "name": "cebe/markdown", @@ -524,12 +541,12 @@ "source": { "type": "git", "url": "https://github.com/Codeception/Codeception.git", - "reference": "a04ceaea52d2a050d8df19df1a85fb1b24456477" + "reference": "8d4d11c900effead558d6b474ca5a9e1b651722e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeception/Codeception/zipball/a04ceaea52d2a050d8df19df1a85fb1b24456477", - "reference": "a04ceaea52d2a050d8df19df1a85fb1b24456477", + "url": "https://api.github.com/repos/Codeception/Codeception/zipball/8d4d11c900effead558d6b474ca5a9e1b651722e", + "reference": "8d4d11c900effead558d6b474ca5a9e1b651722e", "shasum": "" }, "require": { @@ -601,7 +618,7 @@ "functional testing", "unit testing" ], - "time": "2016-03-26 21:39:36" + "time": "2016-04-04 08:29:59" }, { "name": "developeruz/yii2-db-rbac", @@ -704,12 +721,12 @@ "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "416fb8ad1d095a87f1d21bc40711843cd122fd4a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/416fb8ad1d095a87f1d21bc40711843cd122fd4a", + "reference": "416fb8ad1d095a87f1d21bc40711843cd122fd4a", "shasum": "" }, "require": { @@ -750,7 +767,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2016-03-31 10:24:22" }, { "name": "ezyang/htmlpurifier", @@ -845,12 +862,12 @@ "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "d094e337976dff9d8e2424e8485872194e768662" + "reference": "8e4e5ef9fbcc6ced335f398b32dcf2a0e4a24acb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/d094e337976dff9d8e2424e8485872194e768662", - "reference": "d094e337976dff9d8e2424e8485872194e768662", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/8e4e5ef9fbcc6ced335f398b32dcf2a0e4a24acb", + "reference": "8e4e5ef9fbcc6ced335f398b32dcf2a0e4a24acb", "shasum": "" }, "require": { @@ -899,7 +916,7 @@ "rest", "web service" ], - "time": "2016-03-21 20:02:09" + "time": "2016-04-01 05:52:09" }, { "name": "guzzlehttp/promises", @@ -1389,6 +1406,48 @@ "time": "2015-07-03 07:08:52" }, { + "name": "myclabs/deep-copy", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "e3abefcd7f106677fd352cd7c187d6c969aa9ddc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e3abefcd7f106677fd352cd7c187d6c969aa9ddc", + "reference": "e3abefcd7f106677fd352cd7c187d6c969aa9ddc", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "doctrine/collections": "1.*", + "phpunit/phpunit": "~4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "homepage": "https://github.com/myclabs/DeepCopy", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2015-11-07 22:20:37" + }, + { "name": "nodge/lightopenid", "version": "1.1.2", "source": { @@ -1600,29 +1659,30 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.2.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + "reference": "9b2a050b8ee982bf4132fa5c8b381f33c7416f2b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9b2a050b8ee982bf4132fa5c8b381f33c7416f2b", + "reference": "9b2a050b8ee982bf4132fa5c8b381f33c7416f2b", "shasum": "" }, "require": { - "php": ">=5.3.3", + "php": "^5.6 || ^7.0", "phpunit/php-file-iterator": "~1.3", "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", + "phpunit/php-token-stream": "^1.4.2", + "sebastian/code-unit-reverse-lookup": "~1.0", "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" + "sebastian/version": "~1.0|~2.0" }, "require-dev": { "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" + "phpunit/phpunit": "~5" }, "suggest": { "ext-dom": "*", @@ -1632,7 +1692,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "3.3.x-dev" } }, "autoload": { @@ -1658,7 +1718,7 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "time": "2016-03-09 13:32:21" }, { "name": "phpunit/php-file-iterator", @@ -1750,7 +1810,7 @@ }, { "name": "phpunit/php-timer", - "version": "dev-master", + "version": "1.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", @@ -1840,16 +1900,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.8.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "1a1b63266c046e1856fd03812a4e0ac2b51aa2d5" + "reference": "1206dd340c6f02b1322025bfaa2a3c2b244e874f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1a1b63266c046e1856fd03812a4e0ac2b51aa2d5", - "reference": "1a1b63266c046e1856fd03812a4e0ac2b51aa2d5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/beb7683ca88fd9901dccf296806d1e484bd00d11", + "reference": "1206dd340c6f02b1322025bfaa2a3c2b244e874f", "shasum": "" }, "require": { @@ -1858,19 +1918,22 @@ "ext-pcre": "*", "ext-reflection": "*", "ext-spl": "*", - "php": ">=5.3.3", + "myclabs/deep-copy": "~1.3", + "php": "^5.6 || ^7.0", "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", + "phpunit/php-code-coverage": "^3.3.0", "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": ">=1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "^3.1", "sebastian/comparator": "~1.1", "sebastian/diff": "~1.2", "sebastian/environment": "~1.3", "sebastian/exporter": "~1.2", "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", + "sebastian/object-enumerator": "~1.0", + "sebastian/resource-operations": "~1.0", + "sebastian/version": "~1.0|~2.0", "symfony/yaml": "~2.1|~3.0" }, "suggest": { @@ -1882,7 +1945,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.8.x-dev" + "dev-master": "5.4.x-dev" } }, "autoload": { @@ -1908,30 +1971,30 @@ "testing", "xunit" ], - "time": "2016-03-14 15:10:21" + "time": "2016-04-04 14:34:35" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + "reference": "7b18bbdad9880e09740959e90eec4b91c35a4aa9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/7b18bbdad9880e09740959e90eec4b91c35a4aa9", + "reference": "7b18bbdad9880e09740959e90eec4b91c35a4aa9", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", + "php": ">=5.6", "phpunit/php-text-template": "~1.2", "sebastian/exporter": "~1.2" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "~5" }, "suggest": { "ext-soap": "*" @@ -1939,7 +2002,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -1964,7 +2027,7 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2016-03-24 06:24:17" }, { "name": "psr/http-message", @@ -2119,6 +2182,51 @@ "time": "2015-11-26 15:24:53" }, { + "name": "sebastian/code-unit-reverse-lookup", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2016-02-13 06:45:14" + }, + { "name": "sebastian/comparator", "version": "dev-master", "source": { @@ -2403,6 +2511,52 @@ "time": "2015-10-12 03:26:01" }, { + "name": "sebastian/object-enumerator", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "d4ca2fb70344987502567bc50081c03e6192fb26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/d4ca2fb70344987502567bc50081c03e6192fb26", + "reference": "d4ca2fb70344987502567bc50081c03e6192fb26", + "shasum": "" + }, + "require": { + "php": ">=5.6", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "~5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2016-01-28 13:25:10" + }, + { "name": "sebastian/recursion-context", "version": "dev-master", "source": { @@ -2456,20 +2610,70 @@ "time": "2016-01-28 05:39:29" }, { + "name": "sebastian/resource-operations", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28 20:34:47" + }, + { "name": "sebastian/version", - "version": "1.0.6", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5", + "reference": "c829badbd8fdf16a0bad8aa7fa7971c029f1b9c5", "shasum": "" }, + "require": { + "php": ">=5.6" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -2488,7 +2692,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2016-02-04 12:56:52" }, { "name": "swiftmailer/swiftmailer", @@ -2992,12 +3196,12 @@ "source": { "type": "git", "url": "https://github.com/yiisoft/yii2-framework.git", - "reference": "bcc317666439a8ec1dc28874e0577b860b6dd6b3" + "reference": "3fa8254dd475aa0979e1ab2a4a7d83aaf5acdfc8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/bcc317666439a8ec1dc28874e0577b860b6dd6b3", - "reference": "bcc317666439a8ec1dc28874e0577b860b6dd6b3", + "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/4efd28591c92be5f16d3456bbb5e1f1ea5ca96c0", + "reference": "3fa8254dd475aa0979e1ab2a4a7d83aaf5acdfc8", "shasum": "" }, "require": { @@ -3078,7 +3282,7 @@ "framework", "yii2" ], - "time": "2016-03-30 14:53:41" + "time": "2016-04-05 09:54:22" }, { "name": "yiisoft/yii2-bootstrap", @@ -3131,6 +3335,51 @@ "time": "2016-03-30 22:44:25" }, { + "name": "yiisoft/yii2-codeception", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-codeception.git", + "reference": "e01b3c46917b3f00c42f6a4aabf612cc36d792e6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-codeception/zipball/e01b3c46917b3f00c42f6a4aabf612cc36d792e6", + "reference": "e01b3c46917b3f00c42f6a4aabf612cc36d792e6", + "shasum": "" + }, + "require": { + "yiisoft/yii2": ">=2.0.4" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\codeception\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Mark Jebri", + "email": "mark.github@yandex.ru" + } + ], + "description": "The Codeception integration for the Yii framework", + "keywords": [ + "codeception", + "yii2" + ], + "time": "2016-03-21 19:11:26" + }, + { "name": "yiisoft/yii2-composer", "version": "dev-master", "source": { @@ -3538,12 +3787,12 @@ "source": { "type": "git", "url": "https://github.com/yiisoft/yii2-gii.git", - "reference": "989d6c52c92e51f0d562729c329ee1012191cba2" + "reference": "0d93a9dbd55f2d0921b8e153554379bb213a2c7f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/989d6c52c92e51f0d562729c329ee1012191cba2", - "reference": "989d6c52c92e51f0d562729c329ee1012191cba2", + "url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/0d93a9dbd55f2d0921b8e153554379bb213a2c7f", + "reference": "0d93a9dbd55f2d0921b8e153554379bb213a2c7f", "shasum": "" }, "require": { @@ -3583,7 +3832,7 @@ "gii", "yii2" ], - "time": "2016-03-21 19:13:26" + "time": "2016-04-05 09:53:13" } ], "aliases": [], diff --git a/frontend/assets/AppAsset.php b/frontend/assets/AppAsset.php index 69be64e..c28d4f1 100755 --- a/frontend/assets/AppAsset.php +++ b/frontend/assets/AppAsset.php @@ -17,9 +17,10 @@ class AppAsset extends AssetBundle public $basePath = '@webroot'; public $baseUrl = '@web'; public $css = [ - 'css/style.css', + '/css/style.css', '/admin/css/flags32.css', 'https://fonts.googleapis.com/css?family=Roboto:400,700&subset=cyrillic,latin', + '/css/owl.carousel.css' ]; public $js = [ '/js/script.js', @@ -33,10 +34,13 @@ class AppAsset extends AssetBundle '/js/autoresize.jquery.js', '/js/jquery.MultiFile.js', '/js/myGallery_min.js', - 'js/fieldWidget.js' + '/js/fieldWidget.js', + '/js/owl.carousel.min.js', ]; public $depends = [ 'yii\web\YiiAsset', + 'yii\web\JqueryAsset', + 'frontend\assets\FancyboxAsset', ]; public $jsOptions = array( 'position' => \yii\web\View::POS_HEAD diff --git a/frontend/controllers/AccountsController.php b/frontend/controllers/AccountsController.php index c57589b..e630506 100755 --- a/frontend/controllers/AccountsController.php +++ b/frontend/controllers/AccountsController.php @@ -18,6 +18,7 @@ use common\models\Portfolio; use common\models\PortfolioSearch; use common\models\PortfolioSpecialization; + use common\models\PortfolioUser; use common\models\Project; use common\models\ProjectSearch; use common\models\Specialization; @@ -234,8 +235,8 @@ $user_info->load($post); $user_info->save(); $job = [ ]; - foreach($post['Job'] as $index => $value) { - $job[$index] = new Job([ + foreach($post[ 'Job' ] as $index => $value) { + $job[ $index ] = new Job([ 'user_id' => \Yii::$app->user->getId(), 'current' => 0, ]); @@ -478,6 +479,7 @@ { $user = \Yii::$app->user->identity; $portfolio = new Portfolio(); + $specializations = Specialization::find() ->where([ 'specialization_pid' => 0 ]) ->orderBy('specialization_id') @@ -491,6 +493,7 @@ ->indexBy('gallery_id') ->column(); $post = \Yii::$app->request->post(); + $portfolioUsers = $portfolio->portfolioUsers; if(!empty( $post )) { $portfolio->load($post); $portfolio->validate(); @@ -500,13 +503,30 @@ foreach($portfolio->specializationInput as $one_specialization) { $portfolio->link('specializations', Specialization::findOne($one_specialization)); } - return $this->redirect('portfolio'); + $portfolio->unlinkAll('portfolioUsers', true); + $success = true; + if(!empty( $post[ 'PortfolioUser' ] )) { + $portfolioUsers = [ ]; + foreach($post[ 'PortfolioUser' ] as $index => $item) { + $portfolioUsers[ $index ] = new PortfolioUser([ 'portfolio_id' => $portfolio->portfolio_id ]); + } + $success = (PortfolioUser::loadMultiple($portfolioUsers, $post) && PortfolioUser::validateMultiple($portfolioUsers)); + if($success) { + foreach($portfolioUsers as $index => $portfolioUser) { + $portfolioUser->save(false); + } + } + } + if($success) { + return $this->redirect('portfolio'); + } } } return $this->render('_portfolio_form', [ 'portfolio' => $portfolio, 'specializations' => $specializations, 'galleries' => $galleries, + 'portfolioUsers' => $portfolioUsers, ]); } @@ -523,6 +543,7 @@ $user = \Yii::$app->user->identity; $portfolio = $user->getPortfolios() ->where([ 'portfolio_id' => $id ]) + ->with('portfolioUsers.user') ->one(); $galleries = $user->getGalleries() ->select([ @@ -535,13 +556,13 @@ if(!$portfolio instanceof ActiveRecord) { throw new NotFoundHttpException('Запись не найдена'); } - $specializations = Specialization::find() ->where([ 'specialization_pid' => 0 ]) ->orderBy('specialization_id') ->all(); $post = \Yii::$app->request->post(); + $portfolioUsers = $portfolio->portfolioUsers; if(!empty( $post )) { $portfolio->load($post); @@ -552,7 +573,23 @@ foreach($portfolio->specializationInput as $one_specialization) { $portfolio->link('specializations', Specialization::findOne($one_specialization)); } - return $this->redirect('portfolio'); + $portfolio->unlinkAll('portfolioUsers', true); + $success = true; + if(!empty( $post[ 'PortfolioUser' ] )) { + $portfolioUsers = [ ]; + foreach($post[ 'PortfolioUser' ] as $index => $item) { + $portfolioUsers[ $index ] = new PortfolioUser([ 'portfolio_id' => $portfolio->portfolio_id ]); + } + $success = (PortfolioUser::loadMultiple($portfolioUsers, $post) && PortfolioUser::validateMultiple($portfolioUsers)); + if($success) { + foreach($portfolioUsers as $index => $portfolioUser) { + $portfolioUser->save(false); + } + } + } + if($success) { + return $this->redirect('portfolio'); + } } } @@ -560,6 +597,7 @@ 'portfolio' => $portfolio, 'specializations' => $specializations, 'galleries' => $galleries, + 'portfolioUsers' => $portfolioUsers, ]); } diff --git a/frontend/controllers/AjaxController.php b/frontend/controllers/AjaxController.php new file mode 100644 index 0000000..b38f982 --- /dev/null +++ b/frontend/controllers/AjaxController.php @@ -0,0 +1,93 @@ +request->get('ids')); + $model = new UserSearch(); + $dataProvider = $model->search(\Yii::$app->request->queryParams); + $dataProvider->query->andFilterWhere(['not in', 'id', $ids]); + $dataProvider->query->andWhere([ + 'user_info.is_freelancer' => 1, + 'type' => 1, + ]); + $dataProvider->query->with('specializations'); + return $this->renderAjax('users', [ + 'model' => $model, + 'dataProvider' => $dataProvider, + ]); + } + + public function actionUserInput() + { + /** + * @var ActiveRecord $model + */ + $request = \Yii::$app->request; + $response = \Yii::$app->response; + $response->format = $response::FORMAT_JSON; + $user_id = $request->get('id'); + $model = $request->get('model'); + $component = $request->get('component'); + if(empty( $user_id )) { + return [ 'error' => 'User ID must be set' ]; + } elseif(empty( $model )) { + return [ 'error' => 'Model must be set' ]; + } + $user = User::find() + ->where([ + 'id' => $user_id, + 'type' => 1, + 'user_info.is_freelancer' => 1, + ]) + ->joinWith('userInfo') + ->one(); + if(empty( $user )) { + return [ 'error' => 'User not found' ]; + } + if(!class_exists($model)) { + return [ 'error' => 'Class not found' ]; + } + $model = new $model(); + if(!$model instanceof ActiveRecord) { + return [ 'error' => 'Class must extend ActiveRecord' ]; + } + if(!$model->hasAttribute('user_id')) { + return [ 'error' => 'Class must have user_id attribute' ]; + } + $html = $this->renderPartial('project_user', [ + 'model' => $model, + 'user' => $user, + ]); + return [ + 'result' => [ + 'html' => $html, + 'id' => $user->id, + 'firstname' => $user->firstname, + 'lastname' => $user->lastname, + 'component' => $component, + ], + ]; + } + + } diff --git a/frontend/test/UserFixture.php b/frontend/test/UserFixture.php new file mode 100644 index 0000000..5d60f9c --- /dev/null +++ b/frontend/test/UserFixture.php @@ -0,0 +1,10 @@ + [ + 'username' => 'lmayert', + 'email' => 'strosin.vernice@jerde.com', + 'auth_key' => 'K3nF70it7tzNsHddEiq0BZ0i-OU8S3xV', + 'password_hash' => '$2y$13$WSyE5hHsG1rWN2jV8LRHzubilrCLI5Ev/iK0r3jRuwQEs2ldRu.a2', + ], + 'user2' => [ + 'username' => 'napoleon69', + 'email' => 'aileen.barton@heaneyschumm.com', + 'auth_key' => 'dZlXsVnIDgIzFgX4EduAqkEPuphhOh9q', + 'password_hash' => '$2y$13$kkgpvJ8lnjKo8RuoR30ay.RjDf15bMcHIF7Vz1zz/6viYG5xJExU6', + ], + ]; \ No newline at end of file diff --git a/frontend/test/unit/models/UserInfoTest.php b/frontend/test/unit/models/UserInfoTest.php new file mode 100644 index 0000000..ded0a32 --- /dev/null +++ b/frontend/test/unit/models/UserInfoTest.php @@ -0,0 +1,16 @@ + UserInfoFixture::className(), + ]; + } + } \ No newline at end of file diff --git a/frontend/views/accounts/_portfolio_form.php b/frontend/views/accounts/_portfolio_form.php index 83e247a..da2ffcd 100644 --- a/frontend/views/accounts/_portfolio_form.php +++ b/frontend/views/accounts/_portfolio_form.php @@ -1,5 +1,6 @@ title = 'Портфолио'; $this->params[ 'breadcrumbs' ][] = $this->title; - var_dump($portfolio->getErrors()); ?>
title ?>
@@ -41,7 +42,6 @@ use mihaildev\ckeditor\CKEditor; -
-
+
+ +
Фото главное
- field($portfolio, 'cover')->widget(ImageUploaderInput::className(),[ - 'size' => [ - [ - 'width' => 720, - 'height' => 280, - ], - [ - 'width' => 318, - 'height' => 228, - ], - [ - 'width' => 152, - 'height' => 108, - ], - [ - 'width' => 210, - 'height' => 150, - ] - ], - 'multi' => false, - 'gallery' => $portfolio->cover, - 'name' => 'Загрузить фото', - ]); ?> + field($portfolio, 'cover') + ->widget(ImageUploaderInput::className(), [ + 'size' => [ + [ + 'width' => 720, + 'height' => 280, + ], + [ + 'width' => 318, + 'height' => 228, + ], + [ + 'width' => 152, + 'height' => 108, + ], + [ + 'width' => 210, + 'height' => 150, + ], + ], + 'multi' => false, + 'gallery' => $portfolio->cover, + 'name' => 'Загрузить фото', + ]); ?>
@@ -179,6 +182,84 @@ use mihaildev\ckeditor\CKEditor;
+
+ +
+

Добавить пользователя

+

'add_project_user_link' ]) ?>

+
+ render('@frontend/views/ajax/project_user', ['model' => $portfolioUser, 'user' => $portfolioUser->user]); + } + ?> +
+
+ +
@@ -193,7 +274,7 @@ use mihaildev\ckeditor\CKEditor; ], [ 'title' => Yii::t('app', 'delete'), 'aria-label' => Yii::t('app', 'delete'), - 'data-confirm' => Yii::t('app', 'delete_confirm'), + 'data-confirm' => Yii::t('app', 'delete_confirm'), 'data-method' => 'post', 'data-pjax' => 0, ]); @@ -202,7 +283,7 @@ use mihaildev\ckeditor\CKEditor;
- request->referrer)?\Yii::$app->request->referrer:['accounts/portfolio' ]) ?> + request->referrer) ? \Yii::$app->request->referrer : [ 'accounts/portfolio' ]) ?>
@@ -214,29 +295,43 @@ use mihaildev\ckeditor\CKEditor; function() { bottomButton() - function bottomButton(){ - if( ($('.admin-portfolio-foto .admin-avatar-pattern img').length)>0 ) { + function bottomButton() + { + if(($('.admin-portfolio-foto .admin-avatar-pattern img').length) > 0) + { - } else { - $('.admin-portfolio-foto .tst').css({marginBottom:0}) + } else + { + $('.admin-portfolio-foto .tst').css({marginBottom : 0}) } } - $('body').on('click', '.admin-portfolio-foto #cover_remove_img',function(){ - bottomButton() - }) + $('body').on( + 'click', '.admin-portfolio-foto #cover_remove_img', function() + { + bottomButton() + } + ) - $('#portfolio-gallery_id').change(function(){ - var gallery_id = $(this).val(); - $.post( "/accounts/gallery-cover", {gallery_id:gallery_id}, function( data ) { - if(!($('#cover_old_img').val().length)){ - $('#cover_picture_link').val(data); - var newimg=document.createElement("img"); - newimg.setAttribute("src",data); + $('#portfolio-gallery_id').change( + function() + { + var gallery_id = $(this).val(); + $.post( + "/accounts/gallery-cover", {gallery_id : gallery_id}, function(data) + { + if(!($('#cover_old_img').val().length)) + { + $('#cover_picture_link').val(data); + var newimg = document.createElement("img"); + newimg.setAttribute("src", data); - $('#cover_img_block .admin-avatar-pattern').append(newimg); - } - }); - }); - }); + $('#cover_img_block .admin-avatar-pattern').append(newimg); + } + } + ); + } + ); + } + ); diff --git a/frontend/views/ajax/project_user.php b/frontend/views/ajax/project_user.php new file mode 100644 index 0000000..5ee44c7 --- /dev/null +++ b/frontend/views/ajax/project_user.php @@ -0,0 +1,33 @@ + +
+
+ +
+
+ +

name, ['performer/common', 'performer_id' => $user->id], ['target' => '_blank'])?>

+ id}]user_id", ['value' => $user->id])?> +
+
+ Yii::t('app', 'Должность: ')])?> + id}]position", ['class' => 'form-control'])?> +
+
+ Yii::t('app', 'Часы: ')])?> + id}]time", ['class' => 'form-control'])?> +
+
+ +
+
diff --git a/frontend/views/ajax/users.php b/frontend/views/ajax/users.php new file mode 100644 index 0000000..c178cf9 --- /dev/null +++ b/frontend/views/ajax/users.php @@ -0,0 +1,96 @@ + + false, + 'id' => 'pjax-user', + ]); + $js = "$('.user_search_modal_input').tooltip({placement: 'top', title: function() { return $(this).data('error'); }, trigger: 'manual'}); + $('.user_search_modal_input').tooltip('show');"; + $this->registerJs($js); + echo GridView::widget([ + 'id' => 'grid-user', + 'dataProvider' => $dataProvider, + 'filterModel' => $model, + 'summary' => 'Найдено пользователей: {totalCount}', + 'rowOptions' => [ + 'class' => 'user_search_modal_row', + ], + 'columns' => [ + [ + 'attribute' => 'id', + 'filter' => Html::activeInput('number', $model, 'id', [ + 'class' => 'user_search_modal_input user_search_modal_input_id', + 'data-error' => $model->hasErrors('id') ? $model->getFirstError('id') : '', + ]), + ], + [ + 'attribute' => 'userInfo.image', + 'content' => function($model, $key, $index, $column) { + /** + * @var User $model + */ + if(!empty( $model->userInfo->image )) { + return Html::tag('div', Html::img($model->userInfo->image, [ 'width' => '100px' ]), [ 'class' => 'user_search_modal_item_image' ]); + } else { + return Html::tag('div', Html::img('/images/avatar-bg.png', [ 'width' => '100px' ]), [ 'class' => 'user_search_modal_item_image' ]); + } + }, + ], + [ + 'attribute' => 'firstname', + 'filter' => Html::activeInput('text', $model, 'name_search'), + ], + [ + 'attribute' => 'lastname', + 'filter' => Html::activeInput('text', $model, 'surname_search'), + ], + [ + 'attribute' => 'specialization', + 'content' => function($model, $key, $index, $column) { + if(!empty($model->specializations)) { + return implode(', ', ArrayHelper::getColumn($model->specializations, 'specialization_name')); + } else { + return false; + } + }, + 'filterOptions' => [ + 'class' => 'user_search_modal_specialization', + ], + 'label' => Yii::t('app', 'Специализация'), + ], + [ + 'class' => ActionColumn::className(), + 'buttons' => [ + 'apply' => function($url, $model, $key) { + return Html::tag('span', '', ['class' => 'user_search_modal_tick']); + } + ], + 'template' => '{apply}', + ] + ], + 'options' => [ + 'class' => 'grid-view user_search_modal_grid', + ], + ]); + Pjax::end(); +?> diff --git a/frontend/views/company/portfolio-view.php b/frontend/views/company/portfolio-view.php index ab09b66..45545a8 100644 --- a/frontend/views/company/portfolio-view.php +++ b/frontend/views/company/portfolio-view.php @@ -1,17 +1,17 @@ params[ 'company' ] = $user; - + $this->title = 'My Yii Application'; ?>
@@ -53,7 +53,7 @@
- +
name ?>
@@ -82,7 +85,31 @@ } ?>
- +
+ + + +
@@ -109,17 +136,17 @@ } ?>
- + $this, + 'context' => $this, 'model' => $portfolio->className(), 'model_id' => $portfolio->portfolio_id, 'comment_class' => \common\modules\comment\models\Comment::className(), 'rating_class' => \common\modules\comment\models\Rating::className(), 'class_options' => [ - 'scenario' => is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST, - 'user_id' => \Yii::$app->user->getId(), + 'scenario' => is_int(\Yii::$app->user->getId()) ? \common\modules\comment\models\Comment::SCENARIO_USER : \common\modules\comment\models\Comment::SCENARIO_GUEST, + 'user_id' => \Yii::$app->user->getId(), 'guestComment' => true, 'status' => \common\modules\comment\models\Comment::STATUS_ACTIVE, ], @@ -127,7 +154,7 @@ 'view' => 'list-comment', ], 'form_options' => [ - 'view' => 'form-comment', + 'view' => 'form-comment', 'tag' => 'div', 'class' => 'artbox_comment_form', ], @@ -136,188 +163,188 @@ ], ]); ?> - + -
-
Комментарии: 3
-
- -
-
- - -
-
- - - -
-
- - -
-
- -
-
- -
- -
-
-
-
- + /* + ?> +
+
Комментарии: 3
+
+ +
+
+ +
-
- -
-
- - - - +
+ + + +
+
+ + +
+
+ +
+ + +
+ +
+
+
+
+ +
+
+ +
+
+ + + + +
+
+
- - -
-

Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.

-

Евровагонка — удобная в монтаже фасонная доска, которая позволяет создать обшивку из плотно пригнанных элементов с качественно обработанной поверхностью. Толщина евровагонки составляет 125 мм, общая ширина (с гребнем) 960 мм, рабочая ширина 880 мм.Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.

-
- +
-
-
- -
-
-
- -
-
- -
-
- - - - + +
+
+
+ +
+
+ +
+
+ + + + +
+
+
- - -
-

Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.

-

Евровагонка — удобная в монтаже фасонная доска, которая позволяет создать обшивку из плотно пригнанных элементов с качественно обработанной поверхностью. Толщина евровагонки составляет 125 мм, общая ширина (с гребнем) 960 мм, рабочая ширина 880 мм.Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.

-
- +
-
-
- -
-
-
- -
-
- -
-
- - - - + +
+
+
+ +
+
+ +
+
+ + + + +
+
+
- - -
-

Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.

-

Евровагонка — удобная в монтаже фасонная доска, которая позволяет создать обшивку из плотно пригнанных элементов с качественно обработанной поверхностью. Толщина евровагонки составляет 125 мм, общая ширина (с гребнем) 960 мм, рабочая ширина 880 мм.Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.

-
- +
-
-
- -
-
-
- -
-
- -
-
- - - - + +
+
+
+ +
+
+ +
+
+ + + + +
+
+
- - -
-

Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.

-

Евровагонка — удобная в монтаже фасонная доска, которая позволяет создать обшивку из плотно пригнанных элементов с качественно обработанной поверхностью. Толщина евровагонки составляет 125 мм, общая ширина (с гребнем) 960 мм, рабочая ширина 880 мм.Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.

-
- +
-
-
-
-
-
- -
-
- -
-
- - - - +
+
+
+ +
+
+ +
+
+ + + + +
+
+
- - -
-

Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.

-

Евровагонка — удобная в монтаже фасонная доска, которая позволяет создать обшивку из плотно пригнанных элементов с качественно обработанной поверхностью. Толщина евровагонки составляет 125 мм, общая ширина (с гребнем) 960 мм, рабочая ширина 880 мм.Балкон, обшитый вагонкой, выглядит аккуратно, стильно и уютно. Монтаж обшивки вполне возможно выполнить своими силами — достаточно иметь в распоряжении необходимые инструменты и владеть базовыми навыками строительно-ремонтных работ.

-
- +
-
+
-
-
- */ + */ ?>