social-link-table.php 3.29 KB
Newer Older
Marcello Pivanti's avatar
Marcello Pivanti committed
1
2
<?php
/**
3
4
5
 * Copyright 2020 Art-ER S. Cons. P.A.
 * EROI - Emilia Romagna Open Innovation is based on:
 * https://www.open2.0.regione.lombardia.it
Marcello Pivanti's avatar
Marcello Pivanti committed
6
 *
Aster's avatar
Aster committed
7
 * @see http://example.com Developers'community
8
9
 * @license GPLv3
 * @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
Marcello Pivanti's avatar
Marcello Pivanti committed
10
 *
Aster's avatar
Aster committed
11
 * @package    arter\amos\socialauth
Marcello Pivanti's avatar
Marcello Pivanti committed
12
13
14
15
16
 * @category   CategoryName
 * @author     Elite Division S.r.l.
 */

use yii\helpers\Html;
waltermazza's avatar
waltermazza committed
17
use arter\amos\core\icons\AmosIcons;
Marcello Pivanti's avatar
Marcello Pivanti committed
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
47
48
49
?>
<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
50
                                <?= \arter\amos\socialauth\Module::t('amossocialauth', 'Collega il tuo profilo') ?>
Marcello Pivanti's avatar
Marcello Pivanti committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
                            </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
75
                            <span>damian.gomez@arter.it</span>
Marcello Pivanti's avatar
Marcello Pivanti committed
76
77
78
79
80
81
                        </div>
                    </div>
                </div>
            <?php else: ?>
                <div class="validatore_container checkws">
                    <br>
waltermazza's avatar
waltermazza committed
82
                    <?= \arter\amos\socialauth\Module::t('amossocialauth', 'Nessun profilo collegato.') ?>
Marcello Pivanti's avatar
Marcello Pivanti committed
83
84
85
86
87
88
89
                </div>
            <?php endif; ?>
        </div>
        <?php
    }
    ?>
</div>