/**
  * Saveing new language element by category.
  * @param \yii\base\Event $event
  */
 public function saveAttributes($event)
 {
     /* @var $owner BaseActiveRecord */
     $owner = $this->owner;
     foreach ($this->translateAttributes as $attribute) {
         if ($owner->isAttributeChanged($attribute)) {
             Language::saveMessage($owner->attributes[$attribute], $this->category);
         }
     }
 }
Ejemplo n.º 2
0
 public function beforeSave($insert)
 {
     if (parent::beforeSave($insert)) {
         Language::saveMessage($this->name);
         // or If the category is the database table name.
         //     Language::saveMessage($this->name, static::tableName());
         // Language::saveMessage($this->description, static::tableName());
         return true;
     }
     return false;
 }
Ejemplo n.º 3
0
 public function init()
 {
     Language::registerAssets();
     parent::init();
 }
Ejemplo n.º 4
0
 /**
  * Returns the names of possible states in an associative array.
  * @return array
  */
 public static function getStatusNames()
 {
     return \lajax\translatemanager\helpers\Language::a(self::$_CONDITIONS);
 }
/* @var $language_id integer */
/* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $searchModel lajax\translatemanager\models\searches\LanguageSourceSearch */
$this->title = Yii::t('language', 'Translation into {language_id}', ['language_id' => $language_id]);
$this->params['breadcrumbs'][] = ['label' => Yii::t('language', 'Languages'), 'url' => ['list']];
$this->params['breadcrumbs'][] = $this->title;
?>
<h1>
<?php 
echo $this->title;
?>
</h1>
    <?php 
echo Html::hiddenInput('language_id', $language_id, ['id' => 'language_id', 'data-url' => Yii::$app->urlManager->createAbsoluteUrl('/translatemanager/language/save')]);
?>
<div id="translates" class="<?php 
echo $language_id;
?>
">
    <?php 
Pjax::begin(['id' => 'translates']);
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['format' => 'text', 'filter' => Language::getCategories(), 'attribute' => 'category', 'filterInputOptions' => ['class' => 'form-control', 'id' => 'category']], ['format' => 'text', 'attribute' => 'message', 'filterInputOptions' => ['class' => 'form-control', 'id' => 'message'], 'label' => Yii::t('language', 'Source'), 'content' => function ($data) {
    return Html::activeTextarea($data, 'message', ['name' => 'LanguageSource[' . $data->id . ']', 'class' => 'form-control source', 'readonly' => 'readonly']);
}], ['format' => 'text', 'attribute' => 'translation', 'filterInputOptions' => ['class' => 'form-control', 'id' => 'translation'], 'label' => Yii::t('language', 'Translation'), 'content' => function ($data) {
    return Html::activeTextarea($data, 'translation', ['name' => 'LanguageTranslate[' . $data->id . ']', 'class' => 'form-control translation', 'data-id' => $data->id, 'tabindex' => $data->id]);
}], ['format' => 'html', 'attribute' => Yii::t('language', 'Action'), 'content' => function ($data) {
    return Html::button(Yii::t('language', 'Save'), ['type' => 'button', 'data-id' => $data['id'], 'class' => 'btn btn-lg btn-success']);
}]]]);
Pjax::end();
?>
</div>
/* @var $this \yii\web\View */
/* @var $content string */
use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use app\assets\AppAsset;
use yii\helpers\Url;
use lajax\translatemanager\helpers\Language as Lx;
use dyar74\admin\models\Menu;
use cornernote\menu\models\MenuSearch;
use slatiusa\nestable\Nestable;
use cornernote\returnurl\ReturnUrl;
AppAsset::register($this);
\lajax\translatemanager\helpers\Language::registerAssets();
$this->beginPage();
?>
<!DOCTYPE html>
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html lang="<?php 
echo Yii::$app->language;
?>
">
    <!--<![endif]-->
    <head>
        <meta charset="<?php 
echo Yii::$app->charset;
?>