<?php

/**
 * This is the model class for table "sidcai_plantilla_pdf".
 *
 * The followings are the available columns in table 'sidcai_plantilla_pdf':
 * @property integer $plan_codigo_pk
 * @property string $plan_texto
 * @property string $plan_finalizacion
 * @property integer $nombre_plantilla_fk
 * @property integer $audit_usua
 *
 * The followings are the available model relations:
 * @property SidcaiNombrePlantillaPdf $nombrePlantillaFk
 * @property SidcaiUsuario $auditUsua
 */
class SidcaiPlantillaPdf extends CActiveRecord{
	/**
	 * @return string the associated database table name
	 */
	public function tableName(){
		return 'sidcai_plantilla_pdf';
	}

	/**
	 * @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(
				'plan_texto, plan_finalizacion, nombre_plantilla_fk', 
				'required',
				'message' => 'Este campo es requerido.'
			),
			array(
				'plan_texto, plan_finalizacion, nombre_plantilla_fk', 
				'filter', 
				'filter' => 'trim'
			),
			array('nombre_plantilla_fk, audit_usua', 'numerical', 'integerOnly'=>true),
		);
	}

	/**
	 * @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(
			'nombrePlantillaFk' => array(self::BELONGS_TO, 'SidcaiNombrePlantillaPdf', 'nombre_plantilla_fk'),
			'auditUsua' => array(self::BELONGS_TO, 'SidcaiUsuario', 'audit_usua'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels(){
		return array(
			'plan_codigo_pk' => 'Código',
			'plan_texto' => 'Texto',
			'plan_finalizacion' => 'Fecha Finalización',
			'nombre_plantilla_fk' => 'Plantilla',
			'audit_usua' => 'Usuario Auditor',
		);
	}

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return SidcaiPlantillaPdf the static model class
	 */
	public static function model($className=__CLASS__){
		return parent::model($className);
	}
}
