From b28d1c9e6ffeec8300a64c0d7ec0e8d1186c3ebe Mon Sep 17 00:00:00 2001 From: roberto Date: Wed, 22 Aug 2012 12:11:08 +0000 Subject: [PATCH] Se repasa los filtros del grid git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_IntranetNueva/trunk@78 77cfc57b-8ef4-1849-9df6-4a38aa5da120 --- www/protected/models/Candidato.php | 37 ++++++++++--------------- www/protected/views/candidato/index.php | 4 +-- 2 files changed, 16 insertions(+), 25 deletions(-) diff --git a/www/protected/models/Candidato.php b/www/protected/models/Candidato.php index 1708c7f..7d45ef4 100644 --- a/www/protected/models/Candidato.php +++ b/www/protected/models/Candidato.php @@ -43,32 +43,26 @@ class Candidato extends CActiveRecord const GENERO_HOMBRE='Hombre'; const GENERO_MUJER='Mujer'; - private $_nombreCompleto; public $foto; - + public $capacidad_tecnica_search; - public $capacidad_funcional_search; public $nombre_estado_search; - + public $nombreCompleto_search; + /** * Devuelve el nombre completo de un candidato. * @return string $nombreCompleto */ public function getNombreCompleto() { - if(isset($this->_nombreCompleto)) { - return $this->_nombreCompleto; + if(isset($this->nombreCompleto_search)) { + return $this->nombreCompleto_search; } - $this->_nombreCompleto = $this->nombre . ' ' . $this->apellidos; - return $this->_nombreCompleto; + $this->nombreCompleto_search = $this->nombre . ' ' . $this->apellidos; + return $this->nombreCompleto_search; } - - public function setNombreCompleto($value) - { - $this->_nombreCompleto = $value; - } - + public function getRangoSalarial() { return Yii::app()->numberFormatter->formatCurrency($this->salario_minimo,'EUR') . ' - ' . Yii::app()->numberFormatter->formatCurrency($this->salario_maximo,'EUR'); @@ -182,10 +176,10 @@ class Candidato extends CActiveRecord // The following rule is used by search(). // Please remove those attributes that should not be searched. array('id, id_estado, - nombre_estado_search, - dni, nombre, apellidos, email, telefono_fijo, + nombre_estado_search, nombreCompleto_search, capacidad_tecnica_search, + dni, email, telefono_fijo, telefono_movil, sexo, fecha_nacimiento, lugar_nacimiento, - localidad, fecha_alta, usuario_alta, fecha_modificacion, + localidad, fecha_alta, usuario_alta, usuario_modificacion, carnet_conducir, vehiculo_propio, observaciones, salario_minimo, salario_maximo, procedencia, disponibilidad_incorporacion, disponibilidad_entrevistas, @@ -250,7 +244,7 @@ class Candidato extends CActiveRecord 'disponibilidad_viajar' => 'Disponibilidad para viajar', 'disponibilidad_proyectos_internacionales' => 'Disponibilidad para proyectos internacionales', - 'nombreCompleto' => 'Candidato', + 'nombreCompleto_search' => 'Candidato', ); } @@ -272,14 +266,11 @@ class Candidato extends CActiveRecord $criteria->compare( 'estados.descripcion', $this->nombre_estado_search, true ); $criteria->compare('t.dni',$this->dni,true); - $criteria->compare('t.nombre',$this->nombre,true); - $criteria->compare('t.apellidos',$this->apellidos,true); $criteria->compare('t.email',$this->email,true); $criteria->compare('t.telefono_fijo',$this->telefono_fijo,true); $criteria->compare('t.telefono_movil',$this->telefono_movil,true); - $criteria->addSearchCondition('concat(nombre, " ", apellidos)', $this->nombreCompleto); - + $criteria->compare( 'concat(t.nombre, " ", t.apellidos)', $this->nombreCompleto_search, true ); $criteria->compare( 'capacidades.perfil_tecnico_id', $this->capacidad_tecnica_search, true ); $sort = new CSort(); @@ -293,7 +284,7 @@ class Candidato extends CActiveRecord 'asc' => 't.fecha_modificacion', 'desc' => 't.fecha_modificacion desc', ), - 'nombreCompleto' => array( + 'nombreCompleto_search' => array( 'asc' => 'concat(t.nombre, " ", t.apellidos)', 'desc' => 'concat(t.nombre, " ", t.apellidos) desc', ), diff --git a/www/protected/views/candidato/index.php b/www/protected/views/candidato/index.php index 622437b..3cc83a4 100644 --- a/www/protected/views/candidato/index.php +++ b/www/protected/views/candidato/index.php @@ -141,7 +141,7 @@ $this->endWidget('zii.widgets.jui.CJuiDialog'); array( 'type' => 'html', - 'name' => 'nombreCompleto', + 'name' => 'nombreCompleto_search', 'value' => 'CHtml::link(CHtml::encode($data->nombreCompleto), array("view", "id"=>$data->id));', 'headerHtmlOptions'=>array( 'class' => 'head0 sorting', @@ -157,7 +157,7 @@ $this->endWidget('zii.widgets.jui.CJuiDialog'); 'headerHtmlOptions'=>array( 'class' => 'head1 sorting', ), - // 'filter' => CHtml::listData(PerfilTecnico::model()->findAll(), 'id', 'descripcion'), + 'filter' => CHtml::listData(PerfilTecnico::model()->findAll(), 'id', 'descripcion'), 'cssClassExpression' => '"con0"', ),