From d36bdac697720e99e71846bd7d1c4fb3e555e886 Mon Sep 17 00:00:00 2001
From: Vitaliy
Date: Wed, 17 Feb 2016 11:15:14 +0200
Subject: [PATCH] 17.02.16
---
common/models/TeamSearch.php | 2 +-
console/migrations/m160216_180149_tean_date_change.php | 18 ++++++++++++++++++
frontend/config/main.php | 1 +
frontend/controllers/AccountsController.php | 13 ++++---------
frontend/controllers/CompanyController.php | 181 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------
frontend/helpers/TextHelper.php | 24 ++++++++++++++++++++++++
frontend/views/accounts/_blog_form.php | 14 ++++++++++++--
frontend/views/accounts/_projects_form.php | 29 +++++++++++++++++++++++++++--
frontend/views/accounts/_team_form.php | 4 ++--
frontend/views/company/_blog_list_view.php | 28 ++++++++++++++++++++++++++++
frontend/views/company/_company_list_view.php | 19 +++++++++++++++++++
frontend/views/company/_gallery_list_view.php | 19 +++++++++++++++++++
frontend/views/company/_portfolio_list_view.php | 38 ++++++++++++++++++++++++++++++++++++++
frontend/views/company/blog-list.php | 88 ++++++++++++++--------------------------------------------------------------------------
frontend/views/company/blog-view.php | 49 ++++++++++---------------------------------------
frontend/views/company/gallery.php | 170 +++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------
frontend/views/company/portfolio.php | 229 +++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
frontend/views/company/team.php | 179 ++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------
frontend/views/layouts/gallery-company.php | 23 +++++------------------
frontend/views/performer/_blog_list_view.php | 5 +++--
frontend/views/performer/_portfolio_list_view.php | 40 ++++++++++++++++++++++++++++++++++++++++
frontend/views/performer/portfolio.php | 2 +-
frontend/views/performer/portfolio_list_view.php | 38 --------------------------------------
23 files changed, 505 insertions(+), 708 deletions(-)
create mode 100644 console/migrations/m160216_180149_tean_date_change.php
create mode 100644 frontend/helpers/TextHelper.php
create mode 100644 frontend/views/company/_blog_list_view.php
create mode 100644 frontend/views/company/_company_list_view.php
create mode 100644 frontend/views/company/_gallery_list_view.php
create mode 100644 frontend/views/company/_portfolio_list_view.php
create mode 100644 frontend/views/performer/_portfolio_list_view.php
delete mode 100644 frontend/views/performer/portfolio_list_view.php
diff --git a/common/models/TeamSearch.php b/common/models/TeamSearch.php
index b8dad16..0af2c4c 100644
--- a/common/models/TeamSearch.php
+++ b/common/models/TeamSearch.php
@@ -164,7 +164,7 @@
'between',
'experience_from',
$this->experience_from_to ? ( date('Y') - $this->experience_from_to ) : ( date('Y') - 100 ),
- $this->experience_from_from ? ( date('Y') - $this->experience_from_from ) : date('Y'),
+ $this->experience_from_from ? ( date('Y') - $this->experience_from_from ) : date('Y'),
]);
if(!empty( $this->link ) || $this->link === '0') {
diff --git a/console/migrations/m160216_180149_tean_date_change.php b/console/migrations/m160216_180149_tean_date_change.php
new file mode 100644
index 0000000..7f7b42e
--- /dev/null
+++ b/console/migrations/m160216_180149_tean_date_change.php
@@ -0,0 +1,18 @@
+dropColumn('team', 'experience_from');
+ $this->addColumn('team', 'experience_from', $this->integer());
+ }
+
+ public function down()
+ {
+ $this->dropColumn('team', 'experience_from');
+ $this->addColumn('team', 'experience_from', $this->timestamp());
+ }
+}
diff --git a/frontend/config/main.php b/frontend/config/main.php
index 90280e2..dd3610d 100755
--- a/frontend/config/main.php
+++ b/frontend/config/main.php
@@ -67,6 +67,7 @@ return [
'performer/portfolio//' => 'performer/portfolio-filter',
'performer/blog-view//' => 'performer/blog-view',
'performer//' => 'performer/',
+ 'company/portfolio//' => 'company/portfolio-filter',
'company/blog-view//' => 'company/blog-view',
'company//' => 'company/',
diff --git a/frontend/controllers/AccountsController.php b/frontend/controllers/AccountsController.php
index 02f3862..33b9c39 100755
--- a/frontend/controllers/AccountsController.php
+++ b/frontend/controllers/AccountsController.php
@@ -591,14 +591,9 @@
public function actionProjectsCreate()
{
$project = new Project();
- $specialization = Specialization::find()
- ->select([
- 'specialization_name',
- 'specialization_id',
- ])
- ->indexBy('specialization_id')
- ->asArray()
- ->column();
+
+ $specializations = Specialization::find()->where(['specialization_pid' => 0])->orderBy('specialization_id')->all();
+
$payment = Payment::find()
->select([
'name',
@@ -650,7 +645,7 @@
}
return $this->render('_projects_form', [
'project' => $project,
- 'specialization' => $specialization,
+ 'specializations' => $specializations,
'payment' => $payment,
'projects' => $projects,
]);
diff --git a/frontend/controllers/CompanyController.php b/frontend/controllers/CompanyController.php
index b0a4ed7..292e762 100755
--- a/frontend/controllers/CompanyController.php
+++ b/frontend/controllers/CompanyController.php
@@ -1,31 +1,21 @@
portfolios,'portfolio_id');
+
+
+ $filters = PortfolioSpecialization::find()->select(["specialization_id","COUNT('specialization_id') AS count"])
+ ->where(["portfolio_id"=>$projects ])->groupBy("specialization_id")->all();
+
+ $portfolio = new ArrayDataProvider([
+ 'allModels' => $company->portfolios,
+ 'pagination' => [
+ 'pageSize' => 9,
+ ],
+ ]);
+
return $this->render('portfolio',[
- 'company' => $company
+ 'company' => $company,
+ 'filters' => $filters,
+ 'portfolio' => $portfolio,
+ 'count' => count($company->portfolios)
+ ]);
+ }
+
+ public function actionPortfolioFilter($performer_id, $filter){
+ $company = User::findOne($performer_id);
+
+ if(!$company instanceof User){
+ throw new BadRequestHttpException('Пользователь не найден');
+ }
+ $portfolios = ArrayHelper::getColumn($company->portfolios,'portfolio_id');
+
+
+ $filters = PortfolioSpecialization::find()->select(["specialization_id","COUNT('specialization_id') AS count"])
+ ->where(["portfolio_id"=>$portfolios ])->groupBy("specialization_id")->all();
+
+
+ $filter_result = PortfolioSpecialization::find()
+ ->where(['specialization_id'=>$filter,
+ 'portfolio_id'=>$portfolios
+ ])->all();
+
+
+ $portfolio = new ArrayDataProvider([
+ 'allModels' => Portfolio::find()->where(['portfolio_id'=>ArrayHelper::getColumn($filter_result,'portfolio_id')])->all(),
+ 'pagination' => [
+ 'pageSize' => 9,
+ ],
+ ]);
+
+ return $this->render('portfolio',[
+ 'company' => $company,
+ 'filters' => $filters,
+ 'portfolio' => $portfolio,
+ 'filter_id' => $filter,
+ 'count' => count($company->portfolios)
]);
}
@@ -94,8 +138,32 @@ class CompanyController extends Controller
{
$company = User::findOne($company_id);
+ if(!$company instanceof User){
+ throw new BadRequestHttpException('Пользователь не найден');
+ }
+
+
+ $query = Team::find(['user_id'=>$company_id]);
+
+ $countQuery = clone $query;
+
+ $pagination = new Pagination(['totalCount' => $countQuery->count(),
+ 'pageSize' => 9,
+ ]);
+
+ $team = $query->offset($pagination->offset)
+ ->limit($pagination->limit)
+ ->all();
+
+ $team = new ArrayDataProvider([
+ 'allModels' => $team,
+ ]);
+
+
return $this->render('team',[
- 'company' => $company
+ 'company' => $company,
+ 'team' => $team,
+ 'pagination' => $pagination
]);
}
@@ -103,17 +171,54 @@ class CompanyController extends Controller
{
$company = User::findOne($company_id);
+ if(!$company instanceof User){
+ throw new BadRequestHttpException('Пользователь не найден');
+ }
+
+
+ $query = Blog::find(['user_id'=>$company_id]);
+
+ $countQuery = clone $query;
+
+ $pagination = new Pagination(['totalCount' => $countQuery->count(),
+ 'pageSize' => 5,
+ ]);
+
+ $article = $query->offset($pagination->offset)
+ ->limit($pagination->limit)
+ ->all();
+
+ $blog = new ArrayDataProvider([
+ 'allModels' => $article,
+ ]);
+
+
return $this->render('blog-list',[
- 'company' => $company
+ 'company' => $company,
+ 'blog' => $blog,
+ 'pagination' => $pagination
]);
}
- public function actionBlogView($company_id, $article_id)
+
+ public function actionBlogView($company_id, $link)
{
$company = User::findOne($company_id);
+ if(!$company instanceof User){
+ throw new BadRequestHttpException('Пользователь не найден');
+ }
+
+
+ $article = Blog::findOne(['link'=>$link,'user_id'=>$company_id]);
+ $article->view_count ++;
+ $article->save();
+
+
return $this->render('blog-view',[
- 'company' => $company
+ 'company' => $company,
+ 'article' =>$article,
+
]);
}
@@ -160,13 +265,41 @@ class CompanyController extends Controller
]);
}
+
public function actionGallery($company_id)
{
$company = User::findOne($company_id);
+ if(!$company instanceof User){
+ throw new BadRequestHttpException('Пользователь не найден');
+ }
+
+
+ $query = Gallery::find(['user_id'=>$company_id]);
+
+ $countQuery = clone $query;
+
+ $pagination = new Pagination(['totalCount' => $countQuery->count(),
+ 'pageSize' => 5,
+ ]);
+
+ $gallery = $query->offset($pagination->offset)
+ ->limit($pagination->limit)
+ ->all();
+
+ $gallery = new ArrayDataProvider([
+ 'allModels' => $gallery,
+ ]);
+
+ $videos = Fields::getData($company->id,Gallery::className(),'youtube');
+
$this->layout = 'gallery-company';
+
return $this->render('gallery',[
- 'company' => $company
+ 'company' => $company,
+ 'gallery' =>$gallery,
+ 'pagination' => $pagination,
+ 'videos' => $videos
]);
}
}
diff --git a/frontend/helpers/TextHelper.php b/frontend/helpers/TextHelper.php
new file mode 100644
index 0000000..2b1f308
--- /dev/null
+++ b/frontend/helpers/TextHelper.php
@@ -0,0 +1,24 @@
+
')
+ {
+ if ($asHtml) {
+ return static::truncateHtml($string, $length, $suffix, $encoding ?: Yii::$app->charset);
+ }
+
+ if (mb_strlen($string, $encoding ?: Yii::$app->charset) > $length) {
+ return strip_tags(trim(mb_substr($string, 0, $length, $encoding ?: Yii::$app->charset)) . $suffix, $html);
+ } else {
+ return strip_tags($string, $html);
+ }
+
+
+ }
+}
diff --git a/frontend/views/accounts/_blog_form.php b/frontend/views/accounts/_blog_form.php
index e814760..a900bbd 100644
--- a/frontend/views/accounts/_blog_form.php
+++ b/frontend/views/accounts/_blog_form.php
@@ -5,7 +5,8 @@
use common\models\Blog;
use common\widgets\ImageUploader;
use mihaildev\ckeditor\CKEditor;
- use yii\helpers\Html;
+use mihaildev\elfinder\ElFinder;
+use yii\helpers\Html;
use yii\widgets\ActiveForm;
$this->title = 'Блог';
@@ -36,7 +37,16 @@
diff --git a/frontend/views/accounts/_projects_form.php b/frontend/views/accounts/_projects_form.php
index eef4262..7a80f3b 100644
--- a/frontend/views/accounts/_projects_form.php
+++ b/frontend/views/accounts/_projects_form.php
@@ -33,8 +33,33 @@
= $form->field($project, 'project_pid')
->dropDownList($projects, [ 'prompt' => 'Родительский проект' ]) ?>
-= $form->field($project, 'specializationInput')
- ->checkboxList($specialization) ?>
+
+
+
Адрес:
diff --git a/frontend/views/accounts/_team_form.php b/frontend/views/accounts/_team_form.php
index dad351a..c790689 100644
--- a/frontend/views/accounts/_team_form.php
+++ b/frontend/views/accounts/_team_form.php
@@ -64,8 +64,8 @@
= ImageUploader::widget([
'model' => $team,
'field' => 'photo',
- 'width' => 100,
- 'height' => 100,
+ 'width' => 220,
+ 'height' => 220,
'multi' => false,
'gallery' => $team->photo,
'name' => 'Загрузить фото',
diff --git a/frontend/views/company/_blog_list_view.php b/frontend/views/company/_blog_list_view.php
new file mode 100644
index 0000000..37cc481
--- /dev/null
+++ b/frontend/views/company/_blog_list_view.php
@@ -0,0 +1,28 @@
+
+
+
+ = Html::a($model->name, Url::toRoute(['company/blog-view','company_id'=>$this->params['company']->id,'link'=>$model->link]),['class'=>'blog-new-link']);?>
+
+
+
+
= $model->dateCreate?>
+
+
+
= $model->view_count?>
+
+
+
= $model->view_count?>
+
+
+
+ = Html::a(Html::img($model->cover), Url::toRoute(['/company/blog-view','company_id'=>$this->params['company']->id,'link'=>$model->link]));?>
+ = TextHelper::truncateHtmlText($model->description, 1300)?>
+
+ = Html::a('
Подробнее', Url::toRoute(['company/blog-view','company_id'=>$this->params['company']->id,'link'=>$model->link]),['class'=>'blog-post-see-all style']);?>
+
\ No newline at end of file
diff --git a/frontend/views/company/_company_list_view.php b/frontend/views/company/_company_list_view.php
new file mode 100644
index 0000000..2917ce0
--- /dev/null
+++ b/frontend/views/company/_company_list_view.php
@@ -0,0 +1,19 @@
+
+
+
+
+ = Html::a(($model->photo ? Html::img($model->photo) : '') . '
', Url::toRoute('#'))?>
+
+
= $model->user ?>
+
= $model->department->name ?>
+
+
+
\ No newline at end of file
diff --git a/frontend/views/company/_gallery_list_view.php b/frontend/views/company/_gallery_list_view.php
new file mode 100644
index 0000000..105bb2d
--- /dev/null
+++ b/frontend/views/company/_gallery_list_view.php
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/frontend/views/company/_portfolio_list_view.php b/frontend/views/company/_portfolio_list_view.php
new file mode 100644
index 0000000..1e0ff9e
--- /dev/null
+++ b/frontend/views/company/_portfolio_list_view.php
@@ -0,0 +1,38 @@
+
+
+
+
+ = Html::a(Html::img($model->cover), '#');?>
+
+
+
+
+
= StringHelper::truncate(implode(', ',ArrayHelper::getColumn($model->specializations,'specialization_name')),20)?>
+
\ No newline at end of file
diff --git a/frontend/views/company/blog-list.php b/frontend/views/company/blog-list.php
index f519129..a10d727 100755
--- a/frontend/views/company/blog-list.php
+++ b/frontend/views/company/blog-list.php
@@ -1,87 +1,27 @@
params['company'] = $company;
$this->title = 'My Yii Application';
?>
-
+ =
+ LinkPager::widget([
+ 'pagination' => $pagination,
+ ]);
+ ?>
-
diff --git a/frontend/views/company/blog-view.php b/frontend/views/company/blog-view.php
index 54aa8db..e7cec73 100755
--- a/frontend/views/company/blog-view.php
+++ b/frontend/views/company/blog-view.php
@@ -1,59 +1,30 @@
params['company'] = $company;
- $this->title = 'My Yii Application';
+
+$this->title = $article->name ;
?>
\ No newline at end of file
+
diff --git a/frontend/views/company/gallery.php b/frontend/views/company/gallery.php
index 2cc3066..9c65417 100755
--- a/frontend/views/company/gallery.php
+++ b/frontend/views/company/gallery.php
@@ -1,39 +1,30 @@
params['company'] = $company;
$this->title = 'My Yii Application';
?>
-
XX
+
= $model->view_count?>
= Html::a(Html::img($model->cover), Url::toRoute(['/performer/blog-view','performer_id'=>$this->params['user']->id,'link'=>$model->link]));?>
- = StringHelper::truncate($model->description, 1500, '...', null, true)?>
+ = TextHelper::truncateHtmlText($model->description, 1300)?>
= Html::a('Подробнее', Url::toRoute(['performer/blog-view','performer_id'=>$this->params['user']->id,'link'=>$model->link]),['class'=>'blog-post-see-all style']);?>
\ No newline at end of file
diff --git a/frontend/views/performer/_portfolio_list_view.php b/frontend/views/performer/_portfolio_list_view.php
new file mode 100644
index 0000000..8ffa7b5
--- /dev/null
+++ b/frontend/views/performer/_portfolio_list_view.php
@@ -0,0 +1,40 @@
+
+
+
+
+ = Html::a(Html::img($model->cover), '#');?>
+
+
+
+
+
= StringHelper::truncate(implode(', ',ArrayHelper::getColumn($model->specializations,'specialization_name')),20)?>
+
\ No newline at end of file
diff --git a/frontend/views/performer/portfolio.php b/frontend/views/performer/portfolio.php
index 7a03d49..5557f87 100755
--- a/frontend/views/performer/portfolio.php
+++ b/frontend/views/performer/portfolio.php
@@ -34,7 +34,7 @@ $this->title = 'My Yii Application';
=
ListView::widget( [
'dataProvider' => $portfolio,
- 'itemView'=>'portfolio_list_view',
+ 'itemView'=>'_portfolio_list_view',
'layout' => "{items}\n{pager}
"
] );
?>
diff --git a/frontend/views/performer/portfolio_list_view.php b/frontend/views/performer/portfolio_list_view.php
deleted file mode 100644
index 1e0ff9e..0000000
--- a/frontend/views/performer/portfolio_list_view.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
- = Html::a(Html::img($model->cover), '#');?>
-
-
-
-
-
= StringHelper::truncate(implode(', ',ArrayHelper::getColumn($model->specializations,'specialization_name')),20)?>
-
\ No newline at end of file
--
libgit2 0.21.4