From 9bb0160de4c9f22b8a0afe64958b30703e5af9e4 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Wed, 10 Feb 2016 17:36:23 +0200 Subject: [PATCH] 09.02.16 --- common/models/Fields.php | 7 ++++++- common/widgets/views/courses_field.php | 2 +- common/widgets/views/development_field.php | 2 +- common/widgets/views/education_field.php | 4 ++-- frontend/config/main.php | 1 + frontend/controllers/PerformerController.php | 28 ++++++++++++++++------------ frontend/views/performer/common.php | 22 ++++------------------ 7 files changed, 31 insertions(+), 35 deletions(-) diff --git a/common/models/Fields.php b/common/models/Fields.php index e7083aa..c434c42 100755 --- a/common/models/Fields.php +++ b/common/models/Fields.php @@ -3,6 +3,7 @@ namespace common\models; use Yii; +use yii\helpers\ArrayHelper; /** * This is the model class for table "{{%fields}}". @@ -55,7 +56,11 @@ class Fields extends \yii\db\ActiveRecord } public static function getData($id, $model, $type){ - return self::find()->where(['table_id'=>$id, 'table_name'=>$model, 'field_type'=>$type])->all(); + $data = ArrayHelper::toArray(self::find()->where(['table_id'=>$id, 'table_name'=>$model, 'field_type'=>$type])->all()); + print_r($data); + + die(); + return self::find()->where(['table_id'=>$id, 'table_name'=>$model, 'field_type'=>$type])->indexBy('parent_key')->all(); } diff --git a/common/widgets/views/courses_field.php b/common/widgets/views/courses_field.php index 71a87b6..813fb22 100644 --- a/common/widgets/views/courses_field.php +++ b/common/widgets/views/courses_field.php @@ -43,7 +43,7 @@ var block_id = $ (this) .parent ('fieldset'); var sub_block = '
' + - '' + + '' + '' + '' + '
'; diff --git a/common/widgets/views/development_field.php b/common/widgets/views/development_field.php index 6ead254..be4adc2 100644 --- a/common/widgets/views/development_field.php +++ b/common/widgets/views/development_field.php @@ -42,7 +42,7 @@ var block_id = $ (this) .parent ('fieldset'); var sub_block = '
' + - '' + + '' + '' + '' + '
'; diff --git a/common/widgets/views/education_field.php b/common/widgets/views/education_field.php index 7ed5e16..6a7ddb3 100755 --- a/common/widgets/views/education_field.php +++ b/common/widgets/views/education_field.php @@ -55,9 +55,9 @@ var block_id = $ (this) .parent ('fieldset'); var sub_block = '
' + - '' + + '' + ''+ - '' + + '' + ''+ '' + ''+ diff --git a/frontend/config/main.php b/frontend/config/main.php index 967bd17..8edda86 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -64,6 +64,7 @@ return [ 'showScriptName' => false, 'rules' => [ 'landing/' => 'landing/view', + 'performer/common/' => 'performer/common', ] ], ], diff --git a/frontend/controllers/PerformerController.php b/frontend/controllers/PerformerController.php index 83c91b9..6f37ced 100755 --- a/frontend/controllers/PerformerController.php +++ b/frontend/controllers/PerformerController.php @@ -48,24 +48,28 @@ class PerformerController extends Controller ]; } - /** - * @var $user common\models\User - */ + public function actionIndex() { - $user = \Yii::$app->user->identity; + $this->redirect('site/index'); - $education = Fields::getData($user->id,$user::className(),'education'); - - return $this->render('common',[ - 'user' => \Yii::$app->user->identity, - '$education' => $education - ]); } - public function actionCommon(/*$performer_id*/) + public function actionCommon($performer_id) { - return $this->render('common'); + if(\Yii::$app->user->identity instanceof User && \Yii::$app->user->identity->id == $performer_id ){ + $user = \Yii::$app->user->identity; + } else { + $user = User::findOne($performer_id); + } + + + $educations = Fields::getData($user->id,$user::className(),'education'); + + return $this->render('common',[ + 'user' => $user, + 'educations' => $educations + ]); } public function actionPortfolio(/*$performer_id*/) diff --git a/frontend/views/performer/common.php b/frontend/views/performer/common.php index 74aa02e..a8835fa 100755 --- a/frontend/views/performer/common.php +++ b/frontend/views/performer/common.php @@ -14,27 +14,13 @@ $this->title = 'My Yii Application';
+
Образование:
-
1996-2000
-
Сочинский государственный университет, специальность "Дизайнер среды".
-
- -
-
Собственные разработки, патенты:
-
2006
-
Патент "Технология сборки деревянной клеенной стены".
-
2014
-
Патент "Способ литья центробежным способом".
-
- -
-
Курсы, тренинги:
-
2003
-
Тренинг "Основы САПР и 2D черчения и проектирования на компьютере".
-
2014
-
Курс "Архитектурное моделирование".
+
year_from ?>-year_to ?>
+
name ?>
+
-- libgit2 0.21.4