update.php 4.62 KB
Newer Older
Marcello Pivanti's avatar
Marcello Pivanti committed
1
2
3
4
5
6
<?php

/**
 * Art-ER Attrattività, ricerca e territorio dell’Emilia-Romagna
 * OPEN 2.0
 *
7
8
9
10
 * @see https://www.open2.0.regione.lombardia.it Developers'community
 * @license GPLv3
 * @license https://opensource.org/licenses/gpl-3.0.html GNU General Public License version 3
 *
waltermazza's avatar
waltermazza committed
11
 * @package    arter
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
24
25
use arter\amos\translation\AmosTranslation;
use arter\amos\translation\models\TranslationConf;
use arter\amos\core\forms\ActiveForm;
use arter\amos\core\forms\CloseSaveButtonWidget;
use arter\amos\core\forms\TextEditorWidget;
Marcello Pivanti's avatar
Marcello Pivanti committed
26

waltermazza's avatar
waltermazza committed
27
\arter\amos\translation\assets\AmosTranslationAsset::register($this);
Marcello Pivanti's avatar
Marcello Pivanti committed
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

/**
 * @var yii\web\View $this
 * @var yii\data\ActiveDataProvider $dataProvider
 * @var backend\modules\registry\models\search\ProfessionalProfilesSearch $model
 */
$url = filter_input(INPUT_GET, 'url');
if (!$url) {
    $url = filter_input(INPUT_POST, 'url');
}
$module = $this->context->module;

$rteClientOptions = array_merge([
    'placeholder' => AmosTranslation::t('amostranslation', '#description_field_placeholder'),
    'lang' => substr(Yii::$app->language, 0, 2)], $module->clientOptionsRTE);

$this->title = "$classname #{$source[$pk]}: ".AmosTranslation::t('amostranslation', 'translation into')." $lang";
$prev        = \Yii::$app->request->referrer;
if (strpos($prev, '/translation/default/records') !== false) {
    $this->params['breadcrumbs'][] = ['label' => AmosTranslation::t('amostranslation', 'Translate manager'), 'url' => ['/translation']];
    $this->params['breadcrumbs'][] = ['label' => AmosTranslation::t('amostranslation', 'Translate contents'), 'url' => [
            $url]];
} else {
    $this->params['breadcrumbs'][] = ['label' => AmosTranslation::t('amostranslation', '#Original_content'), 'url' => $prev];
}

$this->params['breadcrumbs'][] = $this->title;
?>
<div class="form">
    <?php
    echo $this->render('_language', ['model' => $model]);

    $form = ActiveForm::begin();
    if (!$model->isNewRecord):
        ?>
        <?php
        $workflowId = (defined("$modelClassName::TR_WORKFLOW") ? $modelClassName::TR_WORKFLOW : null);
        if ($workflowId !== null) {
            ?>
            <?=
waltermazza's avatar
waltermazza committed
68
            \arter\amos\core\forms\WorkflowTransitionWidget::widget([
Marcello Pivanti's avatar
Marcello Pivanti committed
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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
114
115
116
117
118
119
120
121
122
123
124
                'form' => $form,
                'model' => $model,
                'workflowId' => $workflowId,
                'classDivIcon' => 'pull-left',
                'classDivMessage' => 'pull-left message',
            ]);
            ?>
            <?php
        }
    endif;
    ?>

    <?= $form->field($model, $pk)->hiddenInput()->label(false); ?>
    <?php foreach ((array) $stringField as $string) { ?>
        <div class="row">
            <div class="col-lg-12">
                <p><?= AmosTranslation::tHtml('amostranslation', 'Source content of') ?> <strong><?= $model->getAttributeLabel($string) ?></strong><?=
                    ($model->language_source) ? " ({$model->language_source})" : ''
                    ?></p>
                <div class="bordered-box color-source-content"><?= $source[$string] ?></div>
            </div>
            <div class="col-lg-12">
                <?= $form->field($model, $string)->textInput() ?>
            </div>
        </div>
    <?php } ?>
    <?php foreach ((array) $textField as $text) { ?>
        <div class="row">
            <div class="col-lg-12">
                <p><?= AmosTranslation::tHtml('amostranslation', 'Source content of') ?> <strong><?= $model->getAttributeLabel($text) ?></strong><?=
                    ($model->language_source) ? " ({$model->language_source})" : ''
                    ?></p>
                <div class="bordered-box color-source-content">
                    <?=
                    ($module->enableRTE && in_array($text, $rteAttributes)) ? \Yii::$app->formatter->asHtml($source[$text])
                            : $source[$text]
                    ?>
                </div>
            </div>
            <div class="col-lg-12">
                <?=
                ($module->enableRTE && in_array($text, $rteAttributes)) ? $form->field($model, $text)->widget(TextEditorWidget::className(),
                        [
                        'clientOptions' => $module->clientOptionsRTE,
                    ]) : $form->field($model, $text)->textarea(['rows' => 4])
                ?>
            </div>
        </div>
    <?php } ?>

    <div class="form-group">
        <?= CloseSaveButtonWidget::widget(['model' => $model]); ?>
    </div>
    <?php ActiveForm::end(); ?>

</div>