_icon.php 7.36 KB
Newer Older
Marcello Pivanti's avatar
Marcello Pivanti committed
1
<?php
Aster's avatar
Aster committed
2

Marcello Pivanti's avatar
Marcello Pivanti committed
3
/**
Aster's avatar
Aster committed
4
5
 * Emilia Romagna Open Innovation
 * Arter
Marcello Pivanti's avatar
Marcello Pivanti committed
6
7
 *
 *
Aster's avatar
Aster committed
8
 * @package    arter\amos\admin\views\user-profile
Marcello Pivanti's avatar
Marcello Pivanti committed
9
10
11
 * @category   CategoryName
 */

Aster's avatar
Aster committed
12
13
14
15
16
17
18
use arter\amos\admin\AmosAdmin;
use arter\amos\admin\base\ConfigurationManager;
use arter\amos\admin\widgets\ConnectToUserWidget;
use arter\amos\admin\widgets\SendMessageToUserWidget;
use arter\amos\core\forms\ContextMenuWidget;
use arter\amos\core\helpers\Html;
use arter\amos\core\icons\AmosIcons;
Marcello Pivanti's avatar
Marcello Pivanti committed
19
20
21

/**
 * @var yii\web\View $this
Aster's avatar
Aster committed
22
 * @var \arter\amos\admin\models\UserProfile $model
Marcello Pivanti's avatar
Marcello Pivanti committed
23
24
25
 */

$userId = $model->user_id;
Aster's avatar
Aster committed
26
/** @var \arter\amos\admin\controllers\UserProfileController $appController */
Marcello Pivanti's avatar
Marcello Pivanti committed
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
$appController = Yii::$app->controller;
$appController->setCwhScopeNetworkInfo($userId);

/** @var AmosAdmin $adminModule */
$adminModule = AmosAdmin::instance();

$nomeCognome = '';
if ($adminModule->confManager->isVisibleBox('box_informazioni_base', ConfigurationManager::VIEW_TYPE_VIEW)) {
    if ($adminModule->confManager->isVisibleField('nome', ConfigurationManager::VIEW_TYPE_VIEW)) {
        $nomeCognome .= $model->nome;
    }
    if ($adminModule->confManager->isVisibleField('cognome', ConfigurationManager::VIEW_TYPE_VIEW)) {
        $nomeCognome .= ' ' . $model->cognome;
    }
}

$viewUrl = "/admin/user-profile/view?id=" . $model->id;

$prevalentPartnershipTruncated = '';
$prevalentPartnershipName = '';
if (!is_null($model->prevalentPartnership)) {
    $prevalentPartnershipTruncated = $model->prevalentPartnership;
    $prevalentPartnershipName = $model->prevalentPartnership->name;
}

?>

54
55
<div class="card-container admin-card-container">
    <div class="icon-header">
Marcello Pivanti's avatar
Marcello Pivanti committed
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
        <?= ContextMenuWidget::widget([
            'model' => $model,
            'actionModify' => '/admin/user-profile/update?id=' . $model->id,
            'disableDelete' => true
        ]) ?>
        <?php if (($adminModule->confManager->isVisibleBox('box_foto', ConfigurationManager::VIEW_TYPE_VIEW)) &&
            ($adminModule->confManager->isVisibleField('userProfileImage', ConfigurationManager::VIEW_TYPE_VIEW))
        ): ?>
            <div class="container-round-img">
                <?php
                $url = $model->getAvatarUrl('card_users');
                Yii::$app->imageUtility->methodGetImageUrl = 'getAvatarUrl';
                $logoOptions = [
                    'class' => Yii::$app->imageUtility->getRoundImage($model)['class'],
                    //'style' => "margin-left: " . Yii::$app->imageUtility->getRoundImage($model)['margin-left'] . "%; margin-top: " . Yii::$app->imageUtility->getRoundImage($model)['margin-top'] . "%;",
                    'alt' => $model->getNomeCognome(),
                ];
                $options = [];
                if (strlen($nomeCognome) > 0) {
                    $logoOptions['alt'] = $nomeCognome;
                    $options['title'] = $nomeCognome;
                }
                $logo = Html::img($url, $logoOptions);
                ?>
                <?= Html::a($logo, $viewUrl, $options); ?>
            </div>
        <?php endif; ?>
    </div>
84
85
    <div class="card-info-content">
    <div class="icon-body">
Aster's avatar
Aster committed
86
        <?= \arter\amos\notificationmanager\forms\NewsWidget::widget([
Marcello Pivanti's avatar
Marcello Pivanti committed
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
            'model' => $model,
            'css_class' => 'badge badge-left'
        ]); ?>
        <h3 class="title">
            <?= Html::a($model->getNomeCognome(), $viewUrl, ['title' => AmosAdmin::t('amosadmin', '#icon_name_title_link') . ' ' . $model->getNomeCognome(), 'data-gui' => 'icon-view-profiles']); ?>
        </h3>
        <?php
        if (
            ($adminModule->confManager->isVisibleBox('box_prevalent_partnership', ConfigurationManager::VIEW_TYPE_VIEW)) &&
            ($adminModule->confManager->isVisibleField('prevalent_partnership_id', ConfigurationManager::VIEW_TYPE_VIEW))
        ): ?>
            <div class="col-xs-12 nop">
                <span class="prevalent-partnership"><?= (!empty($prevalentPartnershipTruncated)) ? AmosIcons::show('briefcase', [], 'dash') . $prevalentPartnershipTruncated : ''; ?></span>
            </div>
        <?php endif; ?>
        <?php
        if (isset($this->params['role'])) {
            $role = $this->params['role'];
            echo Html::tag('p', $role);
        }
        if (isset($this->params['status'])) {
            $status = $this->params['status'];
            echo Html::tag('p', AmosAdmin::t('amosadmin', 'Status:') . ' ' . $status);
        }
        ?>

    </div>
114
    <div class="icon-footer">
Marcello Pivanti's avatar
Marcello Pivanti committed
115
116
117
        <?php
        // draws google Icon if the userprofile is google contact of logged user
        $googleContactIcon = '';
Aster's avatar
Aster committed
118
        $googleContactIcon = \arter\amos\admin\widgets\GoogleContactWidget::widget(['model' => $model]);
Marcello Pivanti's avatar
Marcello Pivanti committed
119
120
121
        $googleContactTooltip = (!empty($googleContactIcon)) ? AmosAdmin::t('amosadmin', '#google_contact_tooltip') : '';

        $isValidated = '';
Aster's avatar
Aster committed
122
        if ($model->status == \arter\amos\admin\models\UserProfile::USERPROFILE_WORKFLOW_STATUS_VALIDATED) {
Marcello Pivanti's avatar
Marcello Pivanti committed
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
            $isValidated = AmosAdmin::t('amosadmin', 'Profile Validated');
        }
        $isFacilitator = '';
        if (
            ($adminModule->confManager->isVisibleBox('box_facilitatori', ConfigurationManager::VIEW_TYPE_VIEW)) &&
            ($adminModule->confManager->isVisibleField('facilitatore_id', ConfigurationManager::VIEW_TYPE_VIEW))
        ) {
            $facilitatorUserIds = Yii::$app->getAuthManager()->getUserIdsByRole("FACILITATOR");
            if (in_array($model->user_id, $facilitatorUserIds)) {
                $isFacilitator = AmosAdmin::t('amosadmin', 'Facilitator');
            }
        }
        $content = '';
        $content .= Html::tag('p', $isValidated);
        $content .= Html::tag('p', $isFacilitator);
        $content .= Html::tag('p', $googleContactTooltip);

140
141

        //        if (!empty($isValidated) || !empty($isFacilitator)) {
Marcello Pivanti's avatar
Marcello Pivanti committed
142
143
144
145
146
147
148
149
150
151
152
153
//            echo Html::tag('div', AmosIcons::show('info-circle', [], 'dash'), [
//                'class' => 'amos-tooltip pull-left',
//                'data-toggle' => 'tooltip',
//                'data-html' => 'true',
//                'title' => $content
//            ]);
//        }

        ?>
        <?= $googleContactIcon; ?>
        <?php if (Yii::$app->user->id != $model->user_id): ?>
            <div class="col-xs-12 icon-btn-action">
Aster's avatar
Aster committed
154
                <?php if ($adminModule->enableUserContacts && !$adminModule->enableSendMessage && \Yii::$app->getUser()->identity->profile->validato_almeno_una_volta): ?>
Marcello Pivanti's avatar
Marcello Pivanti committed
155
156
                    <?= ConnectToUserWidget::widget(['model' => $model, 'divClassBtnContainer' => '']) ?>
                <?php endif; ?>
Aster's avatar
Aster committed
157
                <?php if (!$adminModule->enableUserContacts && $adminModule->enableSendMessage && \Yii::$app->getUser()->identity->profile->validato_almeno_una_volta): ?>
Marcello Pivanti's avatar
Marcello Pivanti committed
158
159
160
161
                    <?= SendMessageToUserWidget::widget(['model' => $model, 'divClassBtnContainer' => '']) ?>
                <?php endif; ?>
                <?php if ($adminModule->enableInviteUserToEvent): ?>
                    <?php
Aster's avatar
Aster committed
162
                    /** @var \arter\amos\events\AmosEvents $eventsModule */
Marcello Pivanti's avatar
Marcello Pivanti committed
163
164
165
166
167
168
169
170
171
                    $eventsModule = Yii::$app->getModule('events');
                    ?>
                    <?php if (!is_null($eventsModule) && $eventsModule->hasMethod('getInviteUserToEventWidget')): ?>
                        <?= $eventsModule->getInviteUserToEventWidget($model) ?>
                    <?php endif; ?>
                <?php endif; ?>
            </div>
        <?php endif; ?>
    </div>
172
    </div>
Marcello Pivanti's avatar
Marcello Pivanti committed
173
</div>