Se añade campo estado con su tabla auxiliar
git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_IntranetNueva/trunk@69 77cfc57b-8ef4-1849-9df6-4a38aa5da120
This commit is contained in:
parent
7391a027dc
commit
4b75305de7
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class m120713_172000_tbl_candidatos_estados extends CDbMigration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->createTable('tbl_candidatos_estados', array(
|
||||||
|
'id' => 'pk',
|
||||||
|
'descripcion' => 'string NOT NULL',
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->addColumn('tbl_candidatos', 'id_estado', 'integer');
|
||||||
|
$this->dropColumn('tbl_candidatos', 'estado');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
$this->dropTable('tbl_candidatos_estados');
|
||||||
|
$this->dropColumn('tbl_candidatos', 'id_estado');
|
||||||
|
$this->addColumn('tbal_candidatos', 'estado', 'string');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* The followings are the available columns in table 'tbl_candidatos':
|
* The followings are the available columns in table 'tbl_candidatos':
|
||||||
* @property integer $id
|
* @property integer $id
|
||||||
* @property string $estado
|
* @property integer $id_estado
|
||||||
* @property string $dni
|
* @property string $dni
|
||||||
* @property string $nombre
|
* @property string $nombre
|
||||||
* @property string $apellidos
|
* @property string $apellidos
|
||||||
@ -80,6 +80,12 @@ class Candidato extends CActiveRecord
|
|||||||
return Poblacion::model()->findByPk($this->localidad)->poblacion;
|
return Poblacion::model()->findByPk($this->localidad)->poblacion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getEstado() {
|
||||||
|
$_estado = CandidatoEstado::model()->findByPk($this->id_estado);
|
||||||
|
if ($_estado != null)
|
||||||
|
return $_estado->descripcion;
|
||||||
|
}
|
||||||
|
|
||||||
public function getNombreCompletoLocalidad() {
|
public function getNombreCompletoLocalidad() {
|
||||||
$nombre = '';
|
$nombre = '';
|
||||||
$poblacion = Poblacion::model()->with('provincia')->findByPk($this->localidad);
|
$poblacion = Poblacion::model()->with('provincia')->findByPk($this->localidad);
|
||||||
@ -104,7 +110,7 @@ class Candidato extends CActiveRecord
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function getCssClassEstado() {
|
public function getCssClassEstado() {
|
||||||
return "estado" . array_search($this->estado, $this->opcionesEstado);
|
return "estado" . array_search($this->id_estado, $this->opcionesEstado);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -113,13 +119,13 @@ class Candidato extends CActiveRecord
|
|||||||
*/
|
*/
|
||||||
public function getOpcionesEstado() {
|
public function getOpcionesEstado() {
|
||||||
return array(
|
return array(
|
||||||
0 => 'Borrador',
|
0 => '510',
|
||||||
1 => 'Sin capacidades',
|
1 => '511',
|
||||||
2 => 'Rechazado',
|
2 => '520',
|
||||||
3 => 'Si más adelante',
|
3 => '530',
|
||||||
4 => 'En proceso: disponible',
|
4 => '540',
|
||||||
5 => 'En proceso: disponible asignado',
|
5 => '560',
|
||||||
6 => 'Otras provincias',
|
6 => '600',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +169,7 @@ class Candidato extends CActiveRecord
|
|||||||
array('salario_minimo, salario_maximo', 'numerical',
|
array('salario_minimo, salario_maximo', 'numerical',
|
||||||
'allowEmpty'=>'true'),
|
'allowEmpty'=>'true'),
|
||||||
|
|
||||||
array('estado, dni, nombre, apellidos, email, telefono_fijo,
|
array('dni, nombre, apellidos, email, telefono_fijo,
|
||||||
telefono_movil, sexo, lugar_nacimiento, localidad,
|
telefono_movil, sexo, lugar_nacimiento, localidad,
|
||||||
carnet_conducir, procedencia, disponibilidad_incorporacion,
|
carnet_conducir, procedencia, disponibilidad_incorporacion,
|
||||||
disponibilidad_entrevistas, disponibilidad_guardias,
|
disponibilidad_entrevistas, disponibilidad_guardias,
|
||||||
@ -171,15 +177,15 @@ class Candidato extends CActiveRecord
|
|||||||
disponibilidad_proyectos_internacionales',
|
disponibilidad_proyectos_internacionales',
|
||||||
'length', 'max'=>255),
|
'length', 'max'=>255),
|
||||||
|
|
||||||
|
array('id_estado', 'numerical', 'integerOnly'=>true),
|
||||||
|
|
||||||
array('fecha_nacimiento, observaciones', 'safe'),
|
array('fecha_nacimiento, observaciones', 'safe'),
|
||||||
|
|
||||||
array('fecha_nacimiento', 'date', 'format'=>'dd/MM/yyyy'),
|
array('fecha_nacimiento', 'date', 'format'=>'dd/MM/yyyy'),
|
||||||
|
|
||||||
array('estado', 'unsafe'),
|
|
||||||
|
|
||||||
// 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, estado, dni, nombre, apellidos, email, telefono_fijo,
|
array('id, id_estado, dni, nombre, apellidos, email, telefono_fijo,
|
||||||
telefono_movil, sexo, fecha_nacimiento, lugar_nacimiento,
|
telefono_movil, sexo, fecha_nacimiento, lugar_nacimiento,
|
||||||
localidad, fecha_alta, usuario_alta, fecha_modificacion,
|
localidad, fecha_alta, usuario_alta, fecha_modificacion,
|
||||||
usuario_modificacion, carnet_conducir, vehiculo_propio,
|
usuario_modificacion, carnet_conducir, vehiculo_propio,
|
||||||
@ -217,7 +223,7 @@ class Candidato extends CActiveRecord
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'id' => 'ID',
|
'id' => 'ID',
|
||||||
'estado' => 'Estado',
|
'id_estado' => 'Estado',
|
||||||
'nombreApellidos' => 'Candidato',
|
'nombreApellidos' => 'Candidato',
|
||||||
'foto' => 'Foto',
|
'foto' => 'Foto',
|
||||||
'dni' => 'DNI/Pasaporte',
|
'dni' => 'DNI/Pasaporte',
|
||||||
@ -263,7 +269,7 @@ class Candidato extends CActiveRecord
|
|||||||
$criteria->together = true;
|
$criteria->together = true;
|
||||||
|
|
||||||
$criteria->compare('t.id',$this->id);
|
$criteria->compare('t.id',$this->id);
|
||||||
$criteria->compare('estado',$this->estado,true);
|
$criteria->compare('id_estado',$this->id_estado);
|
||||||
$criteria->compare('dni',$this->dni,true);
|
$criteria->compare('dni',$this->dni,true);
|
||||||
$criteria->compare('nombre',$this->nombre,true);
|
$criteria->compare('nombre',$this->nombre,true);
|
||||||
$criteria->compare('apellidos',$this->apellidos,true);
|
$criteria->compare('apellidos',$this->apellidos,true);
|
||||||
@ -287,7 +293,7 @@ class Candidato extends CActiveRecord
|
|||||||
|
|
||||||
protected function beforeValidate() {
|
protected function beforeValidate() {
|
||||||
if ($this->isNewRecord) {
|
if ($this->isNewRecord) {
|
||||||
$this->estado = 'Pendiente de clasificar';
|
$this->id_estado = 510;
|
||||||
$this->fecha_alta = date('Y-m-d H:i:s', time());
|
$this->fecha_alta = date('Y-m-d H:i:s', time());
|
||||||
$this->fecha_modificacion = $this->fecha_alta;
|
$this->fecha_modificacion = $this->fecha_alta;
|
||||||
$this->usuario_alta = Yii::app()->user->id;
|
$this->usuario_alta = Yii::app()->user->id;
|
||||||
|
|||||||
86
www/protected/models/CandidatoEstado.php
Normal file
86
www/protected/models/CandidatoEstado.php
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the model class for table "tbl_candidatos_estados".
|
||||||
|
*
|
||||||
|
* The followings are the available columns in table 'tbl_candidatos_estados':
|
||||||
|
* @property integer $id
|
||||||
|
* @property string $descripcion
|
||||||
|
*/
|
||||||
|
class CandidatoEstado extends CActiveRecord
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns the static model of the specified AR class.
|
||||||
|
* @param string $className active record class name.
|
||||||
|
* @return CandidatoEstado the static model class
|
||||||
|
*/
|
||||||
|
public static function model($className=__CLASS__)
|
||||||
|
{
|
||||||
|
return parent::model($className);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string the associated database table name
|
||||||
|
*/
|
||||||
|
public function tableName()
|
||||||
|
{
|
||||||
|
return 'tbl_candidatos_estados';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array validation rules for model attributes.
|
||||||
|
*/
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
// NOTE: you should only define rules for those attributes that
|
||||||
|
// will receive user inputs.
|
||||||
|
return array(
|
||||||
|
array('descripcion', 'required'),
|
||||||
|
array('descripcion', 'length', 'max'=>255),
|
||||||
|
// The following rule is used by search().
|
||||||
|
// Please remove those attributes that should not be searched.
|
||||||
|
array('id, descripcion', 'safe', 'on'=>'search'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array relational rules.
|
||||||
|
*/
|
||||||
|
public function relations()
|
||||||
|
{
|
||||||
|
// NOTE: you may need to adjust the relation name and the related
|
||||||
|
// class name for the relations automatically generated below.
|
||||||
|
return array(
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array customized attribute labels (name=>label)
|
||||||
|
*/
|
||||||
|
public function attributeLabels()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'id' => 'ID',
|
||||||
|
'descripcion' => 'Descripcion',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a list of models based on the current search/filter conditions.
|
||||||
|
* @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
|
||||||
|
*/
|
||||||
|
public function search()
|
||||||
|
{
|
||||||
|
// Warning: Please modify the following code to remove attributes that
|
||||||
|
// should not be searched.
|
||||||
|
|
||||||
|
$criteria=new CDbCriteria;
|
||||||
|
|
||||||
|
$criteria->compare('id',$this->id);
|
||||||
|
$criteria->compare('descripcion',$this->descripcion,true);
|
||||||
|
|
||||||
|
return new CActiveDataProvider($this, array(
|
||||||
|
'criteria'=>$criteria,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -252,6 +252,30 @@ Yii::app()->clientScript->registerScript('wysiwyg', $script, CClientScript::POS_
|
|||||||
</span>
|
</span>
|
||||||
</h3>
|
</h3>
|
||||||
<div class="content nopadding">
|
<div class="content nopadding">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="padding1020">
|
||||||
|
<?php echo $form->labelEx($model,'estado'); ?>
|
||||||
|
<div class="marginleft150">
|
||||||
|
<?php
|
||||||
|
$lista = CHtml::listData(CandidatoEstado::model()->findAll(),'id', 'descripcion');
|
||||||
|
|
||||||
|
echo $form->dropDownList(
|
||||||
|
$model,
|
||||||
|
'id_estado',
|
||||||
|
$lista,
|
||||||
|
array(
|
||||||
|
'class'=>'mf',
|
||||||
|
));
|
||||||
|
?>
|
||||||
|
<?php echo $form->error($model,'id_estado', array('class'=>'errortext')); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="padding1020">
|
<div class="padding1020">
|
||||||
<?php echo $form->labelEx($model,'disponibilidad_incorporacion'); ?>
|
<?php echo $form->labelEx($model,'disponibilidad_incorporacion'); ?>
|
||||||
<div class="marginleft150">
|
<div class="marginleft150">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user