social-link-table.php 3.07 KB
Newer Older
Marcello Pivanti's avatar
Marcello Pivanti committed
1
2
3
4
5
6
7
<?php

/**
 * Art-ER Attrattività, ricerca e territorio dell’Emilia-Romagna
 * OPEN 2.0
 *
 *
waltermazza's avatar
waltermazza committed
8
 * @package    arter\amos\socialauth
Marcello Pivanti's avatar
Marcello Pivanti committed
9
10
11
12
13
 * @category   CategoryName
 * @author     Elite Division S.r.l.
 */

use yii\helpers\Html;
waltermazza's avatar
waltermazza committed
14
use arter\amos\core\icons\AmosIcons;
Marcello Pivanti's avatar
Marcello Pivanti committed
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
?>
<div class="social-auth-bar">
    <?php
    foreach ($providers as $providerName => $config) {
        $lowCaseName = strtolower($providerName);

        /**
         * @var $socialAccount SocialAuthUsers
         */
        $socialAccount = SocialAuthUsers::findOne([
            'provider' => $lowCaseName,
            'user_id' => Yii::$app->user->id
        ]);

        /**
         * Is this social linked
         */
        $socialLinked = (!$socialAccount || !$socialAccount->id);
        ?>
        <div class="social_checkws">
            <div class="header">
                <span style="float:left;">
                    <h4><?= $providerName ?></h4>
                </span>
                <div class="social-buttons-container">
                    <?php if(!$socialLinked) : ?>
                        <?= Html::a(
                                AmosIcons::show($lowCaseName),
                                '/socialauth/social-auth/link-user?provider=' . $lowCaseName, ['class' => 'btn btn-default']); ?>
                        <button type="button" class="btn btn-social collega-social" data-type="<?= $lowCaseName ?>">
                            <span class="fa fa-<?= $lowCaseName ?>"></span>
                            <span>
waltermazza's avatar
waltermazza committed
47
                                <?= \arter\amos\socialauth\Module::t('amossocialauth', 'Collega il tuo profilo') ?>
Marcello Pivanti's avatar
Marcello Pivanti committed
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
                            </span>
                        </button>
                    <?php endif; ?>
                </div>
                <div class="floatclear"></div>
            </div>

            <?php if($socialLinked) : ?>
                <div class="media">
                    <div class="media-left">
                        <label>Foto</label>
                        <img src="https://lh4.googleusercontent.com/-97Zgh4BV3rk/AAAAAAAAAAI/AAAAAAAAAaY/N6HnrvhKCio/photo.jpg?sz=200" alt="immagine" width="80px">
                    </div>
                    <div class="media-body">
                        <div class="field-media">
                            <label>Nome</label>
                            <span>Damian</span>
                        </div>
                        <div class="field-media">
                            <label>Cognome</label>
                            <span>Gomez</span>
                        </div>
                        <div class="field-media">
                            <label>Email</label>
waltermazza's avatar
waltermazza committed
72
                            <span>damian.gomez@arter.it</span>
Marcello Pivanti's avatar
Marcello Pivanti committed
73
74
75
76
77
78
                        </div>
                    </div>
                </div>
            <?php else: ?>
                <div class="validatore_container checkws">
                    <br>
waltermazza's avatar
waltermazza committed
79
                    <?= \arter\amos\socialauth\Module::t('amossocialauth', 'Nessun profilo collegato.') ?>
Marcello Pivanti's avatar
Marcello Pivanti committed
80
81
82
83
84
85
86
                </div>
            <?php endif; ?>
        </div>
        <?php
    }
    ?>
</div>