Cambio en columnas nombre completo y estado
git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_PROFIND_Web/trunk@71 3fe1ab16-cfe0-e34b-8c9f-7d8c168d430d
This commit is contained in:
parent
df44a12017
commit
fac28c4a13
@ -36,6 +36,8 @@
|
|||||||
* @property EstadoCandidato $estado
|
* @property EstadoCandidato $estado
|
||||||
* @property CandidatoIdioma[] $idiomas
|
* @property CandidatoIdioma[] $idiomas
|
||||||
* @property CandidatoTitulacion[] $titulaciones
|
* @property CandidatoTitulacion[] $titulaciones
|
||||||
|
* @property CandidatoAreaFuncional[] $areasFuncionales
|
||||||
|
* @property CandidatoCapacidadProfesional[] $capacidadesProfesionales
|
||||||
*
|
*
|
||||||
* @package application.models
|
* @package application.models
|
||||||
*
|
*
|
||||||
@ -47,15 +49,22 @@ class Candidato extends CActiveRecord {
|
|||||||
|
|
||||||
public $ficheroFotografia;
|
public $ficheroFotografia;
|
||||||
public $fotografia;
|
public $fotografia;
|
||||||
|
public $descripcionEstado;
|
||||||
|
|
||||||
private $_nombreCompleto;
|
private $_nombreCompleto;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Devuelve el nombre completo de un candidato.
|
* @brief Devuelve el nombre completo de un candidato.
|
||||||
* @return string $nombreCompleto
|
* @return string $nombreCompleto
|
||||||
*/
|
*/
|
||||||
public function getNombreCompleto() {
|
public function getNombreCompleto() {
|
||||||
return $this->nombre . ' ' . $this->apellidos;
|
|
||||||
|
if (isset($this->_nombreCompleto)) {
|
||||||
|
return $this->_nombreCompleto;
|
||||||
|
}
|
||||||
|
$this->_nombreCompleto = $this->nombre . ' ' . $this->apellidos;
|
||||||
|
return $this->_nombreCompleto;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setNombreCompleto($value) {
|
public function setNombreCompleto($value) {
|
||||||
@ -129,7 +138,7 @@ class Candidato extends CActiveRecord {
|
|||||||
|
|
||||||
// The following rule is used by search().
|
// The following rule is used by search().
|
||||||
// Please remove those attributes that should not be searched.
|
// Please remove those attributes that should not be searched.
|
||||||
array('id, id_estado, estado, nombre, apellidos, nombreCompleto,
|
array('id, id_estado, estado, descripcionEstado, nombre, apellidos, nombreCompleto,
|
||||||
n_identificacion, email, telefono_fijo,
|
n_identificacion, email, telefono_fijo,
|
||||||
telefono_movil, sexo, fecha_nacimiento, lugar_nacimiento,
|
telefono_movil, sexo, fecha_nacimiento, lugar_nacimiento,
|
||||||
localidad, carnet_conducir, vehiculo_propio,
|
localidad, carnet_conducir, vehiculo_propio,
|
||||||
@ -146,14 +155,33 @@ class Candidato extends CActiveRecord {
|
|||||||
*/
|
*/
|
||||||
public function relations() {
|
public function relations() {
|
||||||
return array(
|
return array(
|
||||||
|
'estado' => array(self::BELONGS_TO, 'EstadoCandidato', 'id_estado'),
|
||||||
|
|
||||||
'idiomas' => array(self::HAS_MANY, 'CandidatoIdioma', 'candidato_id'),
|
'idiomas' => array(self::HAS_MANY, 'CandidatoIdioma', 'candidato_id'),
|
||||||
'idiomasCount' => array(self::STAT, 'CandidatoIdioma', 'candidato_id'),
|
'idiomasCount' => array(self::STAT, 'CandidatoIdioma', 'candidato_id'),
|
||||||
|
|
||||||
'titulaciones' => array(self::HAS_MANY, 'CandidatoTitulacion', 'candidato_id'),
|
'titulaciones' => array(self::HAS_MANY, 'CandidatoTitulacion', 'candidato_id'),
|
||||||
'titulacionesCount' => array(self::STAT, 'CandidatoTitulacion', 'candidato_id'),
|
'titulacionesCount' => array(self::STAT, 'CandidatoTitulacion', 'candidato_id'),
|
||||||
'estado' => array(self::BELONGS_TO, 'EstadoCandidato', 'id_estado'),
|
|
||||||
|
'areasFuncionales' => array(self::HAS_MANY, 'CandidatoAreaFuncional', 'id_candidato'),
|
||||||
|
'areasFuncionalesCount' => array(self::STAT, 'CandidatoAreaFuncional', 'id_candidato'),
|
||||||
|
|
||||||
|
'capacidadesProfesionales' => array(self::HAS_MANY, 'CandidatoCapacidadProfesional', 'id_candidato'),
|
||||||
|
'capacidadesProfesionalesCount' => array(self::STAT, 'CandidatoTitulacion', 'id_candidato'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function scopes() {
|
||||||
|
return array(
|
||||||
|
'disponibles' => array(
|
||||||
|
'condition' => 'id_estado = 1',
|
||||||
|
),
|
||||||
|
'no_disponibles' => array(
|
||||||
|
'condition' => 'id_estado = 2',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Busca el ID del estado inicial de un candidato.
|
* @brief Busca el ID del estado inicial de un candidato.
|
||||||
* @return integer
|
* @return integer
|
||||||
@ -175,7 +203,7 @@ class Candidato extends CActiveRecord {
|
|||||||
return array(
|
return array(
|
||||||
'id' => 'ID',
|
'id' => 'ID',
|
||||||
'id_estado' => 'Estado',
|
'id_estado' => 'Estado',
|
||||||
|
'descripcionEstado' => 'Estado',
|
||||||
'n_identificacion' => 'DNI/Pasaporte',
|
'n_identificacion' => 'DNI/Pasaporte',
|
||||||
'nombre' => 'Nombre',
|
'nombre' => 'Nombre',
|
||||||
'apellidos' => 'Apellidos',
|
'apellidos' => 'Apellidos',
|
||||||
@ -218,11 +246,12 @@ class Candidato extends CActiveRecord {
|
|||||||
$criteria->compare('t.id', $this->id);
|
$criteria->compare('t.id', $this->id);
|
||||||
|
|
||||||
$criteria->compare('t.id_estado', $this->id_estado);
|
$criteria->compare('t.id_estado', $this->id_estado);
|
||||||
//$criteria->compare('estado.descripcion', $this->estado, true);
|
$criteria->compare('estado.descripcion', $this->descripcionEstado, true);
|
||||||
|
|
||||||
$criteria->compare('t.n_identificacion', $this->n_identificacion, true);
|
$criteria->compare('t.n_identificacion', $this->n_identificacion, true);
|
||||||
$criteria->compare('t.nombre', $this->nombre, true);
|
$criteria->compare('t.nombre', $this->nombre, true);
|
||||||
$criteria->compare('t.apellidos', $this->apellidos, true);
|
$criteria->compare('t.apellidos', $this->apellidos, true);
|
||||||
|
$criteria->compare( 'concat(t.nombre, " ", t.apellidos)', $this->_nombreCompleto, true );
|
||||||
$criteria->compare('t.sexo', $this->sexo, true);
|
$criteria->compare('t.sexo', $this->sexo, true);
|
||||||
$criteria->compare('t.localidad', $this->localidad, true);
|
$criteria->compare('t.localidad', $this->localidad, true);
|
||||||
|
|
||||||
@ -260,12 +289,17 @@ class Candidato extends CActiveRecord {
|
|||||||
$sort->modelClass = 'Candidato';
|
$sort->modelClass = 'Candidato';
|
||||||
$sort->attributes = array(
|
$sort->attributes = array(
|
||||||
'*',
|
'*',
|
||||||
'defaultOrder' => 'id',
|
'defaultOrder' => 'id',
|
||||||
|
'descripcionEstado' => array(
|
||||||
|
'asc' => 'estado.descripcion',
|
||||||
|
'desc' => 'estado.descripcion desc',
|
||||||
|
),
|
||||||
'nombreCompleto' => array(
|
'nombreCompleto' => array(
|
||||||
'asc' => 'concat(t.nombre, " ", t.apellidos)',
|
'asc' => 'concat(t.nombre, " ", t.apellidos)',
|
||||||
'desc' => 'concat(t.nombre, " ", t.apellidos) desc',
|
'desc' => 'concat(t.nombre, " ", t.apellidos) desc',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
return new CActiveDataProvider($this, array(
|
return new CActiveDataProvider($this, array(
|
||||||
'criteria' => $criteria,
|
'criteria' => $criteria,
|
||||||
'sort' => $sort,
|
'sort' => $sort,
|
||||||
|
|||||||
@ -14,7 +14,7 @@ $columnas = array(
|
|||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'type' => 'html',
|
'type' => 'html',
|
||||||
'name' => 'id_estado',
|
'name' => 'descripcionEstado',
|
||||||
'value' => 'CHtml::encode($data->estado->descripcion);',
|
'value' => 'CHtml::encode($data->estado->descripcion);',
|
||||||
'headerHtmlOptions' => array(
|
'headerHtmlOptions' => array(
|
||||||
'class' => 'sorting',
|
'class' => 'sorting',
|
||||||
@ -62,7 +62,7 @@ $gridView = $this->widget('zii.widgets.grid.CGridView', array(
|
|||||||
'dataProvider' => $candidatos->search(),
|
'dataProvider' => $candidatos->search(),
|
||||||
'columns' => $columnas,
|
'columns' => $columnas,
|
||||||
'filter' => $candidatos,
|
'filter' => $candidatos,
|
||||||
'filterPosition' => 'footer',
|
'filterPosition' => 'header',
|
||||||
'cssFile' => false,
|
'cssFile' => false,
|
||||||
'htmlOptions' => array('class' => 'dataTables_wrapper form-inline'),
|
'htmlOptions' => array('class' => 'dataTables_wrapper form-inline'),
|
||||||
'itemsCssClass' => 'table table-striped table-bordered dataTable',
|
'itemsCssClass' => 'table table-striped table-bordered dataTable',
|
||||||
@ -83,11 +83,15 @@ $gridView = $this->widget('zii.widgets.grid.CGridView', array(
|
|||||||
<h3 class="heading"><?php echo Yii::t('profind', 'BD Candidatos'); ?></h3>
|
<h3 class="heading"><?php echo Yii::t('profind', 'BD Candidatos'); ?></h3>
|
||||||
<div class="row-fluid sepH_b">
|
<div class="row-fluid sepH_b">
|
||||||
<div class="span8">
|
<div class="span8">
|
||||||
<div class="btn-group">
|
<div class="btn-toolbar">
|
||||||
<?php echo CHtml::link(CHtml::tag('i', array('class' => 'icon-plus'), '') . ' ' . Yii::t('profind', 'Nuevo candidato'),
|
<?php echo CHtml::link(CHtml::tag('i', array('class' => 'icon-plus'), '') . ' ' . Yii::t('profind', 'Nuevo candidato'),
|
||||||
$this->createUrl('create'),
|
$this->createUrl('create'),
|
||||||
array('class' => 'btn')
|
array('class' => 'btn')
|
||||||
); ?>
|
); ?>
|
||||||
|
<?php echo CHtml::link(CHtml::tag('i', array('class' => 'icon-filter'), '') . ' ' . Yii::t('profind', 'Filtro'),
|
||||||
|
$this->createUrl('create'),
|
||||||
|
array('class' => 'btn')
|
||||||
|
); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--<div class="span4">
|
<!--<div class="span4">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user