<?php 
$this->beginWidget('bootstrap.widgets.TbModal', array(
    'id'=>$this->keyToTranslate,
)); ?>


<?php /** @var BootActiveForm $form */
    $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
        'id'=>'horizontalForm',
        'type'=>'horizontal',
    ));
    
    $translatedVal = $this->translationsArray;
    if (isset( $translatedVal[$this->keyToTranslate])) {        
        $translatedVal = $translatedVal[$this->keyToTranslate];
    }
    else{
        $translatedVal = '';
    }
   
   $translatedVal = str_replace("<br />", "\r\n", $translatedVal); 
?>
 
<div class="modal-header">
    <a class="close" data-dismiss="modal">&times;</a>
    <h4><i class="icon-globe"></i> <?php echo $this->keyToTranslate;?></h4>
</div>
 
<div class="modal-body">
    
    
    
     
     
    <fieldset>
     
        <?php #dump($this->translationsArray);#echo $form->textFieldRow('User[textvalue]'); ?>
        <textarea class="" rows="8" style="width:515px" name="Translation[<?php echo $this->keyToTranslate;?>]" id="translationTextField"><?php echo $translatedVal; ?></textarea>
     
    </fieldset>

<?php
/*     
    <div class="form-actions">
        <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'type'=>'primary', 'label'=>'Submit')); ?>
        <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'reset', 'label'=>'Reset')); ?>
    </div>
*/
?>

     

    
</div>
 
<div class="modal-footer">
<?php echo CHtml::ajaxSubmitButton(
    'Save changes',
    CHtml::normalizeUrl(
        array('translation/update','render'=>false)
    ),
    array(
        'success'=>'js: function(data) {
            //alert($("#translationTextField").val());
            $("#'.$this->keyToTranslate.'").modal("hide");
            window.location.href=window.location.href;
        }'
    ),
    array(
        'id'=>'saveTranslationButton',
        'class'=>'btn btn-primary',
    )
); ?>


    <?php $this->widget('bootstrap.widgets.TbButton', array(
        'label'=>'Close',
        'url'=>'#',
        'htmlOptions'=>array('data-dismiss'=>'modal'),
    )); ?>
</div>

<?php $this->endWidget(); ?>
<?php $this->endWidget(); ?>