<?php

/**
 * This is the model class for table "{{integrantes}}".
 *
 * The followings are the available columns in table '{{integrantes}}':
 * @property integer $id
 * @property integer $id_categoria
 * @property string $nombre
 * @property string $descripcion
 * @property string $foto
 * @property string $r_jrc
 * @property string $r_noindexada
 * @property string $congresos
 * @property string $capitulos_libro
 * @property string $patentes
 * @property string $proyectos_act
 * @property string $info_int
 * @property string $descargas
 * @property string $estudios
 * @property string $distinciones
 * @property string $info_cont
 * @property integer $activo
 * @property string $log
 *
 * The followings are the available model relations:
 * @property CategoriasInt $idCategoria
 */
class Integrantes extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Integrantes 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 '{{integrantes}}';
	}

	/**
	 * @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('nombre', 'required'),
			array('id_categoria, activo', 'numerical', 'integerOnly'=>true),
			array('nombre', 'length', 'max'=>150),
			array('foto', 'length', 'max'=>255),
			array('descripcion, r_jrc, r_noindexada, congresos, capitulos_libro, patentes, proyectos_act, info_int, descargas, estudios, distinciones, info_cont, log', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, id_categoria, nombre, descripcion, foto, r_jrc, r_noindexada, congresos, capitulos_libro, patentes, proyectos_act, info_int, descargas, estudios, distinciones, info_cont, activo, log', '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(
			'idCategoria' => array(self::BELONGS_TO, 'CategoriasInt', 'id_categoria'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'id_categoria' => 'Categoría',
			'nombre' => 'Nombre',
			'descripcion' => 'Descripción',
			'foto' => 'Foto',
			'r_jrc' => 'Revistas Científicas',
			'r_noindexada' => 'Difusión',
			'congresos' => 'Congresos',
			'capitulos_libro' => 'Capitulos de Libro',
			'patentes' => 'Patentes',
			'proyectos_act' => 'Proyectos',
			'info_int' => 'Tesistas',
			'descargas' => 'Descargas',
			'estudios' => 'Estudios',
			'distinciones' => 'Distinciones',
			'info_cont' => 'Información de Contacto',
			'activo' => 'Activo',
			'log' => 'Log',
		);
	}

	/**
	 * 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('id_categoria',$this->id_categoria);
		$criteria->compare('nombre',$this->nombre,true);
		$criteria->compare('descripcion',$this->descripcion,true);
		$criteria->compare('foto',$this->foto,true);
		$criteria->compare('r_jrc',$this->r_jrc,true);
		$criteria->compare('r_noindexada',$this->r_noindexada,true);
		$criteria->compare('congresos',$this->congresos,true);
		$criteria->compare('capitulos_libro',$this->capitulos_libro,true);
		$criteria->compare('patentes',$this->patentes,true);
		$criteria->compare('proyectos_act',$this->proyectos_act,true);
		$criteria->compare('info_int',$this->info_int,true);
		$criteria->compare('descargas',$this->descargas,true);
		$criteria->compare('estudios',$this->estudios,true);
		$criteria->compare('distinciones',$this->distinciones,true);
		$criteria->compare('info_cont',$this->info_cont,true);
		$criteria->compare('activo',$this->activo);
		$criteria->compare('log',$this->log,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}