translators.php 3.24 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
 *
7
 * @see https://repo.art-er.it Developers' community
8
9
10
 * @license GPLv3
 * @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
 *
11
 * @package    arter\amos\translation\views\default
Marcello Pivanti's avatar
Marcello Pivanti committed
12
13
14
15
 * @category   CategoryName
 * @author     Elite Division S.r.l.
 */

waltermazza's avatar
waltermazza committed
16
17
use arter\amos\core\helpers\Html;
use arter\amos\core\views\DataProviderView;
Marcello Pivanti's avatar
Marcello Pivanti committed
18
19
20
use yii\widgets\Pjax;
use yii\helpers\StringHelper;
use yii\helpers\Inflector;
waltermazza's avatar
waltermazza committed
21
22
23
use arter\amos\translation\AmosTranslation;
use arter\amos\translation\models\TranslationConf;
use arter\amos\core\icons\AmosIcons;
Marcello Pivanti's avatar
Marcello Pivanti committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

/**
 * @var yii\web\View $this
 * @var yii\data\ActiveDataProvider $dataProvider
 */
$this->title = AmosTranslation::t('amostranslation', 'Manage translators');
$this->params['breadcrumbs'][] = ['label' => AmosTranslation::t('amostranslation', 'Translate manager'), 'url' => ['/translation']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="professional-profiles-index"> 
    <?php //echo $this->render('_filter', ['model' => $model]); ?>

    <p>
        <?php /* echo         Html::a('Nuovo Professional Profiles'        , ['create'], ['class' => 'btn btn-amministration-primary']) */ ?>
    </p>

    <?php     
waltermazza's avatar
waltermazza committed
41
    echo arter\amos\core\views\AmosGridView::widget([
Marcello Pivanti's avatar
Marcello Pivanti committed
42
43
44
45
46
47
48
49
50
51
        'dataProvider' => $dataProvider,
        'columns' => [
            'nome', 
            'cognome',
            'codice_fiscale',            
            [
                'attribute' => 'languages',
                'label' => AmosTranslation::t('amostranslation', 'Languages'),
                'format' => 'html',
                'value' => function ($model){
waltermazza's avatar
waltermazza committed
52
                    $languages = arter\amos\translation\models\TranslationUserLanguageMm::find()->andWhere(['user_id' => $model['user_id']]);
Marcello Pivanti's avatar
Marcello Pivanti committed
53
54
55
56
57
58
59
60
61
62
63
64
65
66
                    if($languages->count()){
                        $i = 0;
                        $lng = '';
                        foreach ($languages->all() as $l){
                        $lng .= ($i == 0? '' : '<br>') . $l->language;
                        $i++;
                        }                        
                        return $lng;
                    } else {
                        return AmosTranslation::t('amostranslation', 'Not set');
                    }
                },             
            ],           
               [
waltermazza's avatar
waltermazza committed
67
            'class' => \arter\amos\core\views\grid\ActionColumn::className(),
Marcello Pivanti's avatar
Marcello Pivanti committed
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
            'template' => '{custom}',
            'buttons' => [
                'custom' => function ($url, $model) {                      
                    $url = yii\helpers\Url::current();                    
                    $urlDestination = \Yii::$app->urlManager->createUrl(['/translation/default/user-language', 'user_id' => $model['user_id'] , 'url' => $url]);
                    return \yii\helpers\Html::a(AmosIcons::show('square-right', ['class' => 'btn btn-tool-secondary']), $urlDestination, [
                        'title' => AmosTranslation::t('app', 'Choose the language he can translate'),                        
                    ]);
                },

            ]
        ]
        ],
    ]);
    ?>

</div>