<?php
echo $form->textFieldRow($model, 'name', array(
    'class' => 'span3',
    'data-translation-id' => 'AUDIOFILES_MODEL_NAME',
));

echo $form->textFieldRow($model, 'descr', array(
    'class' => 'span3',
    'data-translation-id' => 'AUDIOFILES_MODEL_DESCR',
));


$radioList = array(
    'selectUpload' => __('AUDIOFILES_MODEL_DATA'),
    'selectRecord' => __('AUDIOFILES_MODEL_START_RECORD_LABEL')
);

echo '<div class="audioFileUpload-modal">';
echo CHtml::radioButtonList('audioFileRadioButtons', 'selectUpload', $radioList, array(
    'class' => 'control-label controls',
    'data-translation-target' => 'AUDIOFILES_MODEL_DATA_TRANSLATION'
        )
);

echo '<div class="controls selectUpload">';
echo $form->fileField($model, 'data', array(
    'class' => 'span3',
    'accept' => 'audio/wav',
    "data-custom-contexthelp-key" => "SYSTEMAUDIOFILES_DATA_UPLOAD_CUSTOM_CONTEXTHELP"
));
echo $form->hiddenField($model, 'data');
echo "<div class='showError'>";
echo $form->error($model, 'data');
echo '</div>';
echo '</div>';

echo '<div class="controls selectRecord">';
echo CHtml::button(
        __('AUDIOFILES_MODEL_START_RECORD_BUTTON'), array(
    'data-translation-id' => 'AUDIOFILES_MODEL_START_RECORD_BUTTON',
    'onclick' => 'startRecord(' . json_encode($model) . ')'
));
echo '</div>';
echo '</div>';

echo CHtml::hiddenField('recordId', "", array());
?>
<script>
    $('#audioFileRadioButtons').change(function () {
        if ($('[value="selectUpload"]').is(':checked')) {
            $('.selectRecord').hide();
            $('.selectUpload').show();
        }
        if ($('[value="selectRecord"]').is(':checked')) {
            $('.selectUpload').hide();
            $('.selectRecord').show();
        }
    });
</script>