<?php
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/plugins/jquery-ui-1.8.16.custom.min.js');

$idiomaFormConfig = array(
      'elements'=>array(
        'idioma'=>array(
            'type'=>'dropdownlist',            
            'layout'=>'{input}',
            'class'=>'fullwidth',
            'items'=>array_merge(
                    array(''=>'-'),
                    CHtml::listData(Idioma::model()->findAll(), 'descripcion', 'descripcion')
            ),
            
        ),
        'conversacion'=>array(
            'type'=>'dropdownlist',
            'layout'=>'{input}',
            'class'=>'fullwidth',
            'items'=>array_merge(
                    array(''=>'-'),
                    $idioma->OpcionesNivel
            ),
        ),
        'lectura_traduccion'=>array(
            'type'=>'dropdownlist',
            'layout'=>'{input}',
            'class'=>'fullwidth',
            'items'=>array_merge(
                    array(''=>'-'),
                    $idioma->OpcionesNivel
            ),
        ),
    ),
    );
?>


    <div class="padding1020 borderbottom">
        <label><?php echo Yii::t('intranet', 'Idiomas'); ?></label>

        <div class="marginleft150">
            <?php $this->widget('ext.multimodelform.MultiModelForm',array(
                    'id' => 'id_idioma', //the unique widget id
                    'addItemText' => '', // no quiero mostrar el enlace de añadir
                    'removeText' => 'Eliminar',
                    'removeConfirm' => '¿Desea eliminar este idioma?',
                    'tableHtmlOptions' => array(
                        'class' => 'sTable2',
                        'width' => '100%',
                    ),
                    'tableView' => true,
                    'formConfig' => $idiomaFormConfig, //the form configuration array
                    'model' => $idioma, //instance of the form model

                    //if submitted not empty from the controller,
                    //the form will be rendered with validation errors
                    'validatedItems' => $idiomasValidos,

                    //array of member instances loaded from db
                    'data' => $idioma->findAll('candidato_id=:candidato_id', array(':candidato_id'=>$model->id)),

                    'removeHtmlOptions' => array(
                        'class' => 'button plain',
                    ),
                ));
            ?>
            <br clear="all" />
            <div class="mmf_addlink">
            <?php                
                echo CHtml::link('Añadir idioma', '#', array(
                            'class' => 'button plain',
                            'rel' => '.id_idioma_copy',
                            'id' => 'id_idioma',
                            ));

            ?>
            </div>
            <br clear="all" />
        </div>
    </div>
