<?php

/**
 * This is the model class for table "{{colaboladores}}".
 *
 * The followings are the available columns in table '{{colaboladores}}':
 * @property integer $id_colaborador
 * @property string $imagen
 * @property string $nombre_completo
 * @property string $descripcion
 * @property string $puesto
 * @property string $perfil_academico
 * @property string $correo
 * @property string $website
 * @property string $twitter
 * @property string $facebook
 * @property string $otro
 * @property integer $activo
 * @property integer $tipo
 */
class Colaboladores extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Colaboladores 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 '{{colaboladores}}';
	}

	/**
	 * @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_completo, descripcion', 'required'),
			array('activo', 'numerical', 'integerOnly'=>true),
			array('tipo', 'numerical', 'integerOnly'=>true),
			//array('imagen', 'length', 'max'=>255),
			array('imagen', 'file', 'types'=>'jpg, gif, png', 'safe' => false, 'allowEmpty'=>TRUE),
			array('nombre_completo', 'length', 'max'=>150),
			array('idyt', 'length', 'max'=>300),
			array('puesto, perfil_academico, correo, website, twitter, facebook, otro', 'length', 'max'=>100),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id_colaborador, imagen, nombre_completo, descripcion, puesto, perfil_academico, correo, website, twitter, facebook, otro, activo, tipo', '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_colaborador' => 'Id Colaborador',
			'imagen' => 'Imagen',
			'nombre_completo' => 'Nombre Completo',
			'descripcion' => 'Descripción',
			'puesto' => 'Puesto',
			'perfil_academico' => 'Perfil Académico',
			'correo' => 'Correo',
			'website' => 'Website',
			'twitter' => 'Twitter',
			'facebook' => 'Facebook',
			'otro' => 'Otro',
			'activo' => 'Activo',
			'tipo' => 'Sección',
			'idyt' => 'URL Youtube',
		);
	}

	/**
	 * 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_colaborador',$this->id_colaborador);
		$criteria->compare('imagen',$this->imagen,true);
		$criteria->compare('nombre_completo',$this->nombre_completo,true);
		$criteria->compare('descripcion',$this->descripcion,true);
		$criteria->compare('puesto',$this->puesto,true);
		$criteria->compare('perfil_academico',$this->perfil_academico,true);
		$criteria->compare('correo',$this->correo,true);
		$criteria->compare('website',$this->website,true);
		$criteria->compare('twitter',$this->twitter,true);
		$criteria->compare('facebook',$this->facebook,true);
		$criteria->compare('otro',$this->otro,true);
		$criteria->compare('activo',$this->activo);
		$criteria->compare('tipo',$this->tipo,true);
		$criteria->compare('idyt',$this->tipo,true);

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