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

<?php
$funcionalFormConfig = array(
      'elements'=>array(
        'funcional_id'=>array(
            'type'=>'dropdownlist',            
            'layout'=>'{input}',
            'class'=>'ff',
            'items'=>array(0 => '-') + CHtml::listData(PerfilFuncional::model()->findAll(), 'id', 'descripcion'),
        ),
        'meses_funcional'=>array(
            'class'=>'sf',
        ),
    ),
);
?>

<label><?php echo Yii::t('intranet', 'Capacidades funcionales'); ?></label>

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

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

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

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