<?php
/**
 * @var MessageController $this
 * @var array $new_messages
 * @var array $messages
 * @val string $languageName
 * @val string $languageCode
 */

?>
<?php
$form = $this->beginWidget('CActiveForm');
?>
<table class="table table-bordered">
    <tr>
        <th>Сохранить</th>
        <th>Сообщение</th>
        <th>Перевод</th>
    </tr>
    <?php foreach ($messages as $message): ?>

    <tr>
        <td><?php echo CHtml::checkBox("message[{$message['id']}][save]", false) ?>
        </td>
        <td><?php echo $message['message'] ?>
        </td>
        <td><?php echo CHtml::textArea("message[{$message['id']}][translation]",
            $message['translation'],
            array(
                'onchange' => "setTimeout(function(){ $('#" . CHtml::getIdByName("message[{$message['id']}][save]") . "').attr('checked','checked');},100);",
                'class' => 'input-xxlarge',
//                'cols'=>40,
//                'rows'=>4,
            )
        ) ?>
        </td>
    </tr>
    <?php endforeach?>
</table>
<input type="submit" value="Сохранить отмеченные" class="btn-primary btn"/>
<?php
$this->endWidget();
?>