Exemplo n.º 1
0
 public static function getStatus($id = null)
 {
     $statuses = [self::STATUS_TRANSLATED => Module::t('Translated'), self::STATUS_NOT_TRANSLATED => Module::t('Not translated')];
     if ($id !== null) {
         return ArrayHelper::getValue($statuses, $id, null);
     }
     return $statuses;
 }
Exemplo n.º 2
0
 /**
  * @param array|integer $id
  * @return SourceMessage|SourceMessage[]
  * @throws NotFoundHttpException
  */
 protected function findModel($id)
 {
     $query = SourceMessage::find()->where('id = :id', [':id' => $id]);
     $models = is_array($id) ? $query->all() : $query->one();
     if (!empty($models)) {
         return $models;
     } else {
         throw new NotFoundHttpException(Module::t('The requested page does not exist'));
     }
 }
Exemplo n.º 3
0
/**
 * @var View $this
 * @var SourceMessageSearch $searchModel
 * @var ActiveDataProvider $dataProvider
 */
use yii\data\ActiveDataProvider;
use yii\grid\GridView;
use yii\helpers\ArrayHelper;
use yii\helpers\Html;
use yii\web\View;
use yii\widgets\Breadcrumbs;
use yii\widgets\Pjax;
use dvixi\yii2\I18n\models\search\SourceMessageSearch;
use dvixi\yii2\I18n\models\SourceMessage;
use dvixi\yii2\I18n\Module;
$this->title = Module::t('Translations');
echo Breadcrumbs::widget(['links' => [$this->title]]);
?>
<div class="message-index">
    <h3><?php 
echo Html::encode($this->title);
?>
</h3>
    <?php 
Pjax::begin();
echo GridView::widget(['filterModel' => $searchModel, 'dataProvider' => $dataProvider, 'columns' => [['attribute' => 'id', 'value' => function ($model, $index, $dataColumn) {
    return $model->id;
}, 'filter' => false], ['attribute' => 'message', 'format' => 'raw', 'value' => function ($model, $index, $widget) {
    return Html::a($model->message, ['update', 'id' => $model->id], ['data' => ['pjax' => 0]]);
}], ['attribute' => 'category', 'value' => function ($model, $index, $dataColumn) {
    return $model->category;
Exemplo n.º 4
0
<?php

/**
 * @var View $this
 * @var SourceMessage $model
 */
use yii\helpers\Html;
use yii\web\View;
use dvixi\yii2\I18n\models\SourceMessage;
use dvixi\yii2\I18n\Module;
use yii\widgets\ActiveForm;
use yii\widgets\Breadcrumbs;
$this->title = Module::t('Update') . ': ' . $model->message;
echo Breadcrumbs::widget(['links' => [['label' => Module::t('Translations'), 'url' => ['index']], ['label' => $this->title]]]);
?>
<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">Редактирование</h3>
    </div>
    <div class="panel-body">
        <?php 
$form = ActiveForm::begin();
?>
        <div class="row">
            <?php 
foreach ($model->messages as $language => $message) {
    ?>
                <?php 
    echo $form->field($model->messages[$language], '[' . $language . ']translation', ['options' => ['class' => 'form-group col-sm-6']])->textarea()->label($language);
    ?>
            <?php 
Exemplo n.º 5
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => Module::t('ID'), 'category' => Module::t('Category'), 'message' => Module::t('Message'), 'status' => Module::t('Translation status')];
 }
Exemplo n.º 6
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     return ['id' => Module::t('ID'), 'language' => Module::t('Language'), 'translation' => Module::t('Translation')];
 }