<?php

/**
 * This is the model base class for the table "atas_edicao".
 * DO NOT MODIFY THIS FILE! It is automatically generated by giix.
 * If any changes are necessary, you must set or override the required
 * property or method in class "AtasEdicao".
 *
 * Columns in table "atas_edicao" available as properties of the model,
 * followed by relations of table "atas_edicao" available as properties of the model.
 *
 * @property integer $ATE_IDEDICAO
 * @property integer $ATE_IDATA
 * @property string $ATE_ASSUNTO
 * @property string $ATE_CONTEUDO
 * @property integer $ATE_IDFUNCIONARIO
 * @property string $ATE_DATAPROXIMAREUNIAO
 * @property string $ATE_HORARIO
 *
 * @property Atas $Ata
 */
class AtasEdicao extends GxActiveRecord {

    public static function model($className = __CLASS__) {
        return parent::model($className);
    }

    public function tableName() {
        return 'atas_edicao';
    }

    public static function label($n = 1) {
        return Yii::t('app', 'Ratifição|Ratifições', $n);
    }

    public static function representingColumn() {
        return 'ATE_CONTEUDO';
    }

    public function behaviors() {
        return array('datetimeI18NBehavior' => array('class' => 'ext.DateTimeI18NBehavior'));
    }

    public function rules() {
        return array(
            array('ATE_IDATA, ATE_DATAEDICAO, ATE_CONTEUDO, ATE_IDFUNCIONARIO', 'required'),
            array('ATE_IDATA, ATE_IDFUNCIONARIO', 'numerical', 'integerOnly' => true),
            array('ATE_DATAPROXIMAREUNIAO, ATE_HORARIO', 'length', 'max' => 255),
            array('ATE_IDEDICAO, ATE_DATAEDICAO, ATE_CONTEUDO, ATE_IDFUNCIONARIO, ATE_DATAPROXIMAREUNIAO, ATE_HORARIO', 'safe', 'on' => 'search'),
        );
    }

    public function relations() {
        return array(
            'Ata'           => array(self::BELONGS_TO, 'Atas', 'ATE_IDATA'),
            'Participantes' => array(self::BELONGS_TO, 'Funcionarios', 'ATE_IDFUNCIONARIO'),
        );
    }

    public function pivotModels() {
        return array(
        );
    }

    public function attributeLabels() {
        return array(
            'ATE_IDEDICAO'           => 'Código',
            'ATE_IDATA'              => 'Ata',
            'ATE_DATAEDICAO'         => 'Data Edicao',
            'ATE_CONTEUDO'           => 'Conteúdo',
            'ATE_IDFUNCIONARIO'      => 'Participantes',
            'Participantes'          => 'Participantes',
            'ATE_DATAPROXIMAREUNIAO' => 'Próxima reunião',
            'ATE_HORARIO'            => 'Horário',
            'Ata'                    => 'Ata',
        );
    }

    public function search() {
        $criteria = new CDbCriteria;

        $criteria->compare('ATE_IDEDICAO', $this->ATE_IDEDICAO);
        $criteria->compare('ATE_IDATA', $this->ATE_IDATA);
        $criteria->compare('ATE_CONTEUDO', $this->ATE_CONTEUDO, true);
        $criteria->compare('ATE_IDFUNCIONARIO', $this->ATE_IDFUNCIONARIO);
        $criteria->compare('ATE_DATAPROXIMAREUNIAO', $this->ATE_DATAPROXIMAREUNIAO, true);
        $criteria->compare('ATE_HORARIO', $this->ATE_HORARIO, true);

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

}