diff --git a/backend/modules/card/views/user-card/view.php b/backend/modules/card/views/user-card/view.php index be457ab..9cf3277 100755 --- a/backend/modules/card/views/user-card/view.php +++ b/backend/modules/card/views/user-card/view.php @@ -9,6 +9,7 @@ use yii\widgets\DetailView; /* @var $userData common\models\User */ /* @var $skills \common\models\CardSkill */ /* @var $skill \common\models\Skill */ +/* @var $modelFildValue yii\data\ActiveDataProvider */ $this->title = $model->fio; $this->params['breadcrumbs'][] = ['label' => 'User Cards', 'url' => ['index']]; diff --git a/frontend/config/main.php b/frontend/config/main.php index 767b94d..339f96e 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -16,6 +16,9 @@ return [ 'access' => [ 'class' => 'frontend\modules\access\Access', ], + 'card' => [ + 'class' => 'frontend\modules\card\Card', + ], ], 'components' => [ @@ -48,7 +51,10 @@ return [ 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, - 'rules' => [], + 'rules' => [ + '' => 'card/user-card/index', + 'site/index' => 'card/user-card/index', + ], ], ], diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index d24e107..5adf2f7 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -1,6 +1,8 @@ $dataProvider, diff --git a/frontend/modules/card/Card.php b/frontend/modules/card/Card.php new file mode 100644 index 0000000..f1853b3 --- /dev/null +++ b/frontend/modules/card/Card.php @@ -0,0 +1,24 @@ +user->id; + $result = UserCard::find()->where(['id_user' => $id_user])->asArray()->all(); + $id = $result[0]['id']; + + $dataProvider = new ActiveDataProvider([ + 'query' => FieldsValueNew::find() + ->where(['item_id' => $id, 'item_type' => FieldsValueNew::TYPE_PROFILE]) + ->orderBy('order'), + 'pagination' => [ + 'pageSize' => 200, + ], + ]); + + $skills = CardSkill::find()->where(['card_id' => $id])->with('skill')->all(); + + return $this->render('index', [ + 'model' => $this->findModel($id), + 'modelFildValue' => $dataProvider, + 'skills' => $skills, + ]); + + } + + /** + * Finds the Product model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return UserCard the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = UserCard::findOne($id)) !== null) { + return $model; + } + + throw new NotFoundHttpException('The requested page does not exist.'); + } +} \ No newline at end of file diff --git a/frontend/modules/card/views/user-card/index.php b/frontend/modules/card/views/user-card/index.php new file mode 100644 index 0000000..6c98813 --- /dev/null +++ b/frontend/modules/card/views/user-card/index.php @@ -0,0 +1,80 @@ + +