From 5c52cdb53d717bd65ce6c31bc929a02e6295ccfd Mon Sep 17 00:00:00 2001 From: david Date: Fri, 18 Jan 2013 16:50:29 +0000 Subject: [PATCH] Candidatos: funcionan los filtros por estado de la barra lateral izquierda (en el grid) git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_PROFIND_Web/trunk@78 3fe1ab16-cfe0-e34b-8c9f-7d8c168d430d --- www/protected/models/Candidato.php | 13 +++++---- .../views/candidato/sidebars/_candidatos.php | 29 +++++++++++-------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/www/protected/models/Candidato.php b/www/protected/models/Candidato.php index 5e9e575..8fe137b 100644 --- a/www/protected/models/Candidato.php +++ b/www/protected/models/Candidato.php @@ -243,14 +243,17 @@ class Candidato extends CActiveRecord { // should not be searched. $criteria = new CDbCriteria; - - $criteria->with = array('estado'); - $criteria->together = true; - + + if ($this->descripcionEstado) { + $criteria->together = true; + $criteria->with = array('estado'); + $criteria->compare('estado.id', $this->id_estado, true); + $criteria->compare('estado.descripcion', $this->descripcionEstado, true); + } + $criteria->compare('t.id', $this->id); $criteria->compare('t.id_estado', $this->id_estado); - $criteria->compare('estado.descripcion', $this->descripcionEstado, true); $criteria->compare('t.n_identificacion', $this->n_identificacion, true); $criteria->compare('t.nombre', $this->nombre, true); diff --git a/www/themes/profind/views/candidato/sidebars/_candidatos.php b/www/themes/profind/views/candidato/sidebars/_candidatos.php index 6867431..43df096 100644 --- a/www/themes/profind/views/candidato/sidebars/_candidatos.php +++ b/www/themes/profind/views/candidato/sidebars/_candidatos.php @@ -18,21 +18,26 @@
+clientScript->registerScript('filtro_candidatos', " + candidatos_grid = { + update: function() { + $('#candidato-grid .filters select').trigger('change.yiiGridView'); + }, + + setEstado: function(idEstado) { + $('#candidato-grid .filters select option[value=' + idEstado + ']').attr('selected',true); + this.update(); + } + } + "); +?> + endClip(); ?> \ No newline at end of file