Skip to content

Commit 715defd

Browse files
Changes in the administrative part
1 parent 5e7081e commit 715defd

5 files changed

Lines changed: 107 additions & 25 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
CHANGELOG
22
==============
33

4+
1.0.0-beta
5+
-----------------
6+
* Changes in the administrative part
7+
48
1.0.0-alpha2
59
-----------------
610
* Small changes

controllers/AdminUserAuthClientController.php

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class AdminUserAuthClientController extends AdminModelEditorController
2020
{
2121
public function init()
2222
{
23-
$this->name = "Управление социальными профилями";
23+
$this->name = \Yii::t('skeeks/authclient', 'Social profiles');
2424
$this->modelShowAttribute = "displayName";
2525
$this->modelClassName = UserAuthClient::className();
2626

@@ -32,23 +32,6 @@ public function actions()
3232
{
3333
return ArrayHelper::merge(parent::actions(), [
3434

35-
'index' =>
36-
[
37-
"columns" => [
38-
'displayName',
39-
40-
[
41-
'class' => \skeeks\cms\grid\UserColumnData::className(),
42-
'attribute' => "user_id"
43-
],
44-
45-
[
46-
'class' => \skeeks\cms\grid\DateTimeColumnData::className(),
47-
'attribute' => "created_at"
48-
],
49-
],
50-
],
51-
5235
'create' =>
5336
[
5437
'visible' => false

messages/ru/main.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,10 @@
33
'Authorization through social networks' => 'Авторизация через социальные сети',
44
'Authorization by social networks' => 'Авторизация через социальные сети',
55
'Social profiles' => 'Социальные профили',
6+
'Provider' => 'Провайдер',
7+
'Provider Identifier' => 'Провайдер id',
8+
'Created At' => 'Дата создания',
9+
'Updated At' => 'Дата последнего обновления',
10+
'User' => 'Пользователь',
11+
'Display Name' => 'Социальный профиль',
612
];

models/UserAuthClient.php

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@
1010
use skeeks\cms\models\behaviors\HasJsonFieldsBehavior;
1111
use Yii;
1212
use \yii\db\ActiveRecord;
13+
use yii\helpers\ArrayHelper;
1314

1415
/**
16+
* @property string $provider
17+
* @property array $provider_data
18+
* @property string $providerUrl
19+
*
1520
* Class UserAuthClient
1621
* @package skeeks\module\cms\user\model
1722
*/
@@ -59,13 +64,13 @@ public function rules()
5964
public function attributeLabels()
6065
{
6166
return [
62-
'id' => Yii::t('app', 'ID'),
63-
'user_id' => Yii::t('app', 'User'),
64-
'provider' => Yii::t('app', 'Provider'),
65-
'provider_identifier' => Yii::t('app', 'Provider Identifier'),
66-
'provider_data' => Yii::t('app', 'Provider Data'),
67-
'created_at' => Yii::t('app', 'Created At'),
68-
'updated_at' => Yii::t('app', 'Updated At'),
67+
'id' => Yii::t('skeeks/authclient', 'ID'),
68+
'user_id' => Yii::t('skeeks/authclient', 'User'),
69+
'provider' => Yii::t('skeeks/authclient', 'Provider'),
70+
'provider_identifier' => Yii::t('skeeks/authclient', 'Provider Identifier'),
71+
'provider_data' => Yii::t('skeeks/authclient', 'Provider Data'),
72+
'created_at' => Yii::t('skeeks/authclient', 'Created At'),
73+
'updated_at' => Yii::t('skeeks/authclient', 'Updated At'),
6974
];
7075
}
7176

@@ -84,4 +89,24 @@ public function getDisplayName()
8489
{
8590
return $this->provider . " [{$this->provider_identifier}]";
8691
}
92+
93+
/**
94+
* @return string
95+
*/
96+
public function getProviderUrl()
97+
{
98+
if ($this->provider == 'facebook')
99+
{
100+
$id = ArrayHelper::getValue($this->provider_data, 'id');
101+
return 'https://www.facebook.com/' . $id;
102+
}
103+
104+
if ($this->provider == 'vkontakte')
105+
{
106+
$id = ArrayHelper::getValue($this->provider_data, 'user_id');
107+
return 'https://vk.com/id' . $id;
108+
}
109+
110+
return '#';
111+
}
87112
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/**
3+
* @author Semenov Alexander <[email protected]>
4+
* @link http://skeeks.com/
5+
* @copyright 2010 SkeekS (СкикС)
6+
* @date 23.06.2016
7+
*/
8+
9+
/* @var $this yii\web\View */
10+
/* @var $searchModel common\models\searchs\Game */
11+
/* @var $dataProvider yii\data\ActiveDataProvider */
12+
13+
?>
14+
<? $pjax = \skeeks\cms\modules\admin\widgets\Pjax::begin(); ?>
15+
16+
<?php /*echo $this->render('_search', [
17+
'searchModel' => $searchModel,
18+
'dataProvider' => $dataProvider
19+
]); */?>
20+
21+
<?= \skeeks\cms\modules\admin\widgets\GridViewStandart::widget([
22+
'dataProvider' => $dataProvider,
23+
'filterModel' => $searchModel,
24+
'adminController' => $controller,
25+
'pjax' => $pjax,
26+
'columns' =>
27+
[
28+
[
29+
'class' => \yii\grid\DataColumn::className(),
30+
'attribute' => "provider",
31+
'format' => "raw",
32+
'value' => function(\skeeks\cms\authclient\models\UserAuthClient $userAuthClient)
33+
{
34+
return \yii\helpers\Html::a($userAuthClient->provider, $userAuthClient->providerUrl, [
35+
'target' => '_blank'
36+
]);
37+
}
38+
],
39+
40+
[
41+
'class' => \yii\grid\DataColumn::className(),
42+
'attribute' => "provider_identifier",
43+
'format' => "raw",
44+
'value' => function(\skeeks\cms\authclient\models\UserAuthClient $userAuthClient)
45+
{
46+
return \yii\helpers\Html::a($userAuthClient->provider_identifier, $userAuthClient->providerUrl, [
47+
'target' => '_blank'
48+
]);
49+
}
50+
],
51+
52+
[
53+
'class' => \skeeks\cms\grid\UserColumnData::className(),
54+
'attribute' => "user_id"
55+
],
56+
57+
[
58+
'class' => \skeeks\cms\grid\DateTimeColumnData::className(),
59+
'attribute' => "created_at"
60+
],
61+
]
62+
]); ?>
63+
64+
<? $pjax::end(); ?>

0 commit comments

Comments
 (0)