示例#1
0
echo $form->dropDownList($model, 'genero_id', CHtml::listData(Genero::model()->findAll(), 'id', 'genero'), array('class' => 'input-medium', 'empty' => ""));
?>
					</div>
					<?php 
echo $form->error($model, 'genero_id');
?>
				</div>

				<div class="span4">
					<?php 
echo $form->labelEx($model, 'estado_civil_id');
?>
					<div class="input-prepend">
      				<span class="add-on"><i class="icon-list-alt"></i></span>
						<?php 
echo $form->dropDownList($model, 'estado_civil_id', CHtml::listData(EstadoCivil::model()->findAll(), 'id', 'estado_civil'), array('class' => 'input-normal', 'empty' => ""));
?>
					</div>
					<?php 
echo $form->error($model, 'estado_civil_id');
?>
				</div>

				<div class="span4">
					<?php 
echo $form->labelEx($model, 'fecha_nacimiento');
?>
					<div class="input-prepend">
						<span class="add-on"><i class="icon-calendar"></i></span>
						<?php 
if ($model->fecha_nacimiento == '') {
示例#2
0
/* @var $this AlumnosController */
/* @var $model Alumnos */
$this->menu = array(array('label' => 'Crear Alumno', 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#alumnos-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Buscar Alumnos</h1>

<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'alumnos-grid', 'dataProvider' => $model->search(), 'afterAjaxUpdate' => 'reinstallDatePickerNacimiento', 'filter' => $model, 'columns' => array(array('header' => 'ID.', 'name' => 'id', 'value' => '$data->id', 'htmlOptions' => array('width' => '20')), 'nombres', 'apellidos', 'n_identificacion', array('name' => 'genero_id', 'filter' => CHtml::listData(Genero::model()->findAll(), 'id', 'genero'), 'value' => '$data[\'genero\'][\'genero\']', 'htmlOptions' => array('width' => '110')), array('name' => 'estado_civil_id', 'filter' => CHtml::listData(EstadoCivil::model()->findAll(), 'id', 'estado_civil'), 'value' => '$data[\'estadoCivil\'][\'estado_civil\']', 'htmlOptions' => array('width' => '150')), array('header' => 'Fecha de Nacimiento', 'name' => 'fecha_nacimiento', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('language' => 'es', 'model' => $model, 'attribute' => 'fecha_nacimiento', 'options' => array('showAnim' => 'fold', 'language' => 'es', 'dateFormat' => 'dd-mm-yy', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '1900:2000'), 'htmlOptions' => array('id' => 'datepicker_for_fecha_nacimiento', 'style' => 'height:20px;width:80px;'), 'defaultOptions' => array('showOn' => 'focus', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true), 'value' => 'Yii::app()->dateformatter->format("dd-MM-yyyy",$data[\'fecha_nacimiento\']);', 'htmlOptions' => array('width' => '80')), array('name' => 'jornada_id', 'filter' => CHtml::listData(Jornada::model()->findAll(), 'id', 'jornada'), 'value' => '$data[\'jornada\'][\'jornada\']', 'htmlOptions' => array('width' => '150')), array('header' => 'Fecha de Ingreso', 'name' => 'fecha_ingreso', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('language' => 'es', 'model' => $model, 'attribute' => 'fecha_ingreso', 'options' => array('showAnim' => 'fold', 'language' => 'es', 'dateFormat' => 'dd-mm-yy', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '1900:2000'), 'htmlOptions' => array('id' => 'datepicker_for_fecha_ingreso', 'style' => 'height:20px;width:80px;'), 'defaultOptions' => array('showOn' => 'focus', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true), 'value' => 'Yii::app()->dateformatter->format("dd-MM-yyyy",$data[\'fecha_ingreso\']);', 'htmlOptions' => array('width' => '80')), array('class' => 'CButtonColumn', 'template' => '{view}{update}'))));
Yii::app()->clientScript->registerScript('re-install-date-picker', "\nfunction reinstallDatePickerNacimiento(id, data) {\n    \$('#datepicker_for_fecha_nacimiento').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['es'],{'dateFormat':'dd-mm-yy'}));\n    \$('#datepicker_for_fecha_ingreso').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['es'],{'dateFormat':'dd-mm-yy'}));\n}\n");
?>


<script>
    $(document).ready(function()
    {
        $('body').on('dblclick', '#alumnos-grid tbody tr', function(event)
        {
            var
                rowNum = $(this).index(),
                keys = $('#alumnos-grid > div.keys > span'),
                rowId = keys.eq(rowNum).text();

            location.href = '<?php