language_status.php 2.6 KB
Newer Older
Marcello Pivanti's avatar
Marcello Pivanti committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php

/**
 * Art-ER Attrattività, ricerca e territorio dell’Emilia-Romagna
 * OPEN 2.0
 *
 * @package    Open20Package
 * @category   CategoryName
 * @author     Elite Division S.r.l.
 */

use yii\bootstrap\Progress;
use elitedivision\amos\core\helpers\Html;
use yii\helpers\StringHelper;
use elitedivision\amos\translation\models\TranslationUserLanguageMm;
?>
<?php
if (strpos(\yii\helpers\Url::current(), 'create') === false) {
    ?>
    <div class="container-language m-t-10">
        <?php
        $ind = 1;
        foreach ($statusLangs as $key => $value) {
            ?>
            <div class="col-lg-2 col-md-3 col-xs-6">
                <?php
                $url = "/translation/default/update?id={$getParams['id']}&lang=$key&namespace=$namespace";
                $can = true;
                $module = \Yii::$app->getModule('translation');
                $newModel = $module->modelNs . "\\" . StringHelper::basename($namespace) . "Translation";
                $can = (\Yii::$app->getUser()->can('TRANSLATOR', ['model' => new TranslationUserLanguageMm(), 'language' => $key]) && ((!empty($module->defaultLanguage) && $key != $module->defaultLanguage) || (!isset($module->defaultLanguage))));
                $defLang = $module->defaultLanguage;
                if (!empty($defLang) && $defLang == $key) {
                    $can = false;
                }
                ?>
                <p>
                    <?php if ($can): ?>                
                        <a href="/translation/default/update?id=<?= $getParams['id'] ?>&lang=<?= $key ?>&namespace=<?= $namespace ?>" title="Go to translation in <?= $key ?>" target="_blank">
                            <?= $key ?>                                
                        </a>
                    <?php else: ?>
                        <a href="/translation/default/view-tr?id=<?= $getParams['id'] ?>&lang=<?= $key ?>&namespace=<?= $namespace ?>" title="Go to translation in <?= $key ?>" target="_blank">
                            <?= $key ?>                                
                        </a>
                    <?php endif; ?>
                    <?= $value ?>
                </p>

            </div>    
            <?php
            if ((($ind) % 6) == 0 && $ind > 2) {
                ?>
                <hr class="container-language">
                <?php
            }
            $ind++;
        }
        if (($ind - 1 ) % 6 == 0) {
            ?>
            <hr class="container-language">
            <?php
        } else {
            ?>
            <hr class="container-language">
            <?php
        }
        ?>
    </div>
<?php } ?>